showVeryShort() static public method

static public showVeryShort ( $ID, $forcetab = '' )
$ID
$forcetab string name of the tab to force at the display (default '')
Exemplo n.º 1
0
 static function showCentralSpecificList($type)
 {
     global $CFG_GLPI, $DB;
     if (!Session::haveRight("ticket", Ticket::READALL) && !Session::haveRight("ticket", Ticket::READASSIGN) && !Session::haveRight("ticket", CREATE) && !Session::haveRight("ticketvalidation", TicketValidation::VALIDATEREQUEST & TicketValidation::VALIDATEINCIDENT)) {
         return false;
     }
     $groups = implode("','", $_SESSION['glpigroups']);
     $numrows = 0;
     $is_deleted = " `glpi_tickets`.`is_deleted` = 0 ";
     if ($type == "notold") {
         $title = __("Tickets to follow (climbed)", "escalade");
         $status = CommonITILObject::INCOMING . ", " . CommonITILObject::PLANNED . ", " . CommonITILObject::ASSIGNED . ", " . CommonITILObject::WAITING;
         $search_assign = " `glpi_plugin_escalade_histories`.`groups_id` IN ('{$groups}')\n            AND (`glpi_groups_tickets`.`groups_id` NOT IN ('{$groups}')\n            OR `glpi_groups_tickets`.`groups_id` IS NULL)";
         $query_join = "LEFT JOIN `glpi_plugin_escalade_histories`\n            ON (`glpi_tickets`.`id` = `glpi_plugin_escalade_histories`.`tickets_id`)\n         LEFT JOIN `glpi_groups_tickets`\n            ON (`glpi_tickets`.`id` = `glpi_groups_tickets`.`tickets_id`\n               AND `glpi_groups_tickets`.`type`=2)";
     } else {
         $title = __("Tickets to close (climbed)", "escalade");
         $status = CommonITILObject::SOLVED;
         $search_assign = " (`glpi_groups_tickets`.`groups_id` IN ('{$groups}'))";
         $query_join = "LEFT JOIN `glpi_groups_tickets`\n            ON (`glpi_tickets`.`id` = `glpi_groups_tickets`.`tickets_id`\n               AND `glpi_groups_tickets`.`type`=2)";
     }
     $query = "SELECT DISTINCT `glpi_tickets`.`id`\n               FROM `glpi_tickets`\n               LEFT JOIN `glpi_tickets_users`\n                  ON (`glpi_tickets`.`id` = `glpi_tickets_users`.`tickets_id`)";
     $query .= $query_join;
     $query .= "WHERE {$is_deleted} AND ( {$search_assign} )\n                            AND (`status` IN ({$status}))" . getEntitiesRestrictRequest("AND", "glpi_tickets");
     $query .= " ORDER BY glpi_tickets.date_mod DESC";
     $result = $DB->query($query);
     $numrows = $DB->numrows($result);
     if (!$numrows) {
         return;
     }
     $query .= " LIMIT 0, 5";
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     //show central list
     if ($numrows > 0) {
         //construct link to ticket list
         $options['reset'] = 'reset';
         $options['criteria'][0]['field'] = 12;
         // status
         $options['criteria'][0]['searchtype'] = 'equals';
         if ($type == 'notold') {
             $options['criteria'][0]['value'] = 'notold';
         } else {
             if ($type == 'solved') {
                 $options['criteria'][0]['value'] = 5;
             }
         }
         $options['criteria'][0]['link'] = 'AND';
         if ($type == 'notold') {
             $options['criteria'][1]['field'] = 1881;
             // groups_id_assign for escalade history
             $options['criteria'][1]['searchtype'] = 'equals';
             $options['criteria'][1]['value'] = 'mygroups';
             $options['criteria'][1]['link'] = 'AND';
         }
         $options['criteria'][2]['field'] = 8;
         // groups_id_assign
         if ($type == 'notold') {
             $options['criteria'][2]['searchtype'] = 'notequals';
         } else {
             $options['criteria'][2]['searchtype'] = 'equals';
         }
         $options['criteria'][2]['value'] = 'mygroups';
         $options['criteria'][2]['link'] = 'AND';
         echo "<table class='tab_cadrehov' id='pluginEscaladeCentralList'>";
         echo "<tr><th colspan='5'>";
         echo "<a href=\"" . $CFG_GLPI["root_doc"] . "/front/ticket.php?" . Toolbox::append_params($options, '&amp;') . "\">" . Html::makeTitle($title, $number, $numrows) . "</a>";
         echo "</th></tr>";
         if ($number) {
             echo "<tr>";
             echo "<th></th>";
             echo "<th>" . __('Requester') . "</th>";
             echo "<th>" . __('Associated element') . "</th>";
             echo "<th>" . __('Description') . "</th></tr>";
             for ($i = 0; $i < $number; $i++) {
                 $ID = $DB->result($result, $i, "id");
                 Ticket::showVeryShort($ID, 'Ticket$2');
             }
         }
         echo "</table>";
         echo "<br />";
     }
 }
