<?php
/*
6.0秀影企业版视频广告插播功能
*/
class SmilController extends Easy_Controller_Action{
	public function init(){
		$this->_Smil = new SmilModel();
		$this->_View->type = array('picture'=> '图片广告', 'swf'=> 'FLASH广告', 'video'=>'视频广告', 'flv'=>'FLV广告','code'=>'JS或者HTML');
		$this->_View->position = array('片头广告', '中间插播', '片尾广告', '缓冲广告', '自定义时间');
	}
	public function indexAction(){
		$this->_View->rows = $this->_Smil->getAll($where);
		$this->_View->printpage = $this->_Smil->printPage;
	}
	public function addAction(){
		if ($this->_Request->isPost()){
			if ($this->_Smil->add($this->_Request->getPost())===false){
				$this->_View->message = $this->_Smil->error;
			}else{
				$this->_View->message = _('添加成功!');
			}
			exit($this->_View->render('message'));
		}
	}
	public function modifyAction(){
		$id = $this->_Request->getParam('id');
		$this->_View->modify = $this->_Smil->getRow(array('id'=> $id));
		if ($this->_Request->isPost()){
			if ($this->_Smil->modify($this->_Request->getPost())===false){
				$this->_View->message = $this->_Smil->error;
			}else{
				$this->_View->message = _('修改成功!');
			}
			exit($this->_View->render('message'));
		}
	}
	public function lockedAction(){
		$id = $this->_Request->getParam('id');
		$this->_Smil->locked($id);
		$this->_View->message = _('设置成功!');
		exit($this->_View->render('message'));
	}
	public function deleteAction(){
		$id = $this->_Request->getParam('id');
		$this->_Smil->delete($id);
		$this->_View->message = _('删除成功!');
		exit($this->_View->render('message'));
	}
}
?>