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


PHP CommonGLPI::getSelectLinkedItem方法代码示例

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


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

示例1: getTabNameForItem

 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if (static::canView()) {
         $nb = 0;
         $title = self::getTypeName(2);
         if ($_SESSION['glpishow_count_on_tabs']) {
             switch ($item->getType()) {
                 case 'Change':
                     $nb = countElementsInTable('glpi_changes_tickets', "`changes_id` = '" . $item->getID() . "'");
                     break;
                 case 'Problem':
                     $nb = countElementsInTable('glpi_problems_tickets', "`problems_id` = '" . $item->getID() . "'");
                     break;
                 case 'User':
                     $nb = countElementsInTable('glpi_tickets_users', "`users_id` = '" . $item->getID() . "'\n                                                AND `type` = " . CommonITILActor::REQUESTER);
                     $title = __('Created tickets');
                     break;
                 case 'Supplier':
                     $nb = countElementsInTable('glpi_suppliers_tickets', "`suppliers_id` = '" . $item->getID() . "'");
                     break;
                 case 'SLA':
                     $nb = countElementsInTable('glpi_tickets', "`slas_id` = '" . $item->getID() . "'");
                     break;
                 case 'Group':
                     $nb = countElementsInTable('glpi_groups_tickets', "`groups_id` = '" . $item->getID() . "'\n                                               AND `type` = " . CommonITILActor::REQUESTER);
                     $title = __('Created tickets');
                     break;
                 default:
                     // Direct one
                     $nb = countElementsInTable('glpi_tickets', " `itemtype` = '" . $item->getType() . "'\n                                                AND `items_id` = '" . $item->getID() . "'");
                     // Linked items
                     if ($subquery = $item->getSelectLinkedItem()) {
                         $nb += countElementsInTable('glpi_tickets', "(`itemtype`,`items_id`) IN (" . $subquery . ")");
                     }
                     break;
             }
         }
         // glpishow_count_on_tabs
         // Not for Ticket class
         if ($item->getType() != __CLASS__) {
             return self::createTabEntry($title, $nb);
         }
     }
     // show_all_ticket right check
     // Not check show_all_ticket for Ticket itself
     switch ($item->getType()) {
         case __CLASS__:
             $ong = array();
             $ong[2] = _n('Solution', 'Solutions', 1);
             // enquete si statut clos
             if ($item->fields['status'] == self::CLOSED) {
                 $satisfaction = new TicketSatisfaction();
                 if ($satisfaction->getFromDB($item->getID())) {
                     $ong[3] = __('Satisfaction');
                 }
             }
             if (Session::haveRight('observe_ticket', '1')) {
                 $ong[4] = __('Statistics');
             }
             return $ong;
             //   default :
             //      return _n('Ticket','Tickets',2);
     }
     return '';
 }
开发者ID:gaforeror,项目名称:glpi,代码行数:65,代码来源:ticket.class.php

示例2: getTabNameForItem

 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if (!$withtemplate) {
         switch ($item->getType()) {
             case 'Problem':
                 return _n('Item', 'Items', 2);
             default:
                 if (Session::haveRight("show_all_problem", "1")) {
                     $nb = 0;
                     if ($_SESSION['glpishow_count_on_tabs']) {
                         // Direct one
                         $nb = countElementsInTable('glpi_items_problems', " `itemtype` = '" . $item->getType() . "'\n                                                   AND `items_id` = '" . $item->getID() . "'");
                         // Linked items
                         if ($subquery = $item->getSelectLinkedItem()) {
                             $nb += countElementsInTable('glpi_items_problems', " (`itemtype`,`items_id`) IN (" . $subquery . ")");
                         }
                     }
                     return self::createTabEntry(Problem::getTypeName(2), $nb);
                 }
         }
     }
     return '';
 }
开发者ID:gaforeror,项目名称:glpi,代码行数:23,代码来源:item_problem.class.php


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