function showFormTracking($openform = true, $closeform = true)
{
global $CFG_GLPI;
if (!self::canView()) {
return false;
}
echo "<div class='spaced'>";
if (($canedit = Session::haveRightsOr(self::$rightname, array(CREATE, UPDATE, PURGE))) && $openform) {
echo "<form method='post' action='" . $this->getFormURL() . "'>";
}
echo "<table class='tab_cadre_fixe'>";
// Assistance / Tracking-helpdesk
echo "<tr class='tab_bg_1'><th colspan='2'>" . __('Assistance') . "</th></tr>\n";
echo "<tr class='tab_bg_2'>";
echo "<td>" . _n('Ticket', 'Tickets', Session::getPluralNumber()) . ': ' . __('Default ticket template') . "</td><td width='30%'>";
// Only root entity ones and recursive
$options = array('value' => $this->fields["tickettemplates_id"], 'entity' => 0);
if (Session::isMultiEntitiesMode()) {
$options['condition'] = '`is_recursive`';
}
// Only add profile if on root entity
if (!isset($_SESSION['glpiactiveentities'][0])) {
$options['addicon'] = false;
}
TicketTemplate::dropdown($options);
echo "</td></tr>\n";
echo "</table>";
$matrix_options = array('canedit' => $canedit, 'default_class' => 'tab_bg_2');
$rights = array(array('itemtype' => 'Ticket', 'label' => _n('Ticket', 'Tickets', Session::getPluralNumber()), 'field' => 'ticket'), array('itemtype' => 'TicketCost', 'label' => _n('Ticket cost', 'Ticket costs', Session::getPluralNumber()), 'field' => 'ticketcost'), array('itemtype' => 'TicketRecurrent', 'label' => __('Recurrent tickets'), 'field' => 'ticketrecurrent'), array('itemtype' => 'TicketTemplate', 'label' => _n('Ticket template', 'Ticket templates', Session::getPluralNumber()), 'field' => 'tickettemplate'));
$matrix_options['title'] = _n('Ticket', 'Tickets', Session::getPluralNumber());
$this->displayRightsChoiceMatrix($rights, $matrix_options);
$rights = array(array('itemtype' => 'TicketFollowup', 'label' => _n('Followup', 'Followups', Session::getPluralNumber()), 'field' => 'followup'), array('itemtype' => 'TicketTask', 'label' => _n('Task', 'Tasks', Session::getPluralNumber()), 'field' => 'task'));
$matrix_options['title'] = _n('Followup', 'Followups', Session::getPluralNumber()) . " / " . _n('Task', 'Tasks', Session::getPluralNumber());
$this->displayRightsChoiceMatrix($rights, $matrix_options);
$rights = array(array('itemtype' => 'TicketValidation', 'label' => _n('Validation', 'Validations', Session::getPluralNumber()), 'field' => 'ticketvalidation'));
$matrix_options['title'] = _n('Validation', 'Validations', Session::getPluralNumber());
$this->displayRightsChoiceMatrix($rights, $matrix_options);
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_5'><th colspan='2'>" . __('Association') . "</th>";
echo "</tr>\n";
echo "<tr class='tab_bg_2'>";
echo "<td>" . __('See hardware of my groups') . "</td><td>";
Html::showCheckbox(array('name' => '_show_group_hardware', 'checked' => $this->fields['show_group_hardware']));
echo "</td></tr>";
echo "<tr class='tab_bg_2'>";
echo "<td>" . __('Link with items for the creation of tickets') . "</td>";
echo "\n<td>";
self::getLinearRightChoice(self::getHelpdeskHardwareTypes(true), array('field' => 'helpdesk_hardware', 'value' => $this->fields['helpdesk_hardware']));
echo "</td></tr>\n";
echo "<tr class='tab_bg_2'>";
echo "<td>" . __('Associable items to a ticket') . "</td>";
echo "<td><input type='hidden' name='_helpdesk_item_types' value='1'>";
self::dropdownHelpdeskItemtypes(array('values' => $this->fields["helpdesk_item_type"]));
// Linear_HIT
// self::getLinearRightChoice(self::getHelpdeskItemtypes(),
// array('field' => 'helpdesk_item_type',
// 'value' => $this->fields['helpdesk_item_type'],
// 'check_all' => true,
// 'zero_on_empty' => false,
// 'max_per_line' => 4,
// 'check_method' =>
// function ($element, $field) {
// return in_array($element,$field);
// }));
echo "</td>";
echo "</tr>\n";
echo "</table>";
$rights = array(array('itemtype' => 'Stat', 'label' => __('Statistics'), 'field' => 'statistic'), array('itemtype' => 'Planning', 'label' => __('Planning'), 'field' => 'planning'));
$matrix_options['title'] = __('Visibility');
$this->displayRightsChoiceMatrix($rights, $matrix_options);
$rights = array(array('itemtype' => 'Problem', 'label' => _n('Problem', 'Problems', Session::getPluralNumber()), 'field' => 'problem'));
$matrix_options['title'] = _n('Problem', 'Problems', Session::getPluralNumber());
$this->displayRightsChoiceMatrix($rights, $matrix_options);
$rights = array(array('itemtype' => 'Change', 'label' => _n('Change', 'Changes', Session::getPluralNumber()), 'field' => 'change'), array('itemtype' => 'ChangeValidation', 'label' => _n('Validation', 'Validations', Session::getPluralNumber()), 'field' => 'changevalidation'));
$matrix_options['title'] = _n('Change', 'Changes', Session::getPluralNumber());
$this->displayRightsChoiceMatrix($rights, $matrix_options);
if ($canedit && $closeform) {
echo "<div class='center'>";
echo "<input type='hidden' name='id' value='" . $this->fields['id'] . "'>";
echo "<input type='submit' name='update' value=\"" . _sx('button', 'Save') . "\" class='submit'>";
echo "</div>\n";
Html::closeForm();
}
echo "</div>";
}