'.app::get('base')->_('是').'';
$params['id']=$id.'-f';
//$return .='
'.utils::buildTag($params,'input value="false"'.(($value==='false' || !$value )?' checked="checked"':'')).'');
$return .= utils::buildTag($params,'input value="false"'.(($value==='0' || $value==='false' || !$value)?' checked="checked"':'')).'';
if($params['needall']) {
$return .= utils::buildTag($params,'input value=""'.((!$value)?' checked="checked"':'')).'';
}
return $return.'';
}
function input_color($params){
$domid = $params['id'];
if($params['value']==''){
$params['value']='#cccccc';
}
$params['size'] = 7;
$params['maxlength'] = 7;
//todo:ever litie check js
return utils::buildTag($params,'input autocomplete="off"').' ';
}
function input_label($params){
return ''.$params['value'].'';
}
function input_date($params){
if(!$params['type']){
$params['type'] = 'date';
}
if(!$params['vtype']){
$params['vtype'] = 'date';
}
if(is_numeric($params['value'])){
$params['value'] = date('Y-n-j',$params['value']);
}
if(isset($params['concat'])){
$params['name'] .= $params['concat'];
unset($params['concat']);
}
if(!$params['format'] || $params['format']=='timestamp'){
$prefix = '';
}else{
$prefix = '';
}
$params['type'] = 'text';
$return = utils::buildTag($params,'input class="cal '.$params['class'].'" size="10" maxlength="10" autocomplete="off"');
return $prefix.$return.'';
}
function input_default($params){
$ignore = array(
'password'=>1,
'file'=>1,
'hidden'=>1,
'checkbox'=>1,
'radio'=>1,
);
if(!isset($ignore[$params['type']])){
if(!isset($params['vtype'])){
$params['vtype'] = $params['type'];
}
$params['type'] = 'text';
}
return utils::buildTag($params,'input autocomplete="off" class="x-input '.$params['class'].'"');
}
function input_file($params){
$html = '
';
$ui = new base_component_ui($this);
if($params['multi']){
foreach($params['value'] as $value){
$item = array(
'name'=>$params['name'].'[]',
'value'=>$value,
);
$html.= $this->_input_file_one($item,$ui->new_dom_id());
}
}else{
$html.= $this->_input_file_one($params,$ui->new_dom_id());
}
return $html.'
';
}
function input_sfile($params){
if(!$params['f_type']){
$params['f_type'] = 'public';
}
$hidden = '';
$code = '';
return $code.$hidden;
}
function _input_file_one($params,$domid){
$html='';
if($params['value']){
list($ret['url'],$ret['id'],$ret['storager']) = explode('|',$params['value']);
$html.=''.app::get('base')->_('下载').' ';
}else{
$html.='';
}
$html.='';
$html.='';
return $html;
}
function input_gender($params){
$params['type'] = 'radio';
$value = $params['value'];
unset($params['value']);
$id = $params['id'];
$params['id']=$id.'-m';
$return = utils::buildTag($params,'input value="male"'.($value=='male'?' checked="checked"':'')).'';
$params['id']=$id.'-fm';
$return .=' '.utils::buildTag($params,'input value="female"'.($value=='female'?' checked="checked"':'')).'';
return $return;
}
function input_intbool($params){
$params['type'] = 'radio';
$value = $params['value'];
unset($params['value']);
$id = $params['id'];
$params['id']=$id.'-t';
$return = utils::buildTag($params,'input value="1"'.($value==1?' checked="checked"':'')).'';
$params['id']=$id.'-f';
$return .='
'.utils::buildTag($params,'input value="0"'.($value==0?' checked="checked"':'')).'';
return $return;
}
function input_radio($params){
$params['type'] = 'radio';
$options = $params['options'];
$value = $params['value'];
unset($params['options'],$params['value']);
$input_tpl = utils::buildTag($params,'input ',true);
$id_base = $params['id'];
$htmls = array();
$i = 1;
foreach($options as $k=>$item){
$id = $id_base.'-'.($i++);
if($value==$k){
$html = str_replace('/>',' value="'.htmlspecialchars($k).'" checked="checked" />',$input_tpl);
}else{
$html = str_replace('/>',' value="'.htmlspecialchars($k).'" />',$input_tpl);
}
$html = str_replace('id="'.$id_base.'"', 'id="'.$id.'"', $html);
$htmls[]= $html.'';
}
$params['separator'] = $params['separator']?$params['separator']:'
';
$return = implode($params['separator'],$htmls);
return $return;
}
function input_select($params){
if(is_string($params['options'])){
$ui = new base_component_ui($this);
if(!$params['id'])$params['id'] = $ui->new_dom_id();
$params['remote_url'] = $params['options'];
$params['options'] = array($params['value']=>$params['value']);
$script='';
}
if($params['rows']){
foreach($params['rows'] as $r){
$step[$r[$params['valueColumn']]]=intval($r['step']);
$options[$r[$params['valueColumn']]] = $r[$params['labelColumn']];
}
unset($params['valueColumn'],$params['labelColumn'],$params['rows']);
}else{
$options = $params['options'];
unset($params['options']);
}
$params['name'] = $params['search']?'_'.$params['name'].'_search':$params['name'];
$value = $params['value'];
unset($params['value']);
$html=utils::buildTag($params,'select',false);
if(!$params['required']){
$html.='';
}
foreach((array)$options as $k=>$item){
if($k==='0' || $k===0){
$selected = ($value==='0' || $value===0);
}else{
$selected = ($value==$k);
}
$t_step=$step[$k]?str_repeat(' ',($step[$k]-1)*3):'';
$html.='';
}
$html.='';
return $html.$script;
}
function input_textarea($params){
$value = $params['value'];
// $params['style'].=';width:'.($params['width']?$params['width']:'400').'px;';
// $params['style'].=';height:'.($params['height']?$params['height']:'300').'px;';
unset($params['width'],$params['height']);
return utils::buildTag($params,'textarea',false).htmlspecialchars($value).'';
}
function input_time($params){
$params['type'] = 'time';
$return = $this->input_date($params);
if($params['value']){
$hour = utils::mydate('H',$params['value']);
$minute = utils::mydate('i',$params['value']);
}
$select = ' : ';
return $return.$select;
}
function input_tinybool($params){
$params['type'] = 'radio';
$value = $params['value'];
unset($params['value']);
$id = $params['id'];
$params['id']=$id.'-t';
$return = utils::buildTag($params,'input value="Y"'.($value=='Y'?' checked="checked"':'')).'';
$params['id']=$id.'-f';
$return .='
'.utils::buildTag($params,'input value="N"'.($value=='N'?' checked="checked"':'')).'';
return $return;
}
function input_goodscat($params){
return '
';
}
}