<?php
class CommentsController extends Easy_Controller_Action {
	public function Init(){
		$this->_Comments = new CommentsModel();
	}
	public function IndexAction(){
		$this->_View->connets = $this->_Comments->getList('locked=0');
		$this->_View->printpage  = $this->_Comments->printPage;
	}
	public function deleteAction(){
		$id = (int)$this->_Request->getParam('id');
		if ($id){
			$this->_Comments->delete($id);
		}
		$this->_View->message = _('删除成功!');
		exit($this->_View->render('message'));
	}
	public function lockedAction(){
		$id = $this->_Request->getParam('id');
		if ($id){
			$this->_Comments->locked($id);
		}
		$this->_View->message = _('审核成功!');
		exit($this->_View->render('message'));
	}
	public function postAction(){
		$post = $this->_Request->getPost('post');
		$id = (int)$this->_Request->getParams('id');
		if ($post == 'locked'){
			$this->_Comments->locked($id);
			$this->_View->message = _('审核成功!');
		}elseif ($post == 'delete'){
			$this->_Comments->delete($id);
			$this->_View->message = _('删除成功!');
		}
		exit($this->_View->render('message'));
	}
}?>