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


PHP Acl::getUserGroups方法代码示例

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


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

示例1: copyElements

 protected function copyElements($elements, $dest_id, $position = null)
 {
     $counter = 0;
     foreach ($elements as $element) {
         if ($position !== null) {
             $dest_position = $position + $counter;
         } else {
             $dest_position = null;
         }
         $result = $this->pages->copy($element['id'], $dest_id, $dest_position);
         if ($result === false) {
             return false;
         }
         $newId = $result;
         $existing_acl_resource = Acl::getResourceData(Acl::RESOURCE_GROUP_PAGES, $element['id']);
         if ($existing_acl_resource !== false) {
             $new_acl_resource_id = Acl::registerResource(Acl::RESOURCE_GROUP_PAGES, $newId, $this->pages->getAnyCaption($result), $existing_acl_resource['user-groups-mode']);
             $user_groups = Acl::getUserGroups(Acl::RESOURCE_GROUP_PAGES, $element['id']);
             if ($user_groups !== false) {
                 Acl::assignUserGroupsById($new_acl_resource_id, $user_groups);
             }
         }
         $children = $this->pages->getChildren($element['id'], false);
         if ($children !== false) {
             if (count($children) > 0) {
                 if ($this->copyElements($children, $newId) === false) {
                     return false;
                 }
             }
         }
         $counter++;
     }
     return true;
 }
开发者ID:pixelproduction,项目名称:PixelManagerCMS,代码行数:34,代码来源:Pagetree.php

示例2: editAction

 public function editAction()
 {
     $pageId = Request::getParam('pageId', -1);
     if (is_array($pageId)) {
         $containsSubpages = false;
         if (count($pageId) > 0) {
             foreach ($pageId as $id) {
                 $properties = $this->pages->getProperties($id);
                 if ($properties === false) {
                     $this->doesNotExist();
                     return;
                 }
                 if (!$this->helpers->canAccessPage($id, Acl::ACTION_EDIT)) {
                     $this->accessDenied();
                     return;
                 }
                 $children = $this->pages->getChildren($id, false);
                 if ($children !== false) {
                     if (count($children) > 0) {
                         $containsSubpages = true;
                         break;
                     }
                 }
             }
         }
         $this->view->assign('batchEdit', true);
         $this->view->assign('pageIdList', $pageId);
         $caption = array();
         $alias = array();
         $visibility = array();
         $translated_link_urls = array();
         $languages = Config::get()->languages->list;
         foreach ($languages as $key => $language) {
             $caption[$key] = '';
             $alias[$key] = '';
             $visibility[$key] = 0;
             $translated_link_urls[$key] = '';
         }
         $properties = array('visibility' => Pages::VISIBILITY_ALWAYS, 'active' => 1, 'cachable' => 1, 'translated-link-url' => $translated_link_url);
         $aclResource = array('group' => Acl::RESOURCE_GROUP_PAGES, 'resource-id' => null, 'description' => null, 'user-groups-mode' => Acl::RESOURCE_SUPERUSER_ONLY);
         $aclUserGroups = array();
         $this->view->assign('action', 'edit');
         $this->view->assign('caption', $caption);
         $this->view->assign('alias', $alias);
         $this->view->assign('visibility', $visibility);
         $this->view->assign('translatedLinkUrls', $translated_link_urls);
         $this->view->assign('properties', $properties);
         $this->view->assign('inheritAcl', true);
         $this->view->assign('aclResource', $aclResource);
         $this->view->assign('aclUserGroups', $aclUserGroups);
         $this->view->assign('containsSubpages', $containsSubpages);
     } else {
         if ($pageId > -1) {
             $properties = $this->pages->getProperties($pageId);
             if ($properties === false) {
                 $this->doesNotExist();
                 return;
             }
             if (!$this->helpers->canAccessPage($pageId, Acl::ACTION_EDIT)) {
                 $this->accessDenied();
                 return;
             }
             $this->view->assign('action', 'edit');
             $this->view->assign('batchEdit', false);
             $this->view->assign('pageId', $pageId);
             $this->view->assign('caption', $this->pages->getCaption($pageId));
             $this->view->assign('alias', $this->pages->getPageAliases($pageId));
             $this->view->assign('visibility', $this->pages->getVisibility($pageId));
             $this->view->assign('translatedLinkUrls', $this->pages->getTranslatedLinkUrls($pageId));
             $this->view->assign('properties', $properties);
             $aclResource = Acl::getResourceData(Acl::RESOURCE_GROUP_PAGES, $pageId);
             if ($aclResource === false) {
                 $this->view->assign('inheritAcl', true);
                 $aclResource = array('group' => Acl::RESOURCE_GROUP_PAGES, 'resource-id' => null, 'description' => null, 'user-groups-mode' => Acl::RESOURCE_SUPERUSER_ONLY);
                 $aclUserGroups = array();
             } else {
                 $this->view->assign('inheritAcl', false);
                 $aclUserGroups = Acl::getUserGroups(Acl::RESOURCE_GROUP_PAGES, $pageId);
             }
             $this->view->assign('aclResource', $aclResource);
             $this->view->assign('aclUserGroups', $aclUserGroups);
             $containsSubpages = false;
             $children = $this->pages->getChildren($pageId, false);
             if ($children !== false) {
                 if (count($children) > 0) {
                     $containsSubpages = true;
                 }
             }
             $this->view->assign('containsSubpages', $containsSubpages);
         } else {
             $this->createAction();
         }
     }
 }
开发者ID:pixelproduction,项目名称:PixelManagerCMS,代码行数:94,代码来源:Pageproperties.php


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