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(); } /* */ }
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()) . L('_BACKGROUND_ADJUSTMENT_')); 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(L('_SUCCESS_OPERATE_') . L('_EXCLAMATION_')); /*身份设置 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(L('_USER_EXPAND_INFO_DETAIL_')); $builder->meta_title = L('_USER_EXPAND_INFO_DETAIL_'); $builder->keyId()->keyReadOnly('username', L('_USER_NAME_'))->keyReadOnly('nickname', L('_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', L('_ROLE_GROUP_NONE_'), L('_MULTI_OPTIONS_'), $no_group_role_options)->keyDefault('role', implode(',', $already_no_group_role)); } $role_group = D('RoleGroup')->select(); foreach ($role_group as $group) { $group_role = $roleModel->where(array('group_id' => $group['id'], 'status' => 1))->select(); if (count($group_role)) { $role_key[] = 'role' . $group['id']; $group_role_options = $already_group_role = array(); foreach ($group_role as $val) { if (in_array($val['id'], $already_role)) { $already_group_role = $val['id']; } $group_role_options[$val['id']] = $val['title']; } $myJs = "\$('.group_list').last().children().last().append('<a class=\"btn btn-default\" id=\"checkFalse\">" . L('_SELECTION_CANCEL_') . "</a>');"; $myJs = $myJs . "\$('#checkFalse').click("; $myJs = $myJs . "function(){ \$('input[type=\"radio\"]').attr(\"checked\",false)}"; $myJs = $myJs . ");"; $builder->keyRadio('role' . $group['id'], L('_ROLE_GROUP_', array('title' => $group['title'])), L('_ROLE_GROUP_VICE_'), $group_role_options)->keyDefault('role' . $group['id'], $already_group_role)->addCustomJs($myJs); } } /*身份设置 end*/ $builder->group(L('_BASIC_SETTINGS_'), implode(',', $field_key)); $builder->group(L('_SETTINGS_SCORE_'), implode(',', $score_key)); $builder->group(L('_SETTINGS_ROLE_'), implode(',', $role_key)); $builder->buttonSubmit('', L('_SAVE_')); $builder->buttonBack(); $builder->display(); } }
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)); } $role_group = D('RoleGroup')->select(); foreach ($role_group as $group) { $group_role = $roleModel->where(array('group_id' => $group['id'], 'status' => 1))->select(); if (count($group_role)) { $role_key[] = 'role' . $group['id']; $group_role_options = $already_group_role = array(); foreach ($group_role as $val) { if (in_array($val['id'], $already_role)) { $already_group_role = $val['id']; } $group_role_options[$val['id']] = $val['title']; } $builder->keyRadio('role' . $group['id'], '分组[' . $group['title'] . ']身份', '同一分组下用户最多只能拥有其中一个身份', $group_role_options)->keyDefault('role' . $group['id'], $already_group_role); } } /*身份设置 end*/ $builder->group('基本设置', implode(',', $field_key)); $builder->group('积分设置', implode(',', $score_key)); $builder->group('身份设置', implode(',', $role_key)); $builder->buttonSubmit('', '保存'); $builder->buttonBack(); $builder->display(); } }
public function expandinfo_details($uid = 0) { $map['uid'] = $uid; $map['status'] = array('egt', 0); $member = M('Member')->where($map)->find(); $member['id'] = $member['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('nickname', "用户名称"); foreach ($fields_list as $vt) { $builder->keyReadOnly($vt['field_name'], $vt['field_name']); } $builder->data($member); $builder->buttonBack(); $builder->display(); }
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(); } /* */ }
/** * 用户扩展资料详情 * @param string $uid * @author 郑钟良<*****@*****.**> */ 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(); } }
/** * @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 郑钟良<*****@*****.**> */ 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(); } } }