flinkcontroller.php

来自「a short sketch about linux syntex lines.」· PHP 代码 · 共 70 行

PHP
70
字号
<?php
class FlinkController extends Easy_Controller_Action{
	public function init(){
		$this->_Flink = new FlinkModel();
	}
	public function indexAction(){
		$this->_View->rows = $this->_Flink->getAll();
		$this->_View->printpage = $this->_Flink->printpage;
		exit($this->_View->render('plugins/flink_index'));
	}
	public function FlinkAction(){
	}
	public function addAction(){
		if ($this->_Request->isPost()){
			if ($this->_Flink->add($this->_Request->getPost())===false){
				$this->_View->message = $this->_Flink->error;
			}else{
				$this->_View->message = _('添加成功!');
			}
			exit($this->_View->render('message'));
		}
	}
	public function modifyAction(){
		if ($this->_Request->isPost()){
			if ($this->_Flink->modify($this->_Request->getPost())===false){
				$this->_View->message = $this->_Flink->error;
			}else{
				$this->_View->message = _('修改成功!');
			}
			exit($this->_View->render('message'));
		}
		$this->_View->modify = $this->_Flink->getRow($this->_Request->getParam('id'));
		exit($this->_View->render('plugins/flink_modify'));
	}
	public function lockedAction(){
		$this->_Flink->locked($this->_Request->getParam('id'));
		$this->_View->redirect('flink/index');
		exit;
	}
	public function postAction(){
		$action = $this->_Request->getPost('action');
		$id = $this->_Request->getPost('id');
		switch($action){
			case 1:
				$this->_Flink->locked(array('state'=>1), $id);
				$this->_View->message = _('审核成功!');
			break;
			case 2:
				$this->_Flink->delete($id);
				$this->_View->message = _('删除成功!');
			break;
			case 3:
				$this->_Flink->locked(array('state'=>2), $id);
				$this->_View->message = _('禁用成功!');
			break;
		}
		
		exit($this->_View->render('message'));
	}
	public function deleteAction(){
		$id = (int)$this->_Request->getParam('id');
		if ($id){
			$this->_Flink->delete($id);
			$this->_View->message = _('删除成功!');
		}else{
			$this->_View->message = _('删除失败!');
		}
		exit($this->_View->render('message'));
	}
}?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?