Beispiel #1
0
 public function group()
 {
     if (IS_POST) {
         $config = I('post.config');
         if ($config && is_array($config)) {
             foreach ($config as $name => $value) {
                 $map = array('name' => $name);
                 M('Config')->where($map)->setField('value', $value);
             }
         }
         $this->Model->cache();
         action_log('Group_Config', 'Config', I('get.id'));
         $this->success('保存成功!', U('?id=' . I('get.id')));
     } else {
         $id = I('get.id', 1);
         $type = model_field_attr(C('CONFIG_GROUP_LIST'));
         $list = M("Config")->where(array('status' => 1, 'group' => $id))->field('id,name,title,extra,value,remark,type')->order('sort')->select();
         if ($list) {
             $this->assign('list', $list);
         }
         $this->assign('type', $type);
         $this->assign('id', $id);
         $this->display();
     }
 }
                    ?>
</textarea><?php 
                    break;
                    ?>
            <?php 
                case "4":
                    ?>
<select name="config[<?php 
                    echo $config["name"];
                    ?>
]" class="easyui-combobox" data-options="value:'<?php 
                    echo $config["value"];
                    ?>
',multiple:false,required:false,editable:false" style="height: 30px;">
                <?php 
                    $_result = model_field_attr($config['extra']);
                    if (is_array($_result)) {
                        $i = 0;
                        $__LIST__ = $_result;
                        if (count($__LIST__) == 0) {
                            echo "";
                        } else {
                            foreach ($__LIST__ as $key => $vo) {
                                $mod = $i % 2;
                                ++$i;
                                ?>
<option value="<?php 
                                echo $key;
                                ?>
"><?php 
                                echo $vo;
			$post_data['first'] = $post_data['rows'] * ($post_data['page'] - 1);
			$map = array();
            $map = $this->_search();
			$total = $this->Model->where($map)->count();
			if($total==0){
				$_list='';
			}else{
				$_list = $this->Model->where($map)->order($post_data['sort'].' '.$post_data['order'])->limit($post_data['first'].','.$post_data['rows'])->select();
			}
            <?php 
foreach ($_List as $field_key => $field) {
    $extra = unserialize($field['extra']);
    if (in_array($field['type'], array('select', 'checkbox'))) {
        if ($extra['type'] == 1) {
            $option = '';
            $option = model_field_attr($extra['option']);
            echo '$option["' . $field["name"] . '"]=' . var_export($option, true) . ';
                    ';
        }
        if ($extra['type'] == 2) {
            echo '$op_' . $field['name'] . '=R("Admin/Function/get_field_option",array("' . $field["id"] . '"));
                     foreach($op_' . $field['name'] . ' as $op_' . $field['name'] . '_key=>$op_' . $field['name'] . '_one){
                     	$option["' . $field["name"] . '"][$op_' . $field['name'] . '_one["key"]]=$op_' . $field["name"] . '_one["val"];
                     }
                     ';
        }
        if ($extra['type'] == 3) {
            $extra_option_arr = explode('|', $extra['option']);
            if ($extra_option_arr[1] == '') {
                $extra_option_arr[1] = 'type';
                $extra_option_arr[2] = 'value';
 public function get_field_option($f_id = '')
 {
     if ($f_id == '') {
         $f_id = I('get.f_id', 0);
     }
     $extra_ys = M('ModelField')->where('id=' . $f_id)->getField('extra');
     $extra = unserialize($extra_ys);
     $ops = model_field_attr($extra['option']);
     foreach ($ops as $opkey => $opkeyval) {
         $data_ls['key'] = $opkey;
         $data_ls['val'] = $opkeyval;
         $data[] = $data_ls;
     }
     $r_type = I('get.r_type');
     if ($r_type == 'json') {
         $this->ajaxReturn($data);
     } else {
         return $data;
     }
 }