Profile::displayLifeCycleMatrixTicketHelpdesk PHP Method

displayLifeCycleMatrixTicketHelpdesk() public method

Display the matrix of the elements lifecycle of the elements
public displayLifeCycleMatrixTicketHelpdesk ( $title, $html_field, $db_field, $canedit ) : nothing
$title the kind of lifecycle
$html_field field that is sent to _POST
$db_field field inside the DB (to get current state)
$canedit can we edit the elements ?
return nothing
    function displayLifeCycleMatrixTicketHelpdesk($title, $html_field, $db_field, $canedit)
    {
        $columns = array();
        $rows = array();
        $statuses = array();
        $allstatuses = Ticket::getAllStatusArray();
        foreach (array(Ticket::INCOMING, Ticket::SOLVED, Ticket::CLOSED) as $val) {
            $statuses[$val] = $allstatuses[$val];
        }
        $alwaysok = array(Ticket::INCOMING => array(), Ticket::SOLVED => array(Ticket::INCOMING), Ticket::CLOSED => array());
        $allowactions = array(Ticket::INCOMING => array(), Ticket::SOLVED => array(Ticket::CLOSED), Ticket::CLOSED => array(Ticket::CLOSED, Ticket::INCOMING));
        foreach ($statuses as $index_1 => $status_1) {
            $columns[$index_1] = $status_1;
            $row = array('label' => $status_1, 'columns' => array());
            foreach ($statuses as $index_2 => $status_2) {
                $content = array('checked' => true);
                if (isset($this->fields[$db_field][$index_1][$index_2])) {
                    $content['checked'] = $this->fields[$db_field][$index_1][$index_2];
                }
                if (in_array($index_2, $alwaysok[$index_1])) {
                    $content['checked'] = true;
                }
                if ($index_1 == $index_2 || !$canedit || !in_array($index_2, $allowactions[$index_1])) {
                    $content['readonly'] = true;
                }
                $row['columns'][$index_2] = $content;
            }
            $rows[$html_field . "[{$index_1}]"] = $row;
        }
        Html::showCheckboxMatrix($columns, $rows, array('title' => $title, 'first_cell' => '<b>' . __("From \\ To") . '</b>'));
    }