public function itemtypeDropdown() { global $CFG_GLPI; $itemtypes = PluginCustomTab::getTypes(); echo "<select name='itemtype' id='tabsitemtype'>"; echo "<option value='0'>" . Dropdown::EMPTY_VALUE . "</option>\n"; foreach ($itemtypes as $key => $value) { if ($this->fields['id'] > 0 && $this->fields['itemtype'] == $key) { echo "<option value='{$key}' selected='selected'>{$value}</option>"; } else { echo "<option value='{$key}'>{$value}</option>"; } } echo "</select>"; $params = array('itemtype' => '__VALUE__', 'myname' => 'tabstab', 'value' => $this->fields['tab'], 'id' => $this->fields['id']); Ajax::updateItemOnSelectEvent('tabsitemtype', 'tabstab', $CFG_GLPI["root_doc"] . "/plugins/custom/ajax/dropdowntab.php", $params); }
$obj->fields['id'] = 1; if ($_POST['itemtype'] == "ticket") { $obj->fields['status'] = "closed"; } //get object tabs $tabs = $obj->defineTabs(); /*//get object plugins tabs $tmp_plug_tabs = Plugin::getTabs('', $obj, false); $plug_tabs = array(); foreach($tmp_plug_tabs as $key => $tab) { $plug_tabs[$key] = $tab['title']; } $tabs += $plug_tabs;*/ //construct name field $tabs = $tabs[$_POST['tab']]; $types = PluginCustomTab::getTypes(); $itemtype = $types[$_POST['itemtype']]; $_POST['name'] = $itemtype . "-" . $tabs . "-" . ucfirst(__($_POST['color'], 'custom')); } $tabs = new PluginCustomTab(); if (isset($_POST["add"])) { $newID = $tabs->add($_POST); Html::redirect($CFG_GLPI["root_doc"] . "/plugins/custom/front/tab.form.php"); } elseif (isset($_POST["delete"])) { $ok = $tabs->delete($_POST); Html::redirect($CFG_GLPI["root_doc"] . "/plugins/custom/front/tab.php"); } elseif (isset($_REQUEST["purge"])) { $tabs->delete($_REQUEST, 1); Html::redirect($CFG_GLPI["root_doc"] . "/plugins/custom/front/tab.php"); } elseif (isset($_POST["update"])) { $tabs->update($_POST);