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


PHP Publisher::getPermissionHandler方法代码示例

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


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

示例1: CriteriaCompo

 /**
  * Get all subcats and put them in an array indexed by parent id
  *
  * @param array $categories
  *
  * @return array
  */
 public function &getSubCats($categories)
 {
     $xoops = Xoops::getInstance();
     $criteria = new CriteriaCompo(new Criteria('parentid', "(" . implode(',', array_keys($categories)) . ")", 'IN'));
     $ret = array();
     if (!PublisherUtils::IsUserAdmin()) {
         $categoriesGranted = $this->publisher->getPermissionHandler()->getGrantedItems('category_read');
         if (count($categoriesGranted) > 0) {
             $criteria->add(new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'));
         } else {
             return $ret;
         }
         if ($xoops->isUser()) {
             $criteria->add(new Criteria('moderator', $xoops->user->getVar('uid')), 'OR');
         }
     }
     $criteria->setSort('weight');
     $criteria->setOrder('ASC');
     $subcats = $this->getObjects($criteria, true);
     /* @var $subcat PublisherCategory */
     foreach ($subcats as $subcat) {
         $ret[$subcat->getVar('parentid')][$subcat->getVar('categoryid')] = $subcat;
     }
     return $ret;
 }
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:32,代码来源:category.php

示例2: getItems

 /**
  * @param int    $limit
  * @param int    $start
  * @param string $status
  * @param  int   $categoryid
  * @param string $sort
  * @param string $order
  * @param string $notNullFields
  * @param bool   $asobject
  * @param null   $otherCriteria
  * @param string $id_key
  *
  * @return array
  */
 public function getItems($limit = 0, $start = 0, $status = '', $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = '', $asobject = true, $otherCriteria = null, $id_key = 'none')
 {
     global $publisher_isAdmin;
     if (!$publisher_isAdmin) {
         $criteriaPermissions = new CriteriaCompo();
         // Categories for which user has access
         $categoriesGranted = $this->publisher->getPermissionHandler()->getGrantedItems('category_read');
         if (!empty($categoriesGranted)) {
             $grantedCategories = new Criteria('categoryid', "(" . implode(',', $categoriesGranted) . ")", 'IN');
             $criteriaPermissions->add($grantedCategories, 'AND');
         } else {
             return array();
         }
     }
     if (isset($categoryid) && $categoryid != -1) {
         $criteriaCategory = new criteria('categoryid', $categoryid);
     }
     if (!empty($status) && is_array($status)) {
         $criteriaStatus = new CriteriaCompo();
         foreach ($status as $v) {
             $criteriaStatus->add(new Criteria('status', $v), 'OR');
         }
     } elseif (!empty($status) && $status != -1) {
         $criteriaStatus = new CriteriaCompo();
         $criteriaStatus->add(new Criteria('status', $status), 'OR');
     }
     $criteria = new CriteriaCompo();
     if (!empty($criteriaCategory)) {
         $criteria->add($criteriaCategory);
     }
     if (!empty($criteriaPermissions)) {
         $criteria->add($criteriaPermissions);
     }
     if (!empty($criteriaStatus)) {
         $criteria->add($criteriaStatus);
     }
     if (!empty($otherCriteria)) {
         $criteria->add($otherCriteria);
     }
     $criteria->setLimit($limit);
     $criteria->setStart($start);
     $criteria->setSort($sort);
     $criteria->setOrder($order);
     $ret = $this->getItemObjects($criteria, $id_key, $notNullFields);
     return $ret;
 }
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:60,代码来源:item.php


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