<?php
class sitesControl extends skymvc{
	
	public function __construct(){
		parent::__construct();
 
	}
	
	public function onDefault(){
		$data=M("sites")->select(array(
			"where"=>" 1"
		));
		$this->smarty->goAssign(array(
			"data"=>$data
		));
		$this->smarty->display("sites/index.html");
	}
	
	public function onAdd(){
		$siteid=get("siteid","i");
		$data=M("sites")->selectRow("siteid=".$siteid);
		
		$this->smarty->assign("data",$data);
		$this->smarty->display("sites/add.html");
	}
	
	public function onSave(){
		$siteid=intval(get_post('siteid','i'));
		$data=M("sites")->postData();
		if($siteid){
			M("sites")->update($data,"siteid=".$siteid);
		}else{
			M("sites")->insert($data);
		}
		 
		$this->goall("保存成功");
	}
	
	 
	
	
}

?>