protected function buildCondition(&$conditions, &$values, $criteria_type, $field, $param, $join_id = null, $i18n = false, $extra = null)
 {
     $params_list = c2cTools::getCriteriaRequestParameters();
     Document::buildConditionItem($conditions, $values, $criteria_type, $field, $param, $join_id, $i18n, $params_list, $extra);
 }
 /**  
  * Executes list action.
  * Overrides documentsActions::executeList()
  */
 public function executeList()
 {
     // params in order to add images of linked summits, parkings, etc...
     $request_array = array();
     if ($this->hasRequestParameter('rsummits') && ($summit_ids = $this->getRequestParameter('rsummits'))) {
         if (!in_array($summit_ids, array('-', ' '))) {
             $request_array = array(explode('-', $summit_ids), 'sr', 'ri', 'si');
         }
     } elseif ($this->hasRequestParameter('rparkings') && ($parking_ids = $this->getRequestParameter('rparkings'))) {
         if (!in_array($parking_ids, array('-', ' '))) {
             $request_array = array(explode('-', $parking_ids), 'pr', 'ri', 'pi');
         }
     } elseif ($this->hasRequestParameter('rhuts') && ($hut_ids = $this->getRequestParameter('rhuts'))) {
         if (!in_array($hut_ids, array('-', ' '))) {
             $request_array = array(explode('-', $hut_ids), 'hr', 'ri', 'hi');
         }
     } elseif ($this->hasRequestParameter('oroutes') && ($route_ids = $this->getRequestParameter('oroutes'))) {
         if (!in_array($route_ids, array('-', ' '))) {
             $request_array = array(explode('-', $route_ids), 'ro', 'oi', 'ri');
         }
     } elseif ($this->hasRequestParameter('osites') && ($site_ids = $this->getRequestParameter('osites'))) {
         if (!in_array($site_ids, array('-', ' '))) {
             $request_array = array(explode('-', $site_ids), 'to', 'oi', 'ti');
         }
     }
     if (!empty($request_array)) {
         $ids = array_shift($request_array);
         $pager = new c2cDoctrinePager('Image', c2cTools::mobileVersion() ? sfConfig::get('app_list_mobile_maxline_number') : sfConfig::get('app_list_maxline_number'));
         $this->pager = $pager;
         $q = $pager->getQuery();
         $q->select('DISTINCT i.id, i.image_type, i.geom_wkt, i.filename, ii.name, ii.culture, ii.search_name')->from('Image i')->leftJoin('i.associations a ON i.id = a.linked_id')->leftJoin('i.ImageI18n ii')->where('(a.main_id IN (SELECT a2.linked_id FROM Association a2 WHERE a2.main_id IN (' . implode(',', $ids) . ') AND a2.type = ?) AND a.type = ?)' . ' OR (a.main_id IN (' . implode(',', $ids) . ') AND a.type = ?)', $request_array);
         $pager->setPage($this->getRequestParameter('page', 1));
         $pager->init();
         $nb_results = $pager->getNbResults();
         $this->nb_results = $nb_results;
         // deal with format
         if (isset($this->format)) {
             $format = $this->format;
         } else {
             $format = $this->getRequestParameter('format', 'list');
             $format = explode('-', $format);
             $this->format = $format;
         }
         if ($nb_results == 0 && !in_array('json', $format)) {
             $params_list = array_keys(c2cTools::getCriteriaRequestParameters());
             if (count($params_list) == 1) {
                 $param = reset($params_list);
                 if (strpos($param, 'nam') !== false) {
                     $this->query_string = $this->getRequestParameter($param);
                     $this->setTemplate('../../documents/templates/simplenoresult');
                 }
             }
         } else {
             $this->items = $pager->getResults('array');
         }
         $this->setPageTitle($this->__($this->getModuleName() . ' list'));
         $this->setTemplate('list');
     } else {
         parent::executeList();
         $nb_results = $this->nb_results;
         if ($nb_results == 0) {
             return;
         }
         $items = $this->query->execute(array(), Doctrine::FETCH_ARRAY);
         $this->items = Language::parseListItems($items, 'Image');
         $this->setTemplate('list');
     }
     if (in_array('json', $this->format)) {
         $this->setJsonResponse();
         $this->setTemplate('../../documents/templates/jsonlist');
     }
 }
function region_header_list_tag($label = null, $default_order = '', $simple = false)
{
    $params_list = array_keys(c2cTools::getCriteriaRequestParameters());
    $is_default_list = empty($params_list);
    $orderby = sfContext::getInstance()->getRequest()->getParameter('orderby');
    if (in_array($orderby, array('range', 'admin', 'country', 'valley'))) {
        $orderby_area = $orderby;
    } else {
        $orderby_area = 'range';
    }
    return header_list_tag($orderby_area, $label, $default_order, $is_default_list || $simple);
}
Example #4
0
<?php

use_helper('Field', 'Pagination');
$params_list = array_keys(c2cTools::getCriteriaRequestParameters());
$is_default_list = empty($params_list);
$request = sfContext::getInstance()->getRequest();
$orderby = $request->getParameter('orderby');
$add_rating_link = !empty($orderby) && in_array($orderby, sfConfig::get('mod_outings_sort_route_criteria'));
if (!$add_rating_link and !empty($activities)) {
    $orderby = Route::getDefaultRatingOrderby($activities);
    $add_rating_link = !empty($orderby);
}
echo select_all_header_list_tag();
echo header_list_tag('onam', 'name', '', $is_default_list);
echo header_list_tag('date', 'date short', 'desc');
echo header_list_tag('act', 'activities short', '', $is_default_list);
echo header_list_tag('alt', 'elevation short');
echo header_list_tag('hdif', 'height_diff_up short');
echo header_list_tag($orderby, 'ratings', '', !$add_rating_link);
echo header_list_tag('cond', 'cond short');
echo header_list_tag('freq', 'frequentation short');
echo region_header_list_tag('region_name');
echo images_header_list_tag();
echo comments_header_list_tag();
echo simple_header_list_tag('author short');