✏️ 正在编辑: StatusResolucaoController.php
路径:
/srv/systems_dir/yuppiecred-bkp/application/controllers/StatusResolucaoController.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php class StatusResolucaoController extends Zend_Controller_Action { public function init() { /* Initialize action controller here */ } public function indexAction() { $form = new Form_Filtro_StatusResolucao(); $params = $this->_getAllParams(); $filtros = array(); if( isset($params['descricao']) && $params['descricao'] ){ $filtros[] = "(descricao LIKE '%{$params['descricao']}%')"; } if( isset($params['parent_id']) && $params['parent_id'] ){ if( $params['parent_id'] == 'null' ){ $filtros[] = '(parent_id IS NULL OR parent_id = 0)'; } else { $filtros[] = "(parent_id = {$params['parent_id']})"; } } $where = $filtros ? implode(' AND ', $filtros) : null; $form->populate($params); $model = new Model_StatusResolucao(); $listaStatus = $model->listar($where, 'descricao ASC'); $paginator = Zend_Paginator::factory($listaStatus); $paginator->setCurrentPageNumber($this->_getParam('page', 1)); $paginator->setItemCountPerPage(50); $this->view->paginator = $paginator; $this->view->form = $form; } public function saveAction() { $request = $this->getRequest(); $id = (int) $request->getParam('id'); $form = new Form_StatusResolucao(); if( $request->isPost() ){ if( $form->isValid($request->getPost()) ){ $status = new Model_StatusResolucao($request->getPost()); try { $id = $status->salvar($status); $this->_helper->flashMessenger(array( 'success' => 'Dados salvos com sucesso.' )); } catch ( Exception $e ) { $this->_helper->flashMessenger(array( 'alert' => $e->getMessage() )); } } } if( $id > 0 ){ $status = new Model_StatusResolucao(); $dados = $status->exibir($id); $form->populate($dados->toArray()); } $this->view->form = $form; } public function deleteAction() { $request = $this->getRequest(); $id = (int) $request->getParam('id'); try { if( $id > 0 ){ $status = new Model_StatusResolucao(); $status->excluir($id); $this->_helper->flashMessenger(array( 'success' => "Registro excluído com sucesso" )); } } catch ( Exception $e ) { $this->_helper->flashMessenger(array( 'alert' => $e->getMessage() )); } $this->_redirect('/status-resolucao'); } }
💾 保存文件
← 返回文件管理器