本文整理汇总了PHP中Admin\Builder\AdminConfigBuilder::keyDefault方法的典型用法代码示例。如果您正苦于以下问题:PHP AdminConfigBuilder::keyDefault方法的具体用法?PHP AdminConfigBuilder::keyDefault怎么用?PHP AdminConfigBuilder::keyDefault使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Admin\Builder\AdminConfigBuilder
的用法示例。
在下文中一共展示了AdminConfigBuilder::keyDefault方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: website
public function website()
{
$builder = new AdminConfigBuilder();
$data = $builder->handleConfig();
$builder->title('网站信息')->suggest('此处配置网站的一般信息。');
$builder->keyText('WEB_SITE_NAME', '网站名', '用于邮件,短信,站内信显示');
$builder->keyText('ICP', '网站备案号', '设置在网站底部显示的备案号,如“沪ICP备12007941号-2');
$builder->keySingleImage('LOGO', '网站Logo', '网站的logo设置,建议尺寸156*50');
$builder->keySingleImage('QRCODE', '微信二维码', '悬浮微信二维码');
$builder->keySingleImage('JUMP_BACKGROUND', '跳转页背景图片', '跳转页背景图片');
$builder->keyText('SUCCESS_WAIT_TIME', '成功等待时间', '设置成功时页面等待页面');
$builder->keyText('ERROR_WAIT_TIME', '失败等待时间', '设置失败时页面等待页面');
$builder->keyEditor('ABOUT_US', '关于我们内容', '页脚关于我们介绍');
$builder->keyEditor('SUBSCRIB_US', '关注我们', '页脚关注我们内容');
$builder->keyEditor('COPY_RIGHT', '版权信息', '页脚版权信息');
$builder->group('基本信息', array('WEB_SITE_NAME', 'ICP', 'LOGO', 'QRCODE'));
$builder->group('页脚信息', array('ABOUT_US', 'SUBSCRIB_US', 'COPY_RIGHT'));
$builder->group('跳转页面', array('JUMP_BACKGROUND', 'SUCCESS_WAIT_TIME', 'ERROR_WAIT_TIME'));
$builder->data($data);
$builder->keyDefault('SUCCESS_WAIT_TIME', 2);
$builder->keyDefault('ERROR_WAIT_TIME', 5);
$builder->buttonSubmit();
$builder->display();
}
示例2: editAdv
//.........这里部分代码省略.........
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);
}
if ($aId) {
$builder->data($adv);
} else {
$builder->data(array('pos' => $adv['pos'], 'pos_id' => $aPosId));
}
switch ($pos['type']) {
case 1:
//todo 单图
$builder->keySingleImage('pic', '图片', '选图上传,建议尺寸' . $pos['width'] . '*' . $pos['height']);
$builder->keyText('url', '链接地址');
$builder->keySelect('target', '打开方式', null, array('_blank' => '新窗口:_blank', '_self' => '当前层:_self', '_parent' => '父框架:_parent', '_top' => '整个框架:_top'));
break;
case 2:
//todo 多图
break;
case 3:
$builder->keyText('text', '文字内容', '广告展示文字');
$builder->keyText('url', '链接地址');
$builder->keyColor('text_color', '文字颜色', '文字颜色')->keyDefault('data[text_color]', '#000000');
$builder->keyText('text_font_size', '文字大小,需带单位,例如:14px')->keyDefault('data[text_font_size]', '12px');
$builder->keySelect('target', '打开方式', null, array('_blank' => '新窗口:_blank', '_self' => '当前层:_self', '_parent' => '父框架:_parent', '_top' => '整个框架:_top'));
//todo 文字
break;
case 4:
//todo 代码
$builder->keyTextArea('code', '代码内容', '不对此字段进行过滤,可填写js、html');
break;
}
$builder->keyDefault('status', 1)->keyDefault('sort', 1);
$builder->keyDefault('title', $pos['title'] . '的广告 ' . date('m月d日', time()) . ' 添加')->keyDefault('end_time', time() + 60 * 60 * 24 * 7);
if ($pos['type'] == 2) {
$this->_meta_title = $pos['title'] . '设置——' . $advPosModel->switchType($pos['type']);
$adv['start_time'] = isset($adv['start_time']) ? $adv['start_time'] : time();
$adv['end_time'] = isset($adv['end_time']) ? $adv['end_time'] : time() + 60 * 60 * 24 * 7;
$adv['create_time'] = isset($adv['create_time']) ? $adv['create_time'] : time();
$adv['sort'] = isset($adv['sort']) ? $adv['sort'] : 1;
$adv['status'] = isset($adv['status']) ? $adv['status'] : 1;
$advs = D('Adv')->where(array('pos_id' => $aPosId))->select();
foreach ($advs as &$v) {
$data = json_decode($v['data'], true);
if (!empty($data)) {
$v = array_merge($v, $data);
}
}
unset($v);
$this->assign('list', $advs);
$this->assign('pos', $pos);
$this->display('editslider');
} else {
$builder->display();
}
}
}
示例3: website
public function website()
{
$builder = new AdminConfigBuilder();
$data = $builder->handleConfig();
$builder->title('网站信息')->suggest('此处配置网站的一般信息。');
$builder->keyText('WEB_SITE_NAME', '网站名', '用于邮件,短信,站内信显示');
$builder->keyText('ICP', '网站备案号', '设置在网站底部显示的备案号,如“沪ICP备12007941号-2');
$builder->keySingleImage('LOGO', '网站Logo', '网站的logo设置,建议尺寸156*50');
$builder->keySingleImage('QRCODE', '微信二维码', '悬浮微信二维码');
$builder->keySingleImage('JUMP_BACKGROUND', '跳转页背景图片', '跳转页背景图片');
$builder->keyText('SUCCESS_WAIT_TIME', '成功等待时间', '设置成功时页面等待页面');
$builder->keyText('ERROR_WAIT_TIME', '失败等待时间', '设置失败时页面等待页面');
$builder->keyEditor('ABOUT_US', '关于我们内容', '页脚关于我们介绍');
$builder->keyEditor('SUBSCRIB_US', '关注我们', '页脚关注我们内容');
$builder->keyEditor('COPY_RIGHT', '版权信息', '页脚版权信息');
$addons = \Think\Hook::get('uploadDriver');
$opt = array('local' => '本地');
foreach ($addons as $name) {
if (class_exists($name)) {
$class = new $name();
$config = $class->getConfig();
if ($config['switch']) {
$opt[$class->info['name']] = $class->info['title'];
}
}
}
$builder->keySelect('PICTURE_UPLOAD_DRIVER', '图片上传驱动', '图片上传驱动', $opt);
$builder->keySelect('DOWNLOAD_UPLOAD_DRIVER', '附件上传驱动', '附件上传驱动', $opt);
$builder->group('基本信息', array('WEB_SITE_NAME', 'ICP', 'LOGO', 'QRCODE'));
$builder->group('页脚信息', array('ABOUT_US', 'SUBSCRIB_US', 'COPY_RIGHT'));
$builder->group('跳转页面', array('JUMP_BACKGROUND', 'SUCCESS_WAIT_TIME', 'ERROR_WAIT_TIME'));
$builder->group('上传配置', array('PICTURE_UPLOAD_DRIVER', 'DOWNLOAD_UPLOAD_DRIVER'));
$builder->data($data);
$builder->keyDefault('SUCCESS_WAIT_TIME', 2);
$builder->keyDefault('ERROR_WAIT_TIME', 5);
$builder->buttonSubmit();
$builder->display();
}
示例4: website
public function website()
{
$builder = new AdminConfigBuilder();
$data = $builder->handleConfig();
$builder->title(L('_SITE_INFO_'))->suggest(L('_SITE_INFO_VICE_'));
/* $builder->keySelect('LANG', L('_WEBSITE_LANGUAGE_'), L('_SELECT_THE_DEFAULT_LANGUAGE_'), array('zh-cn' => L('_SIMPLIFIED_CHINESE_'), 'en-us' => L('_ENGLISH_')));*/
$builder->keyText('WEB_SITE_NAME', L('_SITE_NAME_'), L('_SITE_NAME_VICE_'));
$builder->keyText('ICP', L('_LICENSE_NO_'), L('_LICENSE_NO_VICE_'));
$builder->keySingleImage('LOGO', L('_SITE_LOGO_'), L('_SITE_LOGO_VICE_'));
$builder->keySingleImage('QRCODE', L('_QR_WEIXIN_'), L('_QR_WEIXIN_VICE_'));
$builder->keySingleImage('JUMP_BACKGROUND', L('_IMG_BG_REDIRECTED_'), L('_IMG_BG_REDIRECTED_'));
$builder->keyText('SUCCESS_WAIT_TIME', L(''), L(''));
$builder->keyText('ERROR_WAIT_TIME', L(''), L(''));
$builder->keyEditor('ABOUT_US', L(''), L(''));
$builder->keyEditor('SUBSCRIB_US', L(''), L(''));
$builder->keyEditor('COPY_RIGHT', L(''), L(''));
$addons = \Think\Hook::get('uploadDriver');
$opt = array('local' => L('_LOCAL_'));
foreach ($addons as $name) {
if (class_exists($name)) {
$class = new $name();
$config = $class->getConfig();
if ($config['switch']) {
$opt[$class->info['name']] = $class->info['title'];
}
}
}
$builder->keySelect('PICTURE_UPLOAD_DRIVER', L('_PICTURE_UPLOAD_DRIVER_'), L('_PICTURE_UPLOAD_DRIVER_'), $opt);
$builder->keySelect('DOWNLOAD_UPLOAD_DRIVER', L('_ATTACHMENT_UPLOAD_DRIVER_'), L('_ATTACHMENT_UPLOAD_DRIVER_'), $opt);
$builder->group(L('_BASIC_INFORMATION_'), array('WEB_SITE_NAME', 'ICP', 'LOGO', 'QRCODE', 'LANG'));
$builder->group(L('_THE_FOOTER_INFORMATION_'), array('ABOUT_US', 'SUBSCRIB_US', 'COPY_RIGHT'));
$builder->group(L('_JUMP_PAGE_'), array('JUMP_BACKGROUND', 'SUCCESS_WAIT_TIME', 'ERROR_WAIT_TIME'));
$builder->keyBool('GET_INFORMATION', L('_OPEN_INSTANT_ACCESS_TO_THE_MESSAGE_'), L('_OPEN_INSTANT_ACCESS_TO_THE_MESSAGE_VICE_'));
$builder->keyText('GET_INFORMATION_INTERNAL', L('_MESSAGE_POLLING_INTERVAL_'), L('_MESSAGE_POLLING_INTERVAL_VICE_'));
$builder->group(L('_PERFORMANCE_SETTINGS_'), array('GET_INFORMATION', 'GET_INFORMATION_INTERNAL'));
$builder->group(L('_UPLOAD_CONFIGURATION_'), array('PICTURE_UPLOAD_DRIVER', 'DOWNLOAD_UPLOAD_DRIVER'));
$builder->data($data);
$builder->keyDefault('SUCCESS_WAIT_TIME', 2);
$builder->keyDefault('ERROR_WAIT_TIME', 5);
$builder->keyDefault('LANG', 'zh-cn');
$builder->keyDefault('GET_INFORMATION', 1);
$builder->keyDefault('GET_INFORMATION_INTERNAL', 10);
$builder->buttonSubmit();
$builder->display();
}