当前位置: 首页>>代码示例>>PHP>>正文


PHP TicketValidation::getValidateRights方法代码示例

本文整理汇总了PHP中TicketValidation::getValidateRights方法的典型用法代码示例。如果您正苦于以下问题:PHP TicketValidation::getValidateRights方法的具体用法?PHP TicketValidation::getValidateRights怎么用?PHP TicketValidation::getValidateRights使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TicketValidation的用法示例。


在下文中一共展示了TicketValidation::getValidateRights方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: showCentralList

 /**
  * @param $start
  * @param $status             (default ''process)
  * @param $showgrouptickets   (true by default)
  */
 static function showCentralList($start, $status = "process", $showgrouptickets = true)
 {
     global $DB, $CFG_GLPI;
     if (!Session::haveRightsOr(self::$rightname, array(CREATE, self::READALL, self::READASSIGN)) && !Session::haveRightsOr('ticketvalidation', TicketValidation::getValidateRights())) {
         return false;
     }
     $search_users_id = " (`glpi_tickets_users`.`users_id` = '" . Session::getLoginUserID() . "'\n                            AND `glpi_tickets_users`.`type` = '" . CommonITILActor::REQUESTER . "') ";
     $search_assign = " (`glpi_tickets_users`.`users_id` = '" . Session::getLoginUserID() . "'\n                            AND `glpi_tickets_users`.`type` = '" . CommonITILActor::ASSIGN . "')";
     $search_observer = " (`glpi_tickets_users`.`users_id` = '" . Session::getLoginUserID() . "'\n                            AND `glpi_tickets_users`.`type` = '" . CommonITILActor::OBSERVER . "')";
     $is_deleted = " `glpi_tickets`.`is_deleted` = 0 ";
     if ($showgrouptickets) {
         $search_users_id = " 0 = 1 ";
         $search_assign = " 0 = 1 ";
         if (count($_SESSION['glpigroups'])) {
             $groups = implode("','", $_SESSION['glpigroups']);
             $search_assign = " (`glpi_groups_tickets`.`groups_id` IN ('" . $groups . "')\n                                AND `glpi_groups_tickets`.`type` = '" . CommonITILActor::ASSIGN . "')";
             if (Session::haveRight(self::$rightname, self::READGROUP)) {
                 $search_users_id = " (`glpi_groups_tickets`.`groups_id` IN ('" . $groups . "')\n                                     AND `glpi_groups_tickets`.`type`\n                                           = '" . CommonITILActor::REQUESTER . "') ";
                 $search_observer = " (`glpi_groups_tickets`.`groups_id` IN ('" . $groups . "')\n                                     AND `glpi_groups_tickets`.`type`\n                                           = '" . CommonITILActor::OBSERVER . "') ";
             }
         }
     }
     $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`)\n                LEFT JOIN `glpi_groups_tickets`\n                     ON (`glpi_tickets`.`id` = `glpi_groups_tickets`.`tickets_id`)";
     switch ($status) {
         case "waiting":
             // on affiche les tickets en attente
             $query .= "WHERE {$is_deleted}\n                             AND ({$search_assign})\n                             AND `status` = '" . self::WAITING . "' " . getEntitiesRestrictRequest("AND", "glpi_tickets");
             break;
         case "process":
             // on affiche les tickets planifiés ou assignés au user
             $query .= "WHERE {$is_deleted}\n                             AND ( {$search_assign} )\n                             AND (`status` IN ('" . implode("','", self::getProcessStatusArray()) . "')) " . getEntitiesRestrictRequest("AND", "glpi_tickets");
             break;
         case "toapprove":
             // on affiche les tickets planifiés ou assignés au user
             $query .= "WHERE {$is_deleted}\n                             AND (`status` = '" . self::SOLVED . "')\n                             AND ({$search_users_id}";
             if (!$showgrouptickets && Session::haveRight('ticket', Ticket::SURVEY)) {
                 $query .= " OR `glpi_tickets`.users_id_recipient = '" . Session::getLoginUserID() . "' ";
             }
             $query .= ")" . getEntitiesRestrictRequest("AND", "glpi_tickets");
             break;
         case "tovalidate":
             // on affiche les tickets à valider
             $query .= " LEFT JOIN `glpi_ticketvalidations`\n                           ON (`glpi_tickets`.`id` = `glpi_ticketvalidations`.`tickets_id`)\n                        WHERE {$is_deleted}\n                              AND `users_id_validate` = '" . Session::getLoginUserID() . "'\n                              AND `glpi_ticketvalidations`.`status` = '" . CommonITILValidation::WAITING . "'\n                              AND (`glpi_tickets`.`status` NOT IN ('" . self::CLOSED . "',\n                                                                   '" . self::SOLVED . "')) " . getEntitiesRestrictRequest("AND", "glpi_tickets");
             break;
         case "rejected":
             // on affiche les tickets rejetés
             $query .= "WHERE {$is_deleted}\n                             AND ({$search_assign})\n                             AND `status` <> '" . self::CLOSED . "'\n                             AND `global_validation` = '" . CommonITILValidation::REFUSED . "' " . getEntitiesRestrictRequest("AND", "glpi_tickets");
             break;
         case "observed":
             $query .= "WHERE {$is_deleted}\n                             AND ({$search_observer})\n                             AND (`status` IN ('" . self::INCOMING . "',\n                                               '" . self::PLANNED . "',\n                                               '" . self::ASSIGNED . "',\n                                               '" . self::WAITING . "'))\n                             AND NOT ( {$search_assign} )\n                             AND NOT ( {$search_users_id} ) " . getEntitiesRestrictRequest("AND", "glpi_tickets");
             break;
         case "survey":
             // tickets dont l'enquête de satisfaction n'est pas remplie et encore valide
             $query .= " INNER JOIN `glpi_ticketsatisfactions`\n                           ON (`glpi_tickets`.`id` = `glpi_ticketsatisfactions`.`tickets_id`)\n                        INNER JOIN `glpi_entities`\n                           ON (`glpi_entities`.`id` = `glpi_tickets`.`entities_id`)\n                        WHERE {$is_deleted}\n                              AND ({$search_users_id}\n                                   OR `glpi_tickets`.`users_id_recipient` = '" . Session::getLoginUserID() . "')\n                              AND `glpi_tickets`.`status` = '" . self::CLOSED . "'\n                              AND (`glpi_entities`.`inquest_duration` = 0\n                                   OR DATEDIFF(ADDDATE(`glpi_ticketsatisfactions`.`date_begin`,\n                                                       INTERVAL\n                                                       `glpi_entities`.`inquest_duration` DAY),\n                                               CURDATE()) > 0)\n                              AND `glpi_ticketsatisfactions`.`date_answered` IS NULL " . getEntitiesRestrictRequest("AND", "glpi_tickets");
             break;
         case "requestbyself":
             // on affiche les tickets demandés le user qui sont planifiés ou assignés
             // à quelqu'un d'autre (exclut les self-tickets)
         // on affiche les tickets demandés le user qui sont planifiés ou assignés
         // à quelqu'un d'autre (exclut les self-tickets)
         default:
             $query .= "WHERE {$is_deleted}\n                             AND ({$search_users_id})\n                             AND (`status` IN ('" . self::INCOMING . "',\n                                               '" . self::PLANNED . "',\n                                               '" . self::ASSIGNED . "',\n                                               '" . self::WAITING . "'))\n                             AND NOT ( {$search_assign} ) " . getEntitiesRestrictRequest("AND", "glpi_tickets");
     }
     $query .= " ORDER BY `glpi_tickets`.`date_mod` DESC";
     $result = $DB->query($query);
     $numrows = $DB->numrows($result);
     if ($_SESSION['glpidisplay_count_on_home'] > 0) {
         $query .= " LIMIT " . intval($start) . ',' . intval($_SESSION['glpidisplay_count_on_home']);
         $result = $DB->query($query);
         $number = $DB->numrows($result);
     } else {
         $number = 0;
     }
     if ($numrows > 0) {
         echo "<table class='tab_cadrehov'>";
         echo "<tr class='noHover'><th colspan='4'>";
         $options['reset'] = 'reset';
         $forcetab = '';
         $num = 0;
         if ($showgrouptickets) {
             switch ($status) {
                 case "toapprove":
                     $options['criteria'][0]['field'] = 12;
                     // status
                     $options['criteria'][0]['searchtype'] = 'equals';
                     $options['criteria'][0]['value'] = self::SOLVED;
                     $options['criteria'][0]['link'] = 'AND';
                     $options['criteria'][1]['field'] = 71;
                     // groups_id
                     $options['criteria'][1]['searchtype'] = 'equals';
                     $options['criteria'][1]['value'] = 'mygroups';
                     $options['criteria'][1]['link'] = 'AND';
                     $forcetab = 'Ticket$2';
                     echo "<a href=\"" . $CFG_GLPI["root_doc"] . "/front/ticket.php?" . Toolbox::append_params($options, '&amp;') . "\">" . Html::makeTitle(__('Your tickets to close'), $number, $numrows) . "</a>";
                     break;
//.........这里部分代码省略.........
开发者ID:glpi-project,项目名称:glpi,代码行数:101,代码来源:ticket.class.php

示例2: helpHeader


//.........这里部分代码省略.........
     echo "<ul id='menu'>";
     // Build the navigation-elements
     // Home
     echo "<li id='menu1'>";
     echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php' title=\"" . __s('Home') . "\" class='itemP'>" . __('Home') . "</a>";
     echo "</li>";
     //  Create ticket
     if (Session::haveRight("ticket", CREATE)) {
         echo "<li id='menu2'>";
         echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php?create_ticket=1' " . "title=\"" . __s('Create a ticket') . "\" class='itemP'>" . __('Create a ticket') . "</a>";
         echo "</li>";
     }
     //  Suivi ticket
     if (Session::haveRight("ticket", Ticket::READMY) || Session::haveRight("followup", TicketFollowup::SEEPUBLIC)) {
         echo "<li id='menu3'>";
         echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/ticket.php' title=\"" . __s('Ticket followup') . "\" class='itemP'>" . _n('Ticket', 'Tickets', Session::getPluralNumber()) . "</a>";
         echo "</li>";
     }
     // Reservation
     if (Session::haveRight("reservation", ReservationItem::RESERVEANITEM)) {
         echo "<li id='menu4'>";
         echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/reservationitem.php' title=\"" . _sn('Reservation', 'Reservations', Session::getPluralNumber()) . "\" class='itemP'>" . _n('Reservation', 'Reservations', Session::getPluralNumber()) . "</a>";
         echo "</li>";
     }
     // FAQ
     if (Session::haveRight('knowbase', KnowbaseItem::READFAQ)) {
         echo "<li id='menu5' >";
         echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.faq.php' title=\"" . __s('FAQ') . "\" class='itemP'>" . __('FAQ') . "</a>";
         echo "</li>";
     }
     // PLUGINS
     $plugins = array();
     if (isset($PLUGIN_HOOKS["helpdesk_menu_entry"]) && count($PLUGIN_HOOKS["helpdesk_menu_entry"])) {
         foreach ($PLUGIN_HOOKS["helpdesk_menu_entry"] as $plugin => $active) {
             if ($active) {
                 $plugins[$plugin] = Plugin::getInfo($plugin);
             }
         }
     }
     if (isset($plugins) && count($plugins) > 0) {
         $list = array();
         foreach ($plugins as $key => $val) {
             $list[$key] = $val["name"];
         }
         asort($list);
         echo "<li id='menu5' onmouseover=\"javascript:menuAff('menu5','menu');\">";
         echo "<a href='#' title=\"" . _sn('Plugin', 'Plugins', Session::getPluralNumber()) . "\" class='itemP'>" . __('Plugins') . "</a>";
         // default none
         echo "<ul class='ssmenu'>";
         // list menu item
         foreach ($list as $key => $val) {
             $link = "";
             if (is_string($PLUGIN_HOOKS["helpdesk_menu_entry"][$key])) {
                 $link = $PLUGIN_HOOKS["helpdesk_menu_entry"][$key];
             }
             echo "<li><a href='" . $CFG_GLPI["root_doc"] . "/plugins/" . $key . $link . "'>" . $plugins[$key]["name"] . "</a></li>\n";
         }
         echo "</ul></li>";
     }
     echo "</ul>";
     echo "</div>";
     // End navigation bar
     // End headline
     //  Le fil d ariane
     echo "<div id='c_ssmenu2'>";
     echo "<ul>";
     echo "<li class='breadcrumb_item'>" . "<a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php' title=\"" . __s('Home') . "\">" . __('Home') . "</a></li>";
     if (TicketValidation::getValidateRights()) {
         $opt = array();
         $opt['reset'] = 'reset';
         $opt['criteria'][0]['field'] = 55;
         // validation status
         $opt['criteria'][0]['searchtype'] = 'equals';
         $opt['criteria'][0]['value'] = TicketValidation::WAITING;
         $opt['criteria'][0]['link'] = 'AND';
         $opt['criteria'][1]['field'] = 59;
         // validation aprobator
         $opt['criteria'][1]['searchtype'] = 'equals';
         $opt['criteria'][1]['value'] = Session::getLoginUserID();
         $opt['criteria'][1]['link'] = 'AND';
         $url_validate = $CFG_GLPI["root_doc"] . "/front/ticket.php?" . Toolbox::append_params($opt, '&amp;');
         $pic_validate = "<a href='{$url_validate}'>" . "<img title=\"" . __s('Ticket waiting for your approval') . "\" alt=\"" . __s('Ticket waiting for your approval') . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/menu_showall.png' class='pointer'></a>";
         echo "<li class='icons_block'>{$pic_validate}</li>\n";
     }
     if (Session::haveRight('ticket', CREATE) && strpos($_SERVER['PHP_SELF'], "ticket")) {
         echo "<li class='icons_block'><a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php?create_ticket=1'>";
         echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/menu_add.png' title=\"" . __s('Add') . "\" alt=\"" . __s('Add') . "\" class='pointer'></a></li>";
     }
     // check user id : header used for display messages when session logout
     if (Session::getLoginUserID()) {
         self::showProfileSelecter($CFG_GLPI["root_doc"] . "/front/helpdesk.public.php");
     }
     echo "</ul></div>";
     echo "</div>";
     // fin header
     echo "<div id='page' >";
     // call static function callcron() every 5min
     CronTask::callCron();
     self::displayMessageAfterRedirect();
 }
开发者ID:OlivierLM,项目名称:glpi,代码行数:101,代码来源:html.class.php

示例3: showMyView

 /**
  * Show the central personal view
  **/
 static function showMyView()
 {
     global $DB, $CFG_GLPI;
     $showticket = Session::haveRightsOr("ticket", array(Ticket::READMY, Ticket::READALL, Ticket::READASSIGN));
     $showproblem = Session::haveRightsOr('problem', array(Problem::READALL, Problem::READMY));
     echo "<table class='tab_cadre_central'>";
     if (Session::haveRight("config", UPDATE)) {
         $logins = User::checkDefaultPasswords();
         $user = new User();
         if (!empty($logins)) {
             $accouts = array();
             foreach ($logins as $login) {
                 $user->getFromDBbyName($login);
                 $accounts[] = $user->getLink();
             }
             $message = sprintf(__('For security reasons, please change the password for the default users: %s'), implode(" ", $accounts));
             echo "<tr><th colspan='2'>";
             Html::displayTitle($CFG_GLPI['root_doc'] . "/pics/warning.png", $message, $message);
             echo "</th></tr>";
         }
         if (file_exists(GLPI_ROOT . "/install/install.php")) {
             echo "<tr><th colspan='2'>";
             $message = sprintf(__('For security reasons, please remove file: %s'), "install/install.php");
             Html::displayTitle($CFG_GLPI['root_doc'] . "/pics/warning.png", $message, $message);
             echo "</th></tr>";
         }
     }
     if ($_SESSION['glpi_use_mode'] == Session::DEBUG_MODE) {
         if (!DBMysql::isMySQLStrictMode()) {
             echo "<tr><th colspan='2'>";
             $message = __('MySQL strict mode is not enabled');
             Html::displayTitle($CFG_GLPI['root_doc'] . "/pics/warning.png", $message, $message);
             echo "</th></tr>";
         }
     }
     if ($DB->isSlave() && !$DB->first_connection) {
         echo "<tr><th colspan='2'>";
         Html::displayTitle($CFG_GLPI['root_doc'] . "/pics/warning.png", __('MySQL replica: read only'), __('MySQL replica: read only'));
         echo "</th></tr>";
     }
     echo "<tr class='noHover'><td class='top' width='50%'><table class='central'>";
     echo "<tr class='noHover'><td>";
     if (Session::haveRightsOr('ticketvalidation', TicketValidation::getValidateRights())) {
         Ticket::showCentralList(0, "tovalidate", false);
     }
     if ($showticket) {
         if (Ticket::isAllowedStatus(Ticket::SOLVED, Ticket::CLOSED)) {
             Ticket::showCentralList(0, "toapprove", false);
         }
         Ticket::showCentralList(0, "survey", false);
         Ticket::showCentralList(0, "rejected", false);
         Ticket::showCentralList(0, "requestbyself", false);
         Ticket::showCentralList(0, "observed", false);
         Ticket::showCentralList(0, "process", false);
         Ticket::showCentralList(0, "waiting", false);
     }
     if ($showproblem) {
         Problem::showCentralList(0, "process", false);
     }
     echo "</td></tr>";
     echo "</table></td>";
     echo "<td class='top'  width='50%'><table class='central'>";
     echo "<tr class='noHover'><td>";
     Planning::showCentral(Session::getLoginUserID());
     Reminder::showListForCentral();
     if (Session::haveRight("reminder_public", READ)) {
         Reminder::showListForCentral(false);
     }
     echo "</td></tr>";
     echo "</table></td></tr></table>";
 }
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:74,代码来源:central.class.php


注:本文中的TicketValidation::getValidateRights方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。