<?php
class site_cityModel extends model{
	public $base;
	public function __construct(&$base){
		parent::__construct($base);
		$this->base=$base;
		$this->table="site_city";
	}
	
	public function id_title($option=array()){
		$data=$this->select($option);
		foreach($data as $v){
			$ndata[$v['sc_id']]=$v['title'];
			
		}
		return $ndata;
	}
	public function id_family($sc_id=0){
		$sc_id=intval($sc_id);
		$ids[]=$sc_id;
		$ids1=$this->selectCols(array("where"=>" pid=".$sc_id." ","fields"=>"sc_id"));
		if($ids1){
			$ids=array_merge($ids,$ids1);
			$ids2=$this->selectCols(array("where"=>" pid in("._implode($ids1).") ","fields"=>"sc_id"));
			if($ids2){
				$ids=array_merge($ids,$ids2);
				$ids3=$this->selectCols(array("where"=>" pid in("._implode($ids2).") ","fields"=>"sc_id"));
				if($ids3){
					$ids=array_merge($ids,$ids3);
				}
			}
		}
		return $ids;
		
	}
}

?>