Exemple #1
0
 public function executeAjaxUserPager()
 {
     $name = $this->getRequestParameter('user_name', 'null');
     $campus = $this->getRequestParameter('user_campus', 'null');
     $department = $this->getRequestParameter('user_department', 'null');
     $c = new Criteria();
     $this->uri_options = '';
     // Manually edit the criteria, avoids allowing any unexpected criteria to be injected
     if ($name != "null" && $name != '') {
         $value = $name;
         $crit1 = $c->getNewCriterion(sfGuardUserProfilePeer::FIRST_NAME, "%" . $value . "%", Criteria::LIKE);
         $crit2 = $c->getNewCriterion(sfGuardUserProfilePeer::LAST_NAME, "%" . $value . "%", Criteria::LIKE);
         $crit3 = $c->getNewCriterion(sfGuardUserProfilePeer::FIRST_NAME, 'UPPER(CONCAT(' . sfGuardUserProfilePeer::FIRST_NAME . ', " ", ' . sfGuardUserProfilePeer::LAST_NAME . ')) LIKE UPPER(\'%' . $value . '%\')', Criteria::CUSTOM);
         // Building an OR statement with propel...not that much fun
         $crit1->addOr($crit2);
         $crit1->addOr($crit3);
         $c->add($crit1);
         $this->logMessage('name not null, setting: [' . $name . ']', 'debug');
         $c->add($crit1);
         $this->uri_options .= '&user_name=' . urlencode($name);
     }
     if ($campus != "null" && $campus != '') {
         $this->logMessage('status not null, setting: [' . $campus . ']');
         $c->add(sfGuardUserProfilePeer::CAMPUS_ID, $campus);
         $this->uri_options .= '&user_campus=' . urlencode($campus);
     }
     if ($department != "null") {
         $this->logMessage('department not null, setting: [' . $department . ']');
         $c->add(sfGuardUserProfilePeer::DEPARTMENT_ID, $department);
         $this->uri_options .= '&project_department=' . urlencode($department);
     }
     //$this->projects = ProjectPeer::doSelect(new Criteria());
     //$this->logMessage('get pager....');
     $this->users = sfGuardUserProfilePeer::retrievePager($c, $this->getRequestParameter('page'), $this->getRequestParameter('max', sfConfig::get('app_pager_user_max')));
     //$this->logMessage('pager retrieved....');
     //$this->logMessage('uri: ['.$this->uri_options.']');
     $this->uri_options = str_replace('?&', '?', $this->uri_options);
     //$this->logMessage('uri: ['.$this->uri_options.']');
 }