Exemple #1
0
 /**
  * Print the Life Cycles form for the current profile
  *
  * @param $openform   boolean  open the form (true by default)
  * @param $closeform  boolean  close the form (true by default)
  **/
 function showFormLifeCycle($openform = true, $closeform = true)
 {
     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() . "'>";
     }
     $this->displayLifeCycleMatrix(__('Life cycle of tickets'), '_cycle_ticket', 'ticket_status', Ticket::getAllStatusArray(), $canedit);
     $this->displayLifeCycleMatrix(__('Life cycle of problems'), '_cycle_problem', 'problem_status', Problem::getAllStatusArray(), $canedit);
     $this->displayLifeCycleMatrix(__('Life cycle of changes'), '_cycle_change', 'change_status', Change::getAllStatusArray(), $canedit);
     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>";
 }
Exemple #2
0
 /**
  * Print the Life Cycles form for the current profile
  *
  * @param $openform   boolean  open the form (true by default)
  * @param $closeform  boolean  close the form (true by default)
  **/
 function showFormLifeCycle($openform = true, $closeform = true)
 {
     if (!Session::haveRight("profile", "r")) {
         return false;
     }
     if (($canedit = Session::haveRight("profile", "w")) && $openform) {
         echo "<form method='post' action='" . $this->getFormURL() . "'>";
     }
     echo "<div class='spaced'>";
     echo "<table class='tab_cadre_fixe'>";
     $tabstatus = Ticket::getAllStatusArray();
     echo "<th colspan='" . (count($tabstatus) + 1) . "'>" . __('Life cycle of tickets') . "</th>";
     //TRANS: \ to split row heading (From) and colums headin (To) for life cycles
     echo "<tr class='tab_bg_1'><td class='b center'>" . __("From \\ To");
     echo "<input type='hidden' name='_cycles_ticket' value='1'</td>";
     foreach ($tabstatus as $label) {
         echo "<td class='center'>{$label}</td>";
     }
     echo "</tr>\n";
     foreach ($tabstatus as $from => $label) {
         echo "<tr class='tab_bg_2'><td class='tab_bg_1'>{$label}</td>";
         foreach ($tabstatus as $dest => $label) {
             echo "<td class='center'>";
             if ($dest == $from) {
                 echo Dropdown::getYesNo(1);
             } else {
                 Dropdown::showYesNo("_cycle_ticket[{$from}][{$dest}]", !isset($this->fields['ticket_status'][$from][$dest]) || $this->fields['ticket_status'][$from][$dest]);
             }
             echo "</td>";
         }
         echo "</tr>\n";
     }
     echo "</table>";
     echo "<table class='tab_cadre_fixe'>";
     $tabstatus = Problem::getAllStatusArray();
     echo "<th colspan='" . (count($tabstatus) + 1) . "'>" . __('Life cycle of problems') . "</th>";
     echo "<tr class='tab_bg_1'><td class='b center'>" . __('From \\ To');
     echo "<input type='hidden' name='_cycles_problem' value='1'</td>";
     foreach ($tabstatus as $label) {
         echo "<td class='center'>{$label}</td>";
     }
     echo "</tr>\n";
     foreach ($tabstatus as $from => $label) {
         echo "<tr class='tab_bg_2'><td class='tab_bg_1'>{$label}</td>";
         foreach ($tabstatus as $dest => $label) {
             echo "<td class='center'>";
             if ($dest == $from) {
                 echo Dropdown::getYesNo(1);
             } else {
                 Dropdown::showYesNo("_cycle_problem[{$from}][{$dest}]", !isset($this->fields['problem_status'][$from][$dest]) || $this->fields['problem_status'][$from][$dest]);
             }
             echo "</td>";
         }
         echo "</tr>\n";
     }
     echo "</table>";
     echo "<table class='tab_cadre_fixe'>";
     $tabstatus = Change::getAllStatusArray();
     //       echo "<th colspan='".(count($tabstatus)+1)."'>".__('Life cycle of changes')."</th>";
     //       echo "<tr class='tab_bg_1'><td class='b center'>".__('From \ To');
     //       echo "<input type='hidden' name='_cycles_change' value='1'</td>";
     //       foreach ($tabstatus as $label) {
     //          echo "<td class='center'>$label</td>";
     //       }
     //       echo "</tr>\n";
     //
     //       foreach ($tabstatus as $from => $label) {
     //          echo "<tr class='tab_bg_2'><td class='tab_bg_1'>$label</td>";
     //          foreach ($tabstatus as $dest => $label) {
     //             echo "<td class='center'>";
     //             if ($dest == $from) {
     //                echo Dropdown::getYesNo(1);
     //             } else {
     //                Dropdown::showYesNo("_cycle_change[$from][$dest]",
     //                                    (!isset($this->fields['change_status'][$from][$dest])
     //                                     || $this->fields['change_status'][$from][$dest]));
     //             }
     //             echo "</td>";
     //          }
     //          echo "</tr>\n";
     //       }
     if ($canedit && $closeform) {
         echo "<tr class='tab_bg_1'>";
         echo "<td colspan='" . (count($tabstatus) + 1) . "' 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>";
 }