예제 #1
0
 /**
  * Executes list action, adding parkings linked to routes
  */
 public function executeList()
 {
     parent::executeList();
     $nb_results = $this->nb_results;
     if ($nb_results == 0) {
         return;
     }
     $timer = new sfTimer();
     $routes = $this->query->execute(array(), Doctrine::FETCH_ARRAY);
     c2cActions::statsdTiming('pager.getResults', $timer->getElapsedTime());
     // if they are criterias on the summit (snam, srnam, salt, styp)
     // we might have only some of the associated summits and not the 'best one' (ticket #337)
     // so we must add a new request to get the summits, display the best one and add a note to explain that the
     // other summit is associated
     // FIXME would be nice to put all in a single request (before), but I didn't manage to do it
     // TODO not working right now
     //if ($this->hasRequestParameter('snam') || $this->hasRequestParameter('srnam') ||
     //    $this->hasRequestParameter('salt') || $this->hasRequestParameter('styp'))
     //{
     // $routes = Route::addBestSummitName($routes, '');
     //}
     $timer = new sfTimer();
     Parking::addAssociatedParkings($routes, 'pr');
     // add associated parkings infos to $routes
     c2cActions::statsdTiming('parking.addAssociatedParkings', $timer->getElapsedTime());
     $timer = new sfTimer();
     Document::countAssociatedDocuments($routes, 'ro', true);
     // number of associated outings
     c2cActions::statsdTiming('document.countAssociatedDocuments', $timer->getElapsedTime());
     Area::sortAssociatedAreas($routes);
     $this->items = Language::parseListItems($routes, 'Route');
 }
예제 #2
0
 /**
  * Executes list action
  */
 public function executeList()
 {
     parent::executeList();
     $nb_results = $this->nb_results;
     if ($nb_results == 0) {
         return;
     }
     $timer = new sfTimer();
     $summits = $this->query->execute(array(), Doctrine::FETCH_ARRAY);
     c2cActions::statsdTiming('pager.getResults', $timer->getElapsedTime());
     $timer = new sfTimer();
     Document::countAssociatedDocuments($summits, 'sr', true);
     c2cActions::statsdTiming('document.countAssociatedDocuments', $timer->getElapsedTime());
     Area::sortAssociatedAreas($summits);
     $this->items = Language::parseListItems($summits, 'Summit');
 }
예제 #3
0
 /**
  * Executes list action, adding ratings from routes linked to outings
  */
 public function executeList()
 {
     // redirect to user outings list if connected and if myoutings criteria is set
     if ($this->getUser()->isConnected() && $this->getRequestParameter('myoutings')) {
         sfLoader::loadHelpers(array('Pagination'));
         $user_id = $this->getUser()->getId();
         $this->redirect(_addUrlParameters(_getBaseUri(), array('myoutings'), array('users' => $user_id)));
     }
     // TODO something to do if outings where filtered on route ratings?
     parent::executeList();
     $format = $this->format;
     if (in_array('cond', $format) && !in_array('json', $format)) {
         $this->setTemplate('conditions');
         if (in_array('full', $format)) {
             $this->setPageTitle($this->__('conditions and comments'));
         } else {
             $this->setPageTitle($this->__('recent conditions'));
         }
     }
     $nb_results = $this->nb_results;
     if ($nb_results == 0) {
         return;
     }
     $show_images = $this->show_images;
     $timer = new sfTimer();
     $outings = $this->query->execute(array(), Doctrine::FETCH_ARRAY);
     c2cActions::statsdTiming('pager.getResults', $timer->getElapsedTime());
     $timer = new sfTimer();
     $outings = Outing::getAssociatedCreatorData($outings);
     // retrieve outing creator names
     c2cActions::statsdTiming('outing.getAssociatedCreatorData', $timer->getElapsedTime());
     $timer = new sfTimer();
     $outings = Outing::getAssociatedRoutesData($outings);
     // retrieve associated route ratings
     c2cActions::statsdTiming('outing.getAssociatedRoutesData', $timer->getElapsedTime());
     if (!in_array('list', $format)) {
         $timer = new sfTimer();
         $outings = Language::getTheBestForAssociatedAreas($outings);
         c2cActions::statsdTiming('language.getTheBestForAssociatedAreas', $timer->getElapsedTime());
     }
     // add images infos
     if ($show_images) {
         $timer = new sfTimer();
         Image::addAssociatedImages($outings, 'oi');
         c2cActions::statsdTiming('image.addAssociatedImages', $timer->getElapsedTime());
     }
     Area::sortAssociatedAreas($outings);
     $this->items = Language::parseListItems($outings, 'Outing', !$show_images);
 }
예제 #4
0
 /**
  * Executes list action
  */
 public function executeList()
 {
     parent::executeList();
     $nb_results = $this->nb_results;
     if ($nb_results == 0) {
         return;
     }
     $timer = new sfTimer();
     $sites = $this->query->execute(array(), Doctrine::FETCH_ARRAY);
     c2cActions::statsdTiming('pager.getResults', $timer->getElapsedTime());
     $timer = new sfTimer();
     Parking::addAssociatedParkings($sites, 'pt');
     // add associated parkings infos to $sites
     c2cActions::statsdTiming('parking.addAssociatedParkings', $timer->getElapsedTime());
     $timer = new sfTimer();
     Document::countAssociatedDocuments($sites, 'to', true);
     c2cActions::statsdTiming('document.countAssociatedDocuments', $timer->getElapsedTime());
     Area::sortAssociatedAreas($sites);
     $this->items = Language::parseListItems($sites, 'Site');
 }