Example #1
0
 public function executeAjaxProjectPager()
 {
     $this->section = $this->getRequestParameter('section', sfConfig::get('app_tab_projects_browse'));
     $owner = $this->getRequestParameter('project_owner', 'null');
     $title = $this->getRequestParameter('project_title', 'null');
     $keywords = $this->getRequestParameter('project_keywords', 'null');
     $school = $this->getRequestParameter('project_school', 'null');
     $status = $this->getRequestParameter('project_status', 'null');
     $department = $this->getRequestParameter('project_department', 'null');
     $applications = $this->getRequestParameter('project_applications', 'null');
     $c = new Criteria();
     $this->uri_options = '';
     if ($title != "null" && $title != '') {
         $this->logMessage('title not null, setting: [' . $title . ']');
         $c->add(ProjectPeer::TITLE, "%" . $title . "%", Criteria::LIKE);
         $this->uri_options .= '&project_title=' . urlencode($title);
     }
     //URI: project_title=C&project_status=&project_department=
     //URI: project_title=C&project_status=project_department&project_department=
     if ($status != "null" && $status != '') {
         $this->logMessage('status not null, setting: [' . $status . ']');
         $c->add(ProjectPeer::STATUS, $status);
         $this->uri_options .= '&project_status=' . urlencode($status);
     }
     if ($department != "null" && $department != '') {
         $this->logMessage('department not null, setting: [' . $department . ']');
         $c->add(ProjectPeer::DEPARTMENT_ID, $department);
         $this->uri_options .= '&project_department=' . urlencode($department);
     }
     if ($applications != "null" && $applications != '') {
         $this->logMessage('applications not null, setting: [' . $applications . ']');
         $c->add(ProjectPeer::APPLICATIONS, $applications);
         $this->uri_options .= '&project_applications=' . urlencode($applications);
     }
     if ($school != "null" && $school != '') {
         $this->logMessage('school not null, setting: [' . $school . ']');
         $c->add(ProjectPeer::CAMPUS_ID, $school);
         $this->uri_options .= '&project_school=' . urlencode($school);
     }
     if ($owner != "null" && $owner != '') {
         $this->logMessage('owner not null, setting: [' . $owner . ']');
         //$c->add(ProjectPeer::, "%".$title."%", Criteria::LIKE);
         //$this->uri_options .= '&project_school='.urlencode($school);
     }
     $this->uri_options .= '&section=' . $this->section;
     //$this->projects = ProjectPeer::doSelect(new Criteria());
     $this->logMessage('get pager....');
     if ($this->section == sfConfig::get('app_tab_projects_browse')) {
         $this->logMessage('browse tab...');
         $this->projects = ProjectPeer::retrievePager($c, $this->getRequestParameter('page', 1), $this->getRequestParameter('max', sfConfig::get('app_pager_project_max')));
     }
     if ($this->section == sfConfig::get('app_tab_projects_myprojects')) {
         $this->logMessage('browse tab...');
         $this->projects = ProjectPeer::retrievePagerByUser($this->getUser()->getID(), $this->getRequestParameter('page', 1), $this->getRequestParameter('max', sfConfig::get('app_pager_project_max')));
     }
     if ($this->section == sfConfig::get('app_tab_projects_favorited')) {
         $this->logMessage('browse tab...');
         $this->projects = ProjectPeer::retrievePagerByUserStarred($this->getUser()->getId(), $this->getRequestParameter('page', 1), $this->getRequestParameter('max', sfConfig::get('app_pager_project_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 . ']');
 }