Exemplo n.º 2
0
 static function showCentralSpecificList($type)
 {
     global $CFG_GLPI, $DB;
     if (!Session::haveRight("show_all_ticket", "1") && !Session::haveRight("show_assign_ticket", "1") && !Session::haveRight("create_ticket", "1") && !Session::haveRight("validate_ticket", "1")) {
         return false;
     }
     $groups = implode("','", $_SESSION['glpigroups']);
     $numrows = 0;
     $is_deleted = " `glpi_tickets`.`is_deleted` = 0 ";
     if ($type == "notold") {
         $title = __("Tickets to follow (climbed)", "escalade");
         $status = CommonITILObject::INCOMING . ", " . CommonITILObject::PLANNED . ", " . CommonITILObject::ASSIGNED . ", " . CommonITILObject::WAITING;
         $search_assign = " `glpi_plugin_escalade_histories`.`groups_id` IN ('{$groups}')\n            AND (`glpi_groups_tickets`.`groups_id` NOT IN ('{$groups}')\n            OR `glpi_groups_tickets`.`groups_id` IS NULL)";
         $query_join = "LEFT JOIN `glpi_plugin_escalade_histories`\n            ON (`glpi_tickets`.`id` = `glpi_plugin_escalade_histories`.`tickets_id`)\n         LEFT JOIN `glpi_groups_tickets`\n            ON (`glpi_tickets`.`id` = `glpi_groups_tickets`.`tickets_id` \n               AND `glpi_groups_tickets`.`type`=2)";
     } else {
         $title = __("Tickets to close (climbed)", "escalade");
         $status = CommonITILObject::SOLVED;
         $search_assign = " (`glpi_groups_tickets`.`groups_id` IN ('{$groups}'))";
         $query_join = "LEFT JOIN `glpi_groups_tickets`\n            ON (`glpi_tickets`.`id` = `glpi_groups_tickets`.`tickets_id` \n               AND `glpi_groups_tickets`.`type`=2)";
     }
     $query = "SELECT DISTINCT `glpi_tickets`.`id`\n      FROM `glpi_tickets`\n      LEFT JOIN `glpi_tickets_users`\n         ON (`glpi_tickets`.`id` = `glpi_tickets_users`.`tickets_id`)";
     $query .= $query_join;
     $query .= "WHERE {$is_deleted} AND ( {$search_assign} )\n                            AND (`status` IN ({$status}))" . getEntitiesRestrictRequest("AND", "glpi_tickets");
     $query .= " ORDER BY glpi_tickets.date_mod DESC";
     $result = $DB->query($query);
     $numrows = $DB->numrows($result);
     if (!$numrows) {
         return;
     }
     $query .= " LIMIT 0, 5";
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     //show central list
     if ($numrows > 0) {
         //construct link to ticket list
         $options['reset'] = 'reset';
         $num = 0;
         foreach ($_SESSION['glpigroups'] as $gID) {
             $options['field'][$num] = 8;
             if ($type == "notold") {
                 $options['searchtype'][$num] = 'notequals';
                 $options['contains'][$num] = $gID;
                 $options['link'][$num] = $num == 0 ? 'AND' : 'OR';
                 $num++;
                 $options['field'][$num] = 1881;
                 //see hook.php, function ..._getAddSearchOptions
             }
             $options['searchtype'][$num] = 'equals';
             $options['contains'][$num] = $gID;
             if ($type == "notold") {
                 $options['link'][$num] = 'AND';
             } else {
                 $options['link'][$num] = $num == 0 ? 'AND' : 'OR';
             }
             $num++;
             $options['field'][$num] = 12;
             // status
             $options['searchtype'][$num] = 'equals';
             $options['contains'][$num] = $type;
             $options['link'][$num] = 'AND';
             $num++;
         }
         echo "<table><tr><td class='top' width='450px'>";
         echo "<table class='tab_cadrehov' id='pluginEscaladeCentralList' style='width:420px'>";
         echo "<tr><th colspan='5'>";
         echo "<a href=\"" . $CFG_GLPI["root_doc"] . "/front/ticket.php?" . Toolbox::append_params($options, '&amp;') . "\">" . Html::makeTitle($title, $number, $numrows) . "</a>";
         echo "</a>";
         echo "</th></tr>";
         if ($number) {
             echo "<tr><th></th>";
             echo "<th>" . __('Requester') . "</th>";
             echo "<th>" . __('Associated element') . "</th>";
             echo "<th>" . __('Description') . "</th></tr>";
             for ($i = 0; $i < $number; $i++) {
                 $ID = $DB->result($result, $i, "id");
                 Ticket::showVeryShort($ID, 'Ticket$2');
             }
         }
         echo "</table>";
         echo "</td></tr></table>";
     }
 }