function admin_index()
 {
     /* Active/Inactive/Delete functionality */
     if (isset($this->request->data["SiteType"]["setStatus"])) {
         //pr($this->request->data);die;
         if (!empty($this->request->data['SiteType']['status'])) {
             $status = $this->request->data['SiteType']['status'];
         } else {
             $this->Session->setFlash("Please select the action.", 'default', array('class' => 'alert alert-danger'));
             $this->redirect(array('action' => 'admin_index'));
         }
         $CheckedList = $this->request->data['checkboxes'];
         $model = 'SiteType';
         $controller = $this->params['controller'];
         $action = $this->params['action'];
         parent::setStatus($status, $CheckedList, $model, $controller, $action);
     }
     /* Active/Inactive/Delete functionality */
     $value = "";
     $value1 = "";
     $show = "";
     $criteria = "";
     if (!empty($this->params)) {
         if (!empty($this->params->query['keyword'])) {
             $criteria .= " SiteType.name LIKE '%" . trim($this->params->query['keyword']) . "%' ";
         }
     }
     $this->Paginator->settings = array('conditions' => array($criteria), 'limit' => Configure::read('Settings.paginationLimit'), 'order' => array('SiteType.id' => 'DESC'));
     $this->set('getData', $this->Paginator->paginate('SiteType'));
     $this->set('keyword', $value);
     $this->set('show', $show);
     $this->set('navadmins', 'class = "active"');
     $this->set('breadcrumb', 'SiteTypes/Listing');
     $this->set('models', Inflector::singularize($this->name));
 }
예제 #2
0
 function admin_index()
 {
     //check for auth session
     $userSession = $this->Session->read('Auth.User');
     /* search functionality */
     $value = "";
     $value1 = "";
     $show = "";
     $conditions = array('Staff.admin_id !=' => 0);
     if (!empty($this->params)) {
         if (!empty($this->params->query['keyword'])) {
             $keyword = $this->params->query['keyword'];
             $value = $keyword;
             $conditions = array('OR' => array('Staff.firstname LIKE' => "%{$keyword}%", 'Staff.lastname LIKE' => "%{$keyword}%", 'Staff.username LIKE' => "%{$keyword}%", 'Staff.email LIKE' => "%{$keyword}%"), 'Staff.admin_id !=' => 0);
         }
     }
     //read pagination limit
     $limit = Configure::read('Settings.paginationLimit');
     //search and paginate
     $this->paginate = array('limit' => $limit, 'fields' => array(), 'conditions' => $conditions, 'order' => array('Staff.id' => 'desc'));
     $getData = $this->paginate('Staff');
     /* Active/Inactive/Delete functionality */
     if (isset($this->request->data["Staff"]["setStatus"])) {
         // echo 'here';die;
         if (!empty($this->request->data['Staff']['status'])) {
             $status = $this->request->data['Staff']['status'];
         } else {
             $this->Session->setFlash("Please select the action.", 'default', array('class' => 'alert alert-danger'));
             $this->redirect(array('action' => 'admin_index'));
         }
         if (!empty($this->request->data['checkboxes'])) {
             $CheckedList = $this->request->data['checkboxes'];
             $model = 'Staff';
             $controller = $this->params['controller'];
             $action = $this->params['action'];
             parent::setStatus($status, $CheckedList, $model, $controller, $action);
         }
     }
     //set layout
     $this->layout = $this->request->is('ajax') ? 'ajax' : 'admin';
     //set model
     $this->set('models', Inflector::singularize($this->name));
     //set breadcrumb
     $this->set('breadcrumb', 'Users/All list');
     //set pagination limit
     $this->set('limit', $limit);
     //set variables for search
     $this->set('keyword', $value);
     $this->set('show', $show);
     $this->set('navadmins', 'class = "active"');
     $this->set(compact('getData'));
     //pr($result);die;
 }