<?php 
class fieldsChajian extends Chajian{

	protected function initChajian()
	{
		$this->arrobj = c('array');
	}

	//返回表字段和默认值
	public function getArr($table, $dfa=array())
	{
		$rs = array();
		$farr = $this->db->gettablefields('[Q]'.$table.'');
		$fobj = array();
		foreach($farr as $k=>$rs1){
			$rs[$rs1['name']] 	= $this->rock->repempt($rs1['dev']);
			$narst = $this->getionfs($rs1['explain']);
			$nsda  = array(
				'name' 	=> $narst['name'],
				'isbt' 	=> $rs1['isnull'],
				'msg' 	=> $narst['msg'],
			);
			if($narst['store'])$nsda['store'] = $narst['store'];
			$fobj[$rs1['name']] = $nsda;
		}
		$rs['id'] = '0';
		foreach($dfa as $k=>$v)$rs[$k]=$v;
		return array(
			'data' 		=> $rs,
			'fieldsobj' => $fobj
		);
	}
	private function getionfs($str)
	{
		$ades = explode('@', $str);
		$store= array();
		if(isset($ades[1])){
			$store = $this->arrobj->strtoarray($ades[1]);
		}
		return array(
			'name'  => $ades[0],
			'store' => $store,
			'msg'	=> arrvalue($ades,2)
		);
	}
}