Inheritance: extends Zend_Form
Example #1
0
 public function indexAction()
 {
     $form = new Admin_Form_UserCriteria();
     $form->groups->addMultiOptions($this->_helper->service('user')->getGroupOptions());
     $form->isValid($this->getRequest()->getParams());
     $criteria = $form->getValues();
     if ($criteria['status'] === null) {
         $criteria['status'] = 1;
     }
     $users = $this->_helper->service('user')->getCollection($criteria, array('username' => 'asc', 'email' => 'asc'), self::LIMIT, $this->_getParam('start'));
     $this->view->pagination = $users;
     $this->view->criteria = (object) array_filter($criteria, function ($value) {
         return $value !== null;
     });
     $this->view->users = array();
     foreach ($users as $user) {
         $this->view->users[] = $user->getEditView($this->view);
     }
     if ($this->_helper->contextSwitch->getCurrentContext() === 'json') {
         return;
     }
     $this->view->counts = array();
     foreach ($form->status->getMultiOptions() as $status => $label) {
         $this->view->counts[$status] = $this->_helper->service('user')->countBy(array('status' => $status));
     }
     $this->view->form = $form;
     $this->view->actions = array(array('label' => getGS('Create new account'), 'module' => 'admin', 'controller' => 'user', 'action' => 'create', 'class' => 'add'));
 }