mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 23:00:56 +01:00
Updated CodeCorner2 (markdown)
parent
c4c2a17d31
commit
459672c75c
@ -46,3 +46,52 @@ if (trim($_POST['fname'].$_POST['sname'])!='')
|
||||
//display the eGroupware footer
|
||||
common::egw_footer();
|
||||
```
|
||||
Now we had to admit that this is working but had nothing to do with the eGroupware style of coding applications. So Ralf told us to do the same thing a bit more the eGroupware style.
|
||||
Sure, there is the [[Coding-Standards|Coding-Standards]], the [[Developer Guide|Developer Guide]] and the [[Style Guide|Style Guide]]. You should have a look at thoose.
|
||||
|
||||
[[Coding-Standards|Coding-Standards]] tell you about how some rules that the eGroupware developers would like you to follow.
|
||||
[[Developer Guide|Developer Guide]] is to improve eGroupware's usability reflecting the user's needs and being able to implement any necessary modifications as effortless as possible.
|
||||
[[Style Guide|Style Guide]] is to give you a guideline how to design your application.
|
||||
|
||||
Taking these into account, you can easily see, that our first approach is messy.
|
||||
|
||||
on our way to the eGroupware campsite, our first encounter with the class
|
||||
You probably remember the required folderstructure to meet the needs of eGroupware to recognise
|
||||
our application.
|
||||
Remember the folder /inc?
|
||||
The usual way eGroupware deals with userinterfaces, userrequests and stuff is through classes.
|
||||
The common classes for an application are:
|
||||
* User Interface Class
|
||||
* Business Object Class
|
||||
* Storage Object Class
|
||||
|
||||
The names for these classes follow a naming schema in order to enable the eGroupware libraries
|
||||
the recognition of your own application classes.
|
||||
* class.test_ui.inc.php for the User Interface Class
|
||||
* class.test_ui.inc.php for the Business Object Class
|
||||
* class.test_so.inc.php for theStorage Object Class
|
||||
|
||||
The classname of the class should meet the classname you use in the filename. But
|
||||
most important is, do NOT use just ```class.{ui|bo|so}.inc.php```, as the
|
||||
class-names have to be unique! There is a reason for this. If you have a look how class-functions are called from
|
||||
eGroupware (e.g. as menuaction), you will understand the need.
|
||||
|
||||
If you design an application the eGroupwareway the index.php file is reduced to something like this:
|
||||
```php
|
||||
<?php
|
||||
header('Location: ../index.php?menuaction=test.test_ui.testinterface');
|
||||
```
|
||||
This means, anybody calling your application from within eGroupware is redirected
|
||||
to the egroupware/index.php with a request for a certain menuaction.
|
||||
|
||||
The $_GET['menuaction'] parameter is taken into account, split and evaluated in the
|
||||
|
||||
* form that it gets validated there is an application test in eGroupware
|
||||
* within test there is a classfile class.test_ui.inc.php in test/inc with the class test_ui
|
||||
* within that class test_ui there is a public callable function testinterface
|
||||
|
||||
|
||||
By now there is no such class in the file nor the required function or the stuff we did not know about at this time.
|
||||
So we created a class.
|
||||
We created the required function testinterface.
|
||||
We added the functionality.
|
Loading…
Reference in New Issue
Block a user