當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CommonGLPI::getLinkedItems方法代碼示例

本文整理匯總了PHP中CommonGLPI::getLinkedItems方法的典型用法代碼示例。如果您正苦於以下問題:PHP CommonGLPI::getLinkedItems方法的具體用法?PHP CommonGLPI::getLinkedItems怎麽用?PHP CommonGLPI::getLinkedItems使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CommonGLPI的用法示例。


在下文中一共展示了CommonGLPI::getLinkedItems方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getTabNameForItem

 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if (!$withtemplate) {
         switch ($item->getType()) {
             case 'Problem':
                 $nb = 0;
                 if ($_SESSION['glpishow_count_on_tabs']) {
                     $nb = countElementsInTable('glpi_items_problems', "`problems_id` = '" . $item->getID() . "'");
                 }
                 return self::createTabEntry(_n('Item', 'Items', Session::getPluralNumber()), $nb);
             case 'User':
                 $nb = 0;
                 if ($_SESSION['glpishow_count_on_tabs']) {
                     $nb = countDistinctElementsInTable('glpi_problems_users', 'problems_id', "`users_id` = '" . $item->getID() . "'");
                 }
                 return self::createTabEntry(Problem::getTypeName(Session::getPluralNumber()), $nb);
             case 'Group':
                 $nb = 0;
                 if ($_SESSION['glpishow_count_on_tabs']) {
                     $nb = countDistinctElementsInTable('glpi_groups_problems', 'problems_id', "`groups_id` = '" . $item->getID() . "'");
                 }
                 return self::createTabEntry(Problem::getTypeName(Session::getPluralNumber()), $nb);
             case 'Supplier':
                 $nb = 0;
                 if ($_SESSION['glpishow_count_on_tabs']) {
                     $nb = countDistinctElementsInTable('glpi_problems_suppliers', 'problems_id', "`suppliers_id` = '" . $item->getID() . "'");
                 }
                 return self::createTabEntry(Problem::getTypeName(Session::getPluralNumber()), $nb);
             default:
                 if (Session::haveRight("problem", Problem::READALL)) {
                     $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
                         $linkeditems = $item->getLinkedItems();
                         if (count($linkeditems)) {
                             foreach ($linkeditems as $type => $tab) {
                                 foreach ($tab as $ID) {
                                     $nb += countElementsInTable('glpi_items_problems', " `itemtype` = '{$type}'\n                                                            AND `items_id` = '{$ID}'");
                                 }
                             }
                         }
                     }
                     return self::createTabEntry(Problem::getTypeName(Session::getPluralNumber()), $nb);
                 }
         }
     }
     return '';
 }
開發者ID:JULIO8,項目名稱:respaldo_glpi,代碼行數:50,代碼來源:item_problem.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
                         $linkeditems = $item->getLinkedItems();
                         if (count($linkeditems)) {
                             foreach ($linkeditems as $type => $tab) {
                                 foreach ($tab as $ID) {
                                     $nb += countElementsInTable('glpi_items_problems', " `itemtype` = '{$type}'\n                                                   AND `items_id` = '{$ID}'");
                                 }
                             }
                         }
                     }
                     return self::createTabEntry(Problem::getTypeName(2), $nb);
                 }
         }
     }
     return '';
 }
開發者ID:geldarr,項目名稱:hack-space,代碼行數:28,代碼來源:item_problem.class.php

示例3: getTabNameForItem

 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if (static::canView()) {
         $nb = 0;
         $title = self::getTypeName(Session::getPluralNumber());
         if ($_SESSION['glpishow_count_on_tabs']) {
             switch ($item->getType()) {
                 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_items_tickets', " `itemtype` = '" . $item->getType() . "'\n                                                AND `items_id` = '" . $item->getID() . "'");
                     // Linked items
                     $linkeditems = $item->getLinkedItems();
                     if (count($linkeditems)) {
                         foreach ($linkeditems as $type => $tab) {
                             foreach ($tab as $ID) {
                                 $nb += countElementsInTable('glpi_items_tickets', " `itemtype` = '{$type}'\n                                                         AND `items_id` = '{$ID}'");
                             }
                         }
                     }
                     break;
             }
         }
         // glpishow_count_on_tabs
         // Not for Ticket class
         if ($item->getType() != __CLASS__) {
             return self::createTabEntry($title, $nb);
         }
     }
     // self::READALL right check
     // Not check self::READALL 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 ($item->canUpdate()) {
                 $ong[4] = __('Statistics');
             }
             return $ong;
             //   default :
             //      return _n('Ticket','Tickets', Session::getPluralNumber());
     }
     return '';
 }
開發者ID:paisdelconocimiento,項目名稱:glpi-smartcities,代碼行數:64,代碼來源:ticket.class.php

