Marius Cramer
2015-08-06 37b29231e47a0c4458dc1c15d98588f16f07e1e2
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"]);
cc7a82 85             $client = $app->db->queryOneRecord("SELECT client.locked FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
7fe908 86             if(is_array($client) && $client['locked'] == 'y') {
MC 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();
666853 109         $app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_before_update', $this);
d4d985 110
7fe908 111         $ext_where = '';
MC 112         $sql = $app->tform->getSQL($this->dataRecord, $app->tform->getCurrentTab(), 'UPDATE', $this->id, $ext_where);
113         if($app->tform->errorMessage == '') {
d4d985 114
61f738 115             $this->oldDataRecord = $app->tform->getDataRecord($this->id);
d4d985 116
7fe908 117             // Save record in database
MC 118             $this->onUpdateSave($sql);
119             $app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_update_save', array('page_form'=>$this, 'sql'=>$sql));
d4d985 120
7fe908 121             // loading plugins
MC 122             $next_tab = $app->tform->getCurrentTab();
123             $this->loadPlugins($next_tab);
d4d985 124
7fe908 125             // Call plugin
MC 126             foreach($this->plugins as $plugin) {
127                 $plugin->onUpdate();
128             }
d4d985 129
7fe908 130             $this->onAfterUpdate();
MC 131             $app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_after_update', $this);
d4d985 132
7fe908 133             // Write data history (sys_datalog)
MC 134             if($app->tform->formDef['db_history'] == 'yes') {
135                 $new_data_record = $app->tform->getDataRecord($this->id);
136                 $app->tform->datalogSave('UPDATE', $this->id, $this->oldDataRecord, $new_data_record);
137                 unset($new_data_record);
138                 unset($old_data_record);
139             }
d4d985 140
7fe908 141             if($_REQUEST["next_tab"] == '') {
MC 142                 $list_name = $_SESSION["s"]["form"]["return_to"];
143                 // When a list is embedded inside of a form
d4d985 144
7fe908 145                 //if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_id"] != $this->id && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
MC 146                 if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
147                     $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"];
148                     $_SESSION["s"]["form"]["return_to"] = '';
149                     session_write_close();
150                     header($redirect);
151                     // When a returnto variable is set
152                 } elseif (isset($_SESSION["s"]["form"]["return_to_url"]) && $_SESSION["s"]["form"]["return_to_url"] != '') {
153                     $redirect = $_SESSION["s"]["form"]["return_to_url"];
154                     $_SESSION["s"]["form"]["return_to_url"] = '';
155                     session_write_close();
156                     header("Location: ".$redirect);
157                     exit;
158                     // Use the default list of the form
159                 } else {
160                     header("Location: ".$app->tform->formDef['list_default']);
161                 }
d4d985 162                 exit;
T 163             } else {
7fe908 164                 $this->onShow();
d4d985 165             }
7fe908 166         } else {
MC 167             $this->onError();
168         }
169     }
d4d985 170
7fe908 171     /*
MC 172          Save record in database
173         */
174
175     function onUpdateSave($sql) {
176         global $app;
177         if(!empty($sql) && !$app->tform->isReadonlyTab($app->tform->getCurrentTab(), $this->id)) {
178             $app->db->query($sql);
179             if($app->db->errorMessage != '') die($app->db->errorMessage);
180         }
181     }
182
183
184
185
186
187     /**
188      * Function called on data insert
189      */
190     function onInsert() {
191         global $app, $conf;
192
193         $this->onBeforeInsert();
666853 194         $app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_before_insert', $this);
7fe908 195
MC 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->tform->getDataRecord($this->id);
315
5f29df 316             $app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_check_delete', $this);
7fe908 317             $this->onBeforeDelete();
MC 318             $app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_before_delete', $this);
319
320             // Saving record to datalog when db_history enabled
321             if($app->tform->formDef["db_history"] == 'yes') {
322                 //$old_data_record = $app->tform->getDataRecord($this->id);
323                 $app->tform->datalogSave('DELETE', $this->id, $this->dataRecord, array());
324             }
325
cc7a82 326             $app->db->query("DELETE FROM ?? WHERE ?? = ? LIMIT 1", $app->tform->formDef['db_table'], $app->tform->formDef['db_table_idx'], $this->id);
7fe908 327
MC 328
329             // loading plugins
330             $next_tab = $app->tform->getCurrentTab();
331             $this->loadPlugins($next_tab);
332
333
334             // Call plugin
335             foreach($this->plugins as $plugin) {
336                 $plugin->onDelete();
337             }
338
339             $this->onAfterDelete();
340             $app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_after_delete', $this);
341         }
342
343         //header("Location: ".$liste["file"]."?PHPSESSID=".$_SESSION["s"]["id"]);
344         $list_name = $_SESSION["s"]["form"]["return_to"];
345         if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_id"] != $this->id && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
346             $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"];
347             $_SESSION["s"]["form"]["return_to"] = '';
348             session_write_close();
349             header($redirect);
350         } else {
351             header("Location: ".$liste["file"]);
352         }
353         exit;
354
355     }
356
357     function onBeforeDelete() {
358         global $app, $conf;
359     }
360
361     function onAfterDelete() {
362         global $app, $conf;
363     }
364
365
366
367
368
369     /**
370      * Function to print the form content
371      */
372     function onPrintForm() {
373         global $app, $conf;
374
375         if($app->tform->formDef['template_print'] == '') die('No print template available.');
376
377         $app->tpl->newTemplate("print.tpl.htm");
378         $app->tpl->setInclude("content_tpl", $app->tform->formDef['template_print']);
379
380         if($app->tform->formDef['auth'] == 'no') {
cc7a82 381             $sql = "SELECT * FROM ?? WHERE ?? = ?";
7fe908 382         } else {
cc7a82 383             $sql = "SELECT * FROM ?? WHERE ?? = ? AND ".$app->tform->getAuthSQL('r');
7fe908 384         }
cc7a82 385         if(!$record = $app->db->queryOneRecord($sql, $app->tform->formDef['db_table'], $app->tform->formDef['db_table_idx'], $this->id)) $app->error($app->lng('error_no_view_permission'));
7fe908 386
MC 387         $record["datum"] = date("d.m.Y");
388
389         $app->tpl->setVar($app->tform->wordbook);
390
391         $app->tpl->setVar($record);
392         $app->tpl_defaults();
393         $app->tpl->pparse();
394         exit;
395
396     }
397
398
399
400
401
402     /**
403      * Function to print the form content
404      */
405     function onMailSendForm() {
406         global $app, $conf;
407
408         if($app->tform->formDef['template_mailsend'] == '') die('No print template available.');
409
410         if($_POST["email"] == '' && $_POST["sender"] == '') {
411             // Zeige Formular zum versenden an.
412             $app->tpl->newTemplate("form.tpl.htm");
413             $app->tpl->setInclude("content_tpl", $app->tform->formDef['template_mailsend']);
414             $app->tpl->setVar('show_form', 1);
415             $app->tpl->setVar("form_action", $app->tform->formDef['action'].'?send_form_by_mail=1');
416             $app->tpl->setVar("id", $this->id);
417             $app->tpl_defaults();
418             $app->tpl->pparse();
419             exit;
420         } else {
421             $app->tpl->newTemplate("mail.tpl.htm");
422             $app->tpl->setInclude("content_tpl", $app->tform->formDef['template_mailsend']);
423             $app->tpl->setVar('show_mail', 1);
d4d985 424             if($app->tform->formDef['auth'] == 'no') {
cc7a82 425                 $sql = "SELECT * FROM ?? WHERE ?? = ?";
7fe908 426             } else {
cc7a82 427                 $sql = "SELECT * FROM ?? WHERE ?? = ? AND ".$app->tform->getAuthSQL('r');
7fe908 428             }
cc7a82 429             if(!$record = $app->db->queryOneRecord($sql, $app->tform->formDef['db_table'], $app->tform->formDef['db_table_idx'], $this->id)) $app->error($app->lng('error_no_view_permission'));
7fe908 430
d4d985 431             $record["datum"] = date("d.m.Y");
7fe908 432             $record["mailmessage"] = $_POST["message"];
MC 433
d4d985 434             $app->tpl->setVar($app->tform->wordbook);
T 435
436             $app->tpl->setVar($record);
437             $app->tpl_defaults();
7fe908 438
MC 439             $email_message = $app->tpl->grab();
440             $email = $_POST["email"];
441             $sender = $_POST["sender"];
442
443             $headers  = "MIME-Version: 1.0\n";
444             $headers .= "Content-type: text/html; charset=iso-8859-1\n";
445             $headers .= "From: $sender\n";
446
447             if (!preg_match('/^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+' . '@' . '([-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.)+' . '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$/', $sender)) {
448                 $sender = 'noreply@iprguard.de';
449             }
450
451             if (preg_match('/^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+' . '@' . '([-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.)+' . '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$/', $email)) {
452                 mail($email, 'Domainrecherche Statement '.$record["domain"], $email_message, $headers);
453             }
454             echo "<p>&nbsp;</p><p>Email wurde versand.</p>";
d4d985 455             exit;
T 456         }
457
458
459
7fe908 460         if($app->tform->formDef['auth'] == 'no') {
cc7a82 461             $sql = "SELECT * FROM ?? WHERE ?? = ?";
7fe908 462         } else {
cc7a82 463             $sql = "SELECT * FROM ?? WHERE ?? = ? AND ".$app->tform->getAuthSQL('r');
d4d985 464         }
cc7a82 465         if(!$record = $app->db->queryOneRecord($sql, $app->tform->formDef['db_table'], $app->tform->formDef['db_table_idx'], $this->id)) $app->error($app->lng('error_no_view_permission'));
7fe908 466
MC 467         $record["datum"] = date("d.m.Y");
468
469         $app->tpl->setVar($app->tform->wordbook);
470
471         $app->tpl->setVar($record);
472         $app->tpl_defaults();
473         $app->tpl->pparse();
474         exit;
475
476     }
477
478
479     /**
480      * Function called on page show
481      */
482     function onShow() {
483         global $app, $conf;
484
485         // Which tab do we render
486         $this->active_tab = $app->tform->getNextTab();
487
488         if($this->id > 0) {
489             $this->onShowEdit();
490         } else {
491             $this->onShowNew();
492         }
493
494         // make Form and Tabs
495         $app->tform->showForm();
496
497         // Setting default values
498         $app->tpl_defaults();
499
500         // Show the navigation bar of the form
501         if(isset($app->tform->formDef['navibar']) && $app->tform->formDef['navibar'] == 'yes') {
502             $navibar = '';
503             if($app->tform->formDef['template_print'] != '') {
504                 $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;';
505             }
506             if($app->tform->formDef['template_mailsend'] != '') {
507                 $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>";
508             }
509             $app->tpl->setVar('form_navibar', $navibar);
510         }
511
512         if(isset($_SESSION['show_info_msg'])) {
513             $app->tpl->setVar('show_info_msg', $_SESSION['show_info_msg']);
514             unset($_SESSION['show_info_msg']);
515         }
516         if(isset($_SESSION['show_error_msg'])) {
517             $app->tpl->setVar('show_error_msg', $_SESSION['show_error_msg']);
518             unset($_SESSION['show_error_msg']);
519         }
520
521         // loading plugins
522         $this->loadPlugins($this->active_tab);
523
524         // Calling the Plugin onShow Events and set the data in the
525         // plugins placeholder in the template
526         foreach($this->plugins as $plugin_name => $plugin) {
527             $app->tpl->setVar($plugin_name, $plugin->onShow());
528         }
529
530         // Parse the templates and send output to the browser
531         $this->onShowEnd();
532
533     }
534
535
536     /**
537      * Function called on new record
538      */
539     function onShowNew() {
540         global $app, $conf;
541
542         if($app->tform->errorMessage == '') {
543             $record = array();
544             $record = $app->tform->getHTML($record, $app->tform->formDef['tab_default'], 'NEW');
545         } else {
546             $record = $app->tform->getHTML($app->tform->encode($_POST, $this->active_tab), $this->active_tab, 'EDIT');
547         }
548
549         $app->tpl->setVar($record);
550     }
551
552
553     /**
554      * Function called on edit record
555      */
556     function onShowEdit() {
557         global $app, $conf;
558
559         // bestehenden Datensatz anzeigen
560         if($app->tform->errorMessage == '') {
561             if($app->tform->formDef['auth'] == 'yes' && $_SESSION["s"]["user"]["typ"] != 'admin') {
cc7a82 562                 $sql = "SELECT * FROM ?? WHERE ?? = ? AND ".$app->tform->getAuthSQL('r');
7fe908 563             } else {
cc7a82 564                 $sql = "SELECT * FROM ?? WHERE ?? = ?";
7fe908 565             }
cc7a82 566             if(!$record = $app->db->queryOneRecord($sql, $app->tform->formDef['db_table'], $app->tform->formDef['db_table_idx'], $this->id)) $app->error($app->lng('error_no_view_permission'));
7fe908 567         } else {
MC 568             // $record = $app->tform->encode($_POST,$this->active_tab);
569             $record = $app->tform->encode($this->dataRecord, $this->active_tab, false);
570         }
571
572         $this->dataRecord = $record;
573
574         // Userdaten umwandeln
575         $record = $app->tform->getHTML($record, $this->active_tab, 'EDIT');
576         $record['id'] = $this->id;
577
578         $app->tpl->setVar($record);
579     }
580
581     function onShowEnd() {
582         global $app, $conf;
583
584         // Template parsen
585         $app->tpl->pparse();
586     }
587
588     function loadPlugins($next_tab) {
589         global $app;
590         if(@is_array($app->tform->formDef["tabs"][$next_tab]["plugins"])) {
591             $app->load('plugin_base');
592             foreach($app->tform->formDef["tabs"][$next_tab]["plugins"] as $plugin_name => $plugin_settings) {
593                 $plugin_class = $plugin_settings["class"];
594                 $app->load($plugin_class);
595                 $this->plugins[$plugin_name] = new $plugin_class;
596                 $this->plugins[$plugin_name]->setOptions($plugin_name, $plugin_settings['options']);
597                 // Make the data of the form easily accessible for the plugib
598                 $this->plugins[$plugin_name]->form = $this;
599                 $this->plugins[$plugin_name]->onLoad();
600             }
601         }
602     }
d4d985 603
T 604
605 }
606
7fe908 607 ?>