📄 netbarcontroller.php
字号:
<?php
/*
秀影EasyFramework框架
qq:24498936
msn:jdzcn_net@hotmail.com
website:http://www.vodcms.com
*/
class NetBarController extends Easy_Controller_Action {
public function init(){
$this->_NetbarModel = new NetbarModel();
}
public function IndexAction(){
if ($this->_Request->getParams('keyword')){
$this->_View->netbar = $this->_NetbarModel->search($this->_Request->getParams('type'), $this->_Request->getParams('keyword'));
}else{
$this->_View->netbar = $this->_NetbarModel->getAll();
}
$this->_View->printpage = $this->_NetbarModel->printpage;
}
public function AddAction(){
if($this->_Request->isPost()){
if ($this->_NetbarModel->addNetbar($this->_Request->getPost())===false){
$this->_View->message = $this->_NetbarModel->error;
exit($this->_View->render('message'));
}else{
$this->_View->message = _('添加成功!');
exit($this->_View->render('message'));
}
}
}
public function modifyAction(){
$id = (int)$this->_Request->getParam('id');
$this->_View->modify = $this->_NetbarModel->getRow(array('id' => $id));
if ($this->_Request->getParam('do')=='locked'){
$this->_NetbarModel->locked($id);
$this->_View->message = _('操作成功!');
exit($this->_View->render('message'));
}
elseif ($this->_Request->isPost()){
if ($this->_NetbarModel->modify($this->_Request->getPost(), array('id'=> (int)$this->_Request->getPost('id'))) === false){
$this->_View->message = $this->_NetbarModel->error;
exit($this->_View->render('message'));
}else{
$this->_View->message = _('修改成功!');
exit($this->_View->render('message'));
}
}
}
public function deleteAction(){
$id = (int)$this->_Request->getParam('id');
$this->_NetbarModel->delete($id);
$this->_View->redirect('?mod=netbar&action=index');
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -