Dropdown integers
static public showInteger ( $myname, $value, $min, $max = 100, $step = 1, $toadd = [], $options = [] ) | ||
$myname | select name | |
$value | default value | |
$min | min value (default 0) | |
$max | max value (default 100) | |
$step | step used (default 1) | |
$toadd | array of values to add at the beginning | |
$options | array of additionnal options : - unit : string unit to used - display : boolean if false get string \deprecated since 0.84 use Dropdown::showNumber instead |
function displayCriteria() { $this->getReport()->startColumn(); echo $this->getCriteriaLabel() . ' :'; $this->getReport()->endColumn(); $this->getReport()->startColumn(); if (empty($this->signe)) { Dropdown::showFromArray($this->getName() . "_sign", array('<=' => '<=', '>=' => '>='), array('value' => Toolbox::unclean_cross_side_scripting_deep($this->getParameter($this->getName() . "_sign")))); echo " "; } Dropdown::showInteger($this->getName(), $this->getParameterValue(), $this->min, $this->max, 1); echo ' ' . $this->unit; $this->getReport()->endColumn(); }
function showForm($ID, $options = array()) { global $CFG_GLPI; if (!$this->canView()) { return false; } if ($ID > 0) { $this->check($ID, READ); } else { $this->check(-1, UPDATE); $this->getEmpty(); if (isset($_GET['preconfig'])) { $this->preconfig($_GET['preconfig']); } else { $_GET['preconfig'] = -1; } } $input = array("name" => $this->fields["name"], "supplier_url" => $this->fields["supplier_url"]); $canedit = $this->can($ID, UPDATE, $input); $canrecu = $this->can($ID, 'recursive', $input); echo "<table class='tab_cadre_fixe'>"; echo "<tr>"; echo "<td class='tab_bg_2 center' colspan='2'>" . __('Preconfiguration') . " "; $opt = array('value' => $_GET['preconfig']); $rand = self::dropdownSupplier('supplier', $opt); $params = array('supplier' => '__VALUE__'); Ajax::updateItemOnSelectEvent("dropdown_supplier{$rand}", "show_preconfig", "../ajax/dropdownSuppliers.php", $params); echo "<span id='show_preconfig'>"; echo "</span>"; echo "</td>"; echo "</tr>"; echo "</table>"; if ($_GET['preconfig'] == -1 && $ID <= 0) { $style = "style='display:none;'"; } else { $style = "style='display:block;'"; } echo "<div id='show_form' {$style}>"; $this->initForm($ID, $options); $this->showFormHeader($options); echo "<tr>"; echo "<td class='tab_bg_2 center'>" . __('Name') . "</td>"; echo "<td class='tab_bg_2 left'>"; echo $this->fields["name"]; echo "<input type='hidden' name='name' value=\"" . $this->fields["name"] . "\">\n"; echo "</td>"; echo "<td class='tab_bg_2 center'>" . __('Manufacturer') . "</td>"; echo "<td class='tab_bg_2 left'>"; Dropdown::show('Manufacturer', array('name' => "manufacturers_id", 'value' => $this->fields["manufacturers_id"])); echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<td class='tab_bg_2 center' colspan='2'>" . __('Manufacturer web address', 'manufacturersimports') . "</td>"; echo "<td class='tab_bg_2 left' colspan='2'>"; echo "<input type='text' name='supplier_url' size='100' value='" . $this->fields["supplier_url"] . "'>"; echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<td class='tab_bg_2 center' colspan='2'>" . __('Default supplier attached', 'manufacturersimports') . "</td>"; echo "<td class='tab_bg_2 left' colspan='2'>"; Dropdown::show('Supplier', array('name' => "suppliers_id", 'value' => $this->fields["suppliers_id"])); echo "</td>"; echo "</tr>"; if ($this->fields["name"] == self::FUJITSU) { echo "<tr>"; echo "<td class='tab_bg_2 center' colspan='2'>" . __('New warranty affected by default (Replace if 0)', 'manufacturersimports') . "</td>"; echo "<td class='tab_bg_2 left' colspan='2'>"; Dropdown::showInteger("warranty_duration", $this->fields["warranty_duration"], 0, 120); echo "</td>"; echo "</tr>"; } else { echo "<input type='hidden' name='warranty_duration' value='0'>\n"; } if ($this->fields["name"] != self::DELL) { echo "<tr>"; echo "<td class='tab_bg_2 center' colspan='2'>" . __('Auto add of document', 'manufacturersimports') . "</td>"; echo "<td class='tab_bg_2 left' colspan='2'>"; Dropdown::showYesNo("document_adding", $this->fields["document_adding"]); echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<td class='tab_bg_2 center' colspan='2'>" . __('Section for document records', 'manufacturersimports') . "</td>"; echo "<td class='tab_bg_2 left' colspan='2'>"; Dropdown::show('DocumentCategory', array('name' => "documentcategories_id", 'value' => $this->fields["documentcategories_id"])); echo "</td>"; echo "</tr>"; } else { echo "<tr>"; echo "<td class='tab_bg_2 center' colspan='2'>" . __('Manufacturer API key', 'manufacturersimports') . "</td>"; echo "<td class='tab_bg_2 left' colspan='2'>"; echo "<input type='text' name='supplier_key' size='32' value='" . $this->fields["supplier_key"] . "'>"; echo "</td>"; echo "</tr>"; } echo "<tr>"; echo "<td class='tab_bg_2 center' colspan='2'>" . __('Add a comment line', 'manufacturersimports') . "</td>"; echo "<td class='tab_bg_2 left' colspan='2'>"; Dropdown::showYesNo("comment_adding", $this->fields["comment_adding"]); echo "</td>"; echo "</tr>"; $this->showFormButtons($options); return true; }
function showForm($ID, $options = array()) { $PluginRacksConfig = new PluginRacksConfig(); $this->initForm($ID, $options); $this->showFormHeader($options); //ligne 1 echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Name') . "</td><td>"; $objectName = autoName($this->fields["name"], "name", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]); Html::autocompletionTextField($this, 'name', array('value' => $objectName)); echo "</td>"; echo "<td>" . __('Size') . "</td><td>"; Dropdown::showInteger("rack_size", $this->fields["rack_size"], 1, 100, 1); echo " " . __('U', 'racks') . "</td>"; echo "</tr>"; //ligne 2 echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Manufacturer') . "</td><td>"; Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"])); echo "</td>"; echo "<td >" . __('Location') . "</td>"; echo "<td>"; Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"])); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td >" . __('Technician in charge of the hardware') . "</td>"; echo "<td >"; User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'interface', 'entity' => $this->fields["entities_id"])); echo "</td>"; echo "<td>" . __('Place', 'racks'); echo "</td><td>"; $PluginRacksRoomLocation = new PluginRacksRoomLocation(); $PluginRacksRoomLocation->dropdownRoomLocations("plugin_racks_roomlocations_id", $this->fields["plugin_racks_roomlocations_id"], $this->fields["entities_id"]); echo "</td>"; echo "</tr>"; //ligne 4 echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Group in charge of the hardware') . "</td><td>"; Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`')); echo "</td>"; echo "<td>" . __('Width', 'racks') . "</td><td>"; echo "<input type='text' name='width' \n value=\"" . Html::formatNumber($this->fields["width"], true) . "\" size='10'> "; $PluginRacksConfig->getUnit("size"); echo "</td>"; echo "</tr>"; //ligne 5 echo "<tr class='tab_bg_1'>"; echo "</td>"; echo "<td>" . __('Serial number') . "</td>"; echo "<td >"; Html::autocompletionTextField($this, 'serial'); echo "</td>"; echo "<td>" . __('Height', 'racks') . "</td><td>"; echo "<input type='text' name='height' \n value=\"" . Html::formatNumber($this->fields["height"], true) . "\" size='10'> "; $PluginRacksConfig->getUnit("size"); echo "</td>"; echo "</tr>"; //ligne 6 echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Inventory number') . "</td>"; echo "<td>"; Html::autocompletionTextField($this, 'otherserial'); echo "</td>"; echo "<td>" . __('Weight', 'racks') . "</td><td>"; echo "<input type='text' name='weight' \n value=\"" . Html::formatNumber($this->fields["weight"], true) . "\" size='10'> "; $PluginRacksConfig->getUnit("weight"); echo "</td>"; echo "</tr>"; //ligne 7 echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Model') . "</td>"; echo "<td>"; Dropdown::show('PluginRacksRackModel', array('name' => "plugin_racks_rackmodels_id", 'value' => $this->fields["plugin_racks_rackmodels_id"])); echo "</td>"; echo "<td>" . __('Depth', 'racks') . "</td><td>"; echo "<input type='text' name='depth' \n value=\"" . Html::formatNumber($this->fields["depth"], true) . "\" size='10'> "; $PluginRacksConfig->getUnit("size"); echo "</td>"; echo "</tr>"; //ligne 8 echo "<tr class='tab_bg_1'>"; echo "<td >" . __('Type') . "</td><td>"; Dropdown::show('PluginRacksRackType', array('value' => $this->fields["plugin_racks_racktypes_id"])); echo "</td>"; echo "<td >" . __('Status') . "</td><td>"; Dropdown::show('PluginRacksRackState', array('value' => $this->fields["plugin_racks_rackstates_id"])); echo "</td>"; echo "</tr>"; //ligne 9 echo "<tr class='tab_bg_1'>"; echo "<td colspan='2'>"; if ((!isset($options['withtemplate']) || $options['withtemplate'] == 0) && !empty($this->fields['template_name'])) { echo "<span class='small_space'>"; printf(__('Created from the template %s'), $this->fields['template_name']); echo "</span>"; } else { echo " "; } echo "</td><td colspan='2'>"; if (isset($options['withtemplate']) && $options['withtemplate']) { //TRANS: %s is the datetime of insertion printf(__('Created on %s'), Html::convDateTime($_SESSION["glpi_currenttime"])); } else { //TRANS: %s is the datetime of update printf(__('Last update on %s'), Html::convDateTime($this->fields["date_mod"])); } echo "</td></tr>\n"; $this->showFormButtons($options); if (!$this->isNewID($this->getID())) { $this->showTotal(); } return true; }
function showForm($ID, $options = array()) { global $DB, $CFG_GLPI, $LANG; $canupdate = haveRight('update_ticket', '1'); $canpriority = haveRight('update_priority', '1'); $showuserlink = 0; if (haveRight('user', 'r')) { $showuserlink = 1; } if ($ID > 0) { $this->check($ID, 'r'); } else { // Create item $this->check(-1, 'w', $options); } $this->showTabs($options); $canupdate_descr = $canupdate || $this->fields['status'] == 'new' && $this->isUser(self::REQUESTER, getLoginUserID()) && $this->numberOfFollowups() == 0 && $this->numberOfTasks() == 0; if (!$ID) { //Get all the user's entities $all_entities = Profile_User::getUserEntities($options["_users_id_requester"], true); $this->userentities = array(); //For each user's entity, check if the technician which creates the ticket have access to it foreach ($all_entities as $tmp => $ID_entity) { if (haveAccessToEntity($ID_entity)) { $this->userentities[] = $ID_entity; } } $this->countentitiesforuser = count($this->userentities); if ($this->countentitiesforuser > 0 && !in_array($this->fields["entities_id"], $this->userentities)) { // If entity is not in the list of user's entities, // then use as default value the first value of the user's entites list $this->fields["entities_id"] = $this->userentities[0]; } } echo "<form method='post' name='form_ticket' enctype='multipart/form-data' action='" . $CFG_GLPI["root_doc"] . "/front/ticket.form.php'>"; echo "<div class='spaced' id='tabsbody'>"; echo "<table class='tab_cadre_fixe'>"; // Optional line $ismultientities = isMultiEntitiesMode(); echo '<tr><th colspan="4">'; if ($ID) { echo $this->getTypeName() . " - " . $LANG['common'][2] . " {$ID} "; if ($ismultientities) { echo "(" . Dropdown::getDropdownName('glpi_entities', $this->fields['entities_id']) . ")"; } } else { if ($ismultientities) { echo $LANG['job'][46] . " : " . Dropdown::getDropdownName("glpi_entities", $this->fields['entities_id']); } else { echo $LANG['job'][13]; } } echo '</th></tr>'; echo "<tr>"; echo "<th class='left' colspan='2'>"; echo "<table>"; echo "<tr>"; echo "<td><span class='tracking_small'>" . $LANG['joblist'][11] . " : </span></td>"; echo "<td>"; $date = $this->fields["date"]; if (!$ID) { $date = date("Y-m-d H:i:s"); } if ($canupdate) { showDateTimeFormItem("date", $date, 1, false); } else { echo convDateTime($date); } echo "</td></tr>"; if ($ID) { echo "<tr><td><span class='tracking_small'>" . $LANG['common'][95] . " :</span></td><td>"; if ($canupdate) { User::dropdown(array('name' => 'users_id_recipient', 'value' => $this->fields["users_id_recipient"], 'entity' => $this->fields["entities_id"], 'right' => 'all')); } else { echo getUserName($this->fields["users_id_recipient"], $showuserlink); } echo "</td></tr>"; } echo "</table>"; echo "</th>"; echo "<th class='left' colspan='2'>"; echo "<table>"; if ($ID) { echo "<tr><td><span class='tracking_small'>" . $LANG['common'][26] . " :</span></td>"; echo "<td><span class='tracking_small'>" . convDateTime($this->fields["date_mod"]) . "\n"; if ($this->fields['users_id_lastupdater'] > 0) { echo $LANG['common'][95] . " "; echo getUserName($this->fields["users_id_lastupdater"], $showuserlink); } echo "</span>"; echo "</td></tr>"; } // SLA echo "<tr>"; echo "<td><span class='tracking_small'>" . $LANG['sla'][5] . " : </span></td>"; echo "<td>"; if ($ID) { if ($this->fields["slas_id"] > 0) { echo "<span class='tracking_small'> "; echo convDateTime($this->fields["due_date"]) . "</span>"; echo "</td></tr><tr><td><span class='tracking_small'>" . $LANG['sla'][1] . " :</span></td>"; echo "<td><span class='tracking_small'>"; echo Dropdown::getDropdownName("glpi_slas", $this->fields["slas_id"]); $commentsla = ""; $slalevel = new SlaLevel(); if ($slalevel->getFromDB($this->fields['slalevels_id'])) { $commentsla .= '<strong>' . $LANG['sla'][6] . " : </strong>" . $slalevel->getName() . '<br><br>'; } $nextaction = new SlaLevel_Ticket(); if ($nextaction->getFromDBForTicket($this->fields["id"])) { $commentsla .= '<strong>' . $LANG['sla'][8] . " : </strong>" . convDateTime($nextaction->fields['date']) . '<br>'; if ($slalevel->getFromDB($nextaction->fields['slalevels_id'])) { $commentsla .= '<strong>' . $LANG['sla'][6] . " : </strong>" . $slalevel->getName() . '<br>'; } } $slaoptions = array(); if (haveRight('config', 'r')) { } $slaoptions['link'] = getItemTypeFormURL('SLA') . "?id=" . $this->fields["slas_id"]; showToolTip($commentsla, $slaoptions); if ($canupdate) { echo " <input type='submit' class='submit' name='sla_delete' value='" . $LANG['sla'][7] . "'>"; } echo "</span>"; } else { showDateTimeFormItem("due_date", $this->fields["due_date"], 1, false, $canupdate); } } else { // New Ticket if ($this->fields["due_date"] == 'NULL') { $this->fields["due_date"] = ''; } showDateTimeFormItem("due_date", $this->fields["due_date"], 1, false, $canupdate); /* echo $LANG['choice'][2]." ".$LANG['sla'][1]." : "; Dropdown::show('Sla',array('entity' => $this->fields["entities_id"], 'value' =>$this->fields["slas_id"]));*/ } echo "</td></tr>"; if ($ID) { switch ($this->fields["status"]) { case 'closed': echo "<tr>"; echo "<td><span class='tracking_small'>" . $LANG['joblist'][12] . " : </span></td>"; echo "<td>"; showDateTimeFormItem("closedate", $this->fields["closedate"], 1, false, $canupdate); echo "</td></tr>"; break; case 'solved': echo "<tr>"; echo "<td><span class='tracking_small'>" . $LANG['joblist'][14] . " : </span></td>"; echo "<td>"; showDateTimeFormItem("solvedate", $this->fields["solvedate"], 1, false, $canupdate); echo "</td></tr>"; break; } } echo "</table>"; echo "</th></tr>"; echo "</table>"; if (!$ID) { $this->showActorsPartForm($ID, $options); } echo "<table class='tab_cadre_fixe'>"; echo "<tr class='tab_bg_1'>"; echo "<th width='10%'>" . $LANG['joblist'][0] . " : </th>"; echo "<td width='40%'>"; if ($canupdate) { self::dropdownStatus("status", $this->fields["status"], 2); // Allowed status } else { echo self::getStatus($this->fields["status"]); } echo "</td>"; echo "<th>" . $LANG['common'][17] . " : </th>"; echo "<td >"; // Permit to set type when creating ticket without update right if ($canupdate || !$ID) { self::dropdownType('type', $this->fields["type"]); } else { echo self::getTicketTypeName($this->fields["type"]); } echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<th>" . $LANG['joblist'][29] . " : </th>"; echo "<td>"; if ($canupdate && $canpriority || !$ID || $canupdate_descr) { // Only change during creation OR when allowed to change priority OR when user is the creator $idurgency = self::dropdownUrgency("urgency", $this->fields["urgency"]); } else { $idurgency = "value_urgency" . mt_rand(); echo "<input id='{$idurgency}' type='hidden' name='urgency' value='" . $this->fields["urgency"] . "'>"; echo self::getUrgencyName($this->fields["urgency"]); } echo "</td>"; echo "<th>" . $LANG['common'][36] . " : </th>"; echo "<td >"; // Permit to set category when creating ticket without update right if ($canupdate || !$ID || $canupdate_descr) { $opt = array('value' => $this->fields["ticketcategories_id"], 'entity' => $this->fields["entities_id"]); if ($_SESSION["glpiactiveprofile"]["interface"] == "helpdesk") { $opt['condition'] = '`is_helpdeskvisible`=1'; } if ($ID && $CFG_GLPI["is_ticket_category_mandatory"]) { $opt['display_emptychoice'] = false; } Dropdown::show('TicketCategory', $opt); } else { echo Dropdown::getDropdownName("glpi_ticketcategories", $this->fields["ticketcategories_id"]); } echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<th>" . $LANG['joblist'][30] . " : </th>"; echo "<td>"; if ($canupdate) { $idimpact = self::dropdownImpact("impact", $this->fields["impact"]); } else { echo self::getImpactName($this->fields["impact"]); } echo "</td>"; echo "<th class='left' rowspan='2'>" . $LANG['document'][14] . " : </th>"; echo "<td rowspan='2'>"; // Select hardware on creation or if have update right if ($canupdate || !$ID || $canupdate_descr) { if ($ID) { if ($this->fields['itemtype'] && class_exists($this->fields['itemtype']) && $this->fields["items_id"]) { $item = new $this->fields['itemtype'](); if ($item->can($this->fields["items_id"], 'r')) { echo $item->getTypeName() . " - " . $item->getLink(true); } else { echo $item->getTypeName() . " " . $item->getNameID(); } } } $dev_user_id = 0; if (!$ID) { $dev_user_id = $options['_users_id_requester']; } else { if (isset($this->users[self::REQUESTER]) && count($this->users[self::REQUESTER]) == 1) { foreach ($this->users[self::REQUESTER] as $user_id_single) { $dev_user_id = $user_id_single['users_id']; } } } if ($dev_user_id > 0) { self::dropdownMyDevices($dev_user_id, $this->fields["entities_id"], $this->fields["itemtype"], $this->fields["items_id"]); } self::dropdownAllDevices("itemtype", $this->fields["itemtype"], $this->fields["items_id"], 1, $this->fields["entities_id"]); } else { if ($ID && $this->fields['itemtype'] && class_exists($this->fields['itemtype'])) { $item = new $this->fields['itemtype'](); $item->getFromDB($this->fields['items_id']); echo $item->getTypeName() . " - " . $item->getNameID(); } else { echo $LANG['help'][30]; } } echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<th class='left'>" . $LANG['joblist'][2] . " : </th>"; echo "<td>"; if ($canupdate && $canpriority) { $idpriority = self::dropdownPriority("priority", $this->fields["priority"], false, true); $idajax = 'change_priority_' . mt_rand(); echo " <span id='{$idajax}' style='display:none'></span>"; } else { $idajax = 'change_priority_' . mt_rand(); $idpriority = 0; echo "<span id='{$idajax}'>" . self::getPriorityName($this->fields["priority"]) . "</span>"; } if ($canupdate) { $params = array('urgency' => '__VALUE0__', 'impact' => '__VALUE1__', 'priority' => $idpriority); ajaxUpdateItemOnSelectEvent(array($idurgency, $idimpact), $idajax, $CFG_GLPI["root_doc"] . "/ajax/priority.php", $params); } echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<th class='left'>" . $LANG['job'][44] . " : </th>"; echo "<td>"; if ($canupdate) { Dropdown::show('RequestType', array('value' => $this->fields["requesttypes_id"])); } else { echo Dropdown::getDropdownName('glpi_requesttypes', $this->fields["requesttypes_id"]); } echo "</td>"; // Display validation state echo "<th>"; if (!$ID) { echo $LANG['validation'][26] . " : "; } else { echo $LANG['validation'][0] . " : "; } echo "</th>"; echo "<td>"; if (!$ID) { User::dropdown(array('name' => "_add_validation", 'entity' => $this->fields['entities_id'], 'right' => 'validate_ticket')); } else { if ($canupdate) { TicketValidation::dropdownStatus('global_validation', array('global' => true, 'value' => $this->fields['global_validation'])); } else { echo TicketValidation::getStatus($this->fields['global_validation']); } } echo "</td></tr>"; // Need comment right to add a followup with the actiontime if (!$ID && haveRight("global_add_followups", "1")) { echo "<tr class='tab_bg_1'>"; echo "<th>" . $LANG['job'][20] . " : </th>"; echo "<td class='left' colspan='3'>"; Dropdown::showInteger('hour', $options['hour'], 0, 100); echo " " . $LANG['job'][21] . " "; Dropdown::showInteger('minute', $options['minute'], 0, 59); echo " " . $LANG['job'][22] . " "; echo "</td>"; echo "</tr>"; } echo '</table>'; if ($ID) { $this->showActorsPartForm($ID, $options); } echo "<table class='tab_cadre_fixe'>"; $view_linked_tickets = $ID || $canupdate; echo "<tr class='tab_bg_1'>"; echo "<th width='10%'>" . $LANG['common'][57] . " :</th>"; echo "<td width='50%'>"; if (!$ID || $canupdate_descr) { $rand = mt_rand(); echo "<script type='text/javascript' >\n"; echo "function showName{$rand}() {\n"; echo "Ext.get('name{$rand}').setDisplayed('none');"; $params = array('maxlength' => 250, 'size' => 60, 'name' => 'name', 'data' => rawurlencode($this->fields["name"])); ajaxUpdateItemJsCode("viewname{$rand}", $CFG_GLPI["root_doc"] . "/ajax/inputtext.php", $params, false); echo "}"; echo "</script>\n"; echo "<div id='name{$rand}' class='tracking left' onClick='showName{$rand}()'>\n"; if (empty($this->fields["name"])) { echo $LANG['reminder'][15]; } else { echo $this->fields["name"]; } echo "</div>\n"; echo "<div id='viewname{$rand}'>\n"; echo "</div>\n"; if (!$ID) { echo "<script type='text/javascript' >\n\n showName{$rand}();\n </script>"; } } else { if (empty($this->fields["name"])) { echo $LANG['reminder'][15]; } else { echo $this->fields["name"]; } } echo "</td>"; // Permit to add doc when creating a ticket if (!$ID) { echo "<th>" . $LANG['document'][2] . " (" . Document::getMaxUploadSize() . ") :"; echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/aide.png' class='pointer' alt=\"" . $LANG['central'][7] . "\" onclick=\"window.open('" . $CFG_GLPI["root_doc"] . "/front/documenttype.list.php','Help','scrollbars=1,resizable=1,width=1000,height=800')\">"; echo "</th>"; echo "<td>"; echo "<input type='file' name='filename' value=\"\" size='25'></td>"; } else { echo "<th colspan='2'>"; echo $LANG['document'][20] . ' : ' . Document_Item::countForItem($this); echo "</th>"; } echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<th width='10%'>" . $LANG['joblist'][6] . " : </th>"; echo "<td width='50%'>"; if (!$ID || $canupdate_descr) { // Admin =oui on autorise la modification de la description $rand = mt_rand(); echo "<script type='text/javascript' >\n"; echo "function showDesc{$rand}() {\n"; echo "Ext.get('desc{$rand}').setDisplayed('none');"; $params = array('rows' => 6, 'cols' => 60, 'name' => 'content', 'data' => rawurlencode($this->fields["content"])); ajaxUpdateItemJsCode("viewdesc{$rand}", $CFG_GLPI["root_doc"] . "/ajax/textarea.php", $params, false); echo "}"; echo "</script>\n"; echo "<div id='desc{$rand}' class='tracking' onClick='showDesc{$rand}()'>\n"; if (!empty($this->fields["content"])) { echo nl2br($this->fields["content"]); } else { echo $LANG['job'][33]; } echo "</div>\n"; echo "<div id='viewdesc{$rand}'></div>\n"; if (!$ID) { echo "<script type='text/javascript' >\n\n showDesc{$rand}();\n </script>"; } } else { echo nl2br($this->fields["content"]); } echo "</td>"; if ($view_linked_tickets) { echo "<th width='10%'>"; echo $LANG['job'][55]; if ($canupdate) { $rand_linked_ticket = mt_rand(); echo " <a class='tracking'\n onClick=\"Ext.get('linkedticket{$rand_linked_ticket}').setDisplayed('block')\">\n"; echo $LANG['buttons'][8]; echo "</a>\n"; } echo '</th>'; echo "<td>"; Ticket_Ticket::displayLinkedTicketsTo($ID); if ($canupdate) { echo "<div style='display:none' id='linkedticket{$rand_linked_ticket}'>"; Ticket_Ticket::dropdownLinks('_link[link]'); echo " " . $LANG['job'][38] . " " . $LANG['common'][2] . " : "; echo "<input type='hidden' name='_link[tickets_id_1]' value='{$ID}'>\n"; echo "<input type='text' name='_link[tickets_id_2]' value='' size='10'>\n"; echo " "; echo "</div>"; } echo "</td>"; } echo "</tr>"; if (!$ID || $canupdate || $canupdate_descr || haveRight("assign_ticket", "1") || haveRight("steal_ticket", "1")) { echo "<tr class='tab_bg_1'>"; if ($ID) { if (haveRight('delete_ticket', 1)) { echo "<td class='tab_bg_2 center' colspan='2'>"; echo "<input type='submit' class='submit' name='update' value='" . $LANG['buttons'][7] . "'></td>"; echo "<td class='tab_bg_2 center' colspan='2'>"; echo "<input type='submit' class='submit' name='delete' value='" . $LANG['buttons'][22] . "'" . addConfirmationOnAction($LANG['common'][50]) . ">"; } else { echo "<td class='tab_bg_2 center' colspan='4'>"; echo "<input type='submit' class='submit' name='update' value='" . $LANG['buttons'][7] . "'>"; } } else { echo "<td class='tab_bg_2 center' colspan='2'>"; echo "<input type='submit' name='add' value=\"" . $LANG['buttons'][8] . "\" class='submit'>"; echo "</td><td class='tab_bg_2 center' colspan='2'>"; echo "<input type='button' value=\"" . $LANG['buttons'][16] . "\" class='submit'\n onclick=\"window.location='" . $CFG_GLPI["root_doc"] . "/front/ticket.form.php'\">"; } echo "</td></tr>"; } echo "</table>"; echo "<input type='hidden' name='id' value='{$ID}'>"; echo "</div>"; echo "</form>"; $this->addDivForTabs(); return true; }
/** * Print the contract form * * @param $ID integer ID of the item * @param $options array * - target filename : where to go when done. * - withtemplate boolean : template or basic item * *@return boolean item found **/ function showForm($ID, $options = array()) { $this->initForm($ID, $options); $can_edit = $this->can($ID, 'w'); $this->showTabs($options); $this->showFormHeader($options); echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Name') . "</td><td>"; Html::autocompletionTextField($this, "name"); echo "</td>"; echo "<td>" . __('Contract type') . "</td><td >"; ContractType::dropdown(array('value' => $this->fields["contracttypes_id"])); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . _x('phone', 'Number') . "</td>"; echo "<td>"; Html::autocompletionTextField($this, "num"); echo "</td>"; echo "<td colspan='2'></td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Start date') . "</td>"; echo "<td>"; Html::showDateFormItem("begin_date", $this->fields["begin_date"]); echo "</td>"; echo "<td>" . __('Initial contract period') . "</td><td>"; Dropdown::showInteger("duration", $this->fields["duration"], 1, 120, 1, array(0 => Dropdown::EMPTY_VALUE), array('unit' => 'month')); if (!empty($this->fields["begin_date"])) { echo " -> " . Infocom::getWarrantyExpir($this->fields["begin_date"], $this->fields["duration"], 0, true); } echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Notice') . "</td><td>"; Dropdown::showInteger("notice", $this->fields["notice"], 0, 120, 1, array(), array('unit' => 'month')); if (!empty($this->fields["begin_date"]) && $this->fields["notice"] > 0) { echo " -> " . Infocom::getWarrantyExpir($this->fields["begin_date"], $this->fields["duration"], $this->fields["notice"], true); } echo "</td>"; echo "<td>" . __('Account number') . "</td><td>"; Html::autocompletionTextField($this, "accounting_number"); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Contract renewal period') . "</td><td>"; Dropdown::showInteger("periodicity", $this->fields["periodicity"], 12, 60, 12, array(0 => Dropdown::EMPTY_VALUE, 1 => sprintf(_n('%d month', '%d months', 1), 1), 2 => sprintf(_n('%d month', '%d months', 2), 2), 3 => sprintf(_n('%d month', '%d months', 3), 3), 6 => sprintf(_n('%d month', '%d months', 6), 6)), array('unit' => 'month')); echo "</td>"; echo "<td>" . __('Invoice period') . "</td>"; echo "<td>"; Dropdown::showInteger("billing", $this->fields["billing"], 12, 60, 12, array(0 => Dropdown::EMPTY_VALUE, 1 => sprintf(_n('%d month', '%d months', 1), 1), 2 => sprintf(_n('%d month', '%d months', 2), 2), 3 => sprintf(_n('%d month', '%d months', 3), 3), 6 => sprintf(_n('%d month', '%d months', 6), 6)), array('unit' => 'month')); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'><td>" . __('Renewal') . "</td><td>"; self::dropdownContractRenewal("renewal", $this->fields["renewal"]); echo "</td>"; echo "<td>" . __('Max number of items') . "</td><td>"; Dropdown::showInteger("max_links_allowed", $this->fields["max_links_allowed"], 1, 200, 1, array(0 => __('Unlimited'))); echo "</td>"; echo "</tr>"; if (Entity::getUsedConfig("use_contracts_alert", $this->fields["entities_id"])) { echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Email alarms') . "</td>"; echo "<td>"; self::dropdownAlert(array('name' => "alert", 'value' => $this->fields["alert"])); Alert::displayLastAlert(__CLASS__, $ID); echo "</td>"; echo "<td colspan='2'> </td>"; echo "</tr>"; } echo "<tr class='tab_bg_1'><td class='top'>" . __('Comments') . "</td>"; echo "<td class='center' colspan='3'>"; echo "<textarea cols='50' rows='4' name='comment' >" . $this->fields["comment"] . "</textarea>"; echo "</td></tr>"; echo "<tr class='tab_bg_2'><td>" . __('Support hours') . "</td>"; echo "<td colspan='3'> </td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('on week') . "</td>"; echo "<td colspan='3'>" . __('Start') . " "; Dropdown::showHours("week_begin_hour", $this->fields["week_begin_hour"]); echo "<span class='small_space'>" . __('End') . "</span> "; Dropdown::showHours("week_end_hour", $this->fields["week_end_hour"]); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('on Saturday') . "</td>"; echo "<td colspan='3'>"; Dropdown::showYesNo("use_saturday", $this->fields["use_saturday"]); echo "<span class='small_space'>" . __('Start') . "</span> "; Dropdown::showHours("saturday_begin_hour", $this->fields["saturday_begin_hour"]); echo "<span class='small_space'>" . __('End') . "</span> "; Dropdown::showHours("saturday_end_hour", $this->fields["saturday_end_hour"]); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Sundays and holidays') . "</td>"; echo "<td colspan='3'>"; Dropdown::showYesNo("use_monday", $this->fields["use_monday"]); echo "<span class='small_space'>" . __('Start') . "</span> "; Dropdown::showHours("monday_begin_hour", $this->fields["monday_begin_hour"]); echo "<span class='small_space'>" . __('End') . "</span> "; Dropdown::showHours("monday_end_hour", $this->fields["monday_end_hour"]); echo "</td></tr>"; $this->showFormButtons($options); $this->addDivForTabs(); return true; }
define('GLPI_ROOT', '../../..'); include GLPI_ROOT . "/inc/includes.php"; header("Content-Type: text/html; charset=UTF-8"); header_nocache(); checkLoginUser(); switch ($_POST['itemtype']) { case 'PluginMonitoringServicescatalog': Dropdown::show('PluginMonitoringServicescatalog', array('name' => 'items_id')); break; case 'PluginMonitoringComponentscatalog': Dropdown::show('PluginMonitoringComponentscatalog', array('name' => 'items_id')); break; case 'PluginMonitoringService': $rand = mt_rand(); echo "<select name='itemtype' id='itemtype{$rand}'>"; echo "<option value='0'>" . DROPDOWN_EMPTY_VALUE . "</option>"; // $a_types =array(); echo "<option value='Computer'>" . Computer::getTypeName() . "</option>"; echo "<option value='NetworkEquipment'>" . NetworkEquipment::getTypeName() . "</option>"; echo "</select>"; $params = array('itemtype' => '__VALUE__', 'entity_restrict' => $_POST['a_entities'], 'selectgraph' => '1', 'rand' => $rand); ajaxUpdateItemOnSelectEvent("itemtype{$rand}", "show_itemtype{$rand}", $CFG_GLPI["root_doc"] . "/plugins/monitoring/ajax/dropdownServiceHostType.php", $params); echo "<span id='show_itemtype{$rand}'><input type='hidden' name='services_id[]' value='0'/></span>\n"; break; case 'PluginMonitoringWeathermap': Dropdown::show('PluginMonitoringWeathermap', array('name' => 'items_id')); echo " " . $LANG['plugin_monitoring']['displayview'][5] . " : " . Dropdown::showInteger("extra_infos", 100, 0, 100, 5); break; default: break; }
function showWarrantyItem($ID, $supplierWarranty) { echo "<td>"; Dropdown::showInteger("to_warranty_duration" . $ID, $supplierWarranty, 0, 120, 1, array(-1 => __('Lifelong'))); echo "</td>"; }
function displaySpecificTypeField($ID, $field = array()) { switch ($field['type']) { case 'notificationinterval': if ($ID > 0) { // $this->fields['notification_interval']; } else { $this->fields['notification_interval'] = 30; } Dropdown::showInteger('notification_interval', $this->fields['notification_interval'], 1, 1000); break; } }
/** * Print the cartridge type form * * @param $ID integer ID of the item * @param $options array * - target for the Form * - withtemplate : 1 for newtemplate, 2 for newobject from template * * @return Nothing (display) * **/ function showForm($ID, $options = array()) { global $LANG; // Show CartridgeItem or blank form if (!haveRight("cartridge", "r")) { return false; } if ($ID > 0) { $this->check($ID, 'r'); } else { // Create item $this->check(-1, 'w'); } $this->showTabs($options); $this->showFormHeader($options); echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['common'][16] . " : </td>"; echo "<td>"; autocompletionTextField($this, "name"); echo "</td>"; echo "<td rowspan='7' class='middle right'>" . $LANG['common'][25] . " : </td>"; echo "<td class='center middle' rowspan='7'>"; echo "<textarea cols='45' rows='9' name='comment'>" . $this->fields["comment"] . "</textarea>"; echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['consumables'][2] . " : </td>"; echo "<td>"; autocompletionTextField($this, "ref"); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['common'][17] . " : </td>"; echo "<td>"; Dropdown::show('CartridgeItemType', array('value' => $this->fields["cartridgeitemtypes_id"])); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['common'][5] . " : </td>"; echo "<td>"; Dropdown::show('Manufacturer', array('value' => $this->fields["manufacturers_id"])); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['common'][10] . " : </td>"; echo "<td>"; User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'interface', 'entity' => $this->fields["entities_id"])); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['consumables'][36] . " : </td>"; echo "<td>"; Dropdown::show('Location', array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"])); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['consumables'][38] . " : </td>"; echo "<td>"; Dropdown::showInteger('alarm_threshold', $this->fields["alarm_threshold"], -1, 100); Alert::displayLastAlert('CartridgeItem', $ID); echo "</td></tr>"; $this->showFormButtons($options); $this->addDivForTabs(); return true; }
function refreshPage() { global $LANG; echo "<form name='form' method='post' action='" . $_SERVER["PHP_SELF"] . "' >"; echo "<table width='100%'>"; echo "<tr>"; echo "<td align='right'>"; echo $LANG['plugin_monitoring']['display'][1] . " : "; echo " "; Dropdown::showInteger("_refresh", $_SESSION['glpi_plugin_monitoring']['_refresh'], 30, 1000, 10); echo " "; echo "<input type='submit' name='sessionupdate' class='submit' value=\"" . $LANG['buttons'][2] . "\">"; echo "</td>"; echo "</tr>"; echo "</table>"; echo "</form>"; }
function showFormAdvancedConfig() { $ID = $this->getField('id'); echo "<form method='post' action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>"; echo "<div class='center'><table class='tab_cadre_fixe'>"; echo "<tr class='tab_bg_2'><th colspan='4'>"; echo "<input type='hidden' name='id' value='{$ID}'>" . __('Advanced information') . "</th></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Use TLS') . "</td><td>"; if (function_exists("ldap_start_tls")) { Dropdown::showYesNo('use_tls', $this->fields["use_tls"]); } else { echo "<input type='hidden' name='use_tls' value='0'>" . __('ldap_start_tls does not exist'); } echo "</td>"; echo "<td>" . __('LDAP directory time zone') . "</td><td>"; Dropdown::showGMT("time_offset", $this->fields["time_offset"]); echo "</td></tr>"; if (self::isLdapPageSizeAvailable(false, false)) { echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Use paged results') . "</td><td>"; Dropdown::showYesNo('can_support_pagesize', $this->fields["can_support_pagesize"]); echo "</td>"; echo "<td>" . __('Page size') . "</td><td>"; Dropdown::showInteger("pagesize", $this->fields['pagesize'], 100, 100000, 100); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Maximum number of results') . "</td><td>"; Dropdown::showInteger('ldap_maxlimit', $this->fields['ldap_maxlimit'], 100, 999999, 100, array(0 => __('Unlimited'))); echo "</td><td colspan='2'></td></tr>"; } else { echo "<input type='hidden' name='can_support_pagesize' value='0'>"; echo "<input type='hidden' name='pagesize' value='0'>"; echo "<input type='hidden' name='ldap_maxlimit' value='0'>"; } echo "<tr class='tab_bg_1'>"; echo "<td>" . __('How LDAP aliases should be handled') . "</td><td colspan='4'>"; $alias_options[LDAP_DEREF_NEVER] = __('Never dereferenced (default)'); $alias_options[LDAP_DEREF_ALWAYS] = __('Always dereferenced'); $alias_options[LDAP_DEREF_SEARCHING] = __('Dereferenced during the search (but not when locating)'); $alias_options[LDAP_DEREF_FINDING] = __('Dereferenced when locating (not during the search)'); Dropdown::showFromArray("deref_option", $alias_options, array('value' => $this->fields["deref_option"])); echo "</td></tr>"; echo "<tr class='tab_bg_2'><td class='center' colspan='4'>"; echo "<input type='submit' name='update' class='submit' value=\"" . __s('Save') . "\">"; echo "</td></tr>"; echo "</table>"; Html::closeForm(); echo "</div>"; }
/** * Print the form for devices linked to a computer or a template * * @param $computer Computer object * @param $withtemplate='' boolean : template or basic computer * * @return Nothing (display) **/ static function showForComputer(Computer $computer, $withtemplate = '') { global $DB, $LANG; $devtypes = self::getDeviceTypes(); $ID = $computer->getField('id'); if (!$computer->can($ID, 'r')) { return false; } $canedit = $withtemplate != 2 && $computer->can($ID, 'w'); echo "<div class='spaced'>"; if ($canedit) { echo "<form name='form_device_action' action='" . getItemTypeFormURL(__CLASS__) . "' method='post'>"; echo "<input type='hidden' name='computers_id' value='{$ID}'>"; } echo "<table class='tab_cadre_fixe' >"; echo "<tr><th colspan='63'>" . $LANG['title'][30] . "</th></tr>"; $nb = 0; $specificity_units = array('DeviceProcessor' => $LANG['setup'][35], 'DeviceMemory' => $LANG['common'][82], 'DeviceHardDrive' => $LANG['common'][82], 'DeviceGraphicCard' => $LANG['common'][82]); foreach ($devtypes as $itemtype) { initNavigateListItems($itemtype, $computer->getTypeName() . " = " . $computer->getName()); $device = new $itemtype(); $specificities = $device->getSpecifityLabel(); $specif_fields = array_keys($specificities); $specif_text = implode(',', $specif_fields); if (!empty($specif_text)) { $specif_text = " ," . $specif_text . " "; } $linktable = getTableForItemType('Computer_' . $itemtype); $fk = getForeignKeyFieldForTable(getTableForItemType($itemtype)); $query = "SELECT COUNT(*) AS NB,\n `id`,\n `{$fk}`\n {$specif_text}\n FROM `{$linktable}`\n WHERE `computers_id` = '{$ID}'\n GROUP BY `{$fk}` {$specif_text}"; $prev = ''; foreach ($DB->request($query) as $data) { addToNavigateListItems($itemtype, $data[$fk]); if ($device->getFromDB($data[$fk])) { echo "<tr class='tab_bg_2'>"; echo "<td class='center'>"; Dropdown::showInteger("quantity_" . $itemtype . "_" . $data['id'], $data['NB']); echo "</td><td>"; if ($device->canCreate()) { echo "<a href='" . $device->getSearchURL() . "'>" . $device->getTypeName() . "</a>"; } else { echo $device->getTypeName(); } echo "</td><td>" . $device->getLink() . "</td>"; $spec = $device->getFormData(); if (isset($spec['label']) && count($spec['label'])) { $colspan = 60 / count($spec['label']); foreach ($spec['label'] as $i => $label) { if (isset($spec['value'][$i])) { echo "<td colspan='{$colspan}'>" . $spec['label'][$i] . " : "; echo $spec['value'][$i] . "</td>"; } else { if ($canedit) { // Specificity echo "<td class='right' colspan='{$colspan}'>" . $spec['label'][$i] . " : "; echo "<input type='text' name='value_" . $itemtype . "_" . $data['id'] . "' value='" . $data['specificity'] . "' size='" . $spec['size'] . "'>"; if (isset($specificity_units[$device->getType()])) { echo ' ' . $specificity_units[$device->getType()]; } echo "</td>"; } else { echo "<td colspan='{$colspan}'>" . $spec['label'][$i] . " : "; echo $data['specificity']; if (isset($specificity_units[$device->getType()])) { echo ' ' . $specificity_units[$device->getType()]; } echo "</td>"; } } } } else { echo "<td colspan='60'> </td>"; } echo "</tr>"; $nb++; } } } if ($canedit) { if ($nb > 0) { echo "<tr><td colspan='63' class='tab_bg_1 center'>"; echo "<input type='submit' class='submit' name='updateall' value='" . $LANG['buttons'][7] . "'></td></tr>"; } echo "<tr><td colspan='63' class='tab_bg_1 center'>"; echo $LANG['devices'][0] . " : "; Dropdown::showAllItems('items_id', '', 0, -1, $devtypes); echo "<input type='submit' name='add' value=\"" . $LANG['buttons'][8] . "\" class='submit'>"; echo "</tr></table></form>"; } else { echo "</table>"; } echo "</div>"; }
function showFormAdvancedOptions($target, $ID = '') { global $DB, $CFG_GLPI, $LANG; echo "<div align='center'><form method='post' name='' id='' action=\"" . $target . "\">"; echo "<table class='tab_cadre' cellpadding='5' width='950'>"; echo "<tr>"; echo "<th colspan='4'>"; echo $LANG['plugin_fusioninventory']["agents"][9]; echo " :</th>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td align='center' width='200'>" . $LANG['plugin_fusioninventory']["agents"][11] . "</td>"; echo "<td align='center' width='200'>"; Dropdown::showInteger("core_discovery", $this->fields["core_discovery"], 1, 32); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td align='center'>" . $LANG['plugin_fusioninventory']["agents"][3] . "</td>"; echo "<td align='center'>"; Dropdown::showInteger("threads_discovery", $this->fields["threads_discovery"], 1, 400); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td align='center'>" . $LANG['plugin_fusioninventory']["agents"][10] . "</td>"; echo "<td align='center'>"; Dropdown::showInteger("core_query", $this->fields["core_query"], 1, 32); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td align='center'>" . $LANG['plugin_fusioninventory']["agents"][2] . "</td>"; echo "<td align='center'>"; Dropdown::showInteger("threads_query", $this->fields["threads_query"], 1, 200); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_2'>"; echo "<td align='center' colspan='4'>"; echo "<input type='hidden' name='ID' value='" . $ID . "'/>"; echo "<div align='center'><input type='submit' name='update' value=\"" . $LANG["buttons"][7] . "\" class='submit' >"; echo "</td>"; echo "</tr>"; echo "</table></form></div>"; }
/** * Show Infocom form for an item (not a standard showForm) * * @param $item CommonDBTM object * @param $withtemplate integer: template or basic item **/ static function showForItem(CommonDBTM $item, $withtemplate = '') { global $CFG_GLPI, $LANG; // Show Infocom or blank form if (!haveRight("infocom", "r")) { return false; } if (!$item) { echo "<div class='spaced'>" . $LANG['financial'][85] . "</div>"; } else { $date_tax = $CFG_GLPI["date_tax"]; $dev_ID = $item->getField('id'); $ic = new self(); $option = ""; if ($withtemplate == 2) { $option = " readonly "; } if (!strpos($_SERVER['PHP_SELF'], "infocoms-show") && in_array($item->getType(), array('CartridgeItem', 'ConsumableItem', 'Software'))) { echo "<div class='firstbloc center'>" . $LANG['financial'][84] . "</div>"; } if (!$ic->getFromDBforDevice($item->getType(), $dev_ID)) { $input = array('itemtype' => $item->getType(), 'items_id' => $dev_ID, 'entities_id' => $item->getEntityID()); if ($ic->can(-1, "w", $input) && $withtemplate != 2) { echo "<div class='spaced b'>"; echo "<table class='tab_cadre_fixe'><tr class='tab_bg_1'><th>"; echo $item->getTypeName() . " - " . $item->getName() . "</th></tr>"; echo "<tr class='tab_bg_1'><td class='center'>"; echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/infocom.form.php?itemtype=" . $item->getType() . "&items_id={$dev_ID}&add=add'>" . $LANG['financial'][68]; echo "</a></td></tr></table></div>"; } } else { // getFromDBforDevice $canedit = $ic->can($ic->fields['id'], "w") && $withtemplate != 2; if ($canedit) { echo "<form name='form_ic' method='post' action='" . $CFG_GLPI["root_doc"] . "/front/infocom.form.php'>"; } echo "<div class='spaced'>"; echo "<table class='tab_cadre" . (!strpos($_SERVER['PHP_SELF'], "infocoms-show") ? "_fixe" : "") . "'>"; echo "<tr><th colspan='4'>" . $LANG['financial'][3] . "</th></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['financial'][26] . " :</td>"; echo "<td>"; if ($withtemplate == 2) { echo Dropdown::getDropdownName("glpi_suppliers", $ic->fields["suppliers_id"]); } else { Dropdown::show('Supplier', array('value' => $ic->fields["suppliers_id"], 'entity' => $item->getEntityID())); } echo "</td>"; if (haveRight("budget", "r")) { echo "<td>" . $LANG['financial'][87] . " :</td><td >"; Dropdown::show('Budget', array('value' => $ic->fields["budgets_id"], 'entity' => $item->getEntityID(), 'comments' => 1)); } else { echo "<td colspan='2'>"; } echo "</td></tr>"; // Can edit calendar ? $editcalendar = $withtemplate != 2; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['financial'][18] . " :</td>"; echo "<td >"; autocompletionTextField($ic, "order_number", array('option' => $option)); echo "</td>"; echo "<td>" . $LANG['financial'][28] . " :</td><td>"; showDateFormItem("order_date", $ic->fields["order_date"], true, $editcalendar); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['financial'][20] . "* :</td>"; echo "<td>"; $objectName = autoName($ic->fields["immo_number"], "immo_number", $withtemplate == 2, 'Infocom', $item->getEntityID()); autocompletionTextField($ic, "immo_number", array('value' => $objectName, 'option' => $option)); echo "</td>"; echo "<td>" . $LANG['financial'][14] . " :</td><td>"; showDateFormItem("buy_date", $ic->fields["buy_date"], true, $editcalendar); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['financial'][82] . " :</td>"; echo "<td>"; autocompletionTextField($ic, "bill", array('option' => $option)); echo "</td>"; echo "<td>" . $LANG['financial'][27] . " :</td><td>"; showDateFormItem("delivery_date", $ic->fields["delivery_date"], true, $editcalendar); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['financial'][19] . " :</td><td>"; autocompletionTextField($ic, "delivery_number", array('option' => $option)); echo "</td>"; echo "<td>" . $LANG['financial'][76] . " :</td><td>"; showDateFormItem("use_date", $ic->fields["use_date"], true, $editcalendar); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['financial'][21] . " :</td>"; echo "<td><input type='text' name='value' {$option} value='" . formatNumber($ic->fields["value"], true) . "' size='14'></td>"; echo "</td>"; echo "<td>" . $LANG['financial'][114] . " :</td><td>"; showDateFormItem("inventory_date", $ic->fields["inventory_date"], true, $editcalendar); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['financial'][78] . " :</td>"; echo "<td><input type='text' {$option} name='warranty_value' value='" . formatNumber($ic->fields["warranty_value"], true) . "' size='14'></td>"; echo "<td rowspan='5'>" . $LANG['common'][25] . " :</td>"; echo "<td rowspan='5' class='middle'>"; echo "<textarea cols='45' rows='9' name='comment' >" . $ic->fields["comment"]; echo "</textarea></td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['financial'][81] . " :</td><td>"; echo formatNumber(self::Amort($ic->fields["sink_type"], $ic->fields["value"], $ic->fields["sink_time"], $ic->fields["sink_coeff"], $ic->fields["warranty_date"], $ic->fields["use_date"], $date_tax, "n")); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['financial'][22] . " :</td><td >"; if ($withtemplate == 2) { echo self::getAmortTypeName($ic->fields["sink_type"]); } else { self::dropdownAmortType("sink_type", $ic->fields["sink_type"]); } echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['financial'][23] . " :</td><td>"; if ($withtemplate == 2) { echo $ic->fields["sink_time"]; } else { Dropdown::showInteger("sink_time", $ic->fields["sink_time"], 0, 15); } echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['financial'][77] . " :</td>"; echo "<td>"; autocompletionTextField($ic, "sink_coeff", array('size' => 14, 'option' => $option)); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; if (!in_array($item->getType(), array('Cartridge', 'CartridgeItem', 'Consumable', 'ConsumableItem', 'Software', 'SoftwareLicense'))) { echo "<td>" . $LANG['financial'][89] . " :</td><td>"; echo self::showTco($item->getField('ticket_tco'), $ic->fields["value"]); } else { echo "<td colspan='2'>"; } echo "</td>"; if (!in_array($item->getType(), array('Cartridge', 'CartridgeItem', 'Consumable', 'ConsumableItem', 'Software', 'SoftwareLicense'))) { echo "<td>" . $LANG['financial'][90] . " :</td><td>"; echo self::showTco($item->getField('ticket_tco'), $ic->fields["value"], $ic->fields["warranty_date"]); } else { echo "<td colspan='2'>"; } echo "</td></tr>"; echo "<tr><th colspan='4'>" . $LANG['financial'][7] . "</th></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['financial'][29] . " :</td><td>"; showDateFormItem("warranty_date", $ic->fields["warranty_date"], true, $editcalendar); echo "</td>"; echo "<td>" . $LANG['financial'][15] . " :</td><td>"; if ($withtemplate == 2) { // -1 = life if ($ic->fields["warranty_duration"] == -1) { echo $LANG['financial'][2]; } else { echo $ic->fields["warranty_duration"]; } } else { Dropdown::showInteger("warranty_duration", $ic->fields["warranty_duration"], 0, 120, 1, array(-1 => $LANG['financial'][2])); } if ($ic->fields["warranty_duration"] >= 0) { echo " " . $LANG['financial'][57]; } echo "<span class='small_space'>" . $LANG['financial'][88] . "</span> "; echo getWarrantyExpir($ic->fields["warranty_date"], $ic->fields["warranty_duration"]); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['financial'][16] . " :</td>"; echo "<td >"; autocompletionTextField($ic, "warranty_info", array('option' => $option)); echo "</td>"; if ($CFG_GLPI['use_mailing']) { echo "<td>" . $LANG['setup'][247] . " :</td>"; echo "<td>"; echo self::dropdownAlert("alert", $ic->fields["alert"]); Alert::displayLastAlert('Infocom', $ic->fields['id']); echo "</td>"; } else { echo "</td><td colspan='2'>"; } echo "</td></tr>"; if ($canedit) { echo "<tr>"; echo "<td class='tab_bg_2 center' colspan='2'>"; echo "<input type='hidden' name='id' value='" . $ic->fields['id'] . "'>"; echo "<input type='submit' name='update' value=\"" . $LANG['buttons'][7] . "\"\n class='submit'>"; echo "</td>"; echo "<td class='tab_bg_2 center' colspan='2'>"; echo "<input type='submit' name='delete' value=\"" . $LANG['buttons'][6] . "\"\n class='submit'>"; echo "</td></tr>"; echo "</table></div></form>"; } else { echo "</table></div>"; } } } }
/** * Display form for configuration * * @param $items_id integer ID * @param $options array * *@return bool true if form is ok * **/ function showForm($items_id, $options = array()) { global $DB, $CFG_GLPI, $LANG; $options['candel'] = false; if ($this->getFromDB("1")) { } else { $input = array(); $input['phppath'] = "/usr/bin/php"; $this->add($input); $this->getFromDB("1"); } $this->showFormHeader($options); $this->getFromDB($items_id); echo "<tr class='tab_bg_1'>"; echo "<td></td>"; echo "<td align='center'>"; echo "</td>"; echo "<td rowspan='3'>"; echo $LANG['plugin_monitoring']['config'][0] . " :"; echo "</td>"; echo "<td rowspan='3'>"; $a_timezones = $this->getTimezones(); $a_timezones_selected = importArrayFromDB($this->fields['timezones']); $a_timezones_selected2 = array(); foreach ($a_timezones_selected as $timezone) { $a_timezones_selected2[$timezone] = $a_timezones[$timezone]; unset($a_timezones[$timezone]); } ksort($a_timezones_selected2); echo "<table>"; echo "<tr>"; echo "<td class='right'>"; if (count($a_timezones)) { echo "<select name='timezones_to_add[]' multiple size='5'>"; foreach ($a_timezones as $key => $val) { echo "<option value='{$key}'>" . $val . "</option>"; } echo "</select>"; } echo "</td><td class='center'>"; if (count($a_timezones)) { echo "<input type='submit' class='submit' name='timezones_add' value='" . $LANG['buttons'][8] . " >>'>"; } echo "<br><br>"; if (count($a_timezones_selected2)) { echo "<input type='submit' class='submit' name='timezones_delete' value='<< " . $LANG['buttons'][6] . "'>"; } echo "</td><td>"; if (count($a_timezones_selected2)) { echo "<select name='timezones_to_delete[]' multiple size='5'>"; foreach ($a_timezones_selected2 as $key => $val) { echo "<option value='{$key}'>" . $val . "</option>"; } echo "</select>"; } else { echo " "; } echo "</td>"; echo "</tr>"; echo "</table>"; echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['plugin_monitoring']['config'][6] . " :</td>"; echo "<td align='center'>"; echo "<input name='phppath' type='text' value='" . $this->fields['phppath'] . "' size='40'/>"; echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['plugin_monitoring']['config'][3] . " :</td>"; echo "<td align='center'>"; Dropdown::showInteger("logretention", $this->fields['logretention'], 0, 1000); echo "</td>"; echo "</tr>"; $this->showFormButtons($options); return true; }
function showForm($ID, $options = array()) { if (!$this->canView()) { return false; } $itemtype = -1; if (isset($options['itemtype'])) { $itemtype = $options['itemtype']; } $items_id = -1; if (isset($options['items_id'])) { $items_id = $options['items_id']; } if ($this->getFromDBByModel($itemtype, $items_id)) { $ID = $this->fields["id"]; } if ($ID > 0) { $this->check($ID, 'r'); } else { // Create item $this->check(-1, 'w', $input); } $this->showFormHeader($options); if ($ID > 0) { echo "<input type='hidden' name='itemtype' value='" . $this->fields["itemtype"] . "'>"; echo "<input type='hidden' name='model_id' value='" . $this->fields["model_id"] . "'>"; } else { echo "<input type='hidden' name='itemtype' value='{$itemtype}'>"; echo "<input type='hidden' name='model_id' value='{$items_id}'>"; } $PluginRacksConfig = new PluginRacksConfig(); echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Size') . "</td>"; echo "<td>"; if ($this->checkIfSpecUsedByRacks($ID)) { echo $this->fields["size"]; } else { Dropdown::showInteger("size", $this->fields["size"], 1, 100, 1); } echo " U</td>"; echo "<td>" . __('Full-depth item', 'racks') . "</td>"; echo "<td>"; Dropdown::showYesNo("length", $this->fields["length"]); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Power supplies number', 'racks') . "</td>"; echo "<td>"; Dropdown::showInteger("nb_alim", $this->fields["nb_alim"], 0, 2, 1); echo "</td>"; echo "<td>" . __('Total Current', 'racks') . "</td>"; echo "<td>"; echo "<input type='text' name='amps' value=\"" . Html::formatNumber($this->fields["amps"], true) . "\" size='10'> (" . __('amps'); echo ")</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Calorific waste', 'racks'); // Dissipation calorifique echo "</td>"; echo "<td>"; echo "<input type='text' name='dissipation' value=\"" . Html::formatNumber($this->fields["dissipation"], true) . "\" size='10'> ("; $PluginRacksConfig->getUnit("dissipation"); echo ")</td>"; echo "<td>" . __('Flow Rate', 'racks'); // Débit d'air frais echo "</td>"; echo "<td>"; echo "<input type='text' name='flow_rate' value=\"" . Html::formatNumber($this->fields["flow_rate"], true) . "\" size='10'> ("; $PluginRacksConfig->getUnit("rate"); echo ")</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Weight', 'racks'); // poids echo "</td>"; echo "<td>"; echo "<input type='text' name='weight' value=\"" . Html::formatNumber($this->fields["weight"], true) . "\" size='10'> ("; $PluginRacksConfig->getUnit("weight"); echo ")</td>"; echo "<td></td>"; echo "<td></td>"; echo "</tr>"; $this->showFormButtons($options); }
/** * Print the Software / license form * * @param $ID Integer : Id of the version or the template to print * @param $options array * - target form target * - softwares_id ID of the software for add process * * @return true if displayed false if item not found or not right to display **/ function showForm($ID, $options = array()) { global $CFG_GLPI, $LANG; $softwares_id = -1; if (isset($options['softwares_id'])) { $softwares_id = $options['softwares_id']; } if (!haveRight("software", "w")) { return false; } if ($ID > 0) { $this->check($ID, 'r'); } else { // Create item $this->check(-1, 'w'); $this->fields['softwares_id'] = $softwares_id; $this->fields['number'] = 1; } $this->showTabs($options); $this->showFormHeader($options); echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['help'][31] . " :</td>"; echo "<td>"; if ($ID > 0) { $softwares_id = $this->fields["softwares_id"]; } else { echo "<input type='hidden' name='softwares_id' value='{$softwares_id}'>"; } echo "<a href='software.form.php?id=" . $softwares_id . "'>" . Dropdown::getDropdownName("glpi_softwares", $softwares_id) . "</a>"; echo "</td>"; echo "<td>" . $LANG['common'][17] . " :</td>"; echo "<td>"; Dropdown::show('SoftwareLicenseType', array('value' => $this->fields["softwarelicensetypes_id"])); echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['common'][16] . " :</td>"; echo "<td>"; autocompletionTextField($this, "name"); echo "</td>"; echo "<td>" . $LANG['common'][19] . " :</td>"; echo "<td>"; autocompletionTextField($this, "serial"); echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['software'][1] . " :</td>"; echo "<td>"; SoftwareVersion::dropdown(array('name' => "softwareversions_id_buy", 'softwares_id' => $this->fields["softwares_id"], 'value' => $this->fields["softwareversions_id_buy"])); echo "</td>"; echo "<td>" . $LANG['common'][20] . " :</td>"; echo "<td>"; autocompletionTextField($this, "otherserial"); echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['software'][2] . " :</td>"; echo "<td>"; SoftwareVersion::dropdown(array('name' => "softwareversions_id_use", 'softwares_id' => $this->fields["softwares_id"], 'value' => $this->fields["softwareversions_id_use"])); echo "</td>"; echo "<td rowspan='" . ($ID > 0 ? '4' : '3') . "' class='middle'>" . $LANG['common'][25] . " :</td>"; echo "<td class='center middle' rowspan='" . ($ID > 0 ? '4' : '3') . "'>"; echo "<textarea cols='45' rows='5' name='comment' >" . $this->fields["comment"] . "</textarea>"; echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['tracking'][29] . " :</td>"; echo "<td>"; Dropdown::showInteger("number", $this->fields["number"], 1, 1000, 1, array(-1 => $LANG['software'][4])); echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['software'][32] . " :</td>"; echo "<td>"; showDateFormItem('expire', $this->fields["expire"]); Alert::displayLastAlert('SoftwareLicense', $ID); echo "</td></tr>\n"; if ($ID > 0) { echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['common'][26] . " : </td>"; echo "<td>" . ($this->fields["date_mod"] ? convDateTime($this->fields["date_mod"]) : $LANG['setup'][307]); echo "</td></tr>"; } $this->showFormButtons($options); $this->addDivForTabs(); return true; }
/** * Print out a link to add directly a new cartridge from a cartridge item. * * @param $cartitem CartridgeItem object * * @return Nothing (displays) **/ static function showAddForm(CartridgeItem $cartitem) { global $CFG_GLPI; $ID = $cartitem->getField('id'); if (!$cartitem->can($ID, 'w')) { return false; } if ($ID > 0) { echo "<div class='firstbloc'>"; echo "<form method='post' action=\"" . static::getFormURL() . "\">"; echo "<table class='tab_cadre_fixe'>"; echo "<tr><td class='center tab_bg_2'>"; echo "<input type='hidden' name='cartridgeitems_id' value='{$ID}'>\n"; Dropdown::showInteger('to_add', 1, 1, 100); echo " <input type='submit' name='add' value=\"" . __s('Add cartridges') . "\"\n class='submit'>"; echo "</td></tr>"; echo "</table>"; Html::closeForm(); echo "</div>"; } }
function displayField($canedit, $name, $value, $template, $description = array()) { global $GO_BLACKLIST_FIELDS; $searchoption = PluginGenericobjectField::getOptionsWithGlobal($name, get_called_class()); if (!empty($searchoption) && !in_array($name, self::getFieldsToHide())) { $this->startColumn(); echo $searchoption['name']; if (isset($searchoption['autoname']) && $searchoption['autoname'] && $template) { echo "* "; } $this->endColumn(); $this->startColumn(); switch ($description['Type']) { case "int(11)": $fk_table = getTableNameForForeignKeyField($name); if ($fk_table != '') { $itemtype = getItemTypeForTable($fk_table); $dropdown = new $itemtype(); $parameters = array('name' => $name, 'value' => $value, 'comments' => true); if ($dropdown->isEntityAssign()) { $parameters["entity"] = $this->fields['entities_id']; } if ($dropdown->maybeRecursive()) { $parameters['entity_sons'] = true; } if (isset($searchoption['condition'])) { $parameters['condition'] = $searchoption['condition']; } Dropdown::show($itemtype, $parameters); } else { $min = $max = $step = 0; if (isset($searchoption['min'])) { $min = $searchoption['min']; } else { $min = 0; } if (isset($searchoption['max'])) { $max = $searchoption['max']; } else { $max = 100; } if (isset($searchoption['step'])) { $step = $searchoption['step']; } else { $step = 1; } Dropdown::showInteger($name, $value, $min, $max, $step); } break; case "tinyint(1)": Dropdown::showYesNo($name, $value); break; case "varchar(255)": if (isset($searchoption['autoname']) && $searchoption['autoname']) { $objectName = autoName($this->fields[$name], $name, $template === "newcomp", $this->getType(), $this->fields["entities_id"]); } else { $objectName = $this->fields[$name]; } Html::autocompletionTextField($this, $name, array('value' => $objectName)); break; case "longtext": case "text": echo "<textarea cols='40' rows='4' name='" . $name . "'>" . $value . "</textarea>"; break; case "date": Html::showDateFormItem($name, $value, false, true); break; case "datetime": Html::showDateTimeFormItem($name, $value, false, true); break; default: case "float": echo "<input type='text' name='{$name}' value='{$value}'>"; break; case 'decimal': echo "<input type='text' name='{$name}' value='" . Html::formatNumber($value) . "'>"; break; } $this->endColumn(); } }
function showForm($items_id, $options = array()) { global $DB, $CFG_GLPI, $LANG; if ($items_id == '0') { $this->getEmpty(); } else { $this->getFromDB($items_id); } $this->showTabs($options); $options['formoptions'] = " enctype='multipart/form-data'"; $this->showFormHeader($options); echo "<tr>"; echo "<td>"; echo $LANG['common'][16] . " :"; echo "</td>"; echo "<td>"; $objectName = autoName($this->fields["name"], "name", 1, $this->getType()); autocompletionTextField($this, 'name', array('value' => $objectName)); echo "</td>"; echo "<td>" . $LANG['plugin_monitoring']['weathermap'][3] . " :</td>"; echo "<td>"; Dropdown::showInteger("width", $this->fields['width'], 100, 3000, 20); echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<td>"; echo $LANG['plugin_monitoring']['weathermap'][5] . " :"; echo "</td>"; echo "<td>"; if ($this->fields['background'] == '') { echo "<input type='file' size='25' value='' name='background'/>"; } else { echo $this->fields['background']; echo " "; echo "<input type='image' name='deletepic' value='deletepic' class='submit' src='" . $CFG_GLPI["root_doc"] . "/pics/delete.png' >"; } echo "</td>"; echo "<td>" . $LANG['plugin_monitoring']['weathermap'][4] . " :</td>"; echo "<td>"; Dropdown::showInteger("height", $this->fields['height'], 100, 3000, 20); echo "</td>"; echo "</tr>"; $this->showFormButtons($options); $this->addDivForTabs(); return true; }
/** * Print the HTML array of the Netpoint associated to a Location * * @param $item Location * * @return Nothing (display) **/ static function showForLocation($item) { global $DB, $CFG_GLPI; $ID = $item->getField('id'); $netpoint = new self(); $item->check($ID, 'r'); $canedit = $item->can($ID, 'w'); if (isset($_POST["start"])) { $start = $_POST["start"]; } else { $start = 0; } $number = countElementsInTable('glpi_netpoints', "`locations_id`='{$ID}'"); if ($canedit) { echo "<div class='first-bloc'>"; // Minimal form for quick input. echo "<form action='" . $netpoint->getFormURL() . "' method='post'>"; echo "<br><table class='tab_cadre_fixe'>"; echo "<tr class='tab_bg_2 center'>"; echo "<td class='b'>" . _n('Network outlet', 'Network outlets', 1) . "</td>"; echo "<td>" . __('Name') . "</td><td>"; Html::autocompletionTextField($item, "name", array('value' => '')); echo "<input type='hidden' name='entities_id' value='" . $_SESSION['glpiactive_entity'] . "'>"; echo "<input type='hidden' name='locations_id' value='{$ID}'></td>"; echo "<td><input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>"; echo "</td></tr>\n"; echo "</table>\n"; Html::closeForm(); // Minimal form for massive input. echo "<form action='" . $netpoint->getFormURL() . "' method='post'>"; echo "<table class='tab_cadre_fixe'>"; echo "<tr class='tab_bg_2 center'>"; echo "<td class='b'>" . _n('Network outlet', 'Network outlets', 2) . "</td>"; echo "<td>" . __('Name') . "</td><td>"; echo "<input type='text' maxlength='100' size='10' name='_before'> "; Dropdown::showInteger('_from', 0, 0, 400); echo " --> "; Dropdown::showInteger('_to', 0, 0, 400); echo " <input type='text' maxlength='100' size='10' name='_after'><br>"; echo "<input type='hidden' name='entities_id' value='" . $_SESSION['glpiactive_entity'] . "'>"; echo "<input type='hidden' name='locations_id' value='{$ID}'></td>"; echo "<input type='hidden' name='_method' value='AddMulti'></td>"; echo "<td><input type='submit' name='execute' value=\"" . _sx('button', 'Add') . "\"\n class='submit'>"; echo "</td></tr>\n"; echo "</table>\n"; Html::closeForm(); echo "</div>"; } echo "<div class='spaced'>"; if ($number < 1) { echo "<table class='tab_cadre_fixe'>"; echo "<tr><th>" . self::getTypeName(1) . "</th>"; echo "<th>" . __('No item found') . "</th></tr>"; echo "</table>\n"; } else { Html::printAjaxPager(sprintf(__('Network outlets for %s'), $item->getTreeLink()), $start, $number); if ($canedit) { $rand = mt_rand(); Html::openMassiveActionsForm('mass' . __CLASS__ . $rand); $paramsma = array('num_displayed' => $_SESSION['glpilist_limit'], 'specific_actions' => array('purge' => _x('button', 'Delete permanently'))); Html::showMassiveActions(__CLASS__, $paramsma); } echo "<table class='tab_cadre_fixe'><tr>"; if ($canedit) { echo "<th width='10'>"; Html::checkAllAsCheckbox('mass' . __CLASS__ . $rand); echo "</th>"; } echo "<th>" . __('Name') . "</th>"; // Name echo "<th>" . __('Comments') . "</th>"; // Comment echo "</tr>\n"; $crit = array('locations_id' => $ID, 'ORDER' => 'name', 'START' => $start, 'LIMIT' => $_SESSION['glpilist_limit']); Session::initNavigateListItems('Netpoint', sprintf(__('%1$s = %2$s'), $item->getTypeName(1), $item->getName())); foreach ($DB->request('glpi_netpoints', $crit) as $data) { Session::addToNavigateListItems('Netpoint', $data["id"]); echo "<tr class='tab_bg_1'>"; if ($canedit) { echo "<td>" . Html::getMassiveActionCheckBox(__CLASS__, $data["id"]) . "</td>"; } echo "<td><a href='" . $netpoint->getFormURL(); echo '?id=' . $data['id'] . "'>" . $data['name'] . "</a></td>"; echo "<td>" . $data['comment'] . "</td>"; echo "</tr>\n"; } echo "</table>\n"; if ($canedit) { $paramsma['ontop'] = false; Html::showMassiveActions(__CLASS__, $paramsma); Html::closeForm(); } Html::printAjaxPager(sprintf(__('Network outlets for %s'), $item->getTreeLink()), $start, $number); } echo "</div>\n"; }
static function showHelpdeskOptions(Entity $entity) { global $LANG, $CFG_GLPI; $ID = $entity->getField('id'); if (!$entity->can($ID, 'r') || !haveRight('entity_helpdesk', 'r')) { return false; } $canedit = haveRight('entity_helpdesk', 'w') && haveAccessToEntity($ID); // Get data $entdata = new EntityData(); if (!$entdata->getFromDB($ID)) { $entdata->getEmpty(); } echo "<div class='spaced'>"; if ($canedit) { echo "<form method='post' name=form action='" . getItemTypeFormURL(__CLASS__) . "'>"; } echo "<table class='tab_cadre_fixe'>"; echo "<tr class='tab_bg_1'><td colspan='2'>" . $LANG['buttons'][15] . " : </td>"; echo "<td colspan='2'>"; $options = array('value' => $entdata->fields["calendars_id"], 'emptylabel' => $LANG['common'][102]); if ($ID == 0) { $options['emptylabel'] = $LANG['sla'][10]; } Dropdown::show('Calendar', $options); if ($entdata->fields["calendars_id"] == 0) { $calendar = new Calendar(); if ($calendar->getFromDB(self::getUsedConfig('calendars_id', $ID))) { echo " - " . $calendar->getLink(); } } echo "</td></tr>"; echo "<tr class='tab_bg_1'><td colspan='2'>" . $LANG['entity'][28] . " : </td>"; echo "<td colspan='2'>"; $toadd = array(); if ($ID != 0) { $toadd = array(0 => $LANG['common'][102]); } Ticket::dropdownType('tickettype', $entdata->fields["tickettype"], $toadd); if ($entdata->fields["calendars_id"] == 0) { $calendar = new Calendar(); if ($calendar->getFromDB(self::getUsedConfig('calendars_id', $ID))) { echo " - " . $calendar->getLink(); } } echo "</td></tr>"; echo "<tr class='tab_bg_1'><td colspan='2'>" . $LANG['setup'][52] . " : </td>"; echo "<td colspan='2'>"; $autoassign = array(-1 => $LANG['setup'][731], NO_AUTO_ASSIGN => $LANG['choice'][0], AUTO_ASSIGN_HARDWARE_CATEGORY => $LANG['setup'][51], AUTO_ASSIGN_CATEGORY_HARDWARE => $LANG['setup'][50]); Dropdown::showFromArray('auto_assign_mode', $autoassign, array('value' => $entdata->fields["auto_assign_mode"])); echo "</td></tr>"; echo "<tr><th colspan='4'>" . $LANG['entity'][17] . "</th></tr>"; echo "<tr class='tab_bg_1'><td colspan='2'>" . $LANG['entity'][18] . " : </td>"; echo "<td colspan='2'>"; Dropdown::showInteger('autoclose_delay', $entdata->fields['autoclose_delay'], 0, 99, 1, array(-1 => $LANG['setup'][731], -10 => $LANG['setup'][307])); /* Alert::dropdownIntegerNever('autoclose_delay', $entdata->fields['autoclose_delay'], array('max' => 99, 'inherit_global' => 1, 'never_value' => -10,)); */ echo " " . $LANG['stats'][31] . "</td></tr>"; echo "<tr><th colspan='4'>" . $LANG['entity'][19] . "</th></tr>"; echo "<tr class='tab_bg_1'><td colspan='2'>" . $LANG['entity'][19] . " : </td>"; echo "<td colspan='2'>"; /// no inquest case = rate 0 $typeinquest = array(0 => $LANG['common'][102], 1 => $LANG['satisfaction'][9], 2 => $LANG['satisfaction'][10]); // No inherit from parent for root entity if ($entdata->fields['entities_id'] == 0) { unset($typeinquest[0]); if ($entdata->fields['inquest_config'] == 0) { $entdata->fields['inquest_config'] = 1; } } $rand = Dropdown::showFromArray('inquest_config', $typeinquest, $options = array('value' => $entdata->fields['inquest_config'])); echo "</td></tr>\n"; // Do not display for root entity in inherit case if ($entdata->fields['inquest_config'] == 0 && $entdata->fields['entities_id'] != 0) { $inquestconfig = self::getUsedConfig('inquest_config', $entdata->fields['entities_id']); $inquestrate = self::getUsedConfig('inquest_config', $entdata->fields['entities_id'], 'inquest_rate'); echo "<tr><td colspan='4' class='green center'>" . $LANG['common'][102] . " : "; if ($inquestrate == 0) { echo $LANG['crontask'][31]; } else { echo $typeinquest[$inquestconfig]; echo " - " . self::getUsedConfig('inquest_config', $entdata->fields['entities_id'], 'inquest_delay'); echo " " . $LANG['stats'][31] . " - "; echo $inquestrate . "%"; if ($inquestconfig == 2) { echo " - " . self::getUsedConfig('inquest_config', $entdata->fields['entities_id'], 'inquest_URL'); } } echo "</td></tr>\n"; } echo "<tr class='tab_bg_1'><td colspan='4'>"; $_REQUEST = array('inquest_config' => $entdata->fields['inquest_config'], 'entities_id' => $ID); $params = array('inquest_config' => '__VALUE__', 'entities_id' => $ID); echo "<div id='inquestconfig'>"; include GLPI_ROOT . '/ajax/ticketsatisfaction.php'; echo "</div>\n"; echo "</td></tr>"; if ($canedit) { echo "<tr>"; echo "<td class='tab_bg_2 center' colspan='4'>"; echo "<input type='hidden' name='entities_id' value='{$ID}'>"; if ($entdata->fields["id"]) { echo "<input type='hidden' name='id' value='" . $entdata->fields["id"] . "'>"; echo "<input type='submit' name='update' value=\"" . $LANG['buttons'][7] . "\"\n class='submit'>"; } else { echo "<input type='submit' name='add' value=\"" . $LANG['buttons'][7] . "\" class='submit'>"; } echo "</td></tr>"; echo "</table></form>"; } else { echo "</table>"; } echo "</div>"; ajaxUpdateItemOnSelectEvent("dropdown_inquest_config{$rand}", "inquestconfig", $CFG_GLPI["root_doc"] . "/ajax/ticketsatisfaction.php", $params); }
/** * Print the consumable type form * * @param $ID integer ID of the item * @param $options array * - target filename : where to go when done. * - withtemplate boolean : template or basic item * * @return Nothing (display) * **/ function showForm($ID, $options = array()) { global $CFG_GLPI; $this->initForm($ID, $options); $this->showTabs($options); $this->showFormHeader($options); echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Name') . "</td>"; echo "<td>"; Html::autocompletionTextField($this, "name"); echo "</td>"; echo "<td>" . __('Type') . "</td>"; echo "<td>"; ConsumableItemType::dropdown(array('value' => $this->fields["consumableitemtypes_id"])); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Reference') . "</td>\n"; echo "<td>"; Html::autocompletionTextField($this, "ref"); echo "</td>"; echo "<td>" . __('Manufacturer') . "</td>"; echo "<td>"; Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"])); echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Technician in charge of the hardware') . "</td>"; echo "<td>"; User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'own_ticket', 'entity' => $this->fields["entities_id"])); echo "</td>"; echo "<td rowspan='4' class='middle'>" . __('Comments') . "</td>"; echo "<td class='middle' rowspan='4'>\n <textarea cols='45' rows='9' name='comment' >" . $this->fields["comment"] . "</textarea>"; echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Group in charge of the hardware') . "</td>"; echo "<td>"; Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`')); echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Stock location') . "</td>"; echo "<td>"; Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"])); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Alert threshold') . "</td>"; echo "<td>"; Dropdown::showInteger('alarm_threshold', $this->fields["alarm_threshold"], 0, 100, 1, array('-1' => __('Never'))); Alert::displayLastAlert('ConsumableItem', $ID); echo "</td></tr>"; $this->showFormButtons($options); $this->addDivForTabs(); return true; }
/** * Display a HTML report about systeme information / configuration * **/ function showSystemInformations() { global $DB, $LANG, $CFG_GLPI; echo "<div class='center' id='tabsbody'>"; echo "<form name='form' action=\"" . getItemTypeFormURL(__CLASS__) . "\" method='post'>"; echo "<input type='hidden' name='id' value='" . $CFG_GLPI["id"] . "'>"; echo "<table class='tab_cadre_fixe'>"; echo "<tr><th colspan='4'>" . $LANG['setup'][70] . "</th></tr>"; echo "<tr class='tab_bg_2'>"; echo "<td>" . $LANG['setup'][102] . " :</td><td>"; $values[1] = $LANG['setup'][103]; $values[2] = $LANG['setup'][104]; $values[3] = $LANG['setup'][105]; $values[4] = $LANG['setup'][106]; $values[5] = $LANG['setup'][107]; Dropdown::showFromArray('event_loglevel', $values, array('value' => $CFG_GLPI["event_loglevel"])); echo "</td><td>" . $LANG['setup'][101] . " :</td><td>"; Dropdown::showInteger('cron_limit', $CFG_GLPI["cron_limit"], 1, 30); echo "</td></tr>"; echo "<tr class='tab_bg_2'>"; echo "<td> " . $LANG['setup'][185] . " :</td><td>"; Dropdown::showYesNo("use_log_in_files", $CFG_GLPI["use_log_in_files"]); echo "</td><td> " . $LANG['setup'][801] . " :</td><td>"; $active = DBConnection::isDBSlaveActive(); Dropdown::showYesNo("_dbslave_status", $active); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td colspan='4' class='center b'>" . $LANG['setup'][306] . ' - ' . $LANG['setup'][400] . "</td>"; echo "</tr>"; echo "<tr class='tab_bg_2'>"; echo "<td>" . $LANG['common'][52] . " :</td>"; echo "<td><input type='text' name='proxy_name' value='" . $CFG_GLPI["proxy_name"] . "'></td>"; echo "<td>" . $LANG['setup'][175] . " :</td>"; echo "<td><input type='text' name='proxy_port' value='" . $CFG_GLPI["proxy_port"] . "'></td>"; echo "</tr>"; echo "<tr class='tab_bg_2'>"; echo "<td>" . $LANG['login'][6] . " :</td>"; echo "<td><input type='text' name='proxy_user' value='" . $CFG_GLPI["proxy_user"] . "'></td>"; echo "<td>" . $LANG['login'][7] . " :</td>"; echo "<td><input type='password' name='proxy_passwd' value='' autocomplete='off'></td>"; echo "</tr>"; echo "<tr class='tab_bg_2'>"; echo "<td colspan='4' class='center'>"; echo "<input type='submit' name='update' class='submit' value=\"" . $LANG['buttons'][2] . "\"></td>"; echo "</tr>"; echo "</table>"; echo "</form>"; $width = 128; echo "<table class='tab_cadre_fixe'>"; echo "<tr><th>" . $LANG['setup'][721] . "</th></tr>"; echo "<tr class='tab_bg_1'><td><pre>[code]\n \n"; $oldlang = $_SESSION['glpilanguage']; loadLanguage('en_GB'); echo "GLPI " . $CFG_GLPI['version'] . " (" . $CFG_GLPI['root_doc'] . " => " . dirname(dirname($_SERVER["SCRIPT_FILENAME"])) . ")\n"; echo "\n</pre></td></tr>"; echo "<tr><th>" . $LANG['common'][52] . "</th></tr>\n"; echo "<tr class='tab_bg_1'><td><pre>\n \n"; echo wordwrap($LANG['setup'][5] . " : " . php_uname() . "\n", $width, "\n\t"); $exts = get_loaded_extensions(); sort($exts); echo wordwrap("PHP " . phpversion() . " (" . implode(', ', $exts) . ")\n", $width, "\n\t"); $msg = $LANG['common'][12] . ": "; foreach (array('memory_limit', 'max_execution_time', 'safe_mode', 'session.save_handler', 'post_max_size', 'upload_max_filesize') as $key) { $msg .= $key . '="' . ini_get($key) . '" '; } echo wordwrap($msg . "\n", $width, "\n\t"); $msg = $LANG['Menu'][4] . ": "; if (isset($_SERVER["SERVER_SOFTWARE"])) { $msg .= $_SERVER["SERVER_SOFTWARE"]; } if (isset($_SERVER["SERVER_SIGNATURE"])) { $msg .= ' (' . html_clean($_SERVER["SERVER_SIGNATURE"]) . ')'; } echo wordwrap($msg . "\n", $width, "\n\t"); if (isset($_SERVER["HTTP_USER_AGENT"])) { echo "\t" . $_SERVER["HTTP_USER_AGENT"] . "\n"; } $version = "???"; foreach ($DB->request('SELECT VERSION() as ver') as $data) { $version = $data['ver']; } echo "MySQL: {$version} (" . $DB->dbuser . "@" . $DB->dbhost . "/" . $DB->dbdefault . ")\n\n"; checkWriteAccessToDirs(true); foreach ($CFG_GLPI["systeminformations_types"] as $type) { $tmp = new $type(); $tmp->showSystemInformations($width); } loadLanguage($oldlang); echo "\n</pre></td></tr>"; echo "<tr class='tab_bg_1'><td>[/code]\n</td></tr>"; echo "<tr class='tab_bg_2'><th>" . $LANG['setup'][722] . "</th></tr>\n"; echo "</table></div>\n"; }
/** * Print the Software / license form * * @param $ID integer Id of the version or the template to print * @param $options array of possible options: * - target form target * - softwares_id ID of the software for add process * * @return true if displayed false if item not found or not right to display **/ function showForm($ID, $options = array()) { global $CFG_GLPI; $softwares_id = -1; if (isset($options['softwares_id'])) { $softwares_id = $options['softwares_id']; } if (!Session::haveRight("software", "w")) { return false; } if ($ID < 0) { // Create item $this->fields['softwares_id'] = $softwares_id; $this->fields['number'] = 1; $soft = new Software(); if ($soft->getFromDB($softwares_id) && in_array($_SESSION['glpiactive_entity'], getAncestorsOf('glpi_entities', $soft->getEntityID()))) { $options['entities_id'] = $soft->getEntityID(); } } $this->initForm($ID, $options); $this->showTabs($options); $this->showFormHeader($options); echo "<tr class='tab_bg_1'>"; echo "<td>" . Software::getTypeName(1) . "</td>"; echo "<td>"; if ($ID > 0) { $softwares_id = $this->fields["softwares_id"]; } else { echo "<input type='hidden' name='softwares_id' value='{$softwares_id}'>"; } echo "<a href='software.form.php?id=" . $softwares_id . "'>" . Dropdown::getDropdownName("glpi_softwares", $softwares_id) . "</a>"; echo "</td>"; echo "<td>" . __('Type') . "</td>"; echo "<td>"; SoftwareLicenseType::dropdown(array('value' => $this->fields["softwarelicensetypes_id"])); echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Name') . "</td>"; echo "<td>"; Html::autocompletionTextField($this, "name"); echo "</td>"; echo "<td>" . __('Serial number') . "</td>"; echo "<td>"; Html::autocompletionTextField($this, "serial"); echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Purchase version') . "</td>"; echo "<td>"; SoftwareVersion::dropdown(array('name' => "softwareversions_id_buy", 'softwares_id' => $this->fields["softwares_id"], 'value' => $this->fields["softwareversions_id_buy"])); echo "</td>"; echo "<td>" . __('Inventory number') . "</td>"; echo "<td>"; Html::autocompletionTextField($this, "otherserial"); echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Version in use') . "</td>"; echo "<td>"; SoftwareVersion::dropdown(array('name' => "softwareversions_id_use", 'softwares_id' => $this->fields["softwares_id"], 'value' => $this->fields["softwareversions_id_use"])); echo "</td>"; echo "<td rowspan='" . ($ID > 0 ? '4' : '3') . "' class='middle'>" . __('Comments') . "</td>"; echo "<td class='center middle' rowspan='" . ($ID > 0 ? '4' : '3') . "'>"; echo "<textarea cols='45' rows='5' name='comment' >" . $this->fields["comment"] . "</textarea>"; echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . _x('quantity', 'Number') . "</td>"; echo "<td>"; Dropdown::showInteger("number", $this->fields["number"], 1, 1000, 1, array(-1 => __('Unlimited'))); echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Expiration') . "</td>"; echo "<td>"; Html::showDateFormItem('expire', $this->fields["expire"]); Alert::displayLastAlert('SoftwareLicense', $ID); echo "</td></tr>\n"; if ($ID > 0) { echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Last update') . "</td>"; echo "<td>" . ($this->fields["date_mod"] ? Html::convDateTime($this->fields["date_mod"]) : __('Never')); echo "</td></tr>"; } $this->showFormButtons($options); $this->addDivForTabs(); return true; }
/** form for Task * * @param $ID Integer : Id of the task * @param $options array * - ticket Object : the ticket **/ function showForm($ID, $options = array()) { global $DB, $LANG, $CFG_GLPI; if (isset($options['ticket']) && !empty($options['ticket'])) { $ticket = $options['ticket']; } if ($ID > 0) { $this->check($ID, 'r'); } else { // Create item $input = array('tickets_id' => $ticket->getField('id')); $this->check(-1, 'w', $input); } $canplan = haveRight("show_planning", "1"); $this->showFormHeader($options); echo "<tr class='tab_bg_1'>"; echo "<td rowspan='5' class='middle right'>" . $LANG['joblist'][6] . " :</td>"; echo "<td class='center middle' rowspan='5'>" . "<textarea name='content' cols='50' rows='6'>" . $this->fields["content"] . "</textarea></td>"; if ($this->fields["date"]) { echo "<td>" . $LANG['common'][27] . " :</td>"; echo "<td>" . convDateTime($this->fields["date"]); } else { echo "<td colspan='2'> "; } echo "<input type='hidden' name='tickets_id' value='" . $this->fields["tickets_id"] . "'>"; echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['common'][36] . " :</td><td>"; Dropdown::show('TaskCategory', array('value' => $this->fields["taskcategories_id"])); echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['common'][77] . " :</td>"; echo "<td><select name='is_private'>"; echo "<option value='0' " . (!$this->fields["is_private"] ? " selected" : "") . ">" . $LANG['choice'][0] . "</option>"; echo "<option value='1' " . ($this->fields["is_private"] ? " selected" : "") . ">" . $LANG['choice'][1] . "</option>"; echo "</select></td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['job'][31] . " :</td><td>"; $units = getTimestampTimeUnits($this->fields["actiontime"]); $hour = $units['hour'] + 24 * $units['day']; $minute = $units['minute']; Dropdown::showInteger('hour', $hour, 0, 100, 1, array($hour)); echo " " . $LANG['job'][21] . " "; Dropdown::showInteger('minute', $minute, 0, 59); echo " " . $LANG['job'][22]; echo "</td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['job'][35] . "</td>"; echo "<td>"; $plan = new TicketPlanning(); $plan->showFormForTask($ticket, $this); echo "</td></tr>"; $this->showFormButtons($options); return true; }
/** * Show Infocom form for an item (not a standard showForm) * * @param $item CommonDBTM object * @param $withtemplate integer template or basic item (default '') **/ static function showForItem(CommonDBTM $item, $withtemplate = '') { global $CFG_GLPI; // Show Infocom or blank form if (!Session::haveRight("infocom", "r")) { return false; } if (!$item) { echo "<div class='spaced'>" . __('Requested item not found') . "</div>"; } else { $date_tax = $CFG_GLPI["date_tax"]; $dev_ID = $item->getField('id'); $ic = new self(); $option = ""; if ($withtemplate == 2) { $option = " readonly "; } if (!strpos($_SERVER['PHP_SELF'], "infocoms-show") && in_array($item->getType(), array('CartridgeItem', 'ConsumableItem', 'Software'))) { echo "<div class='firstbloc center'>" . __('For this type of item, the financial and administrative information are only a model for the items which you should add.') . "</div>"; } if (!$ic->getFromDBforDevice($item->getType(), $dev_ID)) { $input = array('itemtype' => $item->getType(), 'items_id' => $dev_ID, 'entities_id' => $item->getEntityID()); if ($ic->can(-1, "w", $input) && $withtemplate != 2) { echo "<div class='spaced b'>"; echo "<table class='tab_cadre_fixe'><tr class='tab_bg_1'><th>"; echo sprintf(__('%1$s - %2$s'), $item->getTypeName(1), $item->getName()) . "</th></tr>"; echo "<tr class='tab_bg_1'><td class='center'>"; Html::showSimpleForm($CFG_GLPI["root_doc"] . "/front/infocom.form.php", 'add', __('Enable the financial and administrative information'), array('itemtype' => $item->getType(), 'items_id' => $dev_ID)); echo "</td></tr></table></div>"; } } else { // getFromDBforDevice $canedit = $ic->can($ic->fields['id'], "w") && $withtemplate != 2; if ($canedit) { echo "<form name='form_ic' method='post' action='" . $CFG_GLPI["root_doc"] . "/front/infocom.form.php'>"; } echo "<div class='spaced'>"; echo "<table class='tab_cadre" . (!strpos($_SERVER['PHP_SELF'], "infocoms-show") ? "_fixe" : "") . "'>"; echo "<tr><th colspan='4'>" . __('Financial and administrative information') . "</th></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Supplier') . "</td>"; echo "<td>"; if ($withtemplate == 2) { echo Dropdown::getDropdownName("glpi_suppliers", $ic->fields["suppliers_id"]); } else { Supplier::dropdown(array('value' => $ic->fields["suppliers_id"], 'entity' => $item->getEntityID())); } echo "</td>"; if (Session::haveRight("budget", "r")) { echo "<td>" . __('Budget') . "</td><td >"; Budget::dropdown(array('value' => $ic->fields["budgets_id"], 'entity' => $item->getEntityID(), 'comments' => 1)); } else { echo "<td colspan='2'>"; } echo "</td></tr>"; // Can edit calendar ? $editcalendar = $withtemplate != 2; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Order number') . "</td>"; echo "<td >"; Html::autocompletionTextField($ic, "order_number", array('option' => $option)); echo "</td>"; echo "<td>" . __('Order date') . "</td><td>"; Html::showDateFormItem("order_date", $ic->fields["order_date"], true, $editcalendar); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; $istemplate = ''; if ($item->isTemplate() || in_array($item->getType(), array('CartridgeItem', 'ConsumableItem', 'Software'))) { $istemplate = '*'; } echo "<td>" . sprintf(__('%1$s%2$s'), __('Immobilization number'), $istemplate) . "</td>"; echo "<td>"; $objectName = autoName($ic->fields["immo_number"], "immo_number", $withtemplate == 2, 'Infocom', $item->getEntityID()); Html::autocompletionTextField($ic, "immo_number", array('value' => $objectName, 'option' => $option)); echo "</td>"; echo "<td>" . __('Date of purchase') . "</td><td>"; Html::showDateFormItem("buy_date", $ic->fields["buy_date"], true, $editcalendar); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Invoice number') . "</td>"; echo "<td>"; Html::autocompletionTextField($ic, "bill", array('option' => $option)); echo "</td>"; echo "<td>" . __('Delivery date') . "</td><td>"; Html::showDateFormItem("delivery_date", $ic->fields["delivery_date"], true, $editcalendar); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Delivery form') . "</td><td>"; Html::autocompletionTextField($ic, "delivery_number", array('option' => $option)); echo "</td>"; echo "<td>" . __('Startup date') . "</td><td>"; Html::showDateFormItem("use_date", $ic->fields["use_date"], true, $editcalendar); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Value') . "</td>"; echo "<td><input type='text' name='value' {$option} value='" . Html::formatNumber($ic->fields["value"], true) . "' size='14'></td>"; echo "</td>"; echo "<td>" . __('Date of last physical inventory') . "</td><td>"; Html::showDateFormItem("inventory_date", $ic->fields["inventory_date"], true, $editcalendar); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Warranty extension value') . "</td>"; echo "<td><input type='text' {$option} name='warranty_value' value='" . Html::formatNumber($ic->fields["warranty_value"], true) . "' size='14'></td>"; echo "<td rowspan='5'>" . __('Comments') . "</td>"; echo "<td rowspan='5' class='middle'>"; echo "<textarea cols='45' rows='9' name='comment' >" . $ic->fields["comment"]; echo "</textarea></td></tr>\n"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Account net value') . "</td><td>"; echo Html::formatNumber(self::Amort($ic->fields["sink_type"], $ic->fields["value"], $ic->fields["sink_time"], $ic->fields["sink_coeff"], $ic->fields["warranty_date"], $ic->fields["use_date"], $date_tax, "n")); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Amortization type') . "</td><td >"; if ($withtemplate == 2) { echo self::getAmortTypeName($ic->fields["sink_type"]); } else { self::dropdownAmortType("sink_type", $ic->fields["sink_type"]); } echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Amortization duration') . "</td><td>"; if ($withtemplate == 2) { printf(_n('%d year', '%d years', $ic->fields["sink_time"]), $ic->fields["sink_time"]); } else { Dropdown::showNumber("sink_time", array('value' => $ic->fields["sink_time"], 'max' => 15, 'unit' => 'year')); } echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Amortization coefficient') . "</td>"; echo "<td>"; Html::autocompletionTextField($ic, "sink_coeff", array('size' => 14, 'option' => $option)); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; if (!in_array($item->getType(), array('Cartridge', 'CartridgeItem', 'Consumable', 'ConsumableItem', 'Software', 'SoftwareLicense'))) { echo "<td>" . __('TCO (value + tracking cost)') . "</td><td>"; echo self::showTco($item->getField('ticket_tco'), $ic->fields["value"]); } else { echo "<td colspan='2'>"; } echo "</td>"; if (!in_array($item->getType(), array('Cartridge', 'CartridgeItem', 'Consumable', 'ConsumableItem', 'Software', 'SoftwareLicense'))) { echo "<td>" . __('Monthly TCO') . "</td><td>"; echo self::showTco($item->getField('ticket_tco'), $ic->fields["value"], $ic->fields["warranty_date"]); } else { echo "<td colspan='2'>"; } echo "</td></tr>"; echo "<tr><th colspan='4'>" . __('Warranty information') . "</th></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Start date of warranty') . "</td><td>"; Html::showDateFormItem("warranty_date", $ic->fields["warranty_date"], true, $editcalendar); echo "</td>"; echo "<td>" . __('Warranty duration') . "</td><td>"; if ($withtemplate == 2) { // -1 = life if ($ic->fields["warranty_duration"] == -1) { _e('Lifelong'); } else { printf(_n('%d month', '%d months', $ic->fields["warranty_duration"]), $ic->fields["warranty_duration"]); } } else { Dropdown::showInteger("warranty_duration", $ic->fields["warranty_duration"], 0, 120, 1, array(-1 => __('Lifelong')), array('unit' => 'month')); } $tmpdat = self::getWarrantyExpir($ic->fields["warranty_date"], $ic->fields["warranty_duration"], 0, true); if ($tmpdat) { echo "<span class='small_space'>" . sprintf(__('Valid to %s'), $tmpdat) . "</span>"; } echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Warranty information') . "</td>"; echo "<td >"; Html::autocompletionTextField($ic, "warranty_info", array('option' => $option)); echo "</td>"; if ($CFG_GLPI['use_mailing']) { echo "<td>" . __('Alarms on financial and administrative information') . "</td>"; echo "<td>"; self::dropdownAlert(array('name' => "alert", 'value' => $ic->fields["alert"])); Alert::displayLastAlert('Infocom', $ic->fields['id']); echo "</td>"; } else { echo "</td><td colspan='2'>"; } echo "</td></tr>"; if ($canedit) { echo "<tr>"; echo "<td class='tab_bg_2 center' colspan='2'>"; echo "<input type='hidden' name='id' value='" . $ic->fields['id'] . "'>"; echo "<input type='submit' name='update' value=\"" . _sx('button', 'Save') . "\"\n class='submit'>"; echo "</td>"; echo "<td class='tab_bg_2 center' colspan='2'>"; echo "<input type='submit' name='delete' value=\"" . _sx('button', 'Delete permanently') . "\"\n class='submit'>"; echo "</td></tr>"; echo "</table></div>"; Html::closeForm(); } else { echo "</table></div>"; } } } }
@author the order plugin team @copyright Copyright (c) 2010-2015 Order plugin team @license GPLv2+ http://www.gnu.org/licenses/gpl.txt @link https://forge.indepnet.net/projects/order @link http://www.glpi-project.org/ @since 2009 ---------------------------------------------------------------------- */ include "../../../inc/includes.php"; header("Content-Type: text/html; charset=UTF-8"); Html::header_nocache(); Session::checkLoginUser(); $PluginOrderReception = new PluginOrderReception(); echo "<table width='950px' class='tab_cadre_fixe'>"; echo "<tr class='tab_bg_2'><td>" . __("Delivery date") . "</td><td>"; Html::showDateFormItem("delivery_date", date("Y-m-d"), true, 1); echo "</td><td>"; echo __("Delivery form") . "</td><td>"; echo "<input type='text' name='delivery_number' size='20'>"; echo "</td><td>"; echo "<input type='hidden' name='plugin_order_references_id' value='" . $_POST['plugin_order_references_id'] . "'>"; echo "<input type='hidden' name='plugin_order_orders_id' value='" . $_POST['plugin_order_orders_id'] . "'>"; echo __("Number to deliver", "order") . "</td><td width='10%'>"; $nb = $PluginOrderReception->checkItemStatus($_POST['plugin_order_orders_id'], $_POST['plugin_order_references_id'], PluginOrderOrder::ORDER_DEVICE_NOT_DELIVRED); Dropdown::showInteger('number_reception', '', 1, $nb); echo "</td><td>"; echo __("Delivery status", "order") . " "; PluginOrderDeliveryState::Dropdown(array('name' => "plugin_order_deliverystates_id")); echo "</td>"; echo "<td><input type='submit' name='bulk_reception' class='submit' value='" . _sx('button', 'Post') . "'></td></tr></table>"; Html::ajaxFooter();
function showForm($ID, $options = array()) { global $CFG_GLPI; if (!isset($options['several'])) { $options['several'] = false; } if (!Session::haveRight("networking", "r")) { return false; } $this->initForm($ID, $options); $recursiveItems = $this->recursivelyGetItems(); if (count($recursiveItems) > 0) { $lastItem = $recursiveItems[count($recursiveItems) - 1]; $lastItem_entities_id = $lastItem->getField('entities_id'); } else { $lastItem_entities_id = $_SESSION['glpiactive_entity']; } $this->showTabs(); $options['entities_id'] = $lastItem_entities_id; $this->showFormHeader($options); echo "<tr class='tab_bg_1'><td>"; $this->displayRecursiveItems($recursiveItems, 'Type'); echo " :</td>\n<td>"; // Need these to update information echo "<input type='hidden' name='items_id' value='" . $this->fields["items_id"] . "'>\n"; echo "<input type='hidden' name='itemtype' value='" . $this->fields["itemtype"] . "'>\n"; echo "<input type='hidden' name='instantiation_type' value='" . $this->fields["instantiation_type"] . "'>\n"; $this->displayRecursiveItems($recursiveItems, "Link"); echo "</td>\n"; $colspan = 2; if (!$options['several']) { $colspan++; } echo "<td rowspan='{$colspan}'>" . __('Comments') . "</td>"; echo "<td rowspan='{$colspan}' class='middle'>"; echo "<textarea cols='45' rows='{$colspan}' name='comment' >" . $this->fields["comment"] . "</textarea>"; echo "</td></tr>\n"; if (!$options['several']) { echo "<tr class='tab_bg_1'><td>" . _n('Port number', 'Ports number', 1) . "</td>\n"; echo "<td>"; Html::autocompletionTextField($this, "logical_number", array('size' => 5)); echo "</td></tr>\n"; } else { echo "<tr class='tab_bg_1'><td>" . _n('Port number', 'Port numbers', 2) . "</td>\n"; echo "<td>"; echo "<input type='hidden' name='several' value='yes'>"; echo "<input type='hidden' name='logical_number' value=''>\n"; echo __('from') . " "; Dropdown::showInteger('from_logical_number', 0, 0, 100); echo " " . __('to') . " "; Dropdown::showInteger('to_logical_number', 0, 0, 100); echo "</td></tr>\n"; } echo "<tr class='tab_bg_1'><td>" . __('Name') . "</td>\n"; echo "<td>"; Html::autocompletionTextField($this, "name"); echo "</td></tr>\n"; $instantiation = $this->getInstantiation(); if ($instantiation !== false) { echo "<tr class='tab_bg_1'><th colspan='4'>" . $instantiation->getTypeName(1) . "</th></tr>\n"; $instantiation->showInstantiationForm($this, $options, $recursiveItems); unset($instantiation); } if (!$options['several']) { NetworkName::showFormForNetworkPort($this->getID()); } $this->showFormButtons($options); $this->addDivForTabs(); }
/** * Print the contact form * * @param $ID integer ID of the item * @param $options array * - target filename : where to go when done. * - withtemplate boolean : template or basic item * * @return Nothing (display) **/ function showForm($ID, $options = array()) { global $CFG_GLPI; if (!Session::haveRight("config", "r") || !$this->getFromDB($ID)) { return false; } $this->showTabs($options); $this->showFormHeader($options); echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Name') . "</td>"; echo "<td class ='b'>"; $name = $this->fields["name"]; if ($isplug = isPluginItemType($this->fields["itemtype"])) { $name = sprintf(__('%1$s - %2$s'), $isplug["plugin"], $name); } echo $name . "</td>"; echo "<td rowspan='6' class='middle right'>" . __('Comments') . "</td>"; echo "<td class='center middle' rowspan='6'>"; echo "<textarea cols='45' rows='8' name='comment' >" . $this->fields["comment"] . "</textarea>"; echo "</td></tr>"; echo "<tr class='tab_bg_1'><td>" . __('Description') . "</td><td>"; echo $this->getDescription($ID); echo "</td></tr>"; echo "<tr class='tab_bg_1'><td>" . __('Run frequency') . "</td><td>"; $this->dropdownFrequency('frequency', $this->fields["frequency"]); echo "</td></tr>"; $tmpstate = $this->fields["state"]; echo "<tr class='tab_bg_1'><td>" . __('Status') . "</td><td>"; if (is_file(GLPI_CRON_DIR . '/' . $this->fields["name"] . '.lock') || is_file(GLPI_CRON_DIR . '/all.lock')) { echo "<span class='b'>" . __('System lock') . "</span><br>"; $tmpstate = self::STATE_DISABLE; } if ($isplug) { $plug = new Plugin(); if (!$plug->isActivated($isplug["plugin"])) { echo "<span class='b'>" . __('Disabled plugin') . "</span><br>"; $tmpstate = self::STATE_DISABLE; } } if ($this->fields["state"] == self::STATE_RUNNING) { echo "<span class='b'>" . $this->getStateName(self::STATE_RUNNING) . "</span>"; } else { self::dropdownState('state', $this->fields["state"]); } echo "</td></tr>"; echo "<tr class='tab_bg_1'><td>" . __('Run mode') . "</td><td>"; $modes = array(); if ($this->fields['allowmode'] & self::MODE_INTERNAL) { $modes[self::MODE_INTERNAL] = self::getModeName(self::MODE_INTERNAL); } if ($this->fields['allowmode'] & self::MODE_EXTERNAL) { $modes[self::MODE_EXTERNAL] = self::getModeName(self::MODE_EXTERNAL); } Dropdown::showFromArray('mode', $modes, array('value' => $this->fields['mode'])); echo "</td></tr>"; echo "<tr class='tab_bg_1'><td>" . __('Run period') . "</td><td>"; Dropdown::showInteger('hourmin', $this->fields['hourmin'], 0, 24); echo " -> "; Dropdown::showInteger('hourmax', $this->fields['hourmax'], 0, 24); echo "</td></tr>"; echo "<tr class='tab_bg_1'><td>" . __('Number of days this action logs are stored') . "</td><td>"; Dropdown::showInteger('logs_lifetime', $this->fields['logs_lifetime'], 10, 360, 10, array(0 => __('Infinite'))); echo "</td><td>" . __('Last run') . "</td><td>"; if (empty($this->fields['lastrun'])) { _e('Never'); } else { echo Html::convDateTime($this->fields['lastrun']); echo " "; Html::showSimpleForm(static::getFormURL(), 'resetdate', __('Blank'), array('id' => $ID), $CFG_GLPI['root_doc'] . "/pics/reset.png"); } echo "</td></tr>"; $label = $this->getParameterDescription(); echo "<tr class='tab_bg_1'><td>"; if (empty($label)) { echo " </td><td> "; } else { echo $label . " </td><td>"; Dropdown::showInteger('param', $this->fields['param'], 0, 400, 1); } echo "</td><td>" . __('Next run') . "</td><td>"; if ($tmpstate == self::STATE_RUNNING) { $launch = false; } else { $launch = $this->fields['allowmode'] & self::MODE_INTERNAL; } if ($tmpstate != self::STATE_WAITING) { echo $this->getStateName($tmpstate); } else { if (empty($this->fields['lastrun'])) { _e('As soon as possible'); } else { $next = strtotime($this->fields['lastrun']) + $this->fields['frequency']; $h = date('H', $next); $deb = $this->fields['hourmin'] < 10 ? "0" . $this->fields['hourmin'] : $this->fields['hourmin']; $fin = $this->fields['hourmax'] < 10 ? "0" . $this->fields['hourmax'] : $this->fields['hourmax']; if ($deb < $fin && $h < $deb) { $disp = date('Y-m-d', $next) . " {$deb}:00:00"; $next = strtotime($disp); } else { if ($deb < $fin && $h >= $this->fields['hourmax']) { $disp = date('Y-m-d', $next + DAY_TIMESTAMP) . " {$deb}:00:00"; $next = strtotime($disp); } } if ($deb > $fin && $h < $deb && $h >= $fin) { $disp = date('Y-m-d', $next) . " {$deb}:00:00"; $next = strtotime($disp); } else { $disp = date("Y-m-d H:i:s", $next); } if ($next < time()) { echo __('As soon as possible') . '<br>(' . Html::convDateTime($disp) . ') '; } else { echo Html::convDateTime($disp); } } } if ($launch) { echo " "; Html::showSimpleForm(static::getFormURL(), array('execute' => $this->fields['name']), __('Execute')); } if ($tmpstate == self::STATE_RUNNING) { Html::showSimpleForm(static::getFormURL(), 'resetstate', __('Blank'), array('id' => $ID), $CFG_GLPI['root_doc'] . "/pics/reset.png"); } echo "</td></tr>"; $this->showFormButtons($options); $this->addDivForTabs(); return true; }