public function box($field, $value, $fieldinfo) { if ($value == '') { $value = $fieldinfo['defaultvalue']; } $options = explode("\n", $fieldinfo['options']); foreach ($options as $_k) { $v = explode("|", $_k); $k = trim($v[1]); $option[$k] = $v[0]; } $values = explode(',', $value); $value = array(); foreach ($values as $_k) { if ($_k != '') { $value[] = $_k; } } $value = implode(',', $value); switch ($fieldinfo['boxtype']) { case 'radio': $string = \Org\Util\Form::radio($option, $value, "name='info[{$field}]' {$fieldinfo['formattribute']}", $fieldinfo['width'], $field); break; case 'checkbox': $string = \Org\Util\Form::checkbox($option, $value, "name='info[{$field}][]' {$fieldinfo['formattribute']}", 1, $fieldinfo['width'], $field); break; case 'select': $string = \Org\Util\Form::select($option, $value, "name='info[{$field}]' id='{$field}' {$fieldinfo['formattribute']}"); break; case 'multiple': $string = \Org\Util\Form::select($option, $value, "name='info[{$field}][]' id='{$field} ' size=2 multiple='multiple' style='height:60px;' {$fieldinfo['formattribute']}"); break; } return $string; }
public function typeid($field, $value, $fieldinfo) { extract($fieldinfo); $setting = string2array($setting); if (!$value) { $value = $setting['defaultvalue']; } if ($errortips) { $errortips = $this->fields[$field]['errortips']; $this->formValidator .= '$("#' . $field . '").formValidator({onshow:"",onfocus:"' . $errortips . '"}).inputValidator({min:1,onerror:"' . $errortips . '"});'; } $usable_type = $this->categorys[$this->catid]['usable_type']; $usable_array = array(); if ($usable_type) { $usable_array = explode(',', $usable_type); } //获取站点ID if (intval($_GET['siteid'])) { $siteid = intval($_GET['siteid']); } else { $siteid = $this->siteid; } return \Org\Util\Form::select($data, $value, 'name="info[' . $field . ']" id="' . $field . '" ' . $formattribute . ' ' . $css, '≡请选择≡'); }
/** * 推荐位添加模型加载 */ public function public_model_load() { $typeid = intval($_GET['typeid']); $models = D('Model')->where(array('typeid' => $typeid, 'siteid' => $this->siteid))->select(); $modelstr = \Org\Util\Form::select(array_translate($models), '', 'name="info[modelid]" onchange="category_load(this);"', '所有模型'); echo $modelstr; }