From a8d6aa6f9dc8936009efa8cf7a3f714e621ce624 Mon Sep 17 00:00:00 2001 From: leithoff Date: Tue, 26 Jul 2016 15:08:32 +0200 Subject: [PATCH] Updated CodeCorner3 (markdown) --- CodeCorner3.md | 53 ++++++++++++++++---------------------------------- 1 file changed, 17 insertions(+), 36 deletions(-) diff --git a/CodeCorner3.md b/CodeCorner3.md index 142caeb..7aa0142 100644 --- a/CodeCorner3.md +++ b/CodeCorner3.md @@ -366,6 +366,7 @@ This function is added to the class.test_ui.inc.php file.
Step 9
Since you want to be able to call that function from the eGroupware as function call or link or redirekt-link, you have to add the function name to the public_functions array.
+
We do not need the function testinterface anymore
@@ -373,7 +374,6 @@ This function is added to the class.test_ui.inc.php file.
 
 var $public_functions = array(
-    'testinterface' => True,
     'index'    => True,
     );
 
@@ -390,21 +390,15 @@ var $public_functions = array(
 
- // construktor
- function test_ui()
-    {
-      $GLOBALS['egw_info']['flags']['app_header']='test-Application';
-      
-      $this->tmpl =& CreateObject('etemplate.etemplate', 'test.index');
-      $this->bo   =& CreateObject('test.botest');
-      $this->html =& $GLOBALS['egw']->html;
-                
-      if(!@is_object($GLOBALS['egw']->js))
-      {
-           $GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript');
-      }
-
-    }
+	/**
+	 * Constructor
+	 *
+	 */
+	function __construct()
+	{
+                // you may set a fancy app-title.different from title set in setup.inc.php: $setup_info['test']['title']
+		$GLOBALS['egw_info']['flags']['app_header']='test-Application';
+	}
 

  @@ -412,33 +406,20 @@ var $public_functions = array(
Step 11
-
If we add echo "<a href='".$GLOBALS['egw']->link('/index.php',array('menuaction' => 'test.test_ui.index'))."'> Call the eTemplate version </a> <br>"; to our old function testinterface just before the creation of the footer, we have a link to start up our new eTemplate.
-
- -
-
Sure thing, you can call your eTemplate - which is wrapped in a function from your test/index.php:
-
header('Location: ../index.php?menuaction=test.test_ui.index');
+
modify test/index.php +
+<?php
+header('Location: ../index.php?menuaction=test.test_ui.index');
+
+
-  -
-
-
-
Step 12
-
If you wanted to have some fancy title for your Application, different from your application name. Set the app_header (as I did) within the constructor:
-
- -
-
$GLOBALS['egw_info']['flags']['app_header']='My fancy application title';
-
-
-

Now we have our application converted to the eTemplate way of eGroupware. As you can see in the code of the function, I added a few fields to the eTemplate. You can see that I handle data of the $content[...] array and assign them to fields that I have not talked about.

-The index function is called from our index.php file, from a link out of our old application or as callback for this form / dialog. In that case $content is an array with the content the user put into the fields of the dialog.
+The index function is called from our index.php file or as callback for this form / dialog. In that case $content is an array with the content the user put into the fields of the dialog.
 

Let first have a look what happend if we called the first time (or what we do to show the dialog again with the changed data)