<?php
/**
 * 文章分类模型类
 * @package Model
 * @version 1.0
 * @author billow.wang <admin@ivears.com>
 * @date 2013-12-10
 */
class CategoryModel extends Model{
	
    public function SetActionName($ActionName) {
        $this->ActionName=$ActionName;
    }	
	
	public function GetCategoryid($pid){

		$arrid[]=$pid;
		$arrid=$this->GetCategoryCid($pid,$arrid);
		//print_r($arrid);
		return $arrid;
	}
	
	public function GetCategoryCid($cid,&$arrid){
    	$category = D("Category");
        $where = array('model'=>$this->ActionName,'pid'=>$cid);
        $ary_data = $category->where($where)->select();
		if($ary_data){
			foreach($ary_data as $key=>$one){
					$arrid[]=$one['id'];
					$this->GetCategoryCid($one['id'],$arrid);
			}	
		}
		return $arrid;
	}	
    
}