示例4: getTabNameForItem

 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if ($item->isNewItem()) {
         return;
     }
     if (static::canView()) {
         $nb = 0;
         $title = self::getTypeName(Session::getPluralNumber());
         if ($_SESSION['glpishow_count_on_tabs']) {
             switch ($item->getType()) {
                 case 'User':
                     $nb = countElementsInTable(array('glpi_tickets', 'glpi_tickets_users'), getEntitiesRestrictRequest("", 'glpi_tickets') . "AND `glpi_tickets_users`.`tickets_id` = `glpi_tickets`.`id`\n                                                AND `glpi_tickets_users`.`users_id` = '" . $item->getID() . "'\n                                                AND `glpi_tickets_users`.`type` = " . CommonITILActor::REQUESTER);
                     $title = __('Created tickets');
                     break;
                 case 'Supplier':
                     $nb = countElementsInTable(array('glpi_tickets', 'glpi_suppliers_tickets'), getEntitiesRestrictRequest("", 'glpi_tickets') . "AND `glpi_suppliers_tickets`.`tickets_id` = `glpi_tickets`.`id`\n                                                AND `glpi_suppliers_tickets`.`suppliers_id` = '" . $item->getID() . "'");
                     break;
                 case 'SLT':
                     $nb = countElementsInTable('glpi_tickets', ['slts_tto_id' => $item->getID(), 'slts_ttr_id' => $item->getID()]);
                     break;
                 case 'Group':
                     $nb = countElementsInTable(array('glpi_tickets', 'glpi_groups_tickets'), getEntitiesRestrictRequest("", 'glpi_tickets') . "AND `glpi_groups_tickets`.`tickets_id` = `glpi_tickets`.`id`\n                                                AND `glpi_groups_tickets`.`groups_id` = '" . $item->getID() . "'\n                                                AND `glpi_groups_tickets`.`type` = " . CommonITILActor::REQUESTER);
                     $title = __('Created tickets');
                     break;
                 default:
                     // Direct one
                     $nb = countElementsInTable('glpi_items_tickets', ['itemtype' => $item->getType(), 'items_id' => $item->getID()]);
                     // Linked items
                     $linkeditems = $item->getLinkedItems();
                     if (count($linkeditems)) {
                         foreach ($linkeditems as $type => $tab) {
                             foreach ($tab as $ID) {
                                 $nb += countElementsInTable('glpi_items_tickets', ['itemtype' => $type, 'items_id' => $ID]);
                             }
                         }
                     }
                     break;
             }
         }
         // glpishow_count_on_tabs
         // Not for Ticket class
         if ($item->getType() != __CLASS__) {
             return self::createTabEntry($title, $nb);
         }
     }
     // self::READALL right check
     // Not check self::READALL for Ticket itself
     switch ($item->getType()) {
         case __CLASS__:
             $ong = array();
             if ($_SESSION['glpiticket_timeline']) {
                 $timeline = $item->getTimelineItems();
                 $nb_elements = count($timeline);
                 $ong[1] = __("Processing ticket") . " <sup class='tab_nb'>{$nb_elements}</sup>";
             }
             if (!$_SESSION['glpiticket_timeline'] || $_SESSION['glpiticket_timeline_keep_replaced_tabs']) {
                 $ong[2] = _n('Solution', 'Solutions', 1);
             }
             // enquete si statut clos
             if ($item->fields['status'] == self::CLOSED && Session::haveRight('ticket', Ticket::SURVEY)) {
                 $satisfaction = new TicketSatisfaction();
                 if ($satisfaction->getFromDB($item->getID())) {
                     $ong[3] = __('Satisfaction');
                 }
             }
             if ($item->canUpdate()) {
                 $ong[4] = __('Statistics');
             }
             return $ong;
             //   default :
             //      return _n('Ticket','Tickets', Session::getPluralNumber());
     }
     return '';
 }
開發者ID:glpi-project,項目名稱:glpi,代碼行數:74,代碼來源:ticket.class.php

示例5: getTabNameForItem

 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if (!$withtemplate) {
         $nb = 0;
         switch ($item->getType()) {
             case 'Project':
                 if ($_SESSION['glpishow_count_on_tabs']) {
                     $nb = countElementsInTable('glpi_items_projects', ['projects_id' => $item->getID()]);
                 }
                 return self::createTabEntry(_n('Item', 'Items', Session::getPluralNumber()), $nb);
             default:
                 // Not used now
                 if (Session::haveRight("project", Project::READALL)) {
                     if ($_SESSION['glpishow_count_on_tabs']) {
                         // Direct one
                         $nb = countElementsInTable('glpi_items_projects', ['itemtype' => $item->getType(), 'items_id' => $item->getID()]);
                         // Linked items
                         $linkeditems = $item->getLinkedItems();
                         if (count($linkeditems)) {
                             foreach ($linkeditems as $type => $tab) {
                                 foreach ($tab as $ID) {
                                     $nb += countElementsInTable('glpi_items_projects', ['itemtype' => $type, 'items_id' => $ID]);
                                 }
                             }
                         }
                     }
                     return self::createTabEntry(Project::getTypeName(Session::getPluralNumber()), $nb);
                 }
         }
     }
     return '';
 }
開發者ID:glpi-project,項目名稱:glpi,代碼行數:32,代碼來源:item_project.class.php


注:本文中的CommonGLPI::getLinkedItems方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。