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


PHP Change::getCommonSelect方法代码示例

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


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

示例1: getItem


//.........这里部分代码省略.........
     if (isset($params['with_contracts']) && $params['with_contracts']) {
         $fields['_contracts'] = array();
         if (!Contract::canView()) {
             $fields['_contracts'] = self::arrayRightError();
         } else {
             $query = "SELECT `glpi_contracts_items`.*\n                     FROM `glpi_contracts_items`,\n                          `glpi_contracts`\n                     LEFT JOIN `glpi_entities` ON (`glpi_contracts`.`entities_id`=`glpi_entities`.`id`)\n                     WHERE `glpi_contracts`.`id`=`glpi_contracts_items`.`contracts_id`\n                           AND `glpi_contracts_items`.`items_id` = '{$id}'\n                           AND `glpi_contracts_items`.`itemtype` = '{$itemtype}'" . getEntitiesRestrictRequest(" AND", "glpi_contracts", '', '', true) . "\n                     ORDER BY `glpi_contracts`.`name`";
             if ($result = $DB->query($query)) {
                 while ($data = $DB->fetch_assoc($result)) {
                     $fields['_contracts'][] = $data;
                 }
             }
         }
     }
     // retrieve item contracts
     if (isset($params['with_documents']) && $params['with_documents']) {
         $fields['_documents'] = array();
         if (!$itemtype != 'Ticket' && $itemtype != 'KnowbaseItem' && $itemtype != 'Reminder' && !Document::canView()) {
             $fields['_documents'] = self::arrayRightError();
         } else {
             $query = "SELECT `glpi_documents_items`.`id` AS assocID,\n                             `glpi_documents_items`.`date_mod` AS assocdate,\n                             `glpi_entities`.`id` AS entityID,\n                             `glpi_entities`.`completename` AS entity,\n                             `glpi_documentcategories`.`completename` AS headings,\n                             `glpi_documents`.*\n                      FROM `glpi_documents_items`\n                      LEFT JOIN `glpi_documents`\n                                ON (`glpi_documents_items`.`documents_id`=`glpi_documents`.`id`)\n                      LEFT JOIN `glpi_entities` ON (`glpi_documents`.`entities_id`=`glpi_entities`.`id`)\n                      LEFT JOIN `glpi_documentcategories`\n                              ON (`glpi_documents`.`documentcategories_id`=`glpi_documentcategories`.`id`)\n                      WHERE `glpi_documents_items`.`items_id` = '{$id}'\n                            AND `glpi_documents_items`.`itemtype` = '{$itemtype}' ";
             if ($result = $DB->query($query)) {
                 while ($data = $DB->fetch_assoc($result)) {
                     $fields['_documents'][] = $data;
                 }
             }
         }
     }
     // retrieve item tickets
     if (isset($params['with_tickets']) && $params['with_tickets']) {
         $fields['_tickets'] = array();
         if (!Ticket::canView()) {
             $fields['_tickets'] = self::arrayRightError();
         } else {
             $query = "SELECT " . Ticket::getCommonSelect() . "\n                      FROM `glpi_tickets` " . Ticket::getCommonLeftJoin() . "\n                      WHERE `glpi_items_tickets`.`items_id` = '{$id}'\n                             AND `glpi_items_tickets`.`itemtype` = '{$itemtype}' " . getEntitiesRestrictRequest("AND", "glpi_tickets") . "\n                      ORDER BY `glpi_tickets`.`date_mod` DESC";
             if ($result = $DB->query($query)) {
                 while ($data = $DB->fetch_assoc($result)) {
                     $fields['_tickets'][] = $data;
                 }
             }
         }
     }
     // retrieve item problems
     if (isset($params['with_problems']) && $params['with_problems']) {
         $fields['_problems'] = array();
         if (!Problem::canView()) {
             $fields['_problems'] = self::arrayRightError();
         } else {
             $query = "SELECT " . Problem::getCommonSelect() . "\n                            FROM `glpi_problems`\n                            LEFT JOIN `glpi_items_problems`\n                              ON (`glpi_problems`.`id` = `glpi_items_problems`.`problems_id`) " . Problem::getCommonLeftJoin() . "\n                            WHERE `items_id` = '{$id}'\n                                  AND `itemtype` = '{$itemtype}' " . getEntitiesRestrictRequest("AND", "glpi_problems") . "\n                            ORDER BY `glpi_problems`.`date_mod` DESC";
             if ($result = $DB->query($query)) {
                 while ($data = $DB->fetch_assoc($result)) {
                     $fields['_problems'][] = $data;
                 }
             }
         }
     }
     // retrieve item changes
     if (isset($params['with_changes']) && $params['with_changes']) {
         $fields['_changes'] = array();
         if (!Change::canView()) {
             $fields['_changes'] = self::arrayRightError();
         } else {
             $query = "SELECT " . Change::getCommonSelect() . "\n                            FROM `glpi_changes`\n                            LEFT JOIN `glpi_changes_items`\n                              ON (`glpi_changes`.`id` = `glpi_changes_items`.`problems_id`) " . Change::getCommonLeftJoin() . "\n                            WHERE `items_id` = '{$id}'\n                                  AND `itemtype` = '{$itemtype}' " . getEntitiesRestrictRequest("AND", "glpi_changes") . "\n                            ORDER BY `glpi_changes`.`date_mod` DESC";
             if ($result = $DB->query($query)) {
                 while ($data = $DB->fetch_assoc($result)) {
                     $fields['_changes'][] = $data;
                 }
开发者ID:glpi-project,项目名称:glpi,代码行数:67,代码来源:api.class.php

示例2: getItem


//.........这里部分代码省略.........
     }
     // retrieve item contracts
     if (isset($params['with_contracts']) && $params['with_contracts']) {
         $fields['_contracts'] = array();
         if (!Contract::canView()) {
             $fields['_contracts'] = self::arrayRightError();
         } else {
             $query = "SELECT `glpi_contracts_items`.*\n                     FROM `glpi_contracts_items`,\n                          `glpi_contracts`\n                     LEFT JOIN `glpi_entities` ON (`glpi_contracts`.`entities_id`=`glpi_entities`.`id`)\n                     WHERE `glpi_contracts`.`id`=`glpi_contracts_items`.`contracts_id`\n                           AND `glpi_contracts_items`.`items_id` = '{$id}'\n                           AND `glpi_contracts_items`.`itemtype` = '{$itemtype}'" . getEntitiesRestrictRequest(" AND", "glpi_contracts", '', '', true) . "\n                     ORDER BY `glpi_contracts`.`name`";
             if ($result = $DB->query($query)) {
                 while ($data = $DB->fetch_assoc($result)) {
                     $fields['_contracts'][] = $data;
                 }
             }
         }
     }
     // retrieve item contracts
     if (isset($params['with_documents']) && $params['with_documents']) {
         $fields['_documents'] = array();
         if (!$itemtype != 'Ticket' && $itemtype != 'KnowbaseItem' && $itemtype != 'Reminder' && !Document::canView()) {
             $fields['_documents'] = self::arrayRightError();
         } else {
             $query = "SELECT `glpi_documents_items`.`id` AS assocID,\n                             `glpi_documents_items`.`date_mod` AS assocdate,\n                             `glpi_entities`.`id` AS entityID,\n                             `glpi_entities`.`completename` AS entity,\n                             `glpi_documentcategories`.`completename` AS headings,\n                             `glpi_documents`.*\n                      FROM `glpi_documents_items`\n                      LEFT JOIN `glpi_documents`\n                                ON (`glpi_documents_items`.`documents_id`=`glpi_documents`.`id`)\n                      LEFT JOIN `glpi_entities` ON (`glpi_documents`.`entities_id`=`glpi_entities`.`id`)\n                      LEFT JOIN `glpi_documentcategories`\n                              ON (`glpi_documents`.`documentcategories_id`=`glpi_documentcategories`.`id`)\n                      WHERE `glpi_documents_items`.`items_id` = '{$id}'\n                            AND `glpi_documents_items`.`itemtype` = '{$itemtype}' ";
             if ($result = $DB->query($query)) {
                 while ($data = $DB->fetch_assoc($result)) {
                     $fields['_documents'][] = $data;
                 }
             }
         }
     }
     // retrieve item tickets
     if (isset($params['with_tickets']) && $params['with_tickets']) {
         $fields['_tickets'] = array();
         if (!Ticket::canView()) {
             $fields['_tickets'] = self::arrayRightError();
         } else {
             $query = "SELECT " . Ticket::getCommonSelect() . "\n                      FROM `glpi_tickets` " . Ticket::getCommonLeftJoin() . "\n                      WHERE `glpi_items_tickets`.`items_id` = '{$id}'\n                             AND `glpi_items_tickets`.`itemtype` = '{$itemtype}' " . getEntitiesRestrictRequest("AND", "glpi_tickets") . "\n                      ORDER BY `glpi_tickets`.`date_mod` DESC";
             if ($result = $DB->query($query)) {
                 while ($data = $DB->fetch_assoc($result)) {
                     $fields['_tickets'][] = $data;
                 }
             }
         }
     }
     // retrieve item problems
     if (isset($params['with_problems']) && $params['with_problems']) {
         $fields['_problems'] = array();
         if (!Problem::canView()) {
             $fields['_problems'] = self::arrayRightError();
         } else {
             $query = "SELECT " . Problem::getCommonSelect() . "\n                            FROM `glpi_problems`\n                            LEFT JOIN `glpi_items_problems`\n                              ON (`glpi_problems`.`id` = `glpi_items_problems`.`problems_id`) " . Problem::getCommonLeftJoin() . "\n                            WHERE `items_id` = '{$id}'\n                                  AND `itemtype` = '{$itemtype}' " . getEntitiesRestrictRequest("AND", "glpi_problems") . "\n                            ORDER BY `glpi_problems`.`date_mod` DESC";
             if ($result = $DB->query($query)) {
                 while ($data = $DB->fetch_assoc($result)) {
                     $fields['_problems'][] = $data;
                 }
             }
         }
     }
     // retrieve item changes
     if (isset($params['with_changes']) && $params['with_changes']) {
         $fields['_changes'] = array();
         if (!Change::canView()) {
             $fields['_changes'] = self::arrayRightError();
         } else {
             $query = "SELECT " . Change::getCommonSelect() . "\n                            FROM `glpi_changes`\n                            LEFT JOIN `glpi_changes_items`\n                              ON (`glpi_changes`.`id` = `glpi_changes_items`.`problems_id`) " . Change::getCommonLeftJoin() . "\n                            WHERE `items_id` = '{$id}'\n                                  AND `itemtype` = '{$itemtype}' " . getEntitiesRestrictRequest("AND", "glpi_changes") . "\n                            ORDER BY `glpi_changes`.`date_mod` DESC";
             if ($result = $DB->query($query)) {
                 while ($data = $DB->fetch_assoc($result)) {
                     $fields['_changes'][] = $data;
                 }
             }
         }
     }
     // retrieve item notes
     if (isset($params['with_notes']) && $params['with_notes']) {
         $fields['_notes'] = array();
         if (!Session::haveRight($itemtype::$rightname, READNOTE)) {
             $fields['_notes'] = self::arrayRightError();
         } else {
             $fields['_notes'] = Notepad::getAllForItem($itemtype);
         }
     }
     // retrieve item logs
     if (isset($params['with_logs']) && $params['with_logs']) {
         $fields['_logs'] = array();
         if (!Session::haveRight($itemtype::$rightname, READNOTE)) {
             $fields['_logs'] = self::arrayRightError();
         } else {
             $fields['_logs'] = getAllDatasFromTable("glpi_logs", "`items_id` = '" . $item->getID() . "'\n                                                    AND `itemtype` = '" . $item->getType() . "'");
         }
     }
     // expand dropdown (retrieve name of dropdowns) and get hateoas from foreign keys
     $fields = self::parseDropdowns($fields, $params);
     // get hateoas from children
     if ($params['get_hateoas']) {
         $hclasses = self::getHatoasClasses($itemtype);
         foreach ($hclasses as $hclass) {
             $fields['links'][] = array('rel' => $hclass, 'href' => self::$api_url . "/{$itemtype}/" . $item->getID() . "/{$hclass}/");
         }
     }
     return $fields;
 }
开发者ID:stweil,项目名称:glpi,代码行数:101,代码来源:api.class.php


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