Example #1
0
 public function executeListRequest(sfWebRequest $request)
 {
     # security
     if (!$this->getUser()->hasCredential(array('Administrator', 'Staff', 'Volunteer'), false)) {
         $this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getReferer());
         $this->redirect('dashboard/index');
     }
     # filter
     $params = $this->getUser()->getAttribute('contact_request', array(), 'contact_request');
     $this->max_array = array(5, 10, 20, 30);
     if (in_array($request->getParameter('max'), $this->max_array)) {
         $params['max'] = $request->getParameter('max');
     } else {
         if (!isset($params['max'])) {
             $params['max'] = sfConfig::get('app_max_person_per_page', 10);
         }
     }
     $this->page = $page = $request->getParameter('page', 1);
     $this->max = $params['max'];
     $this->getUser()->setAttribute('contact_request', $params, 'contact_request');
     if ($request->getParameter('graterOneDay') == 'ok') {
         $this->grater_than_one = 1;
     } else {
         $this->grater_than_one = 0;
     }
     $this->pager = ContactRequestPeer::getPager($this->max, $this->page, $this->grater_than_one);
     $this->request_list = $this->pager->getResults();
     $this->total = count($this->request_list);
     if ($this->total == 0) {
         $this->getUser()->setFlash('warning', 'Sorry, There are currently no outstanding contact requests!');
     }
 }