<?php
class TskcAction extends HomeAction{
    public function _initialize() {
        parent::_initialize();
    }
    public function index(){

		$this->display();
    }
	
	public function show(){
		$action=D('Page');
		$pid=abs(intval($this->_request('pid')));
		$id=abs(intval($this->_request('id')));	
		
		$tname=trim($this->_request('tname'));
		$tarr=array('product','companys','case','agent','page');
		if(empty($tname)){$tname='page';}
		if(!in_array($tname,$tarr)){
			die('Bad Reuqest!');
		}	
		
		if(!$pid&&!$id){
			$this->error('非法访问');	
		}
		if($id){
				$pagedatas=$action->where(array('id'=>$id))->order(array('order'=>'desc'))->find();
				if($pagedatas['pid']){
					$listpage=$action->where(array('pid'=>$pagedatas['pid']))->order(array('order'=>'desc'))->select();
				}else{
					$listpage=$action->where(array('pid'=>$pagedatas['id']))->order(array('order'=>'desc'))->select();
				}
		}else if($pid){
				$pagedatas=$action->where(array('pid'=>$pid))->order(array('order'=>'desc'))->find();
				$listpage=$action->where(array('pid'=>$pid))->order(array('order'=>'desc'))->select();			
		}
        $this->assign("pagedatas", $pagedatas);
        $this->assign("listpage", $listpage);
		$this->display($tname);	
	}
    
    
}