| | |
| | |
|
| | | // Load table definition from file
|
| | | $app->tform->loadFormDef($tform_def_file);
|
| | |
|
| | | // loading plugins
|
| | | $next_tab = $app->tform->getNextTab();
|
| | | if(is_array($app->tform->formDef["tabs"][$next_tab]["plugins"])) {
|
| | | $app->load('plugin_base');
|
| | | foreach($app->tform->formDef["tabs"][$next_tab]["plugins"] as $plugin_name => $plugin_settings) {
|
| | | $plugin_class = $plugin_settings["class"];
|
| | | $app->load($plugin_class);
|
| | | $this->plugins[$plugin_name] = new $plugin_class;
|
| | | $this->plugins[$plugin_name]->setOptions($plugin_name,$plugin_settings['options']);
|
| | | $this->plugins[$plugin_name]->onLoad();
|
| | | }
|
| | | }
|
| | |
|
| | | // Importing ID
|
| | | |
| | | // Importing ID
|
| | | $this->id = intval($_REQUEST["id"]);
|
| | |
|
| | | if(count($_POST) > 1) {
|
| | |
| | |
|
| | | if(!empty($sql)) {
|
| | | $app->db->query($sql);
|
| | | if($app->db->errorMessage != '') die($app->db->errorMessage);
|
| | | if($app->db->errorMessage != '') die($app->db->errorMessage);
|
| | | }
|
| | | |
| | | // loading plugins
|
| | | $next_tab = $app->tform->getCurrentTab();
|
| | | $this->loadPlugins($next_tab);
|
| | |
|
| | | // Call plugin
|
| | | foreach($this->plugins as $plugin) {
|
| | | $plugin->onInsert();
|
| | | }
|
| | | |
| | | $this->onAfterUpdate();
|
| | |
|
| | | $this->onAfterUpdate();
|
| | |
|
| | | if($_REQUEST["next_tab"] == '') {
|
| | | $list_name = $_SESSION["s"]["form"]["return_to"];
|
| | | if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_id"] != $this->id && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
|
| | | $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"];
|
| | | $_SESSION["s"]["form"]["return_to"] = '';
|
| | | session_write_close();
|
| | | header($redirect);
|
| | | } else {
|
| | | header("Location: ".$app->tform->formDef['list_default']);
|
| | | }
|
| | | if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_id"] != $this->id && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
|
| | | $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"];
|
| | | $_SESSION["s"]["form"]["return_to"] = '';
|
| | | session_write_close();
|
| | | header($redirect);
|
| | | } else {
|
| | | header("Location: ".$app->tform->formDef['list_default']);
|
| | | }
|
| | | exit;
|
| | | } else {
|
| | | $this->onShow();
|
| | |
| | | $app->db->query($sql);
|
| | | if($app->db->errorMessage != '') die($app->db->errorMessage);
|
| | | $this->id = $app->db->insertID();
|
| | |
|
| | | |
| | | // loading plugins
|
| | | $next_tab = $app->tform->getCurrentTab();
|
| | | $this->loadPlugins($next_tab);
|
| | | |
| | | // Call plugin
|
| | | foreach($this->plugins as $plugin) {
|
| | | $plugin->onInsert();
|
| | | }
|
| | | |
| | | $this->onAfterInsert();
|
| | |
|
| | | if($_REQUEST["next_tab"] == '') {
|
| | | $list_name = $_SESSION["s"]["form"]["return_to"];
|
| | | if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_id"] != $this->id && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
|
| | | $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"];
|
| | | $_SESSION["s"]["form"]["return_to"] = '';
|
| | | session_write_close();
|
| | | header($redirect);
|
| | | } else {
|
| | | header("Location: ".$app->tform->formDef['list_default']);
|
| | | }
|
| | | $this->onAfterInsert();
|
| | |
|
| | | if($_REQUEST["next_tab"] == '') {
|
| | | $list_name = $_SESSION["s"]["form"]["return_to"];
|
| | | if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_id"] != $this->id && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
|
| | | $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"];
|
| | | $_SESSION["s"]["form"]["return_to"] = '';
|
| | | session_write_close();
|
| | | header($redirect);
|
| | | } else {
|
| | | header("Location: ".$app->tform->formDef['list_default']);
|
| | | }
|
| | | exit;
|
| | | } else {
|
| | | $this->onShow();
|
| | | $this->onShow();
|
| | | }
|
| | | } else {
|
| | | $this->onError();
|
| | | }
|
| | | }
|
| | | |
| | | function onAfterUpdate() {
|
| | | global $app, $conf;
|
| | | }
|
| | | |
| | | function onAfterInsert() {
|
| | | global $app, $conf;
|
| | | }
|
| | | |
| | |
|
| | | function onAfterUpdate() {
|
| | | global $app, $conf;
|
| | | }
|
| | |
|
| | | function onAfterInsert() {
|
| | | global $app, $conf;
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * Function called on data insert or update error
|
| | |
| | |
|
| | | // checking permissions
|
| | | if($app->tform->formDef['auth'] == 'yes') {
|
| | | if($app->tform->checkPerm($this->id,'d') == false) die("Deletion denied.<br>\r\n");
|
| | | if($app->tform->checkPerm($this->id,'d') == false) $app->error($app->lng('error_no_delete_permission'));
|
| | | }
|
| | |
|
| | | $record_old = $app->db->queryOneRecord("SELECT * FROM ".$liste["table"]." WHERE ".$liste["table_idx"]." = ".$this->id);
|
| | |
| | | }
|
| | |
|
| | | $app->db->query("DELETE FROM ".$liste["table"]." WHERE ".$liste["table_idx"]." = ".$this->id);
|
| | |
|
| | | |
| | | // loading plugins
|
| | | $next_tab = $app->tform->getCurrentTab();
|
| | | $this->loadPlugins($next_tab);
|
| | | |
| | | |
| | | // Call plugin
|
| | | foreach($this->plugins as $plugin) {
|
| | | $plugin->onInsert();
|
| | |
| | |
|
| | | //header("Location: ".$liste["file"]."?PHPSESSID=".$_SESSION["s"]["id"]);
|
| | | $list_name = $_SESSION["s"]["form"]["return_to"];
|
| | | if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_id"] != $this->id && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
|
| | | if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_id"] != $this->id && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
|
| | | $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"];
|
| | | $_SESSION["s"]["form"]["return_to"] = '';
|
| | | session_write_close();
|
| | |
| | |
|
| | | // Setting default values
|
| | | $app->tpl_defaults();
|
| | | |
| | | // loading plugins
|
| | | //$next_tab = $app->tform->getNextTab();
|
| | | $this->loadPlugins($this->active_tab);
|
| | |
|
| | | // Calling the Plugin onShow Events and set the data in the
|
| | | // plugins placeholder in the template
|
| | |
| | | } else {
|
| | | $sql = "SELECT * FROM ".$app->tform->formDef['db_table']." WHERE ".$app->tform->formDef['db_table_idx']." = ".$this->id." AND ".$app->tform->getAuthSQL('u');
|
| | | }
|
| | | if(!$record = $app->db->queryOneRecord($sql)) die("You dont have the permission to view this record or this record does not exist.");
|
| | | if(!$record = $app->db->queryOneRecord($sql)) $app->error($app->lng('error_no_view_permission'));
|
| | | } else {
|
| | | $record = $app->tform->encode($_POST,$this->active_tab);
|
| | | }
|
| | |
| | | // Template parsen
|
| | | $app->tpl->pparse();
|
| | | }
|
| | | |
| | | function loadPlugins($next_tab) {
|
| | | global $app;
|
| | | if(is_array($app->tform->formDef["tabs"][$next_tab]["plugins"])) {
|
| | | $app->load('plugin_base');
|
| | | foreach($app->tform->formDef["tabs"][$next_tab]["plugins"] as $plugin_name => $plugin_settings) {
|
| | | $plugin_class = $plugin_settings["class"];
|
| | | $app->load($plugin_class);
|
| | | $this->plugins[$plugin_name] = new $plugin_class;
|
| | | $this->plugins[$plugin_name]->setOptions($plugin_name,$plugin_settings['options']);
|
| | | $this->plugins[$plugin_name]->onLoad();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | }
|