$v) { if(isset($v['match'])) { # 这里增加value,用以区分update/select的值 if(is_array($v['match'])) { $v['value'] = $v['match'][1]; $v['match'] = $v['match'][0]; } else { $v['value'] = $v['match']; } if($k == 'id') { $config['request']['delete']['where'][$k] = $v['match']; if(isset($config['request']['one'])) $config['request']['one']['where'][$k] = $v['match']; $config['request']['update']['where'][$k] = $v['match']; } //elseif(isset($v['update']) || isset($v['insert'])) elseif(!isset($v['table'])) { $config['request']['insert']['add'][$k] = $v['value']; if(empty($v['insert'])) $config['request']['update']['set'][$k] = $v['value']; } } if(isset($v['table']) && !isset($config['end'])) { $config['end']['insert'] = $v['value']; } if(isset($v['list'])) { $config['manage']['list'][$k]['col'] = $k; $config['manage']['list'][$k]['name'] = $v['name']; if(is_string($v['list'])) { $config['manage']['list'][$k]['value'] = $v['list']; } if(isset($v['option'])) { $config['manage']['list'][$k]['option'] =& $v['option']; } if(isset($v['modal'])) { $config['manage']['list'][$k]['modal'] = $v['modal']; } if(isset($v['edit'])) { $config['manage']['list'][$k]['edit'] = $v['edit']; } } if(empty($config['request']['list'])) { $config['request']['list']['type'] = 'all'; $config['request']['list']['order'] = array('id', 'desc'); $config['request']['list']['page'] = array(15, 'list'); $config['request']['list']['col'] = '*|id'; $config['request']['list']['option'] = array(); } if(isset($v['match'])) { $config['request']['list']['option'][$k] = $v['match']; } if(isset($v['order'])) { if(isset($config['request']['list']['order'])) { if($config['request']['list']['order'][0] && $config['request']['list']['order'][0] != $k) { $config['request']['list']['order'][0] = $k . '` '.(is_string($v['order']) ? $v['order'] : 'desc').',`' . $config['request']['list']['order'][0]; } } } if(isset($v['search'])) { if(strpos($v['search'], 'order') !== false) { $config['manage']['search']['order'][$k] = $v['name']; } if(strpos($v['search'], 'fulltext') !== false) { $config['manage']['search']['fulltext'][$k] = $v['name']; isset($v['match']) && $config['request']['list']['option'][$k] = array('option', 'like'); } if(isset($v['option']) && strpos($v['search'], 'select') !== false) { $config['manage']['search']['select'][$k]['option'] = $v['option']; $config['manage']['search']['select'][$k]['lang'] = $v['name']; if(isset($v['default'])) { $config['manage']['search']['select'][$k]['default'] = $v['default']; } } } if(isset($v['update'])) { $config['manage']['update'][$k]['col'] = $k; $config['manage']['update'][$k]['name'] = $v['name']; if(isset($v['desc'])) { $config['manage']['update'][$k]['desc'] = $v['desc']; } if(isset($v['default'])) { $config['manage']['update'][$k]['default'] = $v['default']; } if(isset($v['option'])) { $config['manage']['update'][$k]['option'] =& $v['option']; } if(isset($v['child'])) { $config['manage']['update'][$k]['child'] = $v['child']; } if(isset($v['child_name'])) { $config['manage']['update'][$k]['child_name'] = $v['child_name']; } if(isset($v['key'])) { $config['manage']['update'][$k]['key'] = $v['key']; } if(isset($v['place'])) { $config['manage']['update'][$k]['place'] = $v['place']; } if(isset($v['table'])) { $config['manage']['update'][$k]['table'] = $v['table']; } if(isset($v['show'])) { $config['manage']['update'][$k]['show'] = $v['show']; } if(isset($v['autocomplete'])) { $config['manage']['update'][$k]['autocomplete'] = $v['autocomplete']; } if(isset($v['match']) && $v['match'] != 'option') { if(is_string($v['match']) && strpos($v['match'], '/') !== false) { $config['manage']['update'][$k]['valid'] = 'validate[required,custom['.$k.']]'; } else { $config['manage']['update'][$k]['valid'] = 'validate[required]'; } } if($v['update']) { $config['manage']['update'][$k]['type'] = $v['update']; } else { $config['manage']['update'][$k]['type'] = 'text'; } } if(isset($v['update']) && $v['update'] == 'radio' && (is_array($v['option']) || is_object($v['option']))) { $config['request']['update' . $k]['type'] = 'update'; $config['request']['update' . $k]['set'][$k] = $v['value']; $config['request']['update' . $k]['where']['id'] = 'yes'; } } if(isset($config['manage']['list']) && is_array($config['manage']['list'])) { $config['manage']['list']['_manage'] = array ( 'col' => 'manage', 'name' => '管理', 'value' => array(), ); if(isset($config['manage']['update']) && !isset($config['manage']['edit'])) { # 3和6 对应database类里的配置 $config['manage']['list']['_manage']['value'] = array(3 => '编辑'); } if(isset($config['manage']['list'][0])) { $config['manage']['list']['_manage']['value'] += $config['manage']['list'][0]; unset($config['manage']['list'][0]); } elseif(isset($config['manage']['list_button'])) { $config['manage']['list']['_manage']['value'] += $config['manage']['list_button']; } if(!$config['manage']['list']['_manage']['value']) { unset($config['manage']['list']['_manage']); } } } return $config; } }