本文整理匯總了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();
}