/** * @since version 0.84 (before in entitydata.class) * * @param $entity Entity object **/ static function showHelpdeskOptions(Entity $entity) { global $CFG_GLPI; $ID = $entity->getField('id'); if (!$entity->can($ID, READ) || !Session::haveRightsOr(self::$rightname, array(self::READHELPDESK, self::UPDATEHELPDESK))) { return false; } $canedit = Session::haveRight(self::$rightname, self::UPDATEHELPDESK) && Session::haveAccessToEntity($ID); echo "<div class='spaced'>"; if ($canedit) { echo "<form method='post' name=form action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>"; } echo "<table class='tab_cadre_fixe'>"; echo "<tr class='tab_bg_1'><td colspan='2'>" . _n('Ticket template', 'Ticket templates', 1) . "</td>"; echo "<td colspan='2'>"; $toadd = array(); if ($ID != 0) { $toadd = array(self::CONFIG_PARENT => __('Inheritance of the parent entity')); } $options = array('value' => $entity->fields["tickettemplates_id"], 'entity' => $ID, 'toadd' => $toadd); TicketTemplate::dropdown($options); if ($entity->fields["tickettemplates_id"] == self::CONFIG_PARENT && $ID != 0) { echo "<font class='green'> "; $tt = new TicketTemplate(); $tid = self::getUsedConfig('tickettemplates_id', $ID, '', 0); if (!$tid) { echo Dropdown::EMPTY_VALUE; } else { if ($tt->getFromDB($tid)) { echo $tt->getLink(); } } echo "</font>"; } echo "</td></tr>"; echo "<tr class='tab_bg_1'><td colspan='2'>" . __('Calendar') . "</td>"; echo "<td colspan='2'>"; $options = array('value' => $entity->fields["calendars_id"], 'emptylabel' => __('24/7')); if ($ID != 0) { $options['toadd'] = array(self::CONFIG_PARENT => __('Inheritance of the parent entity')); } Calendar::dropdown($options); if ($entity->fields["calendars_id"] == self::CONFIG_PARENT && $ID != 0) { echo "<font class='green'> "; $calendar = new Calendar(); $cid = self::getUsedConfig('calendars_id', $ID, '', 0); if (!$cid) { _e('24/7'); } else { if ($calendar->getFromDB($cid)) { echo $calendar->getLink(); } } echo "</font>"; } echo "</td></tr>"; echo "<tr class='tab_bg_1'><td colspan='2'>" . __('Tickets default type') . "</td>"; echo "<td colspan='2'>"; $toadd = array(); if ($ID != 0) { $toadd = array(self::CONFIG_PARENT => __('Inheritance of the parent entity')); } Ticket::dropdownType('tickettype', array('value' => $entity->fields["tickettype"], 'toadd' => $toadd)); if ($entity->fields['tickettype'] == self::CONFIG_PARENT && $ID != 0) { echo "<font class='green'> "; echo Ticket::getTicketTypeName(self::getUsedConfig('tickettype', $ID, '', Ticket::INCIDENT_TYPE)); echo "</font>"; } echo "</td></tr>"; echo "<tr class='tab_bg_1'><td colspan='2'>" . __('Automatic assignment of tickets') . "</td>"; echo "<td colspan='2'>"; $autoassign = self::getAutoAssignMode(); if ($ID == 0) { unset($autoassign[self::CONFIG_PARENT]); } Dropdown::showFromArray('auto_assign_mode', $autoassign, array('value' => $entity->fields["auto_assign_mode"])); if ($entity->fields['auto_assign_mode'] == self::CONFIG_PARENT && $ID != 0) { $auto_assign_mode = self::getUsedConfig('auto_assign_mode', $entity->fields['entities_id']); echo "<font class='green'> "; echo $autoassign[$auto_assign_mode]; echo "</font>"; } echo "</td></tr>"; echo "<tr><th colspan='4'>" . __('Automatic closing configuration') . "</th></tr>"; echo "<tr class='tab_bg_1'>" . "<td colspan='2'>" . __('Automatic closing of solved tickets after') . "</td>"; echo "<td colspan='2'>"; $autoclose = array(self::CONFIG_PARENT => __('Inheritance of the parent entity'), self::CONFIG_NEVER => __('Never'), 0 => __('Immediatly')); if ($ID == 0) { unset($autoclose[self::CONFIG_PARENT]); } Dropdown::showNumber('autoclose_delay', array('value' => $entity->fields['autoclose_delay'], 'min' => 1, 'max' => 99, 'step' => 1, 'toadd' => $autoclose, 'unit' => 'day')); if ($entity->fields['autoclose_delay'] == self::CONFIG_PARENT && $ID != 0) { $autoclose_mode = self::getUsedConfig('autoclose_delay', $entity->fields['entities_id'], '', self::CONFIG_NEVER); echo "<br><font class='green'> "; if ($autoclose_mode >= 0) { printf(_n('%d day', '%d days', $autoclose_mode), $autoclose_mode); } else { echo $autoclose[$autoclose_mode]; } echo "</font>"; } echo "</td></tr>"; echo "<tr><th colspan='4'>" . __('Configuring the satisfaction survey') . "</th></tr>"; echo "<tr class='tab_bg_1'>" . "<td colspan='2'>" . __('Configuring the satisfaction survey') . "</td>"; echo "<td colspan='2'>"; /// no inquest case = rate 0 $typeinquest = array(self::CONFIG_PARENT => __('Inheritance of the parent entity'), 1 => __('Internal survey'), 2 => __('External survey')); // No inherit from parent for root entity if ($ID == 0) { unset($typeinquest[self::CONFIG_PARENT]); if ($entity->fields['inquest_config'] == self::CONFIG_PARENT) { $entity->fields['inquest_config'] = 1; } } $rand = Dropdown::showFromArray('inquest_config', $typeinquest, $options = array('value' => $entity->fields['inquest_config'])); echo "</td></tr>\n"; // Do not display for root entity in inherit case if ($entity->fields['inquest_config'] == self::CONFIG_PARENT && $ID != 0) { $inquestconfig = self::getUsedConfig('inquest_config', $entity->fields['entities_id']); $inquestrate = self::getUsedConfig('inquest_config', $entity->fields['entities_id'], 'inquest_rate'); echo "<tr class='tab_bg_1'><td colspan='4' class='green center'>"; if ($inquestrate == 0) { _e('Disabled'); } else { echo $typeinquest[$inquestconfig] . '<br>'; $inqconf = self::getUsedConfig('inquest_config', $entity->fields['entities_id'], 'inquest_delay'); printf(_n('%d day', '%d days', $inqconf), $inqconf); echo "<br>"; //TRANS: %d is the percentage. %% to display % printf(__('%d%%'), $inquestrate); if ($inquestconfig == 2) { echo "<br>"; echo self::getUsedConfig('inquest_config', $entity->fields['entities_id'], 'inquest_URL'); } } echo "</td></tr>\n"; } echo "<tr class='tab_bg_1'><td colspan='4'>"; $_POST = array('inquest_config' => $entity->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 class='tab_bg_2'>"; echo "<td class='center' colspan='4'>"; echo "<input type='hidden' name='id' value='" . $entity->fields["id"] . "'>"; echo "<input type='submit' name='update' value=\"" . _sx('button', 'Save') . "\"\n class='submit'>"; echo "</td></tr>"; echo "</table>"; Html::closeForm(); } else { echo "</table>"; } echo "</div>"; Ajax::updateItemOnSelectEvent("dropdown_inquest_config{$rand}", "inquestconfig", $CFG_GLPI["root_doc"] . "/ajax/ticketsatisfaction.php", $params); }
/** * Print the sla form * * @param $ID integer ID of the item * @param $options array of possible options: * - target filename : where to go when done. * - withtemplate boolean : template or basic item * *@return boolean item found **/ function showForm($ID, $options = array()) { $rowspan = 4; if ($ID > 0) { $rowspan = 5; } $this->initForm($ID, $options); $this->showFormHeader($options); echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Name') . "</td>"; echo "<td>"; Html::autocompletionTextField($this, "name", array('value' => $this->fields["name"])); echo "<td rowspan='" . $rowspan . "'>" . __('Comments') . "</td>"; echo "<td rowspan='" . $rowspan . "'>\n <textarea cols='45' rows='8' name='comment' class='form-control' >" . $this->fields["comment"] . "</textarea>"; echo "</td></tr>"; 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>"; } echo "<tr class='tab_bg_1'><td>" . __('Calendar') . "</td>"; echo "<td>"; Calendar::dropdown(array('value' => $this->fields["calendars_id"], 'emptylabel' => __('24/7'), 'toadd' => array('-1' => __('Calendar of the ticket')))); echo "</td></tr>"; echo "<tr class='tab_bg_1'><td>" . __('Maximum time to solve') . "</td>"; echo "<td>"; Dropdown::showNumber("resolution_time", array('value' => $this->fields["resolution_time"], 'min' => 0)); $possible_values = array('minute' => _n('Minute', 'Minutes', Session::getPluralNumber()), 'hour' => _n('Hour', 'Hours', Session::getPluralNumber()), 'day' => _n('Day', 'Days', Session::getPluralNumber())); $rand = Dropdown::showFromArray('definition_time', $possible_values, array('value' => $this->fields["definition_time"], 'on_change' => 'appearhideendofworking()')); echo "\n<script type='text/javascript' >\n"; echo "function appearhideendofworking() {\n"; echo "if (\$('#dropdown_definition_time{$rand} option:selected').val() == 'day') {\n \$('#title_endworkingday').show();\n \$('#dropdown_endworkingday').show();\n } else {\n \$('#title_endworkingday').hide();\n \$('#dropdown_endworkingday').hide();\n }"; echo "}\n"; echo "appearhideendofworking();\n"; echo "</script>\n"; echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td><div id='title_endworkingday'>" . __('End of working day') . "</div></td>"; echo "<td><div id='dropdown_endworkingday'>"; Dropdown::showYesNo("end_of_working_day", $this->fields["end_of_working_day"]); echo "</div></td></tr>"; $this->showFormButtons($options); return true; }
/** * Print the sla form * * @param $ID integer ID of the item * @param $options array of possible options: * - target filename : where to go when done. * - withtemplate boolean : template or basic item * *@return boolean item found **/ function showForm($ID, $options = array()) { $rowspan = 4; if ($ID > 0) { $rowspan = 6; } // Get SLA object $sla = new SLA(); if (isset($options['parent'])) { $sla = $options['parent']; } else { $sla->getFromDB($this->fields['slas_id']); } if ($ID > 0) { $this->check($ID, READ); } else { // Create item $options[static::$items_id] = $sla->getField('id'); //force itemtype of parent static::$itemtype = get_class($sla); $this->check(-1, CREATE, $options); } $this->showFormHeader($options); echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Name') . "</td>"; echo "<td>"; Html::autocompletionTextField($this, "name", array('value' => $this->fields["name"])); echo "<td rowspan='" . $rowspan . "'>" . __('Comments') . "</td>"; echo "<td rowspan='" . $rowspan . "'>\n <textarea cols='45' rows='8' name='comment' >" . $this->fields["comment"] . "</textarea>"; echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('SLA') . "</td>"; echo "<td>"; echo $sla->getLink(); echo "<input type='hidden' name='slas_id' value='" . $this->fields['slas_id'] . "'>"; echo "</td></tr>"; 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>"; } echo "<tr class='tab_bg_1'><td>" . __('Calendar') . "</td>"; echo "<td>"; Calendar::dropdown(array('value' => $this->fields["calendars_id"], 'emptylabel' => __('24/7'), 'toadd' => array('-1' => __('Calendar of the ticket')))); echo "</td></tr>"; echo "<tr class='tab_bg_1'><td>" . __('Type') . "</td>"; echo "<td>"; self::getSltTypeDropdown(array('value' => $this->fields["type"])); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'><td>" . __('Maximum time to solve') . "</td>"; echo "<td>"; Dropdown::showNumber("resolution_time", array('value' => $this->fields["resolution_time"], 'min' => 0)); $possible_values = array('minute' => _n('Minute', 'Minutes', Session::getPluralNumber()), 'hour' => _n('Hour', 'Hours', Session::getPluralNumber()), 'day' => _n('Day', 'Days', Session::getPluralNumber())); $rand = Dropdown::showFromArray('definition_time', $possible_values, array('value' => $this->fields["definition_time"], 'on_change' => 'appearhideendofworking()')); echo "\n<script type='text/javascript' >\n"; echo "function appearhideendofworking() {\n"; echo "if (\$('#dropdown_definition_time{$rand} option:selected').val() == 'day') {\n \$('#title_endworkingday').show();\n \$('#dropdown_endworkingday').show();\n } else {\n \$('#title_endworkingday').hide();\n \$('#dropdown_endworkingday').hide();\n }"; echo "}\n"; echo "appearhideendofworking();\n"; echo "</script>\n"; echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td><div id='title_endworkingday'>" . __('End of working day') . "</div></td>"; echo "<td><div id='dropdown_endworkingday'>"; Dropdown::showYesNo("end_of_working_day", $this->fields["end_of_working_day"]); echo "</div></td></tr>"; $this->showFormButtons($options); return true; }
/** * Print the sla form * * @param $ID integer ID of the item * @param $options array of possible options: * - target filename : where to go when done. * - withtemplate boolean : template or basic item * *@return boolean item found **/ function showForm($ID, $options = array()) { $rowspan = 3; if ($ID > 0) { $rowspan = 4; } $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", array('value' => $this->fields["name"])); echo "<td rowspan='" . $rowspan . "'>" . __('Comments') . "</td>"; echo "<td rowspan='" . $rowspan . "'>\n <textarea cols='45' rows='8' name='comment' >" . $this->fields["comment"] . "</textarea>"; echo "</td></tr>"; 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>"; } echo "<tr class='tab_bg_1'><td>" . __('Calendar') . "</td>"; echo "<td>"; Calendar::dropdown(array('value' => $this->fields["calendars_id"], 'emptylabel' => __('24/7'), 'toadd' => array('-1' => __('Calendar of the ticket')))); echo "</td></tr>"; echo "<tr class='tab_bg_1'><td>" . __('Maximum time to solve') . "</td>"; echo "<td>"; $possible_values = array(); for ($i = 10; $i < 60; $i += 10) { $possible_values[$i * MINUTE_TIMESTAMP] = sprintf(_n('%d minutes', '%d minutes', $i), $i); } for ($i = 1; $i < 24; $i++) { $possible_values[$i * HOUR_TIMESTAMP] = sprintf(_n('%d hour', '%d hours', $i), $i); } for ($i = 1; $i < 30; $i++) { $possible_values[$i * DAY_TIMESTAMP] = sprintf(_n('%d day', '%d days', $i), $i); } Dropdown::showFromArray('resolution_time', $possible_values, array('value' => $this->fields["resolution_time"])); echo "</td></tr>"; $this->showFormButtons($options); $this->addDivForTabs(); return true; }
/** * Print the sla form * * @param $ID integer ID of the item * @param $options array of possible options: * - target filename : where to go when done. * - withtemplate boolean : template or basic item * *@return boolean item found **/ function showForm($ID, $options = array()) { $rowspan = 2; $this->initForm($ID, $options); $this->showFormHeader($options); echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Name') . "</td>"; echo "<td>"; Html::autocompletionTextField($this, "name", array('value' => $this->fields["name"])); echo "<td rowspan='" . $rowspan . "'>" . __('Comments') . "</td>"; echo "<td rowspan='" . $rowspan . "'>\n <textarea cols='45' rows='8' name='comment' >" . $this->fields["comment"] . "</textarea>"; echo "</td></tr>"; echo "<tr class='tab_bg_1'><td>" . __('Calendar') . "</td>"; echo "<td>"; Calendar::dropdown(array('value' => $this->fields["calendars_id"], 'emptylabel' => __('24/7'), 'toadd' => array('-1' => __('Calendar of the ticket')))); echo "</td></tr>"; $this->showFormButtons($options); return true; }