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


PHP RSSFeed::addVisibilityRestrict方法代码示例

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


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

示例1: addDefaultWhere

 /**
  * Generic Function to add default where to a request
  *
  * @param $itemtype device type
  *
  * @return select string
  **/
 static function addDefaultWhere($itemtype)
 {
     global $CFG_GLPI;
     switch ($itemtype) {
         case 'Reminder':
             return Reminder::addVisibilityRestrict();
         case 'RSSFeed':
             return RSSFeed::addVisibilityRestrict();
         case 'Notification':
             if (!Config::canView()) {
                 return " `glpi_notifications`.`itemtype` NOT IN ('Crontask', 'DBConnection') ";
             }
             break;
             // No link
         // No link
         case 'User':
             // View all entities
             if (Session::isViewAllEntities()) {
                 return "";
             }
             return getEntitiesRestrictRequest("", "glpi_profiles_users");
         case 'ProjectTask':
             $condition = '';
             $teamtable = 'glpi_projecttaskteams';
             $condition .= "((`{$teamtable}`.`itemtype` = 'User'\n                             AND `{$teamtable}`.`items_id` = '" . Session::getLoginUserID() . "')";
             if (count($_SESSION['glpigroups'])) {
                 $condition .= " OR (`{$teamtable}`.`itemtype` = 'Group'\n                                    AND `{$teamtable}`.`items_id`\n                                       IN (" . implode(",", $_SESSION['glpigroups']) . "))";
             }
             $condition .= ") ";
             return $condition;
         case 'Project':
             $condition = '';
             if (!Session::haveRight("project", Project::READALL)) {
                 $teamtable = 'glpi_projectteams';
                 $condition .= "(`glpi_projects`.users_id = '" . Session::getLoginUserID() . "'\n                               OR (`{$teamtable}`.`itemtype` = 'User'\n                                   AND `{$teamtable}`.`items_id` = '" . Session::getLoginUserID() . "')";
                 if (count($_SESSION['glpigroups'])) {
                     $condition .= " OR (`glpi_projects`.`groups_id`\n                                       IN (" . implode(",", $_SESSION['glpigroups']) . "))";
                     $condition .= " OR (`{$teamtable}`.`itemtype` = 'Group'\n                                      AND `{$teamtable}`.`items_id`\n                                          IN (" . implode(",", $_SESSION['glpigroups']) . "))";
                 }
                 $condition .= ") ";
             }
             return $condition;
         case 'Ticket':
             // Same structure in addDefaultJoin
             $condition = '';
             if (!Session::haveRight("ticket", Ticket::READALL)) {
                 $searchopt =& self::getOptions($itemtype);
                 $requester_table = '`glpi_tickets_users_' . self::computeComplexJoinID($searchopt[4]['joinparams']['beforejoin']['joinparams']) . '`';
                 $requestergroup_table = '`glpi_groups_tickets_' . self::computeComplexJoinID($searchopt[71]['joinparams']['beforejoin']['joinparams']) . '`';
                 $assign_table = '`glpi_tickets_users_' . self::computeComplexJoinID($searchopt[5]['joinparams']['beforejoin']['joinparams']) . '`';
                 $assigngroup_table = '`glpi_groups_tickets_' . self::computeComplexJoinID($searchopt[8]['joinparams']['beforejoin']['joinparams']) . '`';
                 $observer_table = '`glpi_tickets_users_' . self::computeComplexJoinID($searchopt[66]['joinparams']['beforejoin']['joinparams']) . '`';
                 $observergroup_table = '`glpi_groups_tickets_' . self::computeComplexJoinID($searchopt[65]['joinparams']['beforejoin']['joinparams']) . '`';
                 $condition = "(";
                 if (Session::haveRight("ticket", Ticket::READMY)) {
                     $condition .= " {$requester_table}.users_id = '" . Session::getLoginUserID() . "'\n                                    OR {$observer_table}.users_id = '" . Session::getLoginUserID() . "'\n                                    OR `glpi_tickets`.`users_id_recipient` = '" . Session::getLoginUserID() . "'";
                 } else {
                     $condition .= "0=1";
                 }
                 if (Session::haveRight("ticket", Ticket::READGROUP)) {
                     if (count($_SESSION['glpigroups'])) {
                         $condition .= " OR {$requestergroup_table}.`groups_id`\n                                             IN (" . implode(",", $_SESSION['glpigroups']) . ")";
                         $condition .= " OR {$observergroup_table}.`groups_id`\n                                             IN (" . implode(",", $_SESSION['glpigroups']) . ")";
                     }
                 }
                 if (Session::haveRight("ticket", Ticket::OWN)) {
                     // Can own ticket : show assign to me
                     $condition .= " OR {$assign_table}.users_id = '" . Session::getLoginUserID() . "' ";
                 }
                 if (Session::haveRight("ticket", Ticket::READASSIGN)) {
                     // assign to me
                     $condition .= " OR {$assign_table}.`users_id` = '" . Session::getLoginUserID() . "'";
                     if (count($_SESSION['glpigroups'])) {
                         $condition .= " OR {$assigngroup_table}.`groups_id`\n                                             IN (" . implode(",", $_SESSION['glpigroups']) . ")";
                     }
                     if (Session::haveRight('ticket', Ticket::ASSIGN)) {
                         $condition .= " OR `glpi_tickets`.`status`='" . CommonITILObject::INCOMING . "'";
                     }
                 }
                 if (Session::haveRightsOr('ticketvalidation', array(TicketValidation::VALIDATEINCIDENT, TicketValidation::VALIDATEREQUEST))) {
                     $condition .= " OR `glpi_ticketvalidations`.`users_id_validate`\n                                          = '" . Session::getLoginUserID() . "'";
                 }
                 $condition .= ") ";
             }
             return $condition;
         case 'Change':
         case 'Problem':
             if ($itemtype == 'Change') {
                 $right = 'change';
                 $table = 'changes';
                 $groupetable = "`glpi_changes_groups_";
             } else {
                 if ($itemtype == 'Problem') {
//.........这里部分代码省略.........
开发者ID:jose-martins,项目名称:glpi,代码行数:101,代码来源:search.class.php

示例2: addDefaultWhere

 /**
  * Generic Function to add default where to a request
  *
  * @param $itemtype device type
  *
  * @return select string
  **/
 static function addDefaultWhere($itemtype)
 {
     global $CFG_GLPI;
     switch ($itemtype) {
         case 'Reminder':
             return Reminder::addVisibilityRestrict();
         case 'RSSFeed':
             return RSSFeed::addVisibilityRestrict();
         case 'Notification':
             if (!Session::haveRight('config', CREATE)) {
                 return " `glpi_notifications`.`itemtype` NOT IN ('Crontask', 'DBConnection') ";
             }
             break;
             // No link
         // No link
         case 'User':
             // View all entities
             if (Session::isViewAllEntities()) {
                 return "";
             }
             return getEntitiesRestrictRequest("", "glpi_profiles_users");
         case 'Ticket':
             // Same structure in addDefaultJoin
             $condition = '';
             // if (!Session::haveRight("show_all_ticket","1")) {
             if (!Session::haveRight("ticket", Ticket::READALL)) {
                 $searchopt =& self::getOptions($itemtype);
                 $requester_table = '`glpi_tickets_users_' . self::computeComplexJoinID($searchopt[4]['joinparams']['beforejoin']['joinparams']) . '`';
                 $requestergroup_table = '`glpi_groups_tickets_' . self::computeComplexJoinID($searchopt[71]['joinparams']['beforejoin']['joinparams']) . '`';
                 $assign_table = '`glpi_tickets_users_' . self::computeComplexJoinID($searchopt[5]['joinparams']['beforejoin']['joinparams']) . '`';
                 $assigngroup_table = '`glpi_groups_tickets_' . self::computeComplexJoinID($searchopt[8]['joinparams']['beforejoin']['joinparams']) . '`';
                 $observer_table = '`glpi_tickets_users_' . self::computeComplexJoinID($searchopt[66]['joinparams']['beforejoin']['joinparams']) . '`';
                 $observergroup_table = '`glpi_groups_tickets_' . self::computeComplexJoinID($searchopt[65]['joinparams']['beforejoin']['joinparams']) . '`';
                 $condition = "(";
                 $condition .= " {$requester_table}.users_id = '" . Session::getLoginUserID() . "'\n                              OR {$observer_table}.users_id = '" . Session::getLoginUserID() . "'\n                              OR `glpi_tickets`.`users_id_recipient` = '" . Session::getLoginUserID() . "' ";
                 if (Session::haveRight("show_group_ticket", 1)) {
                     if (count($_SESSION['glpigroups'])) {
                         $condition .= " OR {$requestergroup_table}.`groups_id`\n                                             IN ('" . implode("','", $_SESSION['glpigroups']) . "')";
                         $condition .= " OR {$observergroup_table}.`groups_id`\n                                             IN ('" . implode("','", $_SESSION['glpigroups']) . "')";
                     }
                 }
                 if (Session::haveRight("own_ticket", "1")) {
                     // Can own ticket : show assign to me
                     $condition .= " OR {$assign_table}.users_id = '" . Session::getLoginUserID() . "' ";
                 }
                 if (Session::haveRight("show_assign_ticket", "1")) {
                     // show mine + assign to me
                     $condition .= " OR {$assign_table}.`users_id` = '" . Session::getLoginUserID() . "'";
                     if (count($_SESSION['glpigroups'])) {
                         $condition .= " OR {$assigngroup_table}.`groups_id`\n                                             IN ('" . implode("','", $_SESSION['glpigroups']) . "')";
                     }
                     if (Session::haveRight('assign_ticket', 1)) {
                         $condition .= " OR `glpi_tickets`.`status`='" . CommonITILObject::INCOMING . "'";
                     }
                 }
                 if (Session::haveRight('validate_incident', 1) || Session::haveRight('validate_request', 1)) {
                     $condition .= " OR `glpi_ticketvalidations`.`users_id_validate`\n                                          = '" . Session::getLoginUserID() . "'";
                 }
                 $condition .= ") ";
             }
             return $condition;
         default:
             // Plugin can override core definition for its type
             if ($plug = isPluginItemType($itemtype)) {
                 $function = 'plugin_' . $plug['plugin'] . '_addDefaultWhere';
                 if (function_exists($function)) {
                     $out = $function($itemtype);
                     if (!empty($out)) {
                         return $out;
                     }
                 }
             }
             return "";
     }
 }
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:82,代码来源:searcha.class.php


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