• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP getRoleConfigMap函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中getRoleConfigMap函数的典型用法代码示例。如果您正苦于以下问题:PHP getRoleConfigMap函数的具体用法?PHP getRoleConfigMap怎么用?PHP getRoleConfigMap使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: getImageUrlByRoleId

 /**
  * 根据角色获取默认头像
  * @param $role_id
  * @param $size
  * @return mixed|string
  * @author 郑钟良<[email protected]>
  */
 private function getImageUrlByRoleId($role_id, $size)
 {
     $avatar_id = S('Role_Avatar_Id_' . $role_id);
     if (!$avatar_id) {
         $map = getRoleConfigMap('avatar', $role_id);
         $avatar_id = M('RoleConfig')->where($map)->field('value')->find();
         S('Role_Avatar_Id_' . $role_id, $avatar_id, 600);
     }
     if ($avatar_id) {
         if ($size != 0) {
             $path = getThumbImageById($avatar_id['value'], $size, $size);
         } else {
             $path = getThumbImageById($avatar_id['value']);
         }
     } else {
         //角色没有默认
         if ($size != 0) {
             $default_avatar = "Public/images/default_avatar.jpg";
             $path = $this->getImageUrlByPath($default_avatar, $size, false);
         } else {
             $path = get_pic_src("Public/images/default_avatar.jpg");
         }
     }
     return $path;
 }
开发者ID:terrydeng,项目名称:beimeibang1205,代码行数:32,代码来源:UploadAvatarWidget.class.php


示例2: getRoleFieldIds

 private function getRoleFieldIds($uid = null)
 {
     $role_id = get_role_id($uid);
     $fields_list = S('Role_Expend_Info_' . $role_id);
     if (!$fields_list) {
         $map_role_config = getRoleConfigMap('expend_field', $role_id);
         $fields_list = D('RoleConfig')->where($map_role_config)->getField('value');
         if ($fields_list) {
             $fields_list = explode(',', $fields_list);
             S('Role_Expend_Info_' . $role_id, $fields_list, 600);
         }
     }
     return $fields_list;
 }
开发者ID:smartymoon,项目名称:e-anjia,代码行数:14,代码来源:ConfigController.class.php


示例3: _setFieldRole

 /**
  * 重新设置拥有字段的身份
  * @param $role_ids 身份ids
  * @param $add_id 新增字段时字段id
  * @param $edit_id 编辑字段时字段id
  * @return bool
  * @author 郑钟良<[email protected]>
  */
 private function _setFieldRole($role_ids, $add_id, $edit_id)
 {
     $type = 'expend_field';
     $roleConfigModel = D('RoleConfig');
     $map = getRoleConfigMap($type, 0);
     if ($edit_id) {
         //编辑字段
         unset($map['role_id']);
         $map['value'] = array('like', array('%,' . $edit_id . ',%', $edit_id . ',%', '%,' . $edit_id, $edit_id), 'or');
         $already_role_id = $roleConfigModel->where($map)->select();
         $already_role_id = array_column($already_role_id, 'role_id');
         unset($map['value']);
         if (count($role_ids) && count($already_role_id)) {
             $need_add_role_ids = array_diff($role_ids, $already_role_id);
             $need_del_role_ids = array_diff($already_role_id, $role_ids);
         } else {
             if (count($role_ids)) {
                 $need_add_role_ids = $role_ids;
             } else {
                 $need_del_role_ids = $already_role_id;
             }
         }
         foreach ($need_add_role_ids as $val) {
             $map['role_id'] = $val;
             $oldConfig = $roleConfigModel->where($map)->find();
             if (count($oldConfig)) {
                 $oldConfig['value'] = implode(',', array_merge(explode(',', $oldConfig['value']), array($edit_id)));
                 $roleConfigModel->saveData($map, $oldConfig);
             } else {
                 $data = $map;
                 $data['value'] = $edit_id;
                 $roleConfigModel->addData($data);
             }
         }
         foreach ($need_del_role_ids as $val) {
             $map['role_id'] = $val;
             $oldConfig = $roleConfigModel->where($map)->find();
             $oldConfig['value'] = array_diff(explode(',', $oldConfig['value']), array($edit_id));
             if (count($oldConfig['value'])) {
                 $oldConfig['value'] = implode(',', $oldConfig['value']);
                 $roleConfigModel->saveData($map, $oldConfig);
             } else {
                 $roleConfigModel->deleteData($map);
             }
         }
     } else {
         //新增字段
         foreach ($role_ids as $val) {
             $map['role_id'] = $val;
             $oldConfig = $roleConfigModel->where($map)->find();
             if (count($oldConfig)) {
                 $oldConfig['value'] = implode(',', array_unique(array_merge(explode(',', $oldConfig['value']), array($add_id))));
                 $roleConfigModel->saveData($map, $oldConfig);
             } else {
                 $data = $map;
                 $data['value'] = $add_id;
                 $roleConfigModel->addData($data);
             }
         }
     }
     return true;
 }
