fieldtype = ['VARCHAR' => 30]; $this->defaulttype = 'VARCHAR'; } /** * 字段相关属性参数 * * @param array $value 值 * @return string */ public function option($option, $field = NULL) { $_field = [ '' ]; if ($field) { foreach ($field as $t) { if ($t['fieldtype'] == 'Text') { $st = $option['field'] == $t['fieldname'] ? 'selected' : ''; $_field[] = ''; } } $_field = implode('', array_unique($_field)); } return [$this->_search_field().'
'.dr_lang('对文本类型字段有效,会实时变动颜色').'
'.dr_lang('用于字段为空时显示该填充值,并不会去主动变更数据库中的实际值;可以设置会员表字段,表示用当前登录会员信息来填充这个值').'
', '
'.dr_lang('[整数]表示固定宽度;[整数%]表示百分比').'
' ]; } /** * 字段输出 */ public function output($value) { return $value; } /** * 字段表单输入 * * @return string */ public function input($field, $value = '') { // 字段禁止修改时就返回显示字符串 if ($this->_not_edit($field, $value)) { return $this->show($field, $value); } // 字段存储名称 $name = $field['fieldname']; // 字段显示名称 $text = ($field['setting']['validate']['required'] ? ' * ' : '').dr_lang($field['name']); // 字段提示信息 $tips = $field['setting']['validate']['tips'] ? ''.$field['setting']['validate']['tips'].'' : ''; // 表单宽度设置 $width = \Phpcmf\Service::IS_MOBILE_USER() ? '100%' : ($field['setting']['option']['width'] ? $field['setting']['option']['width'] : 200); // 风格 $style = 'style="width:'.$width.(is_numeric($width) ? 'px' : '').';"'; // 字段默认值 $value = $value ? $value : $this->get_default_value($field['setting']['option']['value']); $str = ''; // 加载js if (!$this->is_load_js($field['fieldtype'])) { $str.= ' '; $str.= ''; $str.= ''; $this->set_load_js($field['fieldtype'], 1); } $default = ''; if ($field['setting']['option']['field'] && $value) { $default = '$("#dr_'.$field['setting']['option']['field'].'").css("color", "'.$value.'");'; } $str.= ' '; $js = \Phpcmf\Service::L('js_packer'); $str.= $js->pack(' ', 0); return $this->input_format($name, $text, $str.$tips); } /** * 字段表单显示 * * @param string $field 字段数组 * @param array $value 值 * @return string */ public function show($field, $value = null) { return $this->input_format($field['fieldname'], $field['name'], '
   
'); } }