public function processAction()
 {
     if (!$this->_request->isXmlHttpRequest() || !$this->_request->isPost()) {
         $this->_redirect('/admin/managers/');
     }
     $return = array();
     $managerGateway = new Managers_Model_ManagerGateway();
     $form = $managerGateway->getForm('DeleteManager');
     $validForm = $form->isValid($this->_request->getParams());
     // Check the form for validity
     if (!$validForm) {
         $return['formErrors'] = $form->getMessages();
         $return['formResult'] = FALSE;
     } else {
         $form->removeElement('password_confirm');
         $form->removeElement('submit');
         $temp = $form->getValues();
         // Reset manager_deleted to 1 since we are "deleting" the manager
         $temp['manager_deleted'] = 1;
         $page = $managerGateway->create($temp);
         $page->save();
         $flashMessenger = $this->_helper->getHelper('FlashMessenger');
         $flashMessenger->setNamespace('notifications')->addMessage('Manager Deleted.');
         $return['redirect']['location'] = '/admin/managers/';
     }
     $this->_helper->json->sendJson($return);
 }
 public function indexAction()
 {
     $managerGateway = new Managers_Model_ManagerGateway();
     $this->view->managerList = Zend_Paginator::factory($managerGateway->fetchManagers());
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $this->view->module = $request->getModuleName();
     $this->view->controller = $request->getControllerName();
     $this->view->managerList->setCurrentPageNumber($this->_getParam('page'));
 }
 public function processAction()
 {
     if (!$this->_request->isXmlHttpRequest() || !$this->_request->isPost()) {
         $this->_redirector->gotoRoute(array('controller' => 'index', 'module' => 'managers'), 'admin');
     }
     $return = array();
     $managerGateway = new Managers_Model_ManagerGateway();
     $form = $managerGateway->getForm('CreateManager');
     $validForm = $form->isValid($this->_request->getParams());
     // Check the form for validity
     if (!$validForm) {
         $return['formErrors'] = $form->getMessages();
     } else {
         $form->removeElement('password_confirm');
         $form->removeElement('submit');
         $manager = $managerGateway->create($form->getValues());
         $manager->save();
         $flashMessenger = $this->_helper->getHelper('FlashMessenger');
         $flashMessenger->setNamespace('notifications')->addMessage('Manager Created.');
         $return['redirect']['location'] = '/admin/managers/';
     }
     $this->_helper->json->sendJson($return);
 }