<?php
/*
秀影EasyFramework框架
qq:24498936
msn:jdzcn_net@hotmail.com
website:http://www.vodcms.com
*/
class PlayerController extends Easy_Controller_Action {
	public function init(){
		$this->_Player = new PlayerModel();
	}
	public function indexAction(){
		$this->_View->player = $this->_Player->getAll();
	}
	public function addAction(){
		if ($this->_Request->isPost()){
			if ($this->_Player->add($this->_Request->getPost()) === false){
				$this->_View->message = $this->_Player->error;
				exit($this->_View->render('message'));
			}else{
				$this->_View->message = _('添加播放器成功!');
				exit($this->_View->render('message'));
			}
		}
	}
	public function modifyAction(){
		if ($this->_Request->isPost()){
			if ($this->_Player->modify($this->_Request->getPost())===false){
				$this->_View->message = $this->_Player->error;
			}else{
				$this->_View->message = _('修改成功!');
			}
			exit($this->_View->render('message'));
		}
		$id = (int)$this->_Request->getParam('id');
		$this->_View->modify = $this->_Player->getRow('id='.$id);
	}
	public function deleteAction(){
		$id = (int)$this->_Request->getParam('id');
		$this->_Player->delete($id);
		$this->_View->message = _('删除成功!');
		exit($this->_View->render('message'));
	}
}