Marius Cramer
2014-02-17 ebbe6374fc9c308daf729d2ad1b2f8007ed771ce
commit | author | age
d4d985 1 <?php
T 2
3 /*
436ed8 4 Copyright (c) 2007, Till Brehm, projektfarm Gmbh
d4d985 5 All rights reserved.
T 6
7 Redistribution and use in source and binary forms, with or without modification,
8 are permitted provided that the following conditions are met:
9
10     * Redistributions of source code must retain the above copyright notice,
11       this list of conditions and the following disclaimer.
12     * Redistributions in binary form must reproduce the above copyright notice,
13       this list of conditions and the following disclaimer in the documentation
14       and/or other materials provided with the distribution.
15     * Neither the name of ISPConfig nor the names of its contributors
16       may be used to endorse or promote products derived from this software without
17       specific prior written permission.
18
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
26 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 class tform_actions {
32
7fe908 33     public $id;
MC 34     public $activeTab;
35     public $dataRecord;
36     public $plugins = array();
37     public $oldDataRecord; // This array is only filled during updates and when db_history is enabled.
d4d985 38
7fe908 39     function onLoad() {
MC 40         global $app, $conf, $tform_def_file;
d4d985 41
7fe908 42         // Loading template classes and initialize template
MC 43         if(!is_object($app->tpl)) $app->uses('tpl');
44         if(!is_object($app->tform)) $app->uses('tform');
d4d985 45
7fe908 46         $app->tpl->newTemplate("tabbed_form.tpl.htm");
d4d985 47
7fe908 48         // Load table definition from file
MC 49         $app->tform->loadFormDef($tform_def_file);
d4d985 50
7fe908 51         // Importing ID
MC 52         $this->id = (isset($_REQUEST["id"]))?$app->functions->intval($_REQUEST["id"]):0;
d4d985 53
7fe908 54         // show print version of the form
MC 55         if(isset($_GET["print_form"]) && $_GET["print_form"] == 1) {
56             die('Function disabled.');
57             $this->onPrintForm();
58         }
d4d985 59
7fe908 60         // send this form by email
MC 61         if(isset($_GET["send_form_by_mail"]) && $_GET["send_form_by_mail"] == 1) {
62             die('Function disabled.');
63             $this->onMailSendForm();
64         }
d4d985 65
7fe908 66         if(count($_POST) > 1) {
MC 67             $this->dataRecord = $_POST;
68             $this->onSubmit();
69         } else {
70             $this->onShow();
71         }
72     }
d4d985 73
7fe908 74     /**
MC 75      * Function called on page submit
76      */
d4d985 77
T 78
7fe908 79     function onSubmit() {
MC 80         global $app, $conf;
81
82         // check if the client is locked - he may not change anything, then.
83         if(!$app->auth->is_admin()) {
35509d 84             $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
7fe908 85             $client = $app->db->queryOneRecord("SELECT client.locked FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ".$app->functions->intval($client_group_id));
MC 86             if(is_array($client) && $client['locked'] == 'y') {
87                 $app->tform->errorMessage .= $app->lng("client_you_are_locked")."<br />";
d4d985 88             }
T 89         }
90
7fe908 91         // Calling the action functions
MC 92         if($this->id > 0) {
93             $app->tform->action == 'EDIT';
94             $this->onUpdate();
95         } else {
96             $app->tform->action == 'NEW';
97             $this->onInsert();
d4d985 98         }
7fe908 99     }
d4d985 100
T 101
7fe908 102     /**
MC 103      * Function called on data update
104      */
105     function onUpdate() {
106         global $app, $conf;
d4d985 107
7fe908 108         $this->onBeforeUpdate();
d4d985 109
7fe908 110         $ext_where = '';
MC 111         $sql = $app->tform->getSQL($this->dataRecord, $app->tform->getCurrentTab(), 'UPDATE', $this->id, $ext_where);
112         if($app->tform->errorMessage == '') {
d4d985 113
7fe908 114             if($app->tform->formDef['db_history'] == 'yes') {
MC 115                 $this->oldDataRecord = $app->tform->getDataRecord($this->id);
116             }
d4d985 117
7fe908 118             // Save record in database
MC 119             $this->onUpdateSave($sql);
120             $app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_update_save', array('page_form'=>$this, 'sql'=>$sql));
d4d985 121
7fe908 122             // loading plugins
MC 123             $next_tab = $app->tform->getCurrentTab();
124             $this->loadPlugins($next_tab);
d4d985 125
7fe908 126             // Call plugin
MC 127             foreach($this->plugins as $plugin) {
128                 $plugin->onUpdate();
129             }
d4d985 130
7fe908 131             $this->onAfterUpdate();
MC 132             $app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_after_update', $this);
d4d985 133
7fe908 134             // Write data history (sys_datalog)
MC 135             if($app->tform->formDef['db_history'] == 'yes') {
136                 $new_data_record = $app->tform->getDataRecord($this->id);
137                 $app->tform->datalogSave('UPDATE', $this->id, $this->oldDataRecord, $new_data_record);
138                 unset($new_data_record);
139                 unset($old_data_record);
140             }
d4d985 141
7fe908 142             if($_REQUEST["next_tab"] == '') {
MC 143                 $list_name = $_SESSION["s"]["form"]["return_to"];
144                 // When a list is embedded inside of a form
d4d985 145
7fe908 146                 //if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_id"] != $this->id && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
MC 147                 if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
148                     $redirect = "Location: ".$_SESSION["s"]["list"][$list_name]["parent_script"]."?id=".$_SESSION["s"]["list"][$list_name]["parent_id"]."&next_tab=".$_SESSION["s"]["list"][$list_name]["parent_tab"];
149                     $_SESSION["s"]["form"]["return_to"] = '';
150                     session_write_close();
151                     header($redirect);
152                     // When a returnto variable is set
153                 } elseif (isset($_SESSION["s"]["form"]["return_to_url"]) && $_SESSION["s"]["form"]["return_to_url"] != '') {
154                     $redirect = $_SESSION["s"]["form"]["return_to_url"];
155                     $_SESSION["s"]["form"]["return_to_url"] = '';
156                     session_write_close();
157                     header("Location: ".$redirect);
158                     exit;
159                     // Use the default list of the form
160                 } else {
161                     header("Location: ".$app->tform->formDef['list_default']);
162                 }
d4d985 163                 exit;
T 164             } else {
7fe908 165                 $this->onShow();
d4d985 166             }
7fe908 167         } else {
MC 168             $this->onError();
169         }
170     }
d4d985 171
7fe908 172     /*
MC 173          Save record in database
174         */
175
176     function onUpdateSave($sql) {
177         global $app;
178         if(!empty($sql) && !$app->tform->isReadonlyTab($app->tform->getCurrentTab(), $this->id)) {
179             $app->db->query($sql);
180             if($app->db->errorMessage != '') die($app->db->errorMessage);
181         }
182     }
183
184
185
186
187
188     /**
189      * Function called on data insert
190      */
191     function onInsert() {
192         global $app, $conf;
193
194         $this->onBeforeInsert();
195
196         $ext_where = '';
197         $sql = $app->tform->getSQL($this->dataRecord, $app->tform->getCurrentTab(), 'INSERT', $this->id, $ext_where);
198         if($app->tform->errorMessage == '') {
199
200             $this->id = $this->onInsertSave($sql);
201             $app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_insert_save', array('page_form'=>$this, 'sql'=>$sql));
202
203             // loading plugins
204             $next_tab = $app->tform->getCurrentTab();
205             $this->loadPlugins($next_tab);
206
207             // Call plugin
208             foreach($this->plugins as $plugin) {
209                 $plugin->onInsert();
210             }
211
212             $this->onAfterInsert();
213             $app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_after_insert', $this);
214
215             // Write data history (sys_datalog)
216             if($app->tform->formDef['db_history'] == 'yes') {
217                 $new_data_record = $app->tform->getDataRecord($this->id);
218                 $app->tform->datalogSave('INSERT', $this->id, array(), $new_data_record);
219                 unset($new_data_record);
220             }
221
222
223             if($_REQUEST["next_tab"] == '') {
224                 $list_name = $_SESSION["s"]["form"]["return_to"];
225                 // if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_id"] != $this->id && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
226                 if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
227                     $redirect = "Location: ".$_SESSION["s"]["list"][$list_name]["parent_script"]."?id=".$_SESSION["s"]["list"][$list_name]["parent_id"]."&next_tab=".$_SESSION["s"]["list"][$list_name]["parent_tab"];
228                     $_SESSION["s"]["form"]["return_to"] = '';
229                     session_write_close();
230                     header($redirect);
231                     exit;
232                 } elseif ($_SESSION["s"]["form"]["return_to_url"] != '') {
233                     $redirect = $_SESSION["s"]["form"]["return_to_url"];
234                     $_SESSION["s"]["form"]["return_to_url"] = '';
235                     session_write_close();
236                     header("Location: ".$redirect);
237                     exit;
238                 } else {
239                     header("Location: ".$app->tform->formDef['list_default']);
240                 }
241                 exit;
242             } else {
243                 $this->onShow();
244             }
245         } else {
246             $this->onError();
247         }
248     }
249
250     /*
251          Save record in database
252         */
253
254     function onInsertSave($sql) {
255         global $app, $conf;
256         $app->db->query($sql);
257         if($app->db->errorMessage != '') die($app->db->errorMessage);
258         return $app->db->insertID();
259     }
260
261     function onBeforeUpdate() {
262         global $app, $conf;
263     }
264
265     function onBeforeInsert() {
266         global $app, $conf;
267     }
268
269     function onAfterUpdate() {
270         global $app, $conf;
271     }
272
273     function onAfterInsert() {
274         global $app, $conf;
275     }
276
277
278     /**
279      * Function called on data insert or update error
280      */
281     function onError() {
282         global $app, $conf;
283
284         $app->tpl->setVar("error", "<li>".$app->tform->errorMessage."</li>");
285         $app->tpl->setVar($this->dataRecord);
286         $this->onShow();
287     }
288
289
290     /**
291      * Function called on data delete
292      */
293     function onDelete() {
294         global $app, $conf, $list_def_file, $tform_def_file;
295
296         include_once $list_def_file;
297
298         // Loading tform framework
299         if(!is_object($app->tform)) $app->uses('tform');
300
301         // Load table definition from file
302         $app->tform->loadFormDef($tform_def_file);
303
304         // importing ID
305         $this->id = $app->functions->intval($_REQUEST["id"]);
306
307         if($this->id > 0) {
308
309             // checking permissions
310             if($app->tform->formDef['auth'] == 'yes' && $_SESSION["s"]["user"]["typ"] != 'admin') {
311                 if($app->tform->checkPerm($this->id, 'd') == false) $app->error($app->lng('error_no_delete_permission'));
312             }
313
314             //$this->dataRecord = $app->db->queryOneRecord("SELECT * FROM ".$liste["table"]." WHERE ".$liste["table_idx"]." = ".$this->id);
315             $this->dataRecord = $app->tform->getDataRecord($this->id);
316
5f29df 317             $app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_check_delete', $this);
7fe908 318             $this->onBeforeDelete();
MC 319             $app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_before_delete', $this);
320
321             // Saving record to datalog when db_history enabled
322             if($app->tform->formDef["db_history"] == 'yes') {
323                 //$old_data_record = $app->tform->getDataRecord($this->id);
324                 $app->tform->datalogSave('DELETE', $this->id, $this->dataRecord, array());
325             }
326
327             $app->db->query("DELETE FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id." LIMIT 1");
328
329
330             // loading plugins
331             $next_tab = $app->tform->getCurrentTab();
332             $this->loadPlugins($next_tab);
333
334
335             // Call plugin
336             foreach($this->plugins as $plugin) {
337                 $plugin->onDelete();
338             }
339
340             $this->onAfterDelete();
341             $app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_after_delete', $this);
342         }
343
344         //header("Location: ".$liste["file"]."?PHPSESSID=".$_SESSION["s"]["id"]);
345         $list_name = $_SESSION["s"]["form"]["return_to"];
346         if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_id"] != $this->id && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
347             $redirect = "Location: ".$_SESSION["s"]["list"][$list_name]["parent_script"]."?id=".$_SESSION["s"]["list"][$list_name]["parent_id"]."&next_tab=".$_SESSION["s"]["list"][$list_name]["parent_tab"];
348             $_SESSION["s"]["form"]["return_to"] = '';
349             session_write_close();
350             header($redirect);
351         } else {
352             header("Location: ".$liste["file"]);
353         }
354         exit;
355
356     }
357
358     function onBeforeDelete() {
359         global $app, $conf;
360     }
361
362     function onAfterDelete() {
363         global $app, $conf;
364     }
365
366
367
368
369
370     /**
371      * Function to print the form content
372      */
373     function onPrintForm() {
374         global $app, $conf;
375
376         if($app->tform->formDef['template_print'] == '') die('No print template available.');
377
378         $app->tpl->newTemplate("print.tpl.htm");
379         $app->tpl->setInclude("content_tpl", $app->tform->formDef['template_print']);
380
381         if($app->tform->formDef['auth'] == 'no') {
382             $sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id;
383         } else {
384             $sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id." AND ".$app->tform->getAuthSQL('r');
385         }
386         if(!$record = $app->db->queryOneRecord($sql)) $app->error($app->lng('error_no_view_permission'));
387
388         $record["datum"] = date("d.m.Y");
389
390         $app->tpl->setVar($app->tform->wordbook);
391
392         $app->tpl->setVar($record);
393         $app->tpl_defaults();
394         $app->tpl->pparse();
395         exit;
396
397     }
398
399
400
401
402
403     /**
404      * Function to print the form content
405      */
406     function onMailSendForm() {
407         global $app, $conf;
408
409         if($app->tform->formDef['template_mailsend'] == '') die('No print template available.');
410
411         if($_POST["email"] == '' && $_POST["sender"] == '') {
412             // Zeige Formular zum versenden an.
413             $app->tpl->newTemplate("form.tpl.htm");
414             $app->tpl->setInclude("content_tpl", $app->tform->formDef['template_mailsend']);
415             $app->tpl->setVar('show_form', 1);
416             $app->tpl->setVar("form_action", $app->tform->formDef['action'].'?send_form_by_mail=1');
417             $app->tpl->setVar("id", $this->id);
418             $app->tpl_defaults();
419             $app->tpl->pparse();
420             exit;
421         } else {
422             $app->tpl->newTemplate("mail.tpl.htm");
423             $app->tpl->setInclude("content_tpl", $app->tform->formDef['template_mailsend']);
424             $app->tpl->setVar('show_mail', 1);
d4d985 425             if($app->tform->formDef['auth'] == 'no') {
7fe908 426                 $sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id;
MC 427             } else {
428                 $sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id." AND ".$app->tform->getAuthSQL('r');
429             }
430             if(!$record = $app->db->queryOneRecord($sql)) $app->error($app->lng('error_no_view_permission'));
431
d4d985 432             $record["datum"] = date("d.m.Y");
7fe908 433             $record["mailmessage"] = $_POST["message"];
MC 434
d4d985 435             $app->tpl->setVar($app->tform->wordbook);
T 436
437             $app->tpl->setVar($record);
438             $app->tpl_defaults();
7fe908 439
MC 440             $email_message = $app->tpl->grab();
441             $email = $_POST["email"];
442             $sender = $_POST["sender"];
443
444             $headers  = "MIME-Version: 1.0\n";
445             $headers .= "Content-type: text/html; charset=iso-8859-1\n";
446             $headers .= "From: $sender\n";
447
448             if (!preg_match('/^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+' . '@' . '([-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.)+' . '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$/', $sender)) {
449                 $sender = 'noreply@iprguard.de';
450             }
451
452             if (preg_match('/^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+' . '@' . '([-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.)+' . '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$/', $email)) {
453                 mail($email, 'Domainrecherche Statement '.$record["domain"], $email_message, $headers);
454             }
455             echo "<p>&nbsp;</p><p>Email wurde versand.</p>";
d4d985 456             exit;
T 457         }
458
459
460
7fe908 461         if($app->tform->formDef['auth'] == 'no') {
MC 462             $sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id;
463         } else {
464             $sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id." AND ".$app->tform->getAuthSQL('r');
d4d985 465         }
7fe908 466         if(!$record = $app->db->queryOneRecord($sql)) $app->error($app->lng('error_no_view_permission'));
MC 467
468         $record["datum"] = date("d.m.Y");
469
470         $app->tpl->setVar($app->tform->wordbook);
471
472         $app->tpl->setVar($record);
473         $app->tpl_defaults();
474         $app->tpl->pparse();
475         exit;
476
477     }
478
479
480     /**
481      * Function called on page show
482      */
483     function onShow() {
484         global $app, $conf;
485
486         // Which tab do we render
487         $this->active_tab = $app->tform->getNextTab();
488
489         if($this->id > 0) {
490             $this->onShowEdit();
491         } else {
492             $this->onShowNew();
493         }
494
495         // make Form and Tabs
496         $app->tform->showForm();
497
498         // Setting default values
499         $app->tpl_defaults();
500
501         // Show the navigation bar of the form
502         if(isset($app->tform->formDef['navibar']) && $app->tform->formDef['navibar'] == 'yes') {
503             $navibar = '';
504             if($app->tform->formDef['template_print'] != '') {
505                 $navibar .= '<a href="'.$app->tform->formDef['action'].'?id='.$this->id.'&print_form=1" target="_blank"><img src="../themes/iprg/icons/printer.png" border="0" alt="Drucken" /></a> &nbsp;';
506             }
507             if($app->tform->formDef['template_mailsend'] != '') {
508                 $navibar .= "<a href=\"#\" onclick=\"window.open('".$app->tform->formDef['action'].'?id='.$this->id."&send_form_by_mail=1','send','width=370,height=240')\"><img src=\"../themes/iprg/icons/mail.png\" border=\"0\" alt=\"Als E-Mail versenden\" /></a>";
509             }
510             $app->tpl->setVar('form_navibar', $navibar);
511         }
512
513         if(isset($_SESSION['show_info_msg'])) {
514             $app->tpl->setVar('show_info_msg', $_SESSION['show_info_msg']);
515             unset($_SESSION['show_info_msg']);
516         }
517         if(isset($_SESSION['show_error_msg'])) {
518             $app->tpl->setVar('show_error_msg', $_SESSION['show_error_msg']);
519             unset($_SESSION['show_error_msg']);
520         }
521
522         // loading plugins
523         $this->loadPlugins($this->active_tab);
524
525         // Calling the Plugin onShow Events and set the data in the
526         // plugins placeholder in the template
527         foreach($this->plugins as $plugin_name => $plugin) {
528             $app->tpl->setVar($plugin_name, $plugin->onShow());
529         }
530
531         // Parse the templates and send output to the browser
532         $this->onShowEnd();
533
534     }
535
536
537     /**
538      * Function called on new record
539      */
540     function onShowNew() {
541         global $app, $conf;
542
543         if($app->tform->errorMessage == '') {
544             $record = array();
545             $record = $app->tform->getHTML($record, $app->tform->formDef['tab_default'], 'NEW');
546         } else {
547             $record = $app->tform->getHTML($app->tform->encode($_POST, $this->active_tab), $this->active_tab, 'EDIT');
548         }
549
550         $app->tpl->setVar($record);
551     }
552
553
554     /**
555      * Function called on edit record
556      */
557     function onShowEdit() {
558         global $app, $conf;
559
560         // bestehenden Datensatz anzeigen
561         if($app->tform->errorMessage == '') {
562             if($app->tform->formDef['auth'] == 'yes' && $_SESSION["s"]["user"]["typ"] != 'admin') {
563                 $sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id." AND ".$app->tform->getAuthSQL('r');
564             } else {
565                 $sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id;
566             }
567             if(!$record = $app->db->queryOneRecord($sql)) $app->error($app->lng('error_no_view_permission'));
568         } else {
569             // $record = $app->tform->encode($_POST,$this->active_tab);
570             $record = $app->tform->encode($this->dataRecord, $this->active_tab, false);
571         }
572
573         $this->dataRecord = $record;
574
575         // Userdaten umwandeln
576         $record = $app->tform->getHTML($record, $this->active_tab, 'EDIT');
577         $record['id'] = $this->id;
578
579         $app->tpl->setVar($record);
580     }
581
582     function onShowEnd() {
583         global $app, $conf;
584
585         // Template parsen
586         $app->tpl->pparse();
587     }
588
589     function loadPlugins($next_tab) {
590         global $app;
591         if(@is_array($app->tform->formDef["tabs"][$next_tab]["plugins"])) {
592             $app->load('plugin_base');
593             foreach($app->tform->formDef["tabs"][$next_tab]["plugins"] as $plugin_name => $plugin_settings) {
594                 $plugin_class = $plugin_settings["class"];
595                 $app->load($plugin_class);
596                 $this->plugins[$plugin_name] = new $plugin_class;
597                 $this->plugins[$plugin_name]->setOptions($plugin_name, $plugin_settings['options']);
598                 // Make the data of the form easily accessible for the plugib
599                 $this->plugins[$plugin_name]->form = $this;
600                 $this->plugins[$plugin_name]->onLoad();
601             }
602         }
603     }
d4d985 604
T 605
606 }
607
7fe908 608 ?>