Updated CodeCorner3 (markdown)

leithoff 2016-07-26 15:08:32 +02:00
parent ac03c24d01
commit a8d6aa6f9d

@ -366,6 +366,7 @@ This function is added to the <em>class.test_ui.inc.php</em> file.
<dl>
<dt>Step 9</dt>
<dd>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.</dd>
<dd>We do not need the function testinterface anymore</dd>
</dl>
</dd>
</dl>
@ -373,7 +374,6 @@ This function is added to the <em>class.test_ui.inc.php</em> file.
<hr style="text-align: left; width: 99%;" />&nbsp;
<pre>
var $public_functions = array(
'testinterface' =&gt; True,
'index' =&gt; True,
);
</pre>
@ -390,21 +390,15 @@ var $public_functions = array(
<hr style="text-align: left; width: 99%;" />&nbsp;
<pre>
// construktor
function test_ui()
{
$GLOBALS['egw_info']['flags']['app_header']='test-Application';
$this-&gt;tmpl =&amp; CreateObject('etemplate.etemplate', 'test.index');
$this-&gt;bo =&amp; CreateObject('test.botest');
$this-&gt;html =&amp; $GLOBALS['egw']-&gt;html;
if(!@is_object($GLOBALS['egw']-&gt;js))
{
$GLOBALS['egw']-&gt;js =&amp; 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';
}
</pre>
<hr style="text-align: left; width: 99%;" />&nbsp;
@ -412,33 +406,20 @@ var $public_functions = array(
<dd>
<dl>
<dt>Step 11</dt>
<dd>If we add <tt>echo "&lt;a href='".$GLOBALS['egw']-&gt;link('/index.php',array('menuaction' =&gt; 'test.test_ui.index'))."'&gt; Call the eTemplate version &lt;/a&gt; &lt;br&gt;";</tt> to our <em>old</em> function <em>testinterface</em> just before the creation of the footer, we have a link to start up our new eTemplate.</dd>
</dl>
<dl>
<dd>Sure thing, you can call your eTemplate - which is wrapped in a function from your test/index.php:</dd>
<dd><tt>header('Location: ../index.php?menuaction=test.test_ui.index');</tt></dd>
<dd>modify <em>test/index.php</em>
<pre>
&lt;?php
header('Location: ../index.php?menuaction=test.test_ui.index');
</pre>
</dd>
</dl>
</dd>
</dl>
&nbsp;
<dl>
<dd>
<dl>
<dt>Step 12</dt>
<dd>If you wanted to have some fancy title for your Application, different from your application name. Set the <strong>app_header</strong> (as I did) within the constructor:</dd>
</dl>
<dl>
<dd><tt>$GLOBALS['egw_info']['flags']['app_header']='My fancy application title';</tt></dd>
</dl>
</dd>
</dl>
<br />
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 <tt>$content[...]</tt> array and assign them to fields that I have not talked about.<br />
<br />
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.<br />
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.<br />
&nbsp;
<h4>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)</h4>
&nbsp;