コード例 #1
0
 public function indexAction()
 {
     $db_user = new Application_Model_DbTable_DbUsers();
     $this->view->activelist = $this->activelist;
     $this->view->user_typelist = $this->user_typelist;
     $this->view->active = -1;
     $_data = array('active' => -1, 'user_type' => -1, 'txtsearch' => '');
     if ($this->getRequest()->isPost()) {
         $_data = $this->getRequest()->getPost();
         print_r($_data);
     }
     $rs_rows = $db_user->getUserList($_data);
     $_rs = array();
     foreach ($rs_rows as $key => $rs) {
         $_rs[$key] = array('id' => $rs['id'], 'name' => $rs['last_name'] . ' ' . $rs['name'], 'user_name' => $rs['user_name'], 'user_type' => $this->user_typelist[$rs['user_type']], 'status' => $rs['status']);
     }
     $list = new Application_Form_Frmtable();
     if (!empty($_rs)) {
         $glClass = new Application_Model_GlobalClass();
         $rs_rows = $glClass->getImgActive($_rs, BASE_URL, true);
     } else {
         $result = Application_Model_DbTable_DbGlobal::getResultWarning();
     }
     $collumns = array("LASTNAME_FIRSTNAME", "USER_NAME", "USER_TYPE", "STATUS");
     $link = array('module' => 'aclAcl', 'controller' => 'user', 'action' => 'edited');
     $this->view->list = $list->getCheckList(0, $collumns, $rs_rows, array('cate_name' => $link, 'title' => $link));
 }
コード例 #2
0
 public function indexAction()
 {
     // action body
     //create sesesion
     $session_search_user = new Zend_Session_Namespace('search_user');
     if (empty($session_search_user->limit)) {
         $session_search_user->limit = Application_Form_FrmNavigation::getLimit();
         $session_search_user->active = -1;
         $session_search_user->user_type = -1;
         $session_search_user->txtsearch = '';
         $session_search_user->lock();
     }
     //start page nevigation
     $limit = $session_search_user->limit;
     $start = $this->getRequest()->getParam('limit_satrt', 0);
     $db_user = new Application_Model_DbTable_DbUsers();
     $this->view->activelist = $this->activelist;
     $this->view->active = $session_search_user->active;
     $this->view->user_typelist = $this->user_typelist;
     $this->view->user_type = $session_search_user->user_type;
     if ($this->getRequest()->isPost()) {
         $user_seach_data = $this->getRequest()->getPost();
         //set session when submit
         $session_search_user->unlock();
         $session_search_user->limit = $user_seach_data['rows_per_page'];
         $session_search_user->active = $user_seach_data['active'];
         $session_search_user->user_type = $user_seach_data['user_type'];
         $session_search_user->txtsearch = $user_seach_data['txtsearch'];
         $session_search_user->lock();
         //set value for display
         $this->view->txtsearch = $user_seach_data['txtsearch'];
         $this->view->active = $user_seach_data['active'];
         $this->view->user_type = $user_seach_data['user_type'];
         $limit = $user_seach_data['rows_per_page'];
         $users = $db_user->getUserListBy($user_seach_data, $start, $limit);
         $record_count = $db_user->getUserListTotal($user_seach_data);
     } else {
         if ($session_search_user->active > -1 || $session_search_user->user_type > -1 || !empty($session_search_user->txtsearch)) {
             $user_seach_data = array('active' => $session_search_user->active, 'user_type' => $session_search_user->user_type, 'txtsearch' => $session_search_user->txtsearch);
             $users = $db_user->getUserListBy($user_seach_data, $start, $limit);
             $record_count = $db_user->getUserListTotal($user_seach_data);
         } else {
             $users = $db_user->getUserList($start, $limit);
             $record_count = $db_user->getUserListTotal();
         }
     }
     $result = array();
     $row_num = $start;
     foreach ($users as $i => $user) {
         $result[$i] = array('num' => ++$row_num, 'name' => $user['name'], 'id' => $user['id'], 'user_name' => $user['user_name'], 'active' => $this->activelist[$user['active']], 'user_type' => $this->user_typelist[$user['user_type']]);
     }
     $this->view->userlist = Zend_Json::encode($result);
     $page = new Application_Form_FrmNavigation(self::REDIRECT_URL, $start, $limit, $record_count);
     $page->init(self::REDIRECT_URL, $start, $limit, $record_count);
     $this->view->nevigation = $page->navigationPage();
     $this->view->rows_per_page = $page->getRowsPerPage($limit, 'frmlist_users');
     $this->view->result_row = $page->getResultRows();
 }