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


PHP Role::builtInRoles方法代码示例

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


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

示例1: rightsForOperation

 protected function rightsForOperation($operation, $is_deny = 0)
 {
     $params = array('aco_class' => $this->objects[0], 'aco_key' => !empty($this->objects[1]) ? $this->objects[1] : '', 'aco_value' => !empty($this->objects[2]) ? $this->objects[2] : '', 'action' => $operation);
     $items = AccessItem::model()->findAllByAttributes($params);
     $data = array();
     foreach ($items as $item) {
         if ($item['aro_class']) {
             $data[] = array('id' => $item->getAroId(), 'text' => $item->getAroText());
         }
     }
     $extraResults = array();
     $buildInRoles = Role::builtInRoles();
     foreach ($buildInRoles as $roleName => $roleTitle) {
         $extraResults['User:roles:' . $roleName] = $roleTitle;
     }
     return $this->widget('Select2', array('name' => $this->htmlOptions['name'] . '[' . $operation . ']', 'id' => $this->htmlOptions['id'] . '_' . $operation, 'data' => $data, 'htmlOptions' => array('class' => 'rightsselect', 'data-aco_class' => $params['aco_class'], 'data-aco_key' => $params['aco_key'], 'data-aco_value' => $params['aco_value'], 'data-operation' => $params['action'], 'data-is_deny' => $is_deny), 'classNames' => array(array('User', 'User:id:', 'id', 'email,login,displayname'), array('User', 'User:roles:', '_roles.name', 'title'), $extraResults)), true);
 }
开发者ID:rosko,项目名称:Tempo-CMS,代码行数:17,代码来源:AccessRights.php

示例2: form

 public function form()
 {
     $timezoneList = timezone_identifiers_list();
     sort($timezoneList);
     $timezoneList = array_combine($timezoneList, $timezoneList);
     // Общие настроки
     $ret = array('elements' => array(Form::tab(Yii::t('cms', 'General settings')), 'sitename' => array('type' => 'text', 'size' => 60), 'adminEmail' => array('type' => 'text', 'size' => 60), 'language' => array('type' => 'LanguageSelect', 'empty' => null), 'timezone' => array('type' => 'dropdownlist', 'items' => $timezoneList), 'autoSave' => array('type' => 'checkbox'), 'slugTransliterate' => array('type' => 'checkbox'), 'slugLowercase' => array('type' => 'checkbox'), 'pageOnError403' => array('type' => 'PageSelect'), 'pageOnError404' => array('type' => 'PageSelect'), Form::tab(Yii::t('cms', 'Appearance')), 'theme' => array('type' => 'ThemeSelect', 'empty' => null), 'defaultsPerPage' => array('type' => 'Slider', 'options' => array('min' => 1, 'max' => 50)), 'showWidgetAppearance' => array('type' => 'checkbox'), 'ajaxPager' => array('type' => 'checkbox'), 'ajaxPagerScroll' => array('type' => 'checkbox'), Form::tab(Yii::t('cms', 'Users')), 'defaultsShowEmail' => array('type' => 'dropdownlist', 'items' => Role::builtInRoles()), 'defaultsSendMessage' => array('type' => 'dropdownlist', 'items' => Role::builtInRoles()), 'userExtraFields' => array('type' => 'FieldSet'), Form::tab(Yii::t('cms', 'Performance')), 'cacheTime' => array('type' => 'Slider', 'options' => array('min' => 0, 'max' => 3600, 'step' => 60), 'hint' => Yii::t('cms', 'in seconds, 0 = off, 3600 - one hour'))));
     // Настройки для юнитов
     $units = ContentUnit::getInstalledUnits();
     $ret['elements'][] = Form::tab(Yii::t('cms', 'Units settings'));
     foreach ($units as $unitClass) {
         if (method_exists($unitClass, 'settings')) {
             $elems = call_user_func(array($unitClass, 'settings'), $unitClass);
             if (is_array($elems) && !empty($elems)) {
                 $ret['elements'][] = Form::section(call_user_func(array($unitClass, 'name')));
                 foreach ($elems as $k => $elem) {
                     $ret['elements'][$unitClass . '.' . $k] = $elem;
                 }
             }
         }
     }
     return self::localizedForm($ret);
 }
开发者ID:rosko,项目名称:Tempo-CMS,代码行数:23,代码来源:SiteSettingsForm.php

示例3: getFewRecordsTitle

 public function getFewRecordsTitle($attrName, $attrValue)
 {
     if ($attrName == 'roles') {
         $builtInRoles = Role::builtInRoles();
         if (isset($builtInRoles[$attrValue])) {
             return $builtInRoles[$attrValue];
         } else {
             $role = Role::model()->findByAttributes(array('name' => $attrValue));
             if ($role) {
                 return $role->title;
             } else {
                 return parent::getFewRecordsTitle($attrName, $attrValue);
             }
         }
     } elseif ($attrName == 'login') {
         $user = User::getByLogin($attrValue);
         if ($user) {
             return $user->getFullname();
         } else {
             return parent::getFewRecordsTitle($attrName, $attrValue);
         }
     } else {
         return parent::getFewRecordsTitle($attrName, $attrValue);
     }
 }
开发者ID:rosko,项目名称:Tempo-CMS,代码行数:25,代码来源:User.php


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