本文整理汇总了PHP中Admin\Builder\AdminConfigBuilder::keyColor方法的典型用法代码示例。如果您正苦于以下问题:PHP AdminConfigBuilder::keyColor方法的具体用法?PHP AdminConfigBuilder::keyColor怎么用?PHP AdminConfigBuilder::keyColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Admin\Builder\AdminConfigBuilder
的用法示例。
在下文中一共展示了AdminConfigBuilder::keyColor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
}
}