' . $modal . '
' . $desc . '
'; } /** * desc * * @return string */ static public function desc($desc) { return ''; return $desc; } /** * hr 分割线 * * @return string */ static public function hr($param) { return '
' . $param['name'] . '
'; } /** * cue * * @return string */ static public function cue($param) { $param['cue'] = isset($param['cue']) ? $param['cue'] : ''; if(strpos($param['name'], '-') !== false) { $temp = explode('-', $param['name']); $param['name'] = $temp[0]; $param['cue'] = $temp[1]; } elseif(strpos($param['name'], '(') !== false) { $temp = explode('(', $param['name']); $param['name'] = $temp[0]; $param['cue'] = str_replace(')', '', $temp[1]); } elseif(strpos($param['name'], '(') !== false) { $temp = explode('(', $param['name']); $param['name'] = $temp[0]; $param['cue'] = str_replace(')', '', $temp[1]); } return $param; } /** * pageLeft * * @return string */ static public function pageLeft($param) { $param = self::cue($param); if($param['cue']) { $param['cue'] = '[' . $param['cue'] . ']'; } $html = ''; return $html; } /** * textarea * * @return string */ static public function textarea($param) { return ''; return ''; } /** * image * * @return string */ static public function image($param) { if(isset($param['value'])) { $pic = 'src="' . $param['value'] . '"'; } elseif(isset($param['places'])) { $pic = 'src="http://placehold.it/'.$param['place'].'"'; } else { $pic = 'src="" style=display:none;'; } return '
'; } /** * images * * @return string */ static public function images($param) { $pic = ''; if(isset($param['value'])) { $temp = explode(',', $param['value']); foreach($temp as $k => $v) { $pic .= '点此删除'; } } return '
'.$pic.'
'; } /** * upload * * @return string */ static public function upload($param) { return '
'; //return ''; } /** * editor * * @return string */ static public function editor($param) { return ''; } /** * selector * * @return string */ static public function selector($param, $type = '') { $html = ''; if(isset($param['key']) && strpos($param['key'], '.css') !== false) { $param['key'] = ''; } if(isset($param['option'])) { foreach($param['option'] as $k => $v) { $check = ''; if((isset($param['value']) && $param['value'] == $k) || (empty($param['value']) && isset($param['default']) && $param['default'] == $k)) { $check = 'checked'; } if(is_array($v)) { $value = $v['name']; } else { $value = $v; } $html .= '' . $value . '  '; } $html .= self::hidden($param); } return '
' . $html . '
'; } /** * radio * * @return string */ static public function radio($param, $type = '') { $html = ''; if(isset($param['option'])) { if(isset($param['option']['state']) && $param['option']['state'] == 1) { if(isset($param['value'])) { $param['value'] = explode(',', $param['value']); } else { $param['value'] = array(); } # 处理比较复杂的多维数组 unset($param['option']['state']); foreach($param['option'] as $k => $v) { $check = ''; if(isset($param['update_parent'])) { $input_type = $param['update_parent']; } else { $input_type = $param['update']; } //{check} $html .= ' ' . $v['name'] . '   
'; $span = array('',''); if(isset($v['child']) && $v['child']) { //$i = 1; $j = -1; $html .= ''; } $html .= '
'; } } else { $js = ''; if(isset($param['show']) && !is_array($param['show'])) { $js = 'onclick="inputShow($(this), \''.$param['show'].'\')"'; } foreach($param['option'] as $k => $v) { $check = ''; if(is_array($v)) { $value = $v['name']; isset($v['id']) && $k = $v['id']; } else { $value = $v; } if(isset($param['bit'][$k])) { if(isset($param['value']) && ($param['value'] & $k) > 0) { $check = 'checked'; } } elseif(isset($param['value'])) { if(is_string($param['value']) && strpos(',' . $param['value'], ',' . $k) !== false) { $check = 'checked'; } elseif(is_array($param['value']) && in_array($k, $param['value'])) { $check = 'checked'; } } elseif(isset($param['default'])) { if(is_string($param['default']) && strpos(',' . $param['default'], ',' . $k) !== false) { $check = 'checked'; } elseif(is_array($param['default']) && in_array($k, $param['default'])) { $check = 'checked'; } } $html .= ' ' . $value . '   '; } } } return '
' . $html . '
'; } /** * select * * @return string */ static public function select($param, $class = '', $hidden = '', $change = '') { $html = $class ? '
' : ''; if(isset($param['child'])) { $child_param['name'] = strpos($param['name'], 'add_') !== false ? 'add_' . $param['child_name'] : 'set_' . $param['child_name']; isset($param['value']) && $param['value'] = $param['value']; isset($param['child_value']) && $child_param['value'] = $param['child_value']; $change = 'style="width:45%" id="'.$param['name'].'" data-child="'.$child_param['name'].'_child" '; $class = ' change'; //$param['name'] .= '_parent'; } $html .= $hidden . ''; if(isset($param['child'])) { $child = $child_param['name']; $hidden = self::hidden(array('name' => $child, 'class' => $child . '_child_value')); foreach($param['child'] as $k => $v) { $child_param['name'] = 'child-' . $k; $child_param['option'] = $v; $html .= self::select($child_param, $child . '_child '.$child .'_child_'.$k.'" parent="'.$k.'" style="display:none;margin-top: -35px;margin-left: 27%;"', $hidden); } } $html .= $class ? '
' : ''; return $html; } /** * radio * * @return string */ static public function checkbox($param) { return self::radio($param); } /** * text * * @return string */ static public function text($param, $class = '') { if($class) { return '
'.self::text($param, false).'
'; } else { $auto = ''; if(isset($param['autocomplete'])) { $auto = 'complete="' . Maze::url($param['autocomplete']) . '"'; } return ''; } } /** * password * * @return string */ static public function password($param) { $param['value'] = ''; return self::text($param); } /** * hidden * * @return string */ static public function hidden($param) { $param['update'] = 'hidden'; return self::text($param, ''); } /** * time * * @return string */ static public function time($param) { return ''; } /** * date * * @return string */ static public function date($param) { return ''; } /** * div * * @return string */ static public function node($param, $type = 'div') { $result = array('',''); foreach($param as $k => $v) { $result[0] .= '<'.$type.' '.$v.'>'; $result[1] .= ''; } return $result; } }