コード例 #1
0
ファイル: IndexController.php プロジェクト: Cryde/sydney-core
 /**
  *
  * @param unknown_type $type
  * @param unknown_type $opts
  * @return string
  */
 private function _getQuery($type, $opts = array())
 {
     $sql = '';
     if (!is_array($opts)) {
         $opts = array($opts);
     }
     switch ($type) {
         case 'people':
             $sql = UsersOp::getSqlUserList($this->usersData, $opts);
             break;
     }
     return $sql;
 }
コード例 #2
0
 /**
  * Displays the file list in an HTML format
  * URL example : http://<url>/Adminfiles/Services/displayfiles/format/json
  *
  * @return void
  */
 public function displaypeopleAction()
 {
     $r = $this->getRequest();
     $ts = 1;
     if (isset($r->vmode)) {
         $this->view->vmode = $r->vmode;
         if ($r->vmode == 'list') {
             $ts = 3;
         }
     }
     $this->view->embeded = 'no';
     $this->view->context = 'default';
     if (isset($r->embeded)) {
         $this->view->embeded = $r->embeded;
     }
     if (isset($r->context)) {
         $this->view->context = $r->context;
     }
     $this->view->files = array();
     $fltr = new Zend_Filter_Digits();
     $desc = $fltr->filter($r->desc);
     $order = $fltr->filter($r->order);
     $count = $fltr->filter($r->count);
     $offset = $fltr->filter($r->offset);
     $filter = $fltr->filter($r->filter);
     $fcompany = $fltr->filter($r->fcompany);
     $fgroup = $fltr->filter($r->fgroup);
     $fstatus = $fltr->filter($r->fstatus);
     $fltr = new Zend_Filter_Alnum();
     $searchstr = $fltr->filter($r->searchstr);
     // GDE - #52-Ajouts exports CSV - 07/08/2013
     // On enregistre les filtres afin de pouvoir les utiliser lors de l'export
     $registry = new Zend_Session_Namespace('registry-people');
     if (!$this->isCsv()) {
         $registry->peopleFilterCompany = $fcompany;
         $registry->peopleFilterGroup = $fgroup;
         $registry->peopleFilterStatus = $fstatus;
         $registry->searchstr = $searchstr;
     } else {
         $fcompany = $registry->peopleFilterCompany;
         $fgroup = $registry->peopleFilterGroup;
         $fstatus = $registry->peopleFilterStatus;
         $searchstr = $registry->searchstr;
     }
     if (isset($r->embeded)) {
         $this->view->embeded = $r->embeded;
     }
     if (isset($r->context)) {
         $this->view->context = $r->context;
     }
     // define filters
     $filters = '';
     if (isset($searchstr)) {
         $filters .= " AND ( (LOWER( CONCAT(users.fname, ' ', users.lname)) LIKE '%" . addslashes(strtolower($searchstr)) . "%') OR login like '%" . addslashes(strtolower($searchstr)) . "%' ) ";
     }
     if (isset($r->fgroup) && trim($fgroup) != '') {
         $filters .= " AND users.usersgroups_id = {$fgroup} ";
     }
     if (isset($r->fstatus) && trim($fstatus) != '') {
         $filters .= " AND users.active = {$fstatus} ";
     }
     if (isset($r->fcompany)) {
         if ($r->fcompany != '') {
             $filters .= " AND companies.id = '" . addslashes($r->fcompany) . "' ";
         }
     }
     // GDE - #52-Ajouts exports CSV - 07/08/2013
     // On d�sactive la limitation du nombre de r�sultats pour l'export csv
     if ($this->isCsv()) {
         $count = 0;
     }
     $sql = UsersOp::getSqlUserList($this->usersData, array($filters, $order, $count, $offset, $fcompany, $fgroup, $searchstr));
     $sqlCount = UsersOp::getSqlUserList($this->usersData, array($filters, $order, $count, $offset, $fcompany, $fgroup, $searchstr), true);
     $this->view->users_id = $this->usersId;
     $this->view->people = $this->_db->fetchAll($sql);
     //$where, $order, $count, $offset
     // 	sets the number of pages
     if (!$this->isCsv()) {
         $resultCount = $this->_db->fetchAll($sqlCount);
         $this->view->nbpages = ceil($resultCount[0]['cnt'] / $count);
     }
 }