/** Display a list of users in paginated format */ public function indexAction() { $users = new Users(); $this->view->paginator = $users->getUsersAdmin($this->_getAllParams()); $form = new UserFilterForm(); $this->view->form = $form; $form->username->setValue($this->_getParam('username')); $form->fullname->setValue($this->_getParam('fullname')); $form->visits->setValue($this->_getParam('visits')); $form->lastLogin->setValue($this->_getParam('lastLogin')); $form->role->setValue($this->_getParam('role')); if ($this->_request->isPost() && !is_null($this->_getParam('submit'))) { $formData = $this->_request->getPost(); if ($form->isValid($formData)) { $params = array_filter($formData); unset($params['submit']); unset($params['action']); unset($params['controller']); unset($params['module']); unset($params['page']); unset($params['csrf']); $where = array(); foreach ($params as $key => $value) { if (!is_null($value)) { $where[] = $key . '/' . urlencode(strip_tags($value)); } } $whereString = implode('/', $where); $query = $whereString; $this->_redirect('admin/users/index/' . $query . '/'); } else { $form->populate($formData); } } }
/** Display a list of users in paginated format */ public function indexAction() { $this->view->paginator = $this->getUsers()->getUsersAdmin($this->getAllParams()); $form = new UserFilterForm(); $this->view->form = $form; $form->username->setValue($this->getParam('username')); $form->fullname->setValue($this->getParam('fullname')); $form->role->setValue($this->getParam('role')); if ($this->_request->isPost() && !is_null($this->getParam('submit'))) { $formData = $this->_request->getPost(); if ($form->isValid($formData)) { $params = $this->getArrayFunctions()->array_cleanup($formData); $where = array(); foreach ($params as $key => $value) { if (!is_null($value)) { $where[] = $key . '/' . urlencode(strip_tags($value)); } } $whereString = implode('/', $where); $query = $whereString; $this->redirect('admin/users/index/' . $query . '/'); } else { $form->populate($formData); } } }
/** * Displays the a list of all the assignments. */ public function actionIndex() { $model = new UserFilterForm('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['UserFilterForm'])) { $model->attributes = $_GET['UserFilterForm']; } $this->render('index', array('model' => $model)); }