fieldtype = ['INT' => 10];
$this->defaulttype = 'INT';
}
/**
* 字段相关属性参数
*
* @param array $value 值
* @return string
*/
public function option($option) {
$_option = '';
$_module = \Phpcmf\Service::C()->get_cache('module-'.SITE_ID.'-content');
if ($_module) {
$_option.= '';
foreach ($_module as $dir => $t) {
if (!$t['share']) {
$_option.= '';
}
}
}
return ['
', ''];
}
/**
* 字段输出
*/
public function output($value) {
return intval($value);
}
/**
* 字段入库值
*
* @param array $field 字段信息
* @return void
*/
public function insert_value($field) {
\Phpcmf\Service::L('Field')->data[$field['ismain']][$field['fieldname']] = intval(\Phpcmf\Service::L('Field')->post[$field['fieldname']]);
}
/**
* 字段表单输入
*
* @param string $field 字段数组
* @param array $value 值
* @return string
*/
public function input($field, $value = null) {
// 字段禁止修改时就返回显示字符串
if ($this->_not_edit($field, $value)) {
return $this->show($field, $value);
}
// 字段存储名称
$name = $field['fieldname'];
// 字段显示名称
$text = ($field['setting']['validate']['required'] ? ' * ' : '').dr_lang($field['name']);
// 字段提示信息
$tips = ($name == 'title' && APP_DIR) || $field['setting']['validate']['tips'] ? ''.$field['setting']['validate']['tips'].'' : '';
// 开始输出
$str = '';
$str.= '';
$str.= ''.$tips.'';
return $this->input_format($name, $text, $str);
}
/**
* 字段表单显示
*
* @param string $field 字段数组
* @param array $value 值
* @return string
*/
public function show($field, $value = null) {
return $this->input_format($field['fieldname'], $field['name'], ''.dr_catpos($value, ' - ', false, '', $field['setting']['option']['module']).'
');
}
}