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


PHP CommonDBTM::getSelectLinkedItem方法代码示例

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


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

示例1: showListForItem


//.........这里部分代码省略.........
             $options['field'][0] = 6;
             $options['searchtype'][0] = 'equals';
             $options['contains'][0] = $item->getID();
             $options['link'][0] = 'AND';
             break;
         case 'Group':
             // Mini search engine
             if ($item->haveChildren()) {
                 $tree = Session::getSavedOption(__CLASS__, 'tree', 0);
                 echo "<table class='tab_cadre_fixe'>";
                 echo "<tr class='tab_bg_1'><th>" . __('Last tickets') . "</th></tr>";
                 echo "<tr class='tab_bg_1'><td class='center'>";
                 echo __('Child groups') . "&nbsp;";
                 Dropdown::showYesNo('tree', $tree, -1, array('on_change' => 'reloadTab("start=0&tree="+this.value)'));
             } else {
                 $tree = 0;
             }
             echo "</td></tr></table>";
             if ($tree) {
                 $restrict = "IN (" . implode(',', getSonsOf('glpi_groups', $item->getID())) . ")";
             } else {
                 $restrict = "='" . $item->getID() . "'";
             }
             $restrict = "(`glpi_groups_tickets`.`groups_id` {$restrict}\n                                          AND `glpi_groups_tickets`.`type` = " . CommonITILActor::REQUESTER . ")";
             $order = '`glpi_tickets`.`date_mod` DESC';
             $options['field'][0] = 71;
             $options['searchtype'][0] = $tree ? 'under' : 'equals';
             $options['contains'][0] = $item->getID();
             $options['link'][0] = 'AND';
             break;
         default:
             $restrict = "(`items_id` = '" . $item->getID() . "'\n                                          AND `itemtype` = '" . $item->getType() . "')";
             $order = '`glpi_tickets`.`date_mod` DESC';
             $options['field'][0] = 12;
             $options['searchtype'][0] = 'equals';
             $options['contains'][0] = 'all';
             $options['link'][0] = 'AND';
             $options['itemtype2'][0] = $item->getType();
             $options['field2'][0] = Search::getOptionNumber($item->getType(), 'id');
             $options['searchtype2'][0] = 'equals';
             $options['contains2'][0] = $item->getID();
             $options['link2'][0] = 'AND';
             break;
     }
     $query = "SELECT " . self::getCommonSelect() . "\n                FROM `glpi_tickets` " . self::getCommonLeftJoin() . "\n                WHERE {$restrict} " . getEntitiesRestrictRequest("AND", "glpi_tickets") . "\n                ORDER BY {$order}\n                LIMIT " . intval($_SESSION['glpilist_limit']);
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     // Ticket for the item
     echo "<div class='firstbloc'>";
     // Link to open a new ticket
     if ($item->getID() && Ticket::isPossibleToAssignType($item->getType()) && Session::haveRight('create_ticket', 1)) {
         Html::showSimpleForm($CFG_GLPI["root_doc"] . "/front/ticket.form.php", '_add_fromitem', __('New ticket for this item...'), array('itemtype' => $item->getType(), 'items_id' => $item->getID()));
     }
     echo "<table class='tab_cadre_fixe'>";
     if ($number > 0) {
         Session::initNavigateListItems('Ticket', sprintf(__('%1$s = %2$s'), $item->getTypeName(1), $item->getName()));
         echo "<tr><th colspan='11'>";
         $title = sprintf(_n('Last %d ticket', 'Last %d tickets', $number), $number);
         $link = "<a href='" . $CFG_GLPI["root_doc"] . "/front/ticket.php?" . Toolbox::append_params($options, '&amp;') . "'>" . __('Show all') . "</a>";
         $title = printf(__('%1$s (%2$s)'), $title, $link);
         echo "</th></tr>";
     } else {
         echo "<tr><th>" . __('No ticket found.') . "</th></tr>";
     }
     if ($item->getID() && $item->getType() == 'User' && Session::haveRight('create_ticket', 1)) {
         echo "<tr><td class='tab_bg_2 center b' colspan='11'>";
         Html::showSimpleForm($CFG_GLPI["root_doc"] . "/front/ticket.form.php", '_add_fromitem', __('New ticket for this item...'), array('_users_id_requester' => $item->getID()));
         echo "</td></tr>";
     }
     // Ticket list
     if ($number > 0) {
         self::commonListHeader(Search::HTML_OUTPUT);
         while ($data = $DB->fetch_assoc($result)) {
             Session::addToNavigateListItems('Ticket', $data["id"]);
             self::showShort($data["id"], 0);
         }
     }
     echo "</table></div>";
     // Tickets for linked items
     if ($subquery = $item->getSelectLinkedItem()) {
         $query = "SELECT " . self::getCommonSelect() . "\n                   FROM `glpi_tickets` " . self::getCommonLeftJoin() . "\n                   WHERE (`itemtype`,`items_id`) IN (" . $subquery . ")" . getEntitiesRestrictRequest(' AND ', 'glpi_tickets') . "\n                   ORDER BY `glpi_tickets`.`date_mod` DESC\n                   LIMIT " . intval($_SESSION['glpilist_limit']);
         $result = $DB->query($query);
         $number = $DB->numrows($result);
         echo "<div class='spaced'><table class='tab_cadre_fixe'>";
         echo "<tr><th colspan='11'>";
         echo _n('Ticket on linked items', 'Tickets on linked items', $number);
         echo "</th></tr>";
         if ($number > 0) {
             self::commonListHeader(Search::HTML_OUTPUT);
             while ($data = $DB->fetch_assoc($result)) {
                 // Session::addToNavigateListItems(TRACKING_TYPE,$data["id"]);
                 self::showShort($data["id"], 0);
             }
         } else {
             echo "<tr><th>" . __('No ticket found.') . "</th></tr>";
         }
         echo "</table></div>";
     }
     // Subquery for linked item
 }
