Marius Burkard
2016-04-20 4569cae57f127afd093794310ccd290d2d9fdf36
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
03303d 49         //$app->tform->loadFormDef($tform_def_file, (isset($_SESSION['s']['module']['name']) ? $_SESSION['s']['module']['name'] : ''));
TB 50         $app->tform->loadFormDef($tform_def_file);
d4d985 51
7fe908 52         // Importing ID
MC 53         $this->id = (isset($_REQUEST["id"]))?$app->functions->intval($_REQUEST["id"]):0;
d4d985 54
7fe908 55         // show print version of the form
MC 56         if(isset($_GET["print_form"]) && $_GET["print_form"] == 1) {
57             die('Function disabled.');
58             $this->onPrintForm();
59         }
d4d985 60
7fe908 61         // send this form by email
MC 62         if(isset($_GET["send_form_by_mail"]) && $_GET["send_form_by_mail"] == 1) {
63             die('Function disabled.');
64             $this->onMailSendForm();
65         }
d4d985 66
7fe908 67         if(count($_POST) > 1) {
MC 68             $this->dataRecord = $_POST;
69             $this->onSubmit();
70         } else {
71             $this->onShow();
72         }
73     }
d4d985 74
7fe908 75     /**
MC 76      * Function called on page submit
77      */
d4d985 78
T 79
7fe908 80     function onSubmit() {
MC 81         global $app, $conf;
82
83         // check if the client is locked - he may not change anything, then.
84         if(!$app->auth->is_admin()) {
35509d 85             $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
cc7a82 86             $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 87             if(is_array($client) && $client['locked'] == 'y') {
MC 88                 $app->tform->errorMessage .= $app->lng("client_you_are_locked")."<br />";
d4d985 89             }
T 90         }
91
7fe908 92         // Calling the action functions
MC 93         if($this->id > 0) {
94             $app->tform->action == 'EDIT';
95             $this->onUpdate();
96         } else {
97             $app->tform->action == 'NEW';
98             $this->onInsert();
d4d985 99         }
7fe908 100     }
d4d985 101
T 102
7fe908 103     /**
MC 104      * Function called on data update
105      */
106     function onUpdate() {
107         global $app, $conf;
d4d985 108
7fe908 109         $this->onBeforeUpdate();
666853 110         $app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_before_update', $this);
d4d985 111
7fe908 112         $ext_where = '';
MC 113         $sql = $app->tform->getSQL($this->dataRecord, $app->tform->getCurrentTab(), 'UPDATE', $this->id, $ext_where);
114         if($app->tform->errorMessage == '') {
d4d985 115
61f738 116             $this->oldDataRecord = $app->tform->getDataRecord($this->id);
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();
666853 195         $app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_before_insert', $this);
7fe908 196
MC 197         $ext_where = '';
198         $sql = $app->tform->getSQL($this->dataRecord, $app->tform->getCurrentTab(), 'INSERT', $this->id, $ext_where);
199         if($app->tform->errorMessage == '') {
200
201             $this->id = $this->onInsertSave($sql);
202             $app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_insert_save', array('page_form'=>$this, 'sql'=>$sql));
203
204             // loading plugins
205             $next_tab = $app->tform->getCurrentTab();
206             $this->loadPlugins($next_tab);
207
208             // Call plugin
209             foreach($this->plugins as $plugin) {
210                 $plugin->onInsert();
211             }
212
213             $this->onAfterInsert();
214             $app->plugin->raiseEvent($_SESSION['s']['module']['name'].':'.$app->tform->formDef['name'].':'.'on_after_insert', $this);
215
216             // Write data history (sys_datalog)
217             if($app->tform->formDef['db_history'] == 'yes') {
218                 $new_data_record = $app->tform->getDataRecord($this->id);
219                 $app->tform->datalogSave('INSERT', $this->id, array(), $new_data_record);
220                 unset($new_data_record);
221             }
222
223
224             if($_REQUEST["next_tab"] == '') {
225                 $list_name = $_SESSION["s"]["form"]["return_to"];
226                 // if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_id"] != $this->id && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
227                 if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
228                     $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"];
229                     $_SESSION["s"]["form"]["return_to"] = '';
230                     session_write_close();
231                     header($redirect);
232                     exit;
233                 } elseif ($_SESSION["s"]["form"]["return_to_url"] != '') {
234                     $redirect = $_SESSION["s"]["form"]["return_to_url"];
235                     $_SESSION["s"]["form"]["return_to_url"] = '';
236                     session_write_close();
237                     header("Location: ".$redirect);
238                     exit;
239                 } else {
240                     header("Location: ".$app->tform->formDef['list_default']);
241                 }
242                 exit;
243             } else {
244                 $this->onShow();
245             }
246         } else {
247             $this->onError();
248         }
249     }
250
251     /*
252          Save record in database
253         */
254
255     function onInsertSave($sql) {
256         global $app, $conf;
257         $app->db->query($sql);
258         if($app->db->errorMessage != '') die($app->db->errorMessage);
259         return $app->db->insertID();
260     }
261
262     function onBeforeUpdate() {
263         global $app, $conf;
264     }
265
266     function onBeforeInsert() {
267         global $app, $conf;
268     }
269
270     function onAfterUpdate() {
271         global $app, $conf;
272     }
273
274     function onAfterInsert() {
275         global $app, $conf;
276     }
277
278
279     /**
280      * Function called on data insert or update error
281      */
282     function onError() {
283         global $app, $conf;
284
285         $app->tpl->setVar("error", "<li>".$app->tform->errorMessage."</li>");
286         $app->tpl->setVar($this->dataRecord);
287         $this->onShow();
288     }
289
290
291     /**
292      * Function called on data delete
293      */
294     function onDelete() {
295         global $app, $conf, $list_def_file, $tform_def_file;
296
297         include_once $list_def_file;
298
299         // Loading tform framework
300         if(!is_object($app->tform)) $app->uses('tform');
301
302         // Load table definition from file
303         $app->tform->loadFormDef($tform_def_file);
304
305         // importing ID
306         $this->id = $app->functions->intval($_REQUEST["id"]);
307
308         if($this->id > 0) {
309
310             // checking permissions
311             if($app->tform->formDef['auth'] == 'yes' && $_SESSION["s"]["user"]["typ"] != 'admin') {
312                 if($app->tform->checkPerm($this->id, 'd') == false) $app->error($app->lng('error_no_delete_permission'));
313             }
314
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
cc7a82 327             $app->db->query("DELETE FROM ?? WHERE ?? = ? LIMIT 1", $app->tform->formDef['db_table'], $app->tform->formDef['db_table_idx'], $this->id);
7fe908 328
MC 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') {
cc7a82 382             $sql = "SELECT * FROM ?? WHERE ?? = ?";
7fe908 383         } else {
cc7a82 384             $sql = "SELECT * FROM ?? WHERE ?? = ? AND ".$app->tform->getAuthSQL('r');
7fe908 385         }
cc7a82 386         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 387
MC 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') {
cc7a82 426                 $sql = "SELECT * FROM ?? WHERE ?? = ?";
7fe908 427             } else {
cc7a82 428                 $sql = "SELECT * FROM ?? WHERE ?? = ? AND ".$app->tform->getAuthSQL('r');
7fe908 429             }
cc7a82 430             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 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') {
cc7a82 462             $sql = "SELECT * FROM ?? WHERE ?? = ?";
7fe908 463         } else {
cc7a82 464             $sql = "SELECT * FROM ?? WHERE ?? = ? AND ".$app->tform->getAuthSQL('r');
d4d985 465         }
cc7a82 466         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 467
MC 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') {
cc7a82 563                 $sql = "SELECT * FROM ?? WHERE ?? = ? AND ".$app->tform->getAuthSQL('r');
7fe908 564             } else {
cc7a82 565                 $sql = "SELECT * FROM ?? WHERE ?? = ?";
7fe908 566             }
cc7a82 567             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 568         } else {
MC 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']);
6b15d5 598                 // Make the data of the form easily accessible for the plugin
7fe908 599                 $this->plugins[$plugin_name]->form = $this;
MC 600                 $this->plugins[$plugin_name]->onLoad();
601             }
602         }
603     }
d4d985 604
T 605
606 }
607
7fe908 608 ?>