Profile::showFormTrackingHelpdesk PHP Method

showFormTrackingHelpdesk() public method

Print the helpdesk right form for the current profile
    function showFormTrackingHelpdesk()
    {
        global $CFG_GLPI;
        if (!self::canView()) {
            return false;
        }
        echo "<div class='spaced'>";
        if ($canedit = Session::haveRightsOr(self::$rightname, array(CREATE, UPDATE, PURGE))) {
            echo "<form method='post' action='" . $this->getFormURL() . "'>";
        }
        $matrix_options = array('canedit' => $canedit, 'default_class' => 'tab_bg_2');
        $rights = array(array('rights' => Profile::getRightsFor('Ticket', 'helpdesk'), 'label' => _n('Ticket', 'Tickets', Session::getPluralNumber()), 'field' => 'ticket'), array('rights' => Profile::getRightsFor('TicketFollowup', 'helpdesk'), 'label' => _n('Followup', 'Followups', Session::getPluralNumber()), 'field' => 'followup'), array('rights' => Profile::getRightsFor('TicketTask', 'helpdesk'), 'label' => _n('Task', 'Tasks', Session::getPluralNumber()), 'field' => 'task'), array('rights' => Profile::getRightsFor('TicketValidation', 'helpdesk'), 'label' => _n('Validation', 'Validations', Session::getPluralNumber()), 'field' => 'ticketvalidation'));
        $matrix_options['title'] = __('Assistance');
        $this->displayRightsChoiceMatrix($rights, $matrix_options);
        echo "<table class='tab_cadre_fixehov'>";
        echo "<tr class='tab_bg_5'><th colspan='2'>" . __('Association') . "</th></tr>\n";
        echo "<tr class='tab_bg_2'>";
        echo "<td width=30%>" . __('See hardware of my groups') . "</td><td>";
        Html::showCheckbox(array('name' => '_show_group_hardware', 'checked' => $this->fields['show_group_hardware']));
        echo "</td></tr>\n";
        echo "<tr class='tab_bg_2'>";
        echo "<td>" . __('Link with items for the creation of tickets') . "</td>";
        echo "<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"]));
        echo "</td>";
        echo "</tr>\n";
        echo "<tr class='tab_bg_2'>";
        echo "<td>" . __('Default ticket template') . "</td><td>";
        // 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>";
        echo "</tr>\n";
        if ($canedit) {
            echo "<tr class='tab_bg_1'>";
            echo "<td colspan='4' 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 "</td></tr>\n";
            echo "</table>\n";
            Html::closeForm();
        } else {
            echo "</table>\n";
        }
        echo "</div>";
    }