Creates a submit button element. This method will generate input elements that
can be used to submit, and reset forms by using $options. Image submits can be created by supplying an
image option
/** * Show profile form * * @param $items_id integer id of the profile * @param $target value url of target * * @return nothing **/ function showForm($profiles_id = 0, $openform = TRUE, $closeform = TRUE) { echo "<div class='firstbloc'>"; if (($canedit = Session::haveRightsOr(self::$rightname, array(CREATE, UPDATE, PURGE))) && $openform) { $profile = new Profile(); echo "<form method='post' action='" . $profile->getFormURL() . "'>"; } $profile = new Profile(); $profile->getFromDB($profiles_id); $rights = array(array('itemtype' => 'PluginAddressingAddressing', 'label' => __('Generate reports', 'addressing'), 'field' => 'plugin_addressing')); $profile->displayRightsChoiceMatrix($rights, array('canedit' => $canedit, 'default_class' => 'tab_bg_2', 'title' => __('General'))); echo "<table class='tab_cadre_fixehov'>"; $effective_rights = ProfileRight::getProfileRights($profiles_id, array('plugin_addressing_use_ping_in_equipment')); echo "<tr class='tab_bg_2'>"; echo "<td width='20%'>" . __('Use ping on equipment form', 'addressing') . "</td>"; echo "<td colspan='5'>"; Html::showCheckbox(array('name' => '_plugin_addressing_use_ping_in_equipment[1_0]', 'checked' => $effective_rights['plugin_addressing_use_ping_in_equipment'])); echo "</td></tr>\n"; echo "</table>"; if ($canedit && $closeform) { echo "<div class='center'>"; echo Html::hidden('id', array('value' => $profiles_id)); echo Html::submit(_sx('button', 'Save'), array('name' => 'update')); echo "</div>\n"; Html::closeForm(); } echo "</div>"; }
/** * Show profile form * * @param $items_id integer id of the profile * @param $target value url of target * * @return nothing **/ function showForm($profiles_id = 0, $openform = TRUE, $closeform = TRUE) { echo "<div class='firstbloc'>"; if (($canedit = Session::haveRightsOr(self::$rightname, array(CREATE, UPDATE, PURGE))) && $openform) { $profile = new Profile(); echo "<form method='post' action='" . $profile->getFormURL() . "'>"; } $profile = new Profile(); $profile->getFromDB($profiles_id); if ($profile->getField('interface') == 'central') { $rights = $this->getAllRights(); $profile->displayRightsChoiceMatrix($rights, array('canedit' => $canedit, 'default_class' => 'tab_bg_2', 'title' => __('General'))); } echo "<table class='tab_cadre_fixehov'>"; echo "<tr class='tab_bg_1'><th colspan='4'>" . __('Helpdesk') . "</th></tr>\n"; $effective_rights = ProfileRight::getProfileRights($profiles_id, array('plugin_racks_open_ticket')); echo "<tr class='tab_bg_2'>"; echo "<td width='20%'>" . __('Associable items to a ticket') . "</td>"; echo "<td colspan='5'>"; Html::showCheckbox(array('name' => '_plugin_racks_open_ticket', 'checked' => $effective_rights['plugin_racks_open_ticket'])); echo "</td></tr>\n"; echo "</table>"; if ($canedit && $closeform) { echo "<div class='center'>"; echo Html::hidden('id', array('value' => $profiles_id)); echo Html::submit(_sx('button', 'Save'), array('name' => 'update')); echo "</div>\n"; Html::closeForm(); } echo "</div>"; }
function showForm() { $this->getfromDB(1); $target = self::getFormURL(); echo "<div align='center'><form method='post' action=\"{$target}\">"; echo "<table class='tab_cadre' cellpadding='5'><tr ><th colspan='2'>"; echo self::getTypeName(0) . "</th></tr>"; echo "<tr class='tab_bg_1'><td>"; echo "<select name=\"unit\" size=\"1\"> "; echo "<option "; if ($this->isMetricUnit()) { echo "selected "; } echo "value='" . self::METRIC_UNIT . "'>" . __('metric', 'racks') . "</option>"; echo "<option "; if (!$this->isMetricUnit()) { echo "selected "; } echo "value='" . self::NON_METRIC_UNIT . "'>" . __('English', 'racks') . "</option>"; echo "</select> "; echo "</td>"; echo "<td>"; echo Html::hidden('id', array('value' => 1)); echo Html::submit(_sx('button', 'Post'), array('name' => 'update')); echo "</table>"; Html::closeForm(); echo "</div>"; }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() **/ static function showMassiveActionsSubForm(MassiveAction $ma) { switch ($ma->getAction()) { case 'import_email': Entity::dropdown(); echo "<br><br>"; echo Html::submit(_x('button', 'Import'), array('name' => 'massiveaction')); return true; } return parent::showMassiveActionsSubForm($ma); }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() **/ static function showMassiveActionsSubForm(MassiveAction $ma) { switch ($ma->getAction()) { case 'updatepages': $input = $ma->getInput(); if (!isset($input['maxpages'])) { $input['maxpages'] = ''; } echo "<input type='text' name='pages' value=\"" . $input['maxpages'] . "\" size='6'>"; echo "<br><br>" . Html::submit(_x('button', 'Update'), array('name' => 'massiveaction')); return true; } return parent::showMassiveActionsSubForm($ma); }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() **/ static function showMassiveActionsSubForm(MassiveAction $ma) { global $UNINSTALL_TYPES; foreach ($ma->getItems() as $itemtype => $data) { if (!in_array($itemtype, $UNINSTALL_TYPES)) { return ""; } } switch ($ma->getAction()) { case 'uninstall': $uninst = new PluginUninstallUninstall(); $uninst->dropdownUninstallModels("model_id", $_SESSION["glpiID"], $_SESSION["glpiactive_entity"]); echo " " . Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')); return true; } return ""; }
function showForm() { $this->getfromDB(1); $target = self::getFormURL(); echo "<div align='center'><form method='post' action=\"{$target}\">"; echo "<table class='tab_cadre' cellpadding='5'><tr ><th colspan='2'>"; echo self::getTypeName(0) . "</th></tr>"; echo "<tr class='tab_bg_1'><td>" . __('Configuration of units', 'racks') . "</td><td>"; echo "<select name=\"unit\" size=\"1\"> "; echo "<option "; if ($this->isMetricUnit()) { echo "selected "; } echo "value='" . self::METRIC_UNIT . "'>" . __('metric', 'racks') . "</option>"; echo "<option "; if (!$this->isMetricUnit()) { echo "selected "; } echo "value='" . self::NON_METRIC_UNIT . "'>" . __('English', 'racks') . "</option>"; echo "</select> "; echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>"; echo __("Copy rack's location when adding a new asset in the rack", "racks"); echo "</td>"; echo "<td style='width: 150px;'>"; Dropdown::showYesNo('add_location_on_new_item', $this->fields['add_location_on_new_item']); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>"; echo __("Forward rack's location to linked assets on change", "racks"); echo "</td>"; echo "<td style='width: 150px;'>"; Dropdown::showYesNo('forward_location_on_change', $this->fields['forward_location_on_change']); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td colspan='2' align='center'>"; echo Html::hidden('id', array('value' => 1)); echo Html::submit(_sx('button', 'Post'), array('name' => 'update')); echo "</table>"; Html::closeForm(); echo "</div>"; }
/** * @param $prof Profile object **/ static function showForProfile(Profile $prof) { global $DB; $canedit = Session::haveRightsOr(self::$rightname, array(CREATE, UPDATE, PURGE)); if ($canedit) { echo "<form method='post' action='" . $prof->getFormURL() . "'>"; } $rights = self::getAllRights(); $prof->displayRightsChoiceMatrix($rights, array('canedit' => $canedit, 'default_class' => 'tab_bg_2', 'title' => __('Rights management by profil', 'reports'))); if ($canedit) { echo "<div class='center'>"; echo Html::hidden('id', array('value' => $prof->getField('id'))); echo Html::submit(_sx('button', 'Save'), array('name' => 'update')); echo "</div>\n"; Html::closeForm(); } echo "</div>"; }
/** * Show profile form * * @param $items_id integer id of the profile * @param $target value url of target * * @return nothing **/ function showForm($profiles_id = 0, $openform = TRUE, $closeform = TRUE) { $profile = new Profile(); echo "<div class='firstbloc'>"; if (($canedit = Session::haveRightsOr(self::$rightname, array(CREATE, UPDATE, PURGE))) && $openform) { echo "<form method='post' action='" . $profile->getFormURL() . "'>"; } $profile->getFromDB($profiles_id); $rights = $this->getAllRights(); $profile->displayRightsChoiceMatrix($rights, array('canedit' => $canedit, 'default_class' => 'tab_bg_2', 'title' => __('Reforme', 'reforme'))); if ($canedit && $closeform) { echo "<div class='center'>"; echo Html::hidden('id', array('value' => $profiles_id)); echo Html::submit(_sx('button', 'Save'), array('name' => 'update')); echo "</div>\n"; echo Html::closeForm(false); } echo "</div>"; }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() **/ static function showMassiveActionsSubForm(MassiveAction $ma) { switch ($ma->getAction()) { case 'duplicate': Entity::dropdown(); echo "<br><br>"; echo Html::submit(_x('button', 'Duplicate'), array('name' => 'massiveaction')) . "</span>"; return true; } return parent::showMassiveActionsSubForm($ma); }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() **/ static function showMassiveActionsSubForm(MassiveAction $ma) { global $UNINSTALL_TYPES; switch ($ma->getAction()) { case 'transfert': Entity::dropdown(); echo " " . Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')); return true; } return ""; }
static function showMassiveActionsSubForm(MassiveAction $ma) { switch ($ma->getAction()) { case "add_model": echo "<input type=\"text\" name=\"model_name\"> "; echo Html::submit(_sx('button', 'Post'), array('name' => 'massiveaction')); return true; break; } return parent::showMassiveActionsSubForm($ma); }
/** * Show notepads for an item * * @param $item CommonDBTM object * @param $withtemplate integer template or basic item (default '') **/ static function showForItem(CommonDBTM $item, $withtemplate = '') { global $CFG_GLPI; if (!Session::haveRight($item::$rightname, READNOTE)) { return false; } $notes = static::getAllForItem($item); $rand = mt_rand(); $canedit = Session::haveRight($item::$rightname, UPDATENOTE); $showuserlink = 0; if (User::canView()) { $showuserlink = 1; } if ($canedit) { echo "<div class='boxnote center'>"; echo "<div class='boxnoteleft'></div>"; echo "<form name='addnote_form{$rand}' id='addnote_form{$rand}' "; echo " method='post' action='" . Toolbox::getItemTypeFormURL('Notepad') . "'>"; echo Html::hidden('itemtype', array('value' => $item->getType())); echo Html::hidden('items_id', array('value' => $item->getID())); echo "<div class='boxnotecontent'>"; echo "<div class='floatleft'>"; echo "<textarea name='content' rows=5 cols=100></textarea>"; echo "</div>"; echo "</div>"; // box notecontent echo "<div class='boxnoteright'><br>"; echo Html::submit(_x('button', 'Add'), array('name' => 'add')); echo "</div>"; Html::closeForm(); echo "</div>"; // boxnote } if (count($notes)) { foreach ($notes as $note) { $id = 'note' . $note['id'] . $rand; $classtoadd = ''; if ($canedit) { $classtoadd = " pointer"; } echo "<div class='boxnote' id='view{$id}'>"; echo "<div class='boxnoteleft'>"; echo "<img class='user_picture_verysmall' alt=\"" . __s('Picture') . "\" src='" . User::getThumbnailURLForPicture($note['picture']) . "'>"; echo "</div>"; // boxnoteleft echo "<div class='boxnotecontent'>"; echo "<div class='boxnotefloatright'>"; $username = NOT_AVAILABLE; if ($note['users_id_lastupdater']) { $username = getUserName($note['users_id_lastupdater'], $showuserlink); } $update = sprintf(__('Last update by %1$s on %2$s'), $username, Html::convDateTime($note['date_mod'])); $username = NOT_AVAILABLE; if ($note['users_id']) { $username = getUserName($note['users_id'], $showuserlink); } $create = sprintf(__('Create by %1$s on %2$s'), $username, Html::convDateTime($note['date'])); printf(__('%1$s / %2$s'), $update, $create); echo "</div>"; // floatright echo "<div class='boxnotetext {$classtoadd}' "; if ($canedit) { echo "onclick=\"" . Html::jsHide("view{$id}") . " " . Html::jsShow("edit{$id}") . "\""; } echo ">"; $content = nl2br($note['content']); if (empty($content)) { $content = NOT_AVAILABLE; } echo $content . '</div>'; // boxnotetext echo "</div>"; // boxnotecontent echo "<div class='boxnoteright'>"; if ($canedit) { Html::showSimpleForm(Toolbox::getItemTypeFormURL('Notepad'), array('purge' => 'purge'), _x('button', 'Delete permanently'), array('id' => $note['id']), $CFG_GLPI["root_doc"] . "/pics/delete.png", '', __('Confirm the final deletion?')); } echo "</div>"; // boxnoteright echo "</div>"; // boxnote if ($canedit) { echo "<div class='boxnote starthidden' id='edit{$id}'>"; echo "<form name='update_form{$id}{$rand}' id='update_form{$id}{$rand}' "; echo " method='post' action='" . Toolbox::getItemTypeFormURL('Notepad') . "'>"; echo "<div class='boxnoteleft'></div>"; echo "<div class='boxnotecontent'>"; echo Html::hidden('id', array('value' => $note['id'])); echo "<textarea name='content' rows=5 cols=100>" . $note['content'] . "</textarea>"; echo "</div>"; // boxnotecontent echo "<div class='boxnoteright'><br>"; echo Html::submit(_x('button', 'Update'), array('name' => 'update')); echo "</div>"; // boxnoteright Html::closeForm(); echo "</div>"; // boxnote } } } return true; }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() **/ static function showMassiveActionsSubForm(MassiveAction $ma) { global $CFG_GLPI; $specificities = static::getRelationMassiveActionsSpecificities(); $action = $ma->getAction(); // First, get normalized action : add or remove if (in_array($action, $specificities['normalized']['add'])) { $normalized_action = 'add'; } else { if (in_array($action, $specificities['normalized']['remove'])) { $normalized_action = 'remove'; } else { // If we cannot get normalized action, then, its not for this method ! return parent::showMassiveActionsSubForm($ma); } } switch ($normalized_action) { case 'add': case 'remove': // Get the peer number. For Document_Item, it depends of the action's name $peer_number = static::getRelationMassiveActionsPeerForSubForm($ma); switch ($peer_number) { case 1: $peertype = static::$itemtype_1; $peers_id = static::$items_id_1; break; case 2: $peertype = static::$itemtype_2; $peers_id = static::$items_id_2; break; default: exit; } if ($normalized_action == 'remove' && $specificities['only_remove_all_at_once']) { // If we just want to remove all the items, then just set hidden fields echo Html::hidden('peer_' . $peertype, array('value' => '')); echo Html::hidden('peer_' . $peers_id, array('value' => -1)); } else { // Else, it depends if the peer is an itemtype or not $options = $specificities['select_items_options_' . $peer_number]; // Do we allow to remove all the items at once ? Then, rename the default value ! if ($normalized_action == 'remove' && $specificities['can_remove_all_at_once']) { $options['emptylabel'] = __('Remove all at once'); } if (preg_match('/^itemtype/', $peertype)) { if (count($specificities['itemtypes']) > 0) { $options['itemtype_name'] = 'peer_' . $peertype; $options['items_id_name'] = 'peer_' . $peers_id; $options['itemtypes'] = $specificities['itemtypes']; // At least, if not forced by user, 'checkright' == true if (!isset($options['checkright'])) { $options['checkright'] = true; } Dropdown::showSelectItemFromItemtypes($options); } } else { $options['name'] = 'peer_' . $peers_id; $dropdown_method = $specificities['dropdown_method_' . $peer_number]; $peertype::$dropdown_method($options); } } // Allow any relation to display its own fields (Networkport_Vlan for tagged ...) static::showRelationMassiveActionsSubForm($ma, $peer_number); echo "<br><br>" . Html::submit($specificities['button_labels'][$action], array('name' => 'massiveaction')); return true; } return parent::showMassiveActionsSubForm($ma); }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() **/ static function showMassiveActionsSubForm(MassiveAction $ma) { switch ($ma->getAction()) { case 'duplicate': $entity_assign = False; foreach ($ma->getitems() as $itemtype => $ids) { if ($item = getItemForItemtype($itemtype)) { if ($item->isEntityAssign()) { $entity_assign = true; break; } } } if ($entity_assign) { Entity::dropdown(); } echo "<br><br>" . Html::submit(_x('button', 'Duplicate'), array('name' => 'massiveaction')); return true; case 'move_rule': $input = $ma->getInput(); $values = array('after' => __('After'), 'before' => __('Before')); Dropdown::showFromArray('move_type', $values, array('width' => '20%')); if (isset($input['entity'])) { $entity = $input['entity']; } else { $entity = ""; } if (isset($input['condition'])) { $condition = $input['condition']; } else { $condition = 0; } echo Html::hidden('rule_class_name', array('value' => $input['rule_class_name'])); Rule::dropdown(array('sub_type' => $input['rule_class_name'], 'name' => "ranking", 'condition' => $condition, 'entity' => $entity, 'width' => '50%')); echo "<br><br><input type='submit' name='massiveaction' class='submit' value='" . _sx('button', 'Move') . "'>\n"; return true; } return parent::showMassiveActionsSubForm($ma); }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() * */ static function showMassiveActionsSubForm(MassiveAction $ma) { switch ($ma->getAction()) { case "transfer": Dropdown::show('Entity'); echo Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')); return true; break; } return parent::showMassiveActionsSubForm($ma); }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() **/ static function showMassiveActionsSubForm(MassiveAction $ma) { switch ($ma->getAction()) { case 'transfert': Dropdown::show('Entity'); echo "<br><br>" . Html::submit(__('Post'), array('name' => 'massiveaction')); return true; } return parent::showMassiveActionsSubForm($ma); }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() **/ static function showMassiveActionsSubForm(MassiveAction $ma) { switch ($ma->getAction()) { case 'unlock': $types = array('Monitor' => _n('Monitor', 'Monitors', Session::getPluralNumber()), 'Peripheral' => _n('Device', 'Devices', Session::getPluralNumber()), 'Printer' => _n('Printer', 'Printers', Session::getPluralNumber()), 'SoftwareVersion' => _n('Version', 'Versions', Session::getPluralNumber()), 'NetworkPort' => _n('Network port', 'Network ports', Session::getPluralNumber()), 'NetworkName' => _n('Network name', 'Network names', Session::getPluralNumber()), 'IPAddress' => _n('IP address', 'IP addresses', Session::getPluralNumber()), 'ComputerDisk' => _n('Volume', 'Volumes', Session::getPluralNumber()), 'Device' => _n('Component', 'Components', Session::getPluralNumber()), 'ComputerVirtualMachine' => _n('Virtual machine', 'Virtual machines', Session::getPluralNumber())); _e('Select the type of the item that must be unlock'); echo "<br><br>\n"; Dropdown::showFromArray('attached_item', $types, array('multiple' => true, 'size' => 5, 'values' => array_keys($types))); echo "<br><br>" . Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')); return true; } return false; }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() * @param MassiveAction $ma * @return bool|false */ static function showMassiveActionsSubForm(MassiveAction $ma) { switch ($ma->getAction()) { case 'plugin_ocsinventoryng_update_networkport_type': echo " " . Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')); return true; } return parent::showMassiveActionsSubForm($ma); }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() **/ static function showMassiveActionsSubForm(MassiveAction $ma) { global $CFG_GLPI; switch ($ma->getAction()) { case "solveticket": $change = new Change(); $input = $ma->getInput(); if (isset($input['changes_id']) && $change->getFromDB($input['changes_id'])) { Ticket::showMassiveSolutionForm($change->getEntityID()); echo "<br><br>"; echo Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')); return true; } return false; } return parent::showMassiveActionsSubForm($ma); }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() **/ static function showMassiveActionsSubForm(MassiveAction $ma) { global $CFG_GLPI; $input = $ma->getInput(); switch ($ma->getAction()) { case 'move_license': if (isset($input['options'])) { if (isset($input['options']['move'])) { SoftwareLicense::dropdown(array('condition' => "`glpi_softwarelicenses`.`softwares_id`\n = '" . $input['options']['move']['softwares_id'] . "'", 'used' => $input['options']['move']['used'])); echo Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')); return true; } } return false; } return parent::showMassiveActionsSubForm($ma); }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() **/ static function showMassiveActionsSubForm(MassiveAction $ma) { global $UNINSTALL_TYPES; switch ($ma->getAction()) { case 'transfert': Entity::dropdown(); echo " " . Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')); return true; case 'copy_reference': //useless ? echo " <input type=\"submit\" name=\"massiveaction\" class=\"submit\" value=\"" . _sx('button', 'Post') . "\" >"; return true; } return ""; }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() **/ static function showMassiveActionsSubForm(MassiveAction $ma) { global $CFG_GLPI; switch ($ma->getAction()) { case 'transform_to': Dropdown::showItemTypes('transform_to', NetworkPort::getNetworkPortInstantiations(), array('value' => 'NetworkPortEthernet')); echo "<br><br>"; echo Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')) . "</span>"; return true; } return parent::showMassiveActionsSubForm($ma); }
/** * @since version 0.90 * * @see CommonDBTM::showMassiveActionsSubForm() **/ static function showMassiveActionsSubForm(MassiveAction $ma) { switch ($ma->getAction()) { case 'merge': echo " " . $_SESSION['glpiactive_entity_shortname']; echo "<br><br>" . Html::submit(_x('button', 'Merge'), array('name' => 'massiveaction')); return true; } return parent::showMassiveActionsSubForm($ma); }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() **/ static function showMassiveActionsSubForm(MassiveAction $ma) { global $CFG_GLPI; switch ($ma->getAction()) { case 'change_authtype': $rand = Auth::dropdown(array('name' => 'authtype')); $paramsmassaction = array('authtype' => '__VALUE__'); Ajax::updateItemOnSelectEvent("dropdown_authtype{$rand}", "show_massiveaction_field", $CFG_GLPI["root_doc"] . "/ajax/dropdownMassiveActionAuthMethods.php", $paramsmassaction); echo "<span id='show_massiveaction_field'><br><br>"; echo Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')) . "</span>"; return true; } return parent::showMassiveActionsSubForm($ma); }
/** * Display entities of the loaded profile * * @param $target target for entity change action * @param $myname select name **/ static function showSelector($target, $myname) { global $CFG_GLPI; $rand = mt_rand(); echo "<div class='center'>"; echo "<span class='b'>" . __('Select the desired entity') . "<br>( <img src='" . $CFG_GLPI["root_doc"] . "/pics/entity_all.png' alt=''> " . __s('to see the entity and its sub-entities') . ")</span>" . "<br>"; echo "<a style='font-size:14px;' href='" . $target . "?active_entity=all' title=\"" . __s('Show all') . "\">" . str_replace(" ", " ", __('Show all')) . "</a></div>"; echo "<div class='left' style='width:100%'>"; echo "<form id='entsearchform'>"; echo Html::input('entsearchtext', array('id' => 'entsearchtext')); echo Html::submit(__('Search'), array('id' => 'entsearch')); echo "</form>"; echo "<script type='text/javascript'>"; echo Html::jsGetElementbyID("tree_projectcategory{$rand}") . "\n // call `.jstree` with the options object\n .jstree({\n // the `plugins` array allows you to configure the active plugins on this instance\n 'plugins' : ['themes','json_data', 'search'],\n 'core': {\n 'load_open': true,\n 'html_titles': true,\n 'animation': 0\n },\n 'themes': {\n 'theme': 'classic',\n 'url' : '" . $CFG_GLPI["root_doc"] . "/css/jstree/style.css'\n },\n 'search': {\n 'case_insensitive': true,\n 'show_only_matches': true,\n 'ajax': {\n 'type': 'POST',\n 'url': '" . $CFG_GLPI["root_doc"] . "/ajax/entitytreesearch.php'\n }\n },\n 'json_data': {\n 'ajax': {\n 'type': 'POST',\n 'url': function (node) {\n var nodeId = '';\n var url = '';\n if (node == -1) {\n url = '" . $CFG_GLPI["root_doc"] . "/ajax/entitytreesons.php?node=-1';\n }\n else {\n nodeId = node.attr('id');\n url = '" . $CFG_GLPI["root_doc"] . "/ajax/entitytreesons.php?node='+nodeId;\n }\n\n return url;\n },\n 'success': function (new_data) {\n //where new_data = node children\n //e.g.: [{'data':'Hardware','attr':{'id':'child2'}},\n // {'data':'Software','attr':{'id':'child3'}}]\n return new_data;\n },\n 'progressive_render' : true\n }\n }\n }).bind('select_node.jstree', function (e, data) {\n document.location.href = data.rslt.obj.children('a').attr('href');\n });\n\n var searchTree = function() {\n " . Html::jsGetElementbyID("tree_projectcategory{$rand}") . ".jstree('close_all');;\n " . Html::jsGetElementbyID("tree_projectcategory{$rand}") . ".jstree('search'," . Html::jsGetDropdownValue('entsearchtext') . ");\n }\n\n \$('#entsearchform').submit(function( event ) {\n // cancel submit of entity search form\n event.preventDefault();\n\n // search\n searchTree();\n });\n\n // delay function who reinit timer on each call\n var typewatch = (function(){\n var timer = 0;\n return function(callback, ms){\n clearTimeout (timer);\n timer = setTimeout(callback, ms);\n };\n })();\n\n // autosearch on keypress (delayed and with min length)\n \$('#entsearchtext').keyup(function () {\n var inputsearch = \$(this);\n typewatch(function () {\n if (inputsearch.val().length >= 3) {\n searchTree();\n }\n }, 500);\n })\n .focus();\n "; echo "</script>"; echo "<div id='tree_projectcategory{$rand}' ></div>"; echo "</div>"; }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() **/ static function showMassiveActionsSubForm(MassiveAction $ma) { global $CFG_GLPI; switch ($ma->getAction()) { case 'add_task': $itemtype = $ma->getItemtype(true); $tasktype = $itemtype . 'Task'; if ($ttype = getItemForItemtype($tasktype)) { $ttype->showFormMassiveAction(); return true; } return false; case 'add_actor': $types = array(0 => Dropdown::EMPTY_VALUE, CommonITILActor::REQUESTER => __('Requester'), CommonITILActor::OBSERVER => __('Watcher'), CommonITILActor::ASSIGN => __('Assigned to')); $rand = Dropdown::showFromArray('actortype', $types); $paramsmassaction = array('actortype' => '__VALUE__'); Ajax::updateItemOnSelectEvent("dropdown_actortype{$rand}", "show_massiveaction_field", $CFG_GLPI["root_doc"] . "/ajax/dropdownMassiveActionAddActor.php", $paramsmassaction); echo "<span id='show_massiveaction_field'> </span>\n"; return true; case 'update_notif': Dropdown::showYesNo('use_notification'); echo "<br><br>"; echo Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')); return true; return true; } return parent::showMassiveActionsSubForm($ma); }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() **/ static function showMassiveActionsSubForm(MassiveAction $ma) { global $CFG_GLPI; switch ($ma->getAction()) { case 'add_task': $tasktype = 'TicketTask'; if ($ttype = getItemForItemtype($tasktype)) { $ttype->showFormMassiveAction(); return true; } return false; case "solveticket": $problem = new Problem(); $input = $ma->getInput(); if (isset($input['problems_id']) && $problem->getFromDB($input['problems_id'])) { Ticket::showMassiveSolutionForm($problem->getEntityID()); echo "<br><br>"; echo Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')); return true; } return false; } return parent::showMassiveActionsSubForm($ma); }
function showForm($profiles_id, $options = array()) { if (!Session::haveRight("profile", READ)) { return false; } $canedit = Session::haveRight("profile", UPDATE); //if ($id) { // $this->getProfilesFromDB($id); //} //Ensure rights are defined in database self::installRights(); $profile = new Profile(); $profile->getFromDB($profiles_id); echo "<form action='" . Profile::getFormUrl() . "' method='post'>"; echo "<table class='tab_cadre_fixe'>"; $general_rights = self::getGeneralRights(); $profile->displayRightsChoiceMatrix($general_rights, array('canedit' => $canedit, 'default_class' => 'tab_bg_2', 'title' => __('General', 'genericobject'))); $types_rights = self::getTypesRights(); $title = __('Objects', 'genericobject'); if (count($types_rights) == 0) { $title .= __(" (No types defined yet)", "genericobject"); } $profile->displayRightsChoiceMatrix($types_rights, array('canedit' => $canedit, 'default_class' => 'tab_bg_2', 'title' => $title)); $profile->showLegend(); if ($canedit) { echo "<div class='center'>"; echo Html::hidden('id', array('value' => $profiles_id)); echo Html::submit(_sx('button', 'Save'), array('name' => 'update')); echo "</div>\n"; Html::closeForm(); } echo "</div>"; }
/** * @since version 0.85 * * @see CommonDBTM::showMassiveActionsSubForm() * @param MassiveAction $ma * @return bool|false */ static function showMassiveActionsSubForm(MassiveAction $ma) { switch ($ma->getAction()) { case 'plugin_ocsinventoryng_import': Entity::dropdown(array('name' => 'entity')); echo " " . Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')); return true; /*case 'plugin_ocsinventoryng_link': Computer::dropdown(array('name' => 'computers_id')); echo " ". Html::submit(_x('button','Post'), array('name' => 'massiveaction')); return true;*/ /*case 'plugin_ocsinventoryng_link': Computer::dropdown(array('name' => 'computers_id')); echo " ". Html::submit(_x('button','Post'), array('name' => 'massiveaction')); return true;*/ case 'plugin_ocsinventoryng_replayrules': case 'plugin_ocsinventoryng_delete': echo " " . Html::submit(_x('button', 'Post'), array('name' => 'massiveaction')); return true; } return parent::showMassiveActionsSubForm($ma); }