开发者ID:gaforeror,项目名称:glpi,代码行数:101,代码来源:ticket.class.php

示例2: showListForItem


//.........这里部分代码省略.........
             break;
         case 'Supplier':
             $restrict = "(`glpi_problems_suppliers`.`suppliers_id` = '" . $item->getID() . "'\n                            AND `glpi_problems_suppliers`.`type` = " . CommonITILActor::REQUESTER . ")";
             $order = '`glpi_problems`.`date_mod` DESC';
             $options['field'][0] = 6;
             $options['searchtype'][0] = 'equals';
             $options['contains'][0] = $item->getID();
             $options['link'][0] = 'AND';
             break;
         case 'Group':
             // Mini search engine
             if ($item->haveChildren()) {
                 $tree = Session::getSavedOption(__CLASS__, 'tree', 0);
                 echo "<table class='tab_cadre_fixe'>";
                 echo "<tr class='tab_bg_1'><th>" . __('Last problems') . "</th></tr>";
                 echo "<tr class='tab_bg_1'><td class='center'>";
                 _e('Child groups');
                 Dropdown::showYesNo('tree', $tree, -1, array('on_change' => 'reloadTab("start=0&tree="+this.value)'));
             } else {
                 $tree = 0;
             }
             echo "</td></tr></table>";
             if ($tree) {
                 $restrict = "IN (" . implode(',', getSonsOf('glpi_groups', $item->getID())) . ")";
             } else {
                 $restrict = "='" . $item->getID() . "'";
             }
             $restrict = "(`glpi_groups_problems`.`groups_id` {$restrict}\n                            AND `glpi_groups_problems`.`type` = " . CommonITILActor::REQUESTER . ")";
             $order = '`glpi_problems`.`date_mod` DESC';
             $options['field'][0] = 71;
             $options['searchtype'][0] = $tree ? 'under' : 'equals';
             $options['contains'][0] = $item->getID();
             $options['link'][0] = 'AND';
             break;
         default:
             $restrict = "(`items_id` = '" . $item->getID() . "'\n                            AND `itemtype` = '" . $item->getType() . "')";
             $order = '`glpi_problems`.`date_mod` DESC';
             //             $options['field'][0]      = 12;
             //             $options['searchtype'][0] = 'equals';
             //             $options['contains'][0]   = 'all';
             //             $options['link'][0]       = 'AND';
             //
             //             $options['itemtype2'][0]   = $item->getType();
             //             $options['field2'][0]      = Search::getOptionNumber($item->getType(), 'id');
             //             $options['searchtype2'][0] = 'equals';
             //             $options['contains2'][0]   = $item->getID();
             //             $options['link2'][0]       = 'AND';
             break;
     }
     $query = "SELECT " . self::getCommonSelect() . "\n                FROM `glpi_problems`\n                LEFT JOIN `glpi_items_problems`\n                  ON (`glpi_problems`.`id` = `glpi_items_problems`.`problems_id`) " . self::getCommonLeftJoin() . "\n                WHERE {$restrict} " . getEntitiesRestrictRequest("AND", "glpi_problems") . "\n                ORDER BY {$order}\n                LIMIT " . intval($_SESSION['glpilist_limit']);
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     // Ticket for the item
     echo "<div class='firstbloc'><table class='tab_cadre_fixe'>";
     if ($number > 0) {
         Session::initNavigateListItems('Problem', sprintf(__('%1$s = %2$s'), $item->getTypeName(1), $item->getName()));
         if (count($_SESSION["glpiactiveentities"]) > 1) {
             echo "<tr><th colspan='9'>";
         } else {
             echo "<tr><th colspan='8'>";
         }
         //TRANS : %d is the number of problems
         echo sprintf(_n('Last %d problem', 'Last %d problems', $number), $number);
         //             echo "<span class='small_space'><a href='".$CFG_GLPI["root_doc"]."/front/ticket.php?".
         //                    Toolbox::append_params($options,'&amp;')."'>".__('Show all')."</a></span>";
         echo "</th></tr>";
     } else {
         echo "<tr><th>" . __('No problem found.') . "</th></tr>";
     }
     // Ticket list
     if ($number > 0) {
         self::commonListHeader(Search::HTML_OUTPUT);
         while ($data = $DB->fetch_assoc($result)) {
             Session::addToNavigateListItems('Problem', $data["id"]);
             self::showShort($data["id"]);
         }
     }
     echo "</table></div>";
     // Tickets for linked items
     if ($subquery = $item->getSelectLinkedItem()) {
         $query = "SELECT " . self::getCommonSelect() . "\n                   FROM `glpi_problems`\n                   LEFT JOIN `glpi_items_problems`\n                        ON (`glpi_problems`.`id` = `glpi_items_problems`.`problems_id`) " . self::getCommonLeftJoin() . "\n                   WHERE (`itemtype`,`items_id`) IN (" . $subquery . ")" . getEntitiesRestrictRequest(' AND ', 'glpi_problems') . "\n                   ORDER BY `glpi_problems`.`date_mod` DESC\n                   LIMIT " . intval($_SESSION['glpilist_limit']);
         $result = $DB->query($query);
         $number = $DB->numrows($result);
         echo "<div class='spaced'><table class='tab_cadre_fixe'>";
         echo "<tr><th colspan='8'>";
         _e('Problems on linked items');
         echo "</th></tr>";
         if ($number > 0) {
             self::commonListHeader(Search::HTML_OUTPUT);
             while ($data = $DB->fetch_assoc($result)) {
                 // Session::addToNavigateListItems(TRACKING_TYPE,$data["id"]);
                 self::showShort($data["id"]);
             }
         } else {
             echo "<tr><th>" . __('No problem found.') . "</th></tr>";
         }
         echo "</table></div>";
     }
     // Subquery for linked item
 }
开发者ID:gaforeror,项目名称:glpi,代码行数:101,代码来源:problem.class.php


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