本文整理汇总了PHP中Admin\Builder\AdminConfigBuilder::keyReadOnly方法的典型用法代码示例。如果您正苦于以下问题:PHP AdminConfigBuilder::keyReadOnly方法的具体用法?PHP AdminConfigBuilder::keyReadOnly怎么用?PHP AdminConfigBuilder::keyReadOnly使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Admin\Builder\AdminConfigBuilder
的用法示例。
在下文中一共展示了AdminConfigBuilder::keyReadOnly方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editProfile
public function editProfile($id = 0, $profile_name = '', $visiable = 1)
{
if (IS_POST) {
$data['profile_name'] = $profile_name;
$data['visiable'] = $visiable;
if ($data['profile_name'] == '') {
$this->error(L('_GROUP_NAME_CANNOT_BE_EMPTY_'));
}
if ($id != '') {
$res = D('field_group')->where('id=' . $id)->save($data);
} else {
$map['profile_name'] = $profile_name;
$map['status'] = array('egt', 0);
if (D('field_group')->where($map)->count() > 0) {
$this->error(L('_ALREADY_HAS_THE_SAME_NAME_GROUP_PLEASE_USE_THE_OTHER_GROUP_NAME_'));
}
$data['status'] = 1;
$data['createTime'] = time();
$res = D('field_group')->add($data);
}
if ($res) {
$this->success($id == '' ? L('_ADD_GROUP_SUCCESS_') : L('_EDIT_GROUP_SUCCESS_'), U('profile'));
} else {
$this->error($id == '' ? L('_ADD_GROUP_FAILURE_') : L('_EDIT_GROUP_FAILED_'));
}
} else {
$builder = new AdminConfigBuilder();
if ($id != 0) {
$profile = D('field_group')->where('id=' . $id)->find();
$builder->title(L('_MODIFIED_GROUP_INFORMATION_'));
$builder->meta_title = L('_MODIFIED_GROUP_INFORMATION_');
} else {
$builder->title(L('_ADD_EXTENDED_INFORMATION_PACKET_'));
$builder->meta_title = L('_NEW_GROUP_');
}
$builder->keyReadOnly("id", L('_LOGO_'))->keyText('profile_name', L('_GROUP_NAME_'))->keyBool('visiable', L('_OPEN_YE_OR_NO_'));
$builder->data($profile);
$builder->buttonSubmit(U('editProfile'), $id == 0 ? L('_ADD_') : L('_MODIFY_'))->buttonBack();
$builder->display();
}
}
示例2: uninstall
public function uninstall()
{
$aId = I('id', 0, 'intval');
$aNav = I('remove_nav', 0, 'intval');
$moduleModel = new ModuleModel();
$module = $moduleModel->getModuleById($aId);
if (IS_POST) {
$aWithoutData = I('withoutData', 1, 'intval');
//是否保留数据
$res = $this->moduleModel->uninstall($aId, $aWithoutData);
if ($res == true) {
if (file_exists(APP_PATH . '/' . $module['name'] . '/Info/uninstall.php')) {
require_once APP_PATH . '/' . $module['name'] . '/Info/uninstall.php';
}
if ($aNav) {
M('Channel')->where(array('url' => $module['entry']))->delete();
S('common_nav', null);
}
S('admin_modules', null);
$this->success(L('_THE_SUCCESS_OF_THE_UNLOADING_MODULE_'), U('lists'));
} else {
$this->error(L('_FAILURE_OF_THE_UNLOADING_MODULE_') . $this->moduleModel->error);
}
}
$builder = new AdminConfigBuilder();
$builder->title($module['alias'] . L('_DASH_') . L('_UNLOADING_MODULE_'));
$module['remove_nav'] = 1;
$builder->keyReadOnly('id', L('_MODULE_NUMBER_'));
$builder->suggest('<span class="text-danger">' . L('_OPERATE_CAUTION_') . '</span>');
$builder->keyReadOnly('alias', L('_UNINSTALL_MODULE_'));
$builder->keyBool('withoutData', L('_KEEP_DATA_MODULE_') . '?', L('_DEFAULT_RESERVATION_MODULE_DATA_'))->keyBool('remove_nav', L('_REMOVE_NAVIGATION_'), L('_UNINSTALL_AUTO_UNINSTALL_MENU_', array('link' => U('channel/index'))));
$module['withoutData'] = 1;
$builder->data($module);
$builder->buttonSubmit();
$builder->buttonBack();
$builder->display();
}
示例3: editAdv
public function editAdv()
{
$advModel = D('Common/Adv');
$aId = I('id', 0, 'intval');
if ($aId != 0) {
$adv = $advModel->find($aId);
$aPosId = $adv['pos_id'];
} else {
$aPosId = I('get.pos_id', 0, 'intval');
}
$advPosModel = D('Common/AdvPos');
$pos = $advPosModel->find($aPosId);
if (IS_POST) {
$adv['title'] = I('title', '', 'text');
$adv['pos_id'] = $aPosId;
$adv['url'] = I('url', '', 'text');
$adv['sort'] = I('sort', 1, 'intval');
$adv['status'] = I('status', 1, 'intval');
$adv['create_time'] = I('create_time', '', 'intval');
$adv['start_time'] = I('start_time', '', 'intval');
$adv['end_time'] = I('end_time', '', 'intval');
$adv['target'] = I('target', '', 'text');
S('adv_list_' . $pos['name'] . $pos['path'], null);
if ($pos['type'] == 2) {
//todo 多图
$aTitles = I('title', '', 'text');
$aUrl = I('url', '', 'text');
$aSort = I('sort', '', 'intval');
$aStartTime = I('start_time', '', 'intval');
$aEndTime = I('end_time', '', 'intval');
$aTarget = I('target', '', 'text');
$added = 0;
$advModel->where(array('pos_id' => $aPosId))->delete();
foreach (I('pic', 0, 'intval') as $key => $v) {
$data['pic'] = $v;
$data['target'] = $aTarget[$key];
$adv_temp['title'] = $aTitles[$key];
$adv_temp['pos_id'] = $adv['pos_id'];
$adv_temp['url'] = $aUrl[$key];
$adv_temp['sort'] = $aSort[$key];
$adv_temp['status'] = 1;
$adv_temp['create_time'] = time();
$adv_temp['start_time'] = $aStartTime[$key];
$adv_temp['end_time'] = $aEndTime[$key];
$adv_temp['target'] = $aTarget[$key];
$adv_temp['data'] = json_encode($data);
$result = $advModel->add($adv_temp);
if ($result !== false) {
$added++;
}
//todo添加
}
$this->success('成功改动' . $added . '个广告。');
} else {
switch ($pos['type']) {
case 1:
//todo 单图
$data['pic'] = I('pic', 0, 'intval');
$data['target'] = I('target', 0, 'text');
break;
case 3:
$data['text'] = I('text', '', 'text');
$data['text_color'] = I('text_color', '', 'text');
$data['text_font_size'] = I('text_font_size', '', 'text');
$data['target'] = I('target', 0, 'text');
//todo 文字
break;
case 4:
//todo 代码
$data['code'] = I('code', '', '');
break;
}
$adv['data'] = json_encode($data);
if ($aId == 0) {
$result = $advModel->add($adv);
} else {
$adv['id'] = $aId;
$result = $advModel->save($adv);
}
if ($result === false) {
$this->error('保存失败。');
} else {
$this->success('保存成功。');
}
}
} else {
//快速添加广告位逻辑
//todo 快速添加
$builder = new AdminConfigBuilder();
$adv['pos'] = $pos['title'] . '——' . $pos['name'] . '——' . $pos['path'];
$adv['pos_id'] = $aPosId;
$builder->keyReadOnly('pos', '所属广告位');
$builder->keyReadOnly('pos_id', '广告位ID');
$builder->keyId()->keyTitle('title', '广告说明');
$builder->title($pos['title'] . '设置——' . $advPosModel->switchType($pos['type']));
$builder->keyTime('start_time', '开始生效时间', '不设置则立即生效')->keyTime('end_time', '失效时间', '不设置则一直有效')->keyText('sort', '排序')->keyCreateTime()->keyStatus();
$builder->buttonSubmit();
$data = json_decode($adv['data'], true);
if (!empty($data)) {
$adv = array_merge($adv, $data);
//.........这里部分代码省略.........
示例4: editProfile
public function editProfile($id = 0, $profile_name = '', $visiable = 1)
{
if (IS_POST) {
$data['profile_name'] = $profile_name;
$data['visiable'] = $visiable;
if ($data['profile_name'] == '') {
$this->error('分组名称不能为空!');
}
if ($id != '') {
$res = D('field_group')->where('id=' . $id)->save($data);
} else {
$map['profile_name'] = $profile_name;
$map['status'] = array('egt', 0);
if (D('field_group')->where($map)->count() > 0) {
$this->error('已经有同名分组,请使用其他分组名称!');
}
$data['status'] = 1;
$data['createTime'] = time();
$res = D('field_group')->add($data);
}
if ($res) {
$this->success($id == '' ? "添加分组成功" : "编辑分组成功", U('profile'));
} else {
$this->error($id == '' ? "添加分组失败" : "编辑分组失败");
}
} else {
$builder = new AdminConfigBuilder();
if ($id != 0) {
$profile = D('field_group')->where('id=' . $id)->find();
$builder->title("修改分组信息");
$builder->meta_title = '修改分组信息';
} else {
$builder->title("添加扩展信息分组");
$builder->meta_title = '新增分组';
}
$builder->keyReadOnly("id", "标识")->keyText('profile_name', '分组名称')->keyBool('visiable', '是否公开');
$builder->data($profile);
$builder->buttonSubmit(U('editProfile'), $id == 0 ? "添加" : "修改")->buttonBack();
$builder->display();
}
}
示例5: uninstall
public function uninstall()
{
$aId = I('id', 0, 'intval');
$aNav = I('remove_nav', 0, 'intval');
$moduleModel = new ModuleModel();
$module = $moduleModel->getModuleById($aId);
if (IS_POST) {
$aWithoutData = I('withoutData', 1, 'intval');
//是否保留数据
$res = $this->moduleModel->uninstall($aId, $aWithoutData);
if ($res == true) {
if (file_exists(APP_PATH . '/' . $module['name'] . '/Info/uninstall.php')) {
require_once APP_PATH . '/' . $module['name'] . '/Info/uninstall.php';
}
if ($aNav) {
M('Channel')->where(array('url' => $module['entry']))->delete();
S('common_nav', null);
}
S('admin_modules', null);
$this->success('卸载模块成功。', U('lists'));
} else {
$this->error('卸载模块失败。' . $this->moduleModel->error);
}
}
$builder = new AdminConfigBuilder();
$builder->title($module['alias'] . '——卸载模块');
$module['remove_nav'] = 1;
$builder->keyReadOnly('id', '模块编号');
$builder->suggest('<span class="text-danger">请谨慎操作,此操作无法还原。</span>');
$builder->keyReadOnly('alias', '卸载的模块');
$builder->keyBool('withoutData', '是否保留模块数据?', '默认保留模块数据')->keyBool('remove_nav', '移除导航', '卸载后自动卸载掉对应的菜单,或者<a target="_blank" href="' . U('channel/index') . '">手动设置</a>');
$module['withoutData'] = 1;
$builder->data($module);
$builder->buttonSubmit();
$builder->buttonBack();
$builder->display();
}