开发者ID:naliduo,项目名称:Lightweight-social-platform,代码行数:70,代码来源:UserController.class.php


示例4: setMap

 private function setMap()
 {
     $aTag = I('tag', 0, 'intval');
     $aRole = I('role', 0, 'intval');
     $role_list = modC('SHOW_ROLE_TAB', '', 'People');
     if ($role_list != '') {
         $role_list = json_decode($role_list, true);
         $role_list = $role_list[1]['items'];
         if (count($role_list)) {
             foreach ($role_list as &$val) {
                 $val['id'] = $val['data-id'];
             }
             unset($val);
             $this->assign('role_list', $role_list);
         } else {
             $aRole = 0;
         }
     } else {
         $aRole = 0;
     }
     $map = array();
     if ($aTag && $aRole) {
         //同时选择标签和身份
         !isset($_GET['tag']) && ($_GET['tag'] = $_POST['tag']);
         $map_uids['tags'] = array('like', '%[' . $aTag . ']%');
         $tag_links = M('Ucenter/UserTagLink')->getListByMap($map_uids);
         $tag_uids = array_column($tag_links, 'uid');
         $this->assign('tag_id', $aTag);
         !isset($_GET['role']) && ($_GET['role'] = $_POST['role']);
         $map_role['role_id'] = $aRole;
         $map_role['status'] = 1;
         $role_links = D('UserRole')->where($map_role)->limit(999)->field('uid')->select();
         $role_uids = array_column($role_links, 'uid');
         $this->assign('role_id', $aRole);
         if ($tag_uids && $role_uids) {
             $uids = array_intersect($tag_uids, $role_uids);
         } else {
             $uids = array();
         }
         $map['uid'] = array('in', $uids);
     } else {
         if ($aTag) {
             //选择标签,没选择身份
             !isset($_GET['tag']) && ($_GET['tag'] = $_POST['tag']);
             $map_uids['tags'] = array('like', '%[' . $aTag . ']%');
             $tag_links = M('Ucenter/UserTagLink')->getListByMap($map_uids);
             $tag_uids = array_column($tag_links, 'uid');
             $map['uid'] = array('in', $tag_uids);
             $this->assign('tag_id', $aTag);
         } else {
             if ($aRole) {
                 //选择身份,没选择标签
                 !isset($_GET['role']) && ($_GET['role'] = $_POST['role']);
                 $map_role['role_id'] = $aRole;
                 $map_role['status'] = 1;
                 $role_links = D('UserRole')->where($map_role)->limit(999)->field('uid')->select();
                 $role_uids = array_column($role_links, 'uid');
                 $map['uid'] = array('in', $role_uids);
                 $this->assign('role_id', $aRole);
             }
         }
     }
     $userTagModel = M('Ucenter/UserTag');
     if ($aRole) {
         $map_tags = getRoleConfigMap('user_tag', $aRole);
         $can_config = D('RoleConfig')->where($map_tags)->field('value')->find();
         if ($can_config['value'] != '') {
             $tag_list = $userTagModel->getTreeListByIds($can_config['value']);
         } else {
             $tag_list = null;
         }
     } else {
         $tag_list = $userTagModel->getTreeList();
     }
     $this->assign('tag_list', $tag_list);
     $nickname = I('keywords', '', 'op_t');
     if ($nickname != '') {
         !isset($_GET['keywords']) && ($_GET['keywords'] = $_POST['keywords']);
         $map['nickname'] = array('like', '%' . $nickname . '%');
         $this->assign('nickname', $nickname);
     }
     return $map;
 }
开发者ID:terrydeng,项目名称:beimeibang1205,代码行数:83,代码来源:IndexController.class.php


