✏️ 正在编辑: MotivoLigacaoController.php
路径:
/srv/systems_dir/yuppiecred-lidernegocios/application/controllers/MotivoLigacaoController.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php class MotivoLigacaoController extends Zend_Controller_Action { public function init() { /* Initialize action controller here */ } public function indexAction() { $form = new Form_Filtro_MotivoLigacao(); $params = $this->_getAllParams(); $filtros = array(); if( isset($params['descricao']) && $params['descricao'] ){ $filtros[] = "(descricao LIKE '%{$params['descricao']}%')"; } $where = $filtros ? implode(' AND ', $filtros) : null; $form->populate($params); $model = new Model_MotivoLigacao(); $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_MotivoLigacao(); if( $request->isPost() ){ if( $form->isValid($request->getPost()) ){ $motivoLigacao = new Model_MotivoLigacao($request->getPost()); try { $id = $motivoLigacao->salvar($motivoLigacao); $this->_helper->flashMessenger(array( 'success' => 'Dados salvos com sucesso.' )); } catch ( Exception $e ) { $this->_helper->flashMessenger(array( 'alert' => $e->getMessage() )); } } } if( $id > 0 ){ $motivoLigacao = new Model_MotivoLigacao(); $dados = $motivoLigacao->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_MotivoLigacao(); $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('/motivo-ligacao'); } }
💾 保存文件
← 返回文件管理器