本文整理汇总了PHP中Admin\Builder\AdminConfigBuilder::keyId方法的典型用法代码示例。如果您正苦于以下问题:PHP AdminConfigBuilder::keyId方法的具体用法?PHP AdminConfigBuilder::keyId怎么用?PHP AdminConfigBuilder::keyId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Admin\Builder\AdminConfigBuilder
的用法示例。
在下文中一共展示了AdminConfigBuilder::keyId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
/**
* 编辑公告
* @author 郑钟良<zzl@ourstu.com>
*/
public function edit()
{
$aId = I('id', 0, 'intval');
$title = $aId ? "编辑" : "新增";
if (IS_POST) {
$aId && ($data['id'] = $aId);
$data['title'] = I('post.title', '', 'op_t');
$data['icon'] = I('post.icon', 'icon-star', 'op_t');
$data['link'] = I('post.link');
if (mb_strlen($data['link'], 'utf-8') && !in_array(strtolower(substr($data['link'], 0, 6)), array('http:/', 'https:', 'ftp://', 'rtsp:/', 'mms://'))) {
$data['link'] = 'http://' . $data['link'];
}
$data['content'] = I('post.content', '', 'op_t');
$data['end_time'] = intval(I('post.end_time'));
$result = $this->announcementModel->editData($data);
if ($result) {
S('Announcement_list', null);
//清空缓存
$this->success($title . '公告成功!', addons_url('Announcement://admin/buildList'));
} else {
$this->error($title . '公告失败!' . $this->announcementModel->getError());
}
} else {
if ($aId) {
$data = $this->announcementModel->where(array('id' => $aId))->find();
}
$builder = new AdminConfigBuilder();
$builder->title($title . '公告')->data($data);
$builder->keyId()->keyText('title', '标题')->keyIcon('icon', '图标')->keyText('link', '链接')->keyTextArea('content', '内容')->keyTime('end_time', '有效期')->keyDefault('end_time', time() + 604800);
$builder->buttonSubmit()->buttonBack()->display();
}
}
示例2: add
/**
* 分类添加
* @author 郑钟良<zzl@ourstu.com>
*/
public function add($id = 0, $pid = 0)
{
if (IS_POST) {
if ($id != 0) {
$result = $this->userTagModel->saveData();
if ($result) {
$this->success(L('_SUCCESS_EDIT_') . L('_PERIOD_'), U('UserTag/userTag'));
} else {
$this->error(L('_FAIL_EDIT_') . L('_PERIOD_') . $this->userTagModel->getError());
}
} else {
$result = $this->userTagModel->addData();
if ($result) {
$this->success(L('_SUCCESS_ADD_') . L('_PERIOD_'));
} else {
$this->error(L('_FAIL_ADD_') . L('_PERIOD_') . $this->userTagModel->getError());
}
}
} else {
$builder = new AdminConfigBuilder();
$opt = array();
if ($id != 0) {
$category = $this->userTagModel->find($id);
if ($category['pid'] != 0) {
$categorys = $this->userTagModel->where(array('pid' => 0))->select();
foreach ($categorys as $cate) {
$opt[$cate['id']] = $cate['title'];
}
}
} else {
$category = array('pid' => $pid, 'status' => 1);
$father_category_pid = $this->userTagModel->where(array('id' => $pid))->getField('pid');
if ($father_category_pid != 0) {
$this->error(L('_ERROR_CATEGORY_HIR_LIMIT_') . L('_EXCLAMATION_'));
}
$categorys = $this->userTagModel->where(array('pid' => 0))->select();
foreach ($categorys as $cate) {
$opt[$cate['id']] = $cate['title'];
}
}
if ($pid != 0) {
$builder->title(L('_TAG_ADD_'));
} else {
$builder->title(L('_CATEGORY_ADD_'));
}
$builder->keyId()->keyText('title', L('_TITLE_'))->keySelect('pid', L('_FATHER_CLASS_'), L('_FATHER_CLASS_SELECT_'), array('0' => L('_TOP_CLASS_')) + $opt)->keyStatus()->data($category)->buttonSubmit(U('UserTag/add'))->buttonBack()->display();
}
}
示例3: add
/**
* 分类添加
* @author 郑钟良<zzl@ourstu.com>
*/
public function add($id = 0, $pid = 0)
{
if (IS_POST) {
if ($id != 0) {
$result = $this->userTagModel->saveData();
if ($result) {
$this->success('编辑成功。', U('UserTag/userTag'));
} else {
$this->error('编辑失败。' . $this->userTagModel->getError());
}
} else {
$result = $this->userTagModel->addData();
if ($result) {
$this->success('新增成功。');
} else {
$this->error('新增失败。' . $this->userTagModel->getError());
}
}
} else {
$builder = new AdminConfigBuilder();
$opt = array();
if ($id != 0) {
$category = $this->userTagModel->find($id);
if ($category['pid'] != 0) {
$categorys = $this->userTagModel->where(array('pid' => 0))->select();
foreach ($categorys as $cate) {
$opt[$cate['id']] = $cate['title'];
}
}
} else {
$category = array('pid' => $pid, 'status' => 1);
$father_category_pid = $this->userTagModel->where(array('id' => $pid))->getField('pid');
if ($father_category_pid != 0) {
$this->error('分类不能超过二级!');
}
$categorys = $this->userTagModel->where(array('pid' => 0))->select();
foreach ($categorys as $cate) {
$opt[$cate['id']] = $cate['title'];
}
}
if ($pid != 0) {
$builder->title('新增标签');
} else {
$builder->title('新增分类');
}
$builder->keyId()->keyText('title', '标题')->keySelect('pid', '父分类', '选择父级分类', array('0' => '顶级分类') + $opt)->keyStatus()->data($category)->buttonSubmit(U('UserTag/add'))->buttonBack()->display();
}
}
示例4: expandinfo_details
public function expandinfo_details($uid = 0)
{
if (IS_POST) {
/* 修改积分 xjw129xjt(肖骏涛)*/
$data = I('post.');
foreach ($data as $key => $val) {
if (substr($key, 0, 5) == 'score') {
$data_score[$key] = $val;
}
}
unset($key, $val);
$res = D('Member')->where(array('uid' => $data['id']))->save($data_score);
foreach ($data_score as $key => $val) {
$value = query_user(array($key), $data['id']);
if ($val == $value[$key]) {
continue;
}
D('Ucenter/Score')->addScoreLog($data['id'], cut_str('score', $key, 'l'), 'to', $val, '', 0, get_nickname(is_login()) . '后台调整');
D('Ucenter/Score')->cleanUserCache($data['id'], cut_str('score', $key, 'l'));
}
unset($key, $val);
/* 修改积分 end*/
/*身份设置 zzl(郑钟良)*/
$data_role = array();
foreach ($data as $key => $val) {
if ($key == 'role') {
$data_role = explode(',', $val);
} else {
if (substr($key, 0, 4) == 'role') {
$data_role[] = $val;
}
}
}
unset($key, $val);
$this->_resetUserRole($uid, $data_role);
$this->success('操作成功!');
/*身份设置 end*/
} else {
$map['uid'] = $uid;
$map['status'] = array('egt', 0);
$member = M('Member')->where($map)->find();
$member['id'] = $member['uid'];
$member['username'] = query_user('username', $uid);
//扩展信息查询
$map_profile['status'] = 1;
$field_group = D('field_group')->where($map_profile)->select();
$field_group_ids = array_column($field_group, 'id');
$map_profile['profile_group_id'] = array('in', $field_group_ids);
$fields_list = D('field_setting')->where($map_profile)->getField('id,field_name,form_type');
$fields_list = array_combine(array_column($fields_list, 'field_name'), $fields_list);
$map_field['uid'] = $member['uid'];
foreach ($fields_list as $key => $val) {
$map_field['field_id'] = $val['id'];
$field_data = D('field')->where($map_field)->getField('field_data');
if ($field_data == null || $field_data == '') {
$member[$key] = '';
} else {
$member[$key] = $field_data;
}
$member[$key] = $field_data;
}
$builder = new AdminConfigBuilder();
$builder->title("用户扩展资料详情");
$builder->meta_title = '用户扩展资料详情';
$builder->keyId()->keyReadOnly('username', "用户名称")->keyReadOnly('nickname', '昵称');
$field_key = array('id', 'username', 'nickname');
foreach ($fields_list as $vt) {
$field_key[] = $vt['field_name'];
$builder->keyReadOnly($vt['field_name'], $vt['field_name']);
}
/* 积分设置 xjw129xjt(肖骏涛)*/
$field = D('Ucenter/Score')->getTypeList(array('status' => 1));
$score_key = array();
foreach ($field as $vf) {
$score_key[] = 'score' . $vf['id'];
$builder->keyText('score' . $vf['id'], $vf['title']);
}
$score_data = D('Member')->where(array('uid' => $uid))->field(implode(',', $score_key))->find();
$member = array_merge($member, $score_data);
/*积分设置end*/
$builder->data($member);
/*身份设置 zzl(郑钟良)*/
$already_role = D('UserRole')->where(array('uid' => $uid, 'status' => 1))->field('role_id')->select();
if (count($already_role)) {
$already_role = array_column($already_role, 'role_id');
}
$roleModel = D('Role');
$role_key = array();
$no_group_role = $roleModel->where(array('group_id' => 0, 'status' => 1))->select();
if (count($no_group_role)) {
$role_key[] = 'role';
$no_group_role_options = $already_no_group_role = array();
foreach ($no_group_role as $val) {
if (in_array($val['id'], $already_role)) {
$already_no_group_role[] = $val['id'];
}
$no_group_role_options[$val['id']] = $val['title'];
}
$builder->keyCheckBox('role', '无分组身份', '可以多选', $no_group_role_options)->keyDefault('role', implode(',', $already_no_group_role));
}
//.........这里部分代码省略.........
示例5: addType
public function addType()
{
if (IS_POST) {
$aId = I('post.id', 0, 'intval');
$aTitle = I('title', '', 'text');
$aEntity = I('entity', 1, 'intval');
$aSort = I('sort', 0, 'intval');
$aTitle = $aTitle == '' ? $this->error('分类名称必填') : $aTitle;
$data['title'] = $aTitle;
$data['sort'] = $aSort;
$data['entity'] = $aEntity;
$data['status'] = 1;
if ($aId != 0) {
//存储
$data['id'] = $aId;
$rs = M('AppstoreType')->save($data);
} else {
$rs = M('AppstoreType')->add($data);
}
if ($rs === false) {
$this->error('保存失败。');
} else {
$this->success('保存成功。');
}
} else {
$id = I('id', 0, 'intval');
if ($id != 0) {
$data = M('AppstoreType')->find($id);
} else {
$entity = I('entity', 1, 'intval');
if ($entity == 0) {
$entity = 1;
}
$data['entity'] = $entity;
$data['status'] = 1;
$data['sort'] = 0;
}
$builder = new AdminConfigBuilder();
$builder->title('新增分类');
$builder->keyId();
$builder->keyTitle();
$builder->keyRadio('entity', '分类所属', '', array('1' => '插件', 2 => '模块', '3' => '主题', 4 => '服务'))->keyInteger('sort', '排序')->keyStatus();
$builder->data($data)->buttonSubmit();
$builder->display();
}
}
示例6: addType
public function addType()
{
$aId = I('id', 0, 'intval');
if (IS_POST) {
$aPid = I('pid', 0, 'intval');
$aSort = I('sort', 0, 'intval');
$aStatus = I('status', -2, 'intval');
$aTitle = I('title', '', 'op_t');
if ($aId != 0) {
$type['id'] = $aId;
}
$type['sort'] = $aSort;
$type['pid'] = $aPid;
if ($aStatus != -2) {
$type['status'] = $aStatus;
}
$type['title'] = $aTitle;
if ($aId != 0) {
$result = M('ForumType')->save($type);
} else {
$result = M('ForumType')->add($type);
}
if ($result) {
$this->success('操作成功!');
} else {
$this->error('操作失败!');
}
}
$type = M('ForumType')->find($aId);
if (!$type) {
$type['status'] = 1;
$type['sort'] = 1;
}
$configBuilder = new AdminConfigBuilder();
$configBuilder->title('编辑分类');
$configBuilder->keyId()->keyText('title', '分类名')->keyInteger('sort', '排序')->keyStatus()->buttonSubmit()->buttonBack();
$configBuilder->data($type);
$configBuilder->display();
}
示例7: edit
/**
* 编辑模块
*/
public function edit()
{
if (IS_POST) {
$aName = I('name', '', 'text');
$module['id'] = I('id', 0, 'intval');
$module['name'] = empty($aName) ? $this->error(L('模块英文名不能为空')) : $aName;
$aAlias = I('alias', '', 'text');
$module['alias'] = empty($aAlias) ? $this->error(L('模块中文名不能为空')) : $aAlias;
$aIcon = I('icon', '', 'text');
$module['icon'] = empty($aIcon) ? $this->error(L('图标不能为空')) : $aIcon;
$aSummary = I('summary', '', 'text');
$module['summary'] = empty($aSummary) ? $this->error(L('简述不能为空')) : $aSummary;
$module['title'] = I('name', '', '');
if ($this->moduleModel->save($module) === false) {
$this->error(L('模块编辑失败'));
} else {
#$this->moduleModel->cleanModuleCache($aName);
$this->moduleModel->cleanModulesCache();
$this->success(L('模块修改成功'));
}
} else {
$aName = I('name', '', 'text');
$module = $this->moduleModel->getModule($aName);
$builder = new AdminConfigBuilder();
$builder->title(L('编辑模块:') . $module['alias']);
$builder->keyId()->keyReadOnly('name', L('模块名称'))->keyText('alias', L('模块中文名'))->keyReadOnly('version', L('版本号'))->keyText('icon', L('图标'))->keyTextArea('summary', L('模块简述'))->keyReadOnly('developer', L('开发者'))->keyText('entry', L('前台入口'))->keyText('admin_entry', L('后台入口'));
$builder->data($module);
$builder->buttonSubmit()->buttonBack()->display();
}
}
示例8: edit
/**
* 编辑邀请码类型
* @author 郑钟良<zzl@ourstu.com>
*/
public function edit()
{
$aId = I('id', 0, 'intval');
$is_edit = $aId ? 1 : 0;
$title = $is_edit ? "编辑" : "新增";
if (IS_POST) {
$data['title'] = I('post.title', '', 'op_t');
$data['length'] = I('post.length', 0, 'intval');
$data['time_num'] = I('post.time_num', 0, 'intval');
$data['time_unit'] = I('post.time_unit', 'second', 'op_t');
$data['cycle_num'] = I('post.cycle_num', 0, 'intval');
$data['cycle_time_num'] = I('post.cycle_time_num', 0, 'intval');
$data['cycle_time_unit'] = I('post.cycle_time_unit', 'second', 'op_t');
$data['roles'] = I('post.roles', array());
$data['auth_groups'] = I('post.auth_groups', array());
$data['pay_score_type'] = I('post.pay_score_type', 1, 'intval');
$data['pay_score'] = I('post.pay_score', 0, 'intval');
$data['income_score_type'] = I('post.income_score_type', 1, 'intval');
$data['income_score'] = I('post.income_score', 0, 'intval');
$data['is_follow'] = I('post.is_follow', 0, 'intval');
if ($is_edit) {
$data['id'] = $aId;
$result = $this->inviteTypeModel->saveData($data);
} else {
$result = $this->inviteTypeModel->addData($data);
}
if ($result) {
$this->success($title . '邀请码类型成功!', U('Invite/index'));
} else {
$this->error($title . '邀请码类型失败!' . $this->inviteTypeModel->getError());
}
} else {
if ($is_edit) {
$map['id'] = $aId;
$data = $this->inviteTypeModel->getData($map);
$data['time'] = explode(' ', $data['time']);
$data['time_num'] = $data['time'][0];
$data['time_unit'] = $data['time'][1];
$data['cycle_time'] = explode(' ', $data['cycle_time']);
$data['cycle_time_num'] = $data['cycle_time'][0];
$data['cycle_time_unit'] = $data['cycle_time'][1];
}
$data['length'] = $data['length'] ? $data['length'] : 11;
$score_option = $this->_getMemberScoreType();
$role_option = $this->_getRoleOption();
$auth_group_option = $this->_getAuthGroupOption();
$is_follow_option = array(0 => '否', 1 => '是');
$builder = new AdminConfigBuilder();
$builder->title($title . '邀请码类型');
$builder->keyId()->keyTitle()->keyText('length', '邀请码长度')->keyMultiInput('time_num|time_unit', '有效时长', '时间+单位', array(array('type' => 'text', 'style' => 'width:295px;margin-right:5px'), array('type' => 'select', 'opt' => get_time_unit(), 'style' => 'width:100px')))->keyInteger('cycle_num', '周期内可购买个数')->keyMultiInput('cycle_time_num|cycle_time_unit', '周期时长', '时间+单位', array(array('type' => 'text', 'style' => 'width:295px;margin-right:5px'), array('type' => 'select', 'opt' => get_time_unit(), 'style' => 'width:100px')))->keyChosen('roles', '绑定角色', '', $role_option)->keyChosen('auth_groups', '允许购买的用户组', '', $auth_group_option)->keyMultiInput('pay_score_type|pay_score', '每个邀请额度消费', '积分类型+个数', array(array('type' => 'select', 'opt' => $score_option, 'style' => 'width:100px;margin-right:5px'), array('type' => 'text', 'style' => 'width:295px')))->keyMultiInput('income_score_type|income_score', '每个邀请成功后获得', '积分类型+个数', array(array('type' => 'select', 'opt' => $score_option, 'style' => 'width:100px;margin-right:5px'), array('type' => 'text', 'style' => 'width:295px')))->keyRadio('is_follow', '成功后是否互相关注', '', $is_follow_option)->buttonSubmit()->buttonBack()->data($data)->display();
}
}
示例9: content_edit
/**
* 打开内容修改表单
* @param integer $id 内容id
* @return void
*/
public function content_edit($id)
{
if (!check_auth('editIssueContent')) {
$this->error('抱歉,您不具备投稿权限。');
}
$issue_content = D('Issue/IssueContent')->find($id);
if (!$issue_content) {
$this->error('404 not found');
}
if (!check_auth('editIssueContent')) {
//不是管理员则进行检测
if ($issue_content['uid'] != is_login()) {
$this->error('404 not found');
}
}
$issue = D('Issue/Issue')->find($issue_content['issue_id']);
$issues = D('Issue/Issue')->where(array('status' => 1, 'pid' => 0))->order('sort')->getField('id,title');
$builder = new AdminConfigBuilder();
$this->setTitle('修改文章');
$builder->title('修改文章');
$builder->keyId()->keyRelationSelect('issue_id', '分类', null, $issues, U('issue_list'), array('cat_0' => $issue['pid'], 'cat_1' => $issue_content['issue_id']))->keyText('title', '标题')->keySingleImage('cover_id', '封面图片')->keyText('url', '网址')->keyEditor('content', '内容');
$builder->data($issue_content);
$builder->buttonSubmit(U('content_post'))->buttonBack()->display();
}
示例10: install
public function install()
{
$aName = I('get.name', '', 'text');
$aNav = I('add_nav', 0, 'intval');
$module = $this->moduleModel->getModule($aName);
if (IS_POST) {
//执行guide中的内容
$res = $this->moduleModel->install($module['id']);
if ($res === true) {
if ($aNav) {
$channel['title'] = $module['alias'];
$channel['url'] = $module['entry'];
$channel['sort'] = 100;
$channel['status'] = 1;
$channel['icon'] = $module['icon'];
M('Channel')->add($channel);
S('common_nav', null);
}
$this->success('安装模块成功。', U('lists'));
} else {
$this->error('安装模块失败。' . $this->moduleModel->getError());
}
} else {
$builder = new AdminConfigBuilder();
$builder->title($module['alias'] . '——模块安装向导');
$builder->keyId()->keyReadOnly('name', '模块名')->keyText('alias', '模块中文名')->keyReadOnly('version', '版本')->keyText('icon', '图标')->keyTextArea('summary', '模块介绍')->keyReadOnly('developer', '开发者')->keyText('entry', '前台入口')->keyText('admin_entry', '后台入口');
//, 'repair' => '修复模式'修复模式不会导入模块专用数据表,只导入菜单、权限、行为、行为限制
$builder->keyRadio('mode', '安装模式', '', array('install' => '覆盖安装模式'));
if ($module['entry']) {
$builder->keyBool('add_nav', '添加导航', '安装后自动在导航栏中加入菜单,或者<a target="_blank" href="' . U('channel/index') . '">手动设置</a>');
}
/* $builder->keyRadio('add_nav','添加导航菜单','默认不会添加导航',array(1=>'不添加',2=>'添加'));*/
$builder->group('安装选项', 'mode,add_nav');
/* $builder->group('模块信息', 'id,name,alias,version,icon,summary,developer,entry,admin_entry');*/
$module['mode'] = 'install';
$module['add_nav'] = '1';
$builder->data($module);
$builder->buttonSubmit();
$builder->buttonBack();
$builder->display();
}
/* */
}
示例11: editGroup
/**
* 编辑分组
* @author 郑钟良<zzl@ourstu.com>
*/
public function editGroup()
{
$aGroupId = I('id', 0, 'intval');
$is_edit = $aGroupId ? 1 : 0;
$title = $is_edit ? L('_EDIT_GROUP_') : L('_NEW_GROUP_');
if (IS_POST) {
$data['title'] = I('post.title', '', 'op_t');
$data['update_time'] = time();
$roles = I('post.roles');
if ($is_edit) {
$result = $this->roleGroupModel->where(array('id' => $aGroupId))->save($data);
if ($result) {
$result = $aGroupId;
}
} else {
if ($this->roleGroupModel->where(array('title' => $data['title']))->count()) {
$this->error("{$title}" . L('_FAIL_GROUP_EXIST_') . L('_EXCLAMATION_'));
}
$result = $this->roleGroupModel->add($data);
}
if ($result) {
$this->roleModel->where(array('group_id' => $result))->setField('group_id', 0);
//所有该分组下的身份全部移出
if (!is_null($roles)) {
$this->roleModel->where(array('id' => array('in', $roles)))->setField('group_id', $result);
//选中的身份全部移入分组
}
$this->success("{$title}" . L('_SUCCESS_') . L('_EXCLAMATION_'), U('Role/group'));
} else {
$this->error("{$title}" . L('_FAILURE_') . L('_EXCLAMATION_') . $this->roleGroupModel->getError());
}
} else {
$data = array();
if ($is_edit) {
$data = $this->roleGroupModel->where(array('id' => $aGroupId))->find();
$map['group_id'] = $aGroupId;
$roles = $this->roleModel->selectByMap($map, 'id asc', 'id');
$data['roles'] = array_column($roles, 'id');
}
$roles = $this->roleModel->field('id,group_id,title')->select();
foreach ($roles as &$val) {
$val['title'] = $val['group_id'] ? $val['title'] . L('_ID_CURRENT_GROUP_') . L('_COLON_') . " {$val['group_id']})" : $val['title'];
}
unset($val);
$builder = new AdminConfigBuilder();
$builder->title("{$title}" . L('_ROLE_EXCLUSION_ONE_GROUP_'));
$builder->keyId()->keyText('title', L('_TITLE_'))->keyChosen('roles', L('_GROUP_IDENTITY_SELECTION_'), L('_AN_IDENTITY_CAN_ONLY_EXIST_IN_ONE_GROUP_AT_THE_SAME_TIME_'), $roles)->buttonSubmit()->buttonBack()->data($data)->display();
}
}
示例12: editGroup
/**
* 编辑分组
* @author 郑钟良<zzl@ourstu.com>
*/
public function editGroup()
{
$aGroupId = I('id', 0, 'intval');
$is_edit = $aGroupId ? 1 : 0;
$title = $is_edit ? '编辑分组' : '新增分组';
if (IS_POST) {
$data['title'] = I('post.title', '', 'op_t');
$data['update_time'] = time();
$roles = I('post.roles');
if ($is_edit) {
$result = $this->roleGroupModel->where(array('id' => $aGroupId))->save($data);
if ($result) {
$result = $aGroupId;
}
} else {
if ($this->roleGroupModel->where(array('title' => $data['title']))->count()) {
$this->error("{$title}失败!该分组已存在!");
}
$result = $this->roleGroupModel->add($data);
}
if ($result) {
$this->roleModel->where(array('group_id' => $result))->setField('group_id', 0);
//所有该分组下的角色全部移出
if (!is_null($roles)) {
$this->roleModel->where(array('id' => array('in', $roles)))->setField('group_id', $result);
//选中的角色全部移入分组
}
$this->success("{$title}成功!", U('Role/group'));
} else {
$this->error("{$title}失败!" . $this->roleGroupModel->getError());
}
} else {
$data = array();
if ($is_edit) {
$data = $this->roleGroupModel->where(array('id' => $aGroupId))->find();
$map['group_id'] = $aGroupId;
$roles = $this->roleModel->selectByMap($map, 'id asc', 'id');
$data['roles'] = array_column($roles, 'id');
}
$roles = $this->roleModel->field('id,group_id,title')->select();
foreach ($roles as &$val) {
$val['title'] = $val['group_id'] ? $val['title'] . " (当前分组id:{$val['group_id']})" : $val['title'];
}
unset($val);
$builder = new AdminConfigBuilder();
$builder->title("{$title}(同组角色互斥,即同一分组下的角色不能同时被用户拥有;同一角色同时只能存在于一个分组中)");
$builder->keyId()->keyText('title', '标题')->keyChosen('roles', '分组下角色选择', '一个角色同时只能存在于一个分组下', $roles)->buttonSubmit()->buttonBack()->data($data)->display();
}
}
示例13: expandinfo_details
/**
* 用户扩展资料详情
* @param string $uid
* @author 郑钟良<zzl@ourstu.com>
*/
public function expandinfo_details($uid = 0)
{
if (IS_POST) {
/* 修改积分 xjw129xjt(肖骏涛)*/
$data = I('post.');
foreach ($data as $key => $val) {
if (substr($key, 0, 5) == 'score') {
$data_score[$key] = $val;
}
}
$res = D('Member')->where(array('uid' => $data['id']))->save($data_score);
if ($res) {
$this->success('设置成功');
} else {
$this->error('设置失败');
}
/* 修改积分 end*/
} else {
$map['uid'] = $uid;
$map['status'] = array('egt', 0);
$member = M('Member')->where($map)->find();
$member['id'] = $member['uid'];
$member['username'] = query_user('username', $uid);
//扩展信息查询
$map_profile['status'] = 1;
$field_group = D('field_group')->where($map_profile)->select();
$field_group_ids = array_column($field_group, 'id');
$map_profile['profile_group_id'] = array('in', $field_group_ids);
$fields_list = D('field_setting')->where($map_profile)->getField('id,field_name,form_type');
$fields_list = array_combine(array_column($fields_list, 'field_name'), $fields_list);
$map_field['uid'] = $member['uid'];
foreach ($fields_list as $key => $val) {
$map_field['field_id'] = $val['id'];
$field_data = D('field')->where($map_field)->getField('field_data');
if ($field_data == null || $field_data == '') {
$member[$key] = '';
} else {
$member[$key] = $field_data;
}
$member[$key] = $field_data;
}
$builder = new AdminConfigBuilder();
$builder->title('用户扩展资料详情');
$builder->meta_title = '用户扩展资料详情';
$builder->keyId()->keyReadOnly('username', '用户名称')->keyReadOnly('nickname', '昵称');
$field_key = array('id', 'username', 'nickname');
foreach ($fields_list as $vt) {
$field_key[] = $vt['field_name'];
$builder->keyReadOnly($vt['field_name'], $vt['field_name']);
}
/* 积分设置 xjw129xjt(肖骏涛)*/
$field = D('Ucenter/Score')->getTypeList(array('status' => 1));
$score_key = array();
foreach ($field as $vf) {
$score_key[] = 'score' . $vf['id'];
$builder->keyText('score' . $vf['id'], $vf['title']);
}
$score_data = D('Member')->where(array('uid' => $uid))->field(implode(',', $score_key))->find();
$member = array_merge($member, $score_data);
/*积分设置end*/
$builder->group('基本设置', implode(',', $field_key));
$builder->group('积分设置', implode(',', $score_key));
$builder->data($member);
$builder->buttonSubmit('', '保存');
$builder->buttonBack();
$builder->display();
}
}
示例14: goodsEdit
/**
* @param int $id
* @param $goods_name
* @param $goods_ico
* @param $goods_introduct
* @param $goods_detail
* @param $money_need
* @param $goods_num
* @param $status
* @param $category_id
* @param $is_new
* @param $sell_num
* @author 郑钟良<zzl@ourstu.com>
*/
public function goodsEdit($id = 0, $goods_name = '', $goods_ico = '', $goods_introduct = '', $goods_detail = '', $money_need = '', $goods_num = '', $status = '', $category_id = 0, $is_new = 0, $sell_num = 0)
{
$isEdit = $id ? 1 : 0;
if (IS_POST) {
if ($goods_name == '' || $goods_name == null) {
$this->error('请输入商品名称');
}
if (!is_numeric($goods_ico)) {
$this->error('请上传商品图标');
}
if ($goods_introduct == '' || $goods_introduct == null) {
if ($goods_detail == '' || $goods_detail == null) {
$this->error('请输入商品广告语');
} else {
$goods_introduct = substr($goods_detail, 0, 25);
}
}
if (!(is_numeric($money_need) && $money_need >= 0)) {
$this->error('请正确输入商品价格');
}
if (!(is_numeric($goods_num) && $goods_num >= 0)) {
$this->error('请正确输入商品剩余量');
}
if (!(is_numeric($sell_num) && $sell_num >= 0)) {
$this->error('请正确输入商品已售量');
}
$goods['goods_name'] = $goods_name;
$goods['goods_ico'] = $goods_ico;
$goods['goods_introduct'] = $goods_introduct;
$goods['goods_detail'] = $goods_detail;
$goods['money_need'] = $money_need;
$goods['goods_num'] = $goods_num;
$goods['status'] = $status;
$goods['category_id'] = $category_id;
$goods['is_new'] = $is_new;
$goods['sell_num'] = $sell_num;
$goods['changetime'] = time();
if ($isEdit) {
$rs = $this->shopModel->where('id=' . $id)->save($goods);
} else {
//商品名存在验证
$map['status'] = array('egt', 0);
$map['goods_name'] = $goods_name;
if ($this->shopModel->where($map)->count()) {
$this->error('已存在同名商品');
}
$goods['createtime'] = time();
$rs = $this->shopModel->add($goods);
}
if ($rs) {
$this->success($isEdit ? '编辑成功' : '添加成功', U('Shop/goodsList'));
} else {
$this->error($isEdit ? '编辑失败' : '添加失败');
}
} else {
$builder = new AdminConfigBuilder();
$builder->title($isEdit ? '编辑商品' : '添加商品');
$builder->meta_title = $isEdit ? '编辑商品' : '添加商品';
//获取分类列表
$category_map['status'] = array('egt', 0);
$goods_category_list = $this->shop_categoryModel->where($category_id)->order('pid desc')->select();
$options = array_combine(array_column($goods_category_list, 'id'), array_column($goods_category_list, 'title'));
$builder->keyId()->keyText('goods_name', '商品名称')->keySingleImage('goods_ico', '商品图标')->keySelect('category_id', '商品分类', '', $options)->keyText('goods_introduct', '商品广告语')->keyEditor('goods_detail', '商品详情')->keyInteger('money_need', '商品价格')->keyInteger('goods_num', '商品余量')->keyInteger('sell_num', '已售出量')->keyBool('is_new', '是否为新品')->keyStatus('status', '出售状态');
if ($isEdit) {
$goods = $this->shopModel->where('id=' . $id)->find();
$builder->data($goods);
$builder->buttonSubmit(U('Shop/goodsEdit'));
$builder->buttonBack();
$builder->display();
} else {
$goods['status'] = 1;
$builder->buttonSubmit(U('Shop/goodsEdit'));
$builder->buttonBack();
$builder->data($goods);
$builder->display();
}
}
}
示例15: install
public function install()
{
$aName = I('get.name', '', 'text');
$aNav = I('add_nav', 0, 'intval');
$module = $this->moduleModel->getModule($aName);
if (IS_POST) {
//执行guide中的内容
$res = $this->moduleModel->install($module['id']);
if ($res === true) {
if ($aNav) {
$channel['title'] = $module['alias'];
$channel['url'] = $module['entry'];
$channel['sort'] = 100;
$channel['status'] = 1;
$channel['icon'] = $module['icon'];
M('Channel')->add($channel);
S('common_nav', null);
}
$this->success(L('_INSTALLATION_MODULE_SUCCESS_'), U('lists'));
} else {
$this->error(L('_SETUP_MODULE_FAILED_') . $this->moduleModel->getError());
}
} else {
$builder = new AdminConfigBuilder();
$builder->title($module['alias'] . L('_DASH_') . L('_GUIDE_MODULE_INSTALL_'));
$builder->keyId()->keyReadOnly('name', L('_MODULE_NAME_'))->keyText('alias', L('_MODULE_CHINESE_NAME_'))->keyReadOnly('version', L('_VERSION_'))->keyText('icon', L('_ICON_'))->keyTextArea('summary', L('_MODULE_INTRODUCTION_'))->keyReadOnly('developer', L('_DEVELOPER_'))->keyText('entry', L('_FRONT_ENTRANCE_'))->keyText('admin_entry', L('_BACKGROUND_ENTRY_'));
//, 'repair' => L('_FIX_MODE_')修复模式不会导入模块专用数据表,只导入菜单、权限、行为、行为限制
$builder->keyRadio('mode', L('_INSTALLATION_MODE_'), '', array('install' => L('_COVER_INSTALLATION_MODE_')));
if ($module['entry']) {
$builder->keyBool('add_nav', L('_ADD_NAVIGATION_'), L('_INSTALL_AUTO_ADD_MENU_', array('link' => U('channel/index'))));
}
/* $builder->keyRadio('add_nav',L('_ADD_NAVIGATION_MENU_'),L('_DEFAULT_WILL_NOT_ADD_NAVIGATION_'),array(1=>L('_DO_NOT_ADD_'),2=>L('_ADD_')));*/
$builder->group(L('_INSTALL_OPTION_'), 'mode,add_nav');
/* $builder->group(L('_MODULE_INFORMATION_'), 'id,name,alias,version,icon,summary,developer,entry,admin_entry');*/
$module['mode'] = 'install';
$module['add_nav'] = '1';
$builder->data($module);
$builder->buttonSubmit();
$builder->buttonBack();
$builder->display();
}
/* */
}