From 459672c75c310131974f7986fca9900a64597965 Mon Sep 17 00:00:00 2001 From: leithoff Date: Tue, 5 Jul 2016 13:54:02 +0200 Subject: [PATCH] Updated CodeCorner2 (markdown) --- CodeCorner2.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/CodeCorner2.md b/CodeCorner2.md index 491a761..a397fdd 100644 --- a/CodeCorner2.md +++ b/CodeCorner2.md @@ -45,4 +45,53 @@ if (trim($_POST['fname'].$_POST['sname'])!='') } //display the eGroupware footer common::egw_footer(); -``` \ No newline at end of file +``` +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 +