示例5: configField

 /**
  * 身份扩展资料配置 及 注册时要填写的资料配置
  * @author 郑钟良<[email protected]>
  */
 public function configField()
 {
     $aRoleId = I('id', 0, 'intval');
     if (!$aRoleId) {
         $this->error(L('_PLEASE_CHOOSE_YOUR_IDENTITY_'));
     }
     $aType = I('get.type', 0, 'intval');
     //扩展资料设置类型:1注册时要填写资料配置,0扩展资料字段设置
     if ($aType) {
         //注册时要填写资料配置
         $type = 'register_expend_field';
     } else {
         //扩展资料字段设置
         $type = 'expend_field';
     }
     $map = getRoleConfigMap($type, $aRoleId);
     if (IS_POST) {
         $data['value'] = '';
         if (isset($_POST['fields'])) {
             sort($_POST['fields']);
             $data['value'] = implode(',', array_unique($_POST['fields']));
         }
         if ($this->roleConfigModel->where($map)->find()) {
             $result = $this->roleConfigModel->saveData($map, $data);
         } else {
             $data = array_merge($map, $data);
             $result = $this->roleConfigModel->addData($data);
         }
         if ($result === false) {
             $this->error(L('_FAILED_') . $this->roleConfigModel->getError());
         } else {
             clear_role_cache($aRoleId);
             $this->success(L('_OPERATION_SUCCESS_'));
         }
     } else {
         $aType = I('get.type', 0, 'intval');
         //扩展资料设置类型:1注册时要填写资料配置,0扩展资料字段设置
         $mRole_list = $this->roleModel->field('id,title')->select();
         $fields = $this->roleConfigModel->where($map)->getField('value');
         if ($aType == 1) {
             //注册时要填写资料配置
             $map_fields = getRoleConfigMap('expend_field', $aRoleId);
             $expend_fields = $this->roleConfigModel->where($map_fields)->getField('value');
             $field_list = $expend_fields ? $this->getExpendField($expend_fields) : array();
             $this->meta_title = L('_REGISTRATION_TO_FILL_IN_THE_DATA_CONFIGURATION_');
             $tpl = 'fieldregister';
             //模板地址
             $tab = 'fieldRegister';
         } else {
             //扩展资料字段设置
             $field_list = $this->getExpendField();
             $this->meta_title = L('_EXTENDED_DATA_FIELD_SETTINGS_');
             $tpl = 'field';
             //模板地址
             $tab = 'field';
         }
         $this->assign('field_list', $field_list);
         $this->assign('role_list', $mRole_list);
         $this->assign('this_role', array('id' => $aRoleId, 'fields' => $fields));
         $this->assign('tab', $tab);
         $this->display($tpl);
     }
 }
开发者ID:naliduo,项目名称:Lightweight-social-platform,代码行数:67,代码来源:RoleController.class.php


示例6: configField

 /**
  * 角色扩展资料配置 及 注册时要填写的资料配置
  * @author 郑钟良<[email protected]>
  */
 public function configField()
 {
     $aRoleId = I('id', 0, 'intval');
     if (!$aRoleId) {
         $this->error('请选择角色!');
     }
     $aType = I('get.type', 0, 'intval');
     //扩展资料设置类型:1注册时要填写资料配置,0扩展资料字段设置
     if ($aType) {
         //注册时要填写资料配置
         $type = 'register_expend_field';
     } else {
         //扩展资料字段设置
         $type = 'expend_field';
     }
     $map = getRoleConfigMap($type, $aRoleId);
     if (IS_POST) {
         $data['value'] = '';
         if (isset($_POST['fields'])) {
             sort($_POST['fields']);
             $data['value'] = implode(',', array_unique($_POST['fields']));
         }
         if ($this->roleConfigModel->where($map)->find()) {
             $result = $this->roleConfigModel->saveData($map, $data);
         } else {
             $data = array_merge($map, $data);
             $result = $this->roleConfigModel->addData($data);
         }
         if ($result === false) {
             $this->error('操作失败' . $this->roleConfigModel->getError());
         } else {
             clear_role_cache($aRoleId);
             $this->success('操作成功!');
         }
     } else {
         $aType = I('get.type', 0, 'intval');
         //扩展资料设置类型:1注册时要填写资料配置,0扩展资料字段设置
         $mRole_list = $this->roleModel->field('id,title')->select();
         $fields = $this->roleConfigModel->where($map)->getField('value');
         if ($aType == 1) {
             //注册时要填写资料配置
             $map_fields = getRoleConfigMap('expend_field', $aRoleId);
             $expend_fields = $this->roleConfigModel->where($map_fields)->getField('value');
             $field_list = $expend_fields ? $this->getExpendField($expend_fields) : array();
             $this->meta_title = '注册时要填写资料配置';
             $tpl = 'fieldregister';
             //模板地址
             $tab = 'fieldRegister';
         } else {
             //扩展资料字段设置
             $field_list = $this->getExpendField();
             $this->meta_title = '扩展资料字段设置';
             $tpl = 'field';
             //模板地址
             $tab = 'field';
         }
         $this->assign('field_list', $field_list);
         $this->assign('role_list', $mRole_list);
         $this->assign('this_role', array('id' => $aRoleId, 'fields' => $fields));
         $this->assign('tab', $tab);
         $this->display($tpl);
     }
 }
开发者ID:qimeijun,项目名称:OCenter,代码行数:67,代码来源:RoleController.class.php


示例7: getRoleFieldIds

 private function getRoleFieldIds($uid = null)
 {
     $role_id = session('temp_login_role_id') ? session('temp_login_role_id') : get_role_id($uid);
     $fields_list = S('Role_Register_Expend_Info_' . $role_id);
     if (!$fields_list) {
         $map_role_config = getRoleConfigMap('register_expend_field', $role_id);
         $fields_list = M('RoleConfig')->where($map_role_config)->getField('value');
         if ($fields_list) {
             $fields_list = explode(',', $fields_list);
             S('Role_Register_Expend_Info_' . $role_id, $fields_list, 600);
         }
     }
     return $fields_list;
 }
开发者ID:terrydeng,项目名称:beimeibang1205,代码行数:14,代码来源:RegStepWidget.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP getRoleInformation函数代码示例发布时间:2022-05-15
下一篇:
PHP getRoleCategory函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap