📄 servercontroller.php
字号:
<?php
class ServerController extends Easy_Controller_Action {
public function init(){
$this->_Server = new ServerModel();
}
public function IndexAction(){
$this->_View->server = $this->_Server->getAll();
$this->_View->PrintPage = $this->_Server->PrintPage;
$this->_View->Option = $this->_Server->CreateOption();
}
public function AddAction(){
if ($this->_Request->isPost()){
if ($this->_Server->add($this->_Request->getPost()) === false){
$this->_View->message = $this->_Server->error;
}else{
$this->_View->message = _('服务器添加成功!');
}
exit($this->_View->render('message'));
}else{
$this->_View->redirect('?mod=server&action=index');
}
}
public function modifyAction(){
$id = intval($this->_Request->getParam('id'));
$this->_View->modify = $this->_Server->getRow($id);
$this->_View->Option = $this->_Server->CreateOption($this->_View->modify['parentid']);
if ($this->_Request->getParam('do') == 'locked'){
$this->_Server->locked($id);
$this->_View->redirect('?mod=server&action=index');
}
elseif($this->_Request->isPost()){
if ($this->_Server->modify($this->_Request->getPost())===false){
$this->_View->message = $this->_Server->error;
}else{
$this->_View->message = _('服务器修改成功!');
}
exit($this->_View->render('message'));
}
}
public function deleteAction(){
$id = intval($this->_Request->getParam('id'));
$this->_Server->delete($id);
$this->_View->redirect('?mod=server&action=index');
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -