예제 #1
0
<?php

use_helper('Field', 'SmartFormat', 'sfBBCode');
$item_i18n = $item->getRaw('OutingI18n');
$item_i18n = $item_i18n[0];
$a = sfConfig::get('app_activities_list');
$c = sfConfig::get('mod_outings_conditions_statuses_list');
$f = sfConfig::get('mod_outings_frequentation_statuses_list');
$conditions_status = doctrine_value($item['conditions_status']);
$frequentation_status = doctrine_value($item['frequentation_status']);
$properties = array('module' => 'outings', 'name' => $item_i18n['name'], 'url' => jsonlist_url($item_i18n, 'outings'), 'date' => $item['date'], 'activities' => $use_keys ? BaseDocument::convertStringToArray($item['activities']) : BaseDocument::convertStringToArrayTranslate($item['activities'], $a), 'creator' => $item['creator'], 'maxElevation' => doctrine_value($item['max_elevation']), 'heightDiffUp' => doctrine_value($item['height_diff_up']), 'routesRating' => isset($item['linked_routes']) ? field_route_ratings_data($item, false, false, false, $use_keys ? 'jsonkeys' : 'json') : null, 'conditionsStatus' => $use_keys ? $conditions_status : @$c[$conditions_status], 'frequentationStatus' => $use_keys ? $frequentation_status : @$f[$frequentation_status], 'nbLinkedImages' => isset($item['nb_images']) ? $item['nb_images'] : 0, 'nbComments' => isset($item['nb_comments']) ? $item['nb_comments'] : 0, 'hasTrack' => strlen($item['geom_wkt']) > 0 ? true : false, 'linkedAreas' => json_decode(get_partial('documents/regions4jsonlist', array('geoassociations' => $item['geoassociations'], 'use_keys' => $use_keys))));
if ($add_conditions) {
    $avalanche_date_list = sfConfig::get('mod_outings_avalanche_date_list');
    $avalanche_date = $use_keys ? BaseDocument::convertStringToArray($item['avalanche_date']) : BaseDocument::convertStringToArrayTranslate($item['avalanche_date'], $avalanche_date_list);
    $has_avalanche_date = check_not_empty($avalanche_date) && !$avalanche_date instanceof sfOutputEscaperObjectDecorator && count($avalanche_date) && !array_intersect(array(0, 1), $avalanche_date);
    $glacier_statuses = sfConfig::get('mod_outings_glacier_statuses_list');
    $glacier_status = doctrine_value($item['glacier_status']);
    $properties = array_merge($properties, array('accessElevation' => doctrine_value($item['access_elevation']), 'upSnowElevation' => doctrine_value($item['up_snow_elevation']), 'downSnowElevation' => doctrine_value($item['down_snow_elevation']), 'glacierStatus' => $use_keys ? $glacier_status : @$glacier_statuses[$glacier_status], 'avalancheObsType' => $avalanche_date));
    if ($add_text) {
        $outing_route_desc = $item_i18n['outing_route_desc'];
        if (check_not_empty($outing_route_desc) && !$outing_route_desc instanceof sfOutputEscaperObjectDecorator) {
            if ($text_html) {
                $outing_route_desc = parse_links(parse_bbcode($outing_route_desc, null, false, false));
            }
        } else {
            $outing_route_desc = null;
        }
        $conditions_levels = unserialize($item_i18n['conditions_levels']);
        $conditions = $item_i18n['conditions'];
        if (check_not_empty($conditions) && !$conditions instanceof sfOutputEscaperObjectDecorator) {
            if ($text_html) {
예제 #2
0
}
$item_i18n = $item['OutingI18n'][0];
$activities = $item['activities'];
?>
<div class="right"><?php 
echo get_paginated_activities($activities);
?>
</div>
<div><?php 
echo list_link($item_i18n, 'outings') . ' ' . $has_gps_track;
?>
</div>
<div>
<?php 
echo _implode(' - ', array(format_date($item['date'], 'D'), link_to($item['creator'], '@document_by_id?module=users&id=' . $item['creator_id'])));
?>
</div>
<div>
<?php 
echo _implode(' - ', array(displayWithSuffix($item['max_elevation'], 'meters'), displayWithSuffix($item['height_diff_up'], 'meters'), isset($item['linked_routes']) ? field_route_ratings_data($item, false, false, false, 'html', $activities) : '', get_paginated_value($item['conditions_status'], 'mod_outings_conditions_statuses_list'), field_frequentation_picto_if_set($item, true)));
?>
</div>
<div><?php 
include_partial('documents/regions4list', array('geoassociations' => $item['geoassociations']));
?>
</div>
<div><?php 
echo picto_tag('picto_images', __('nb_linked_images')), ' ', isset($item['nb_images']) ? $item['nb_images'] : '0', ' ', picto_tag('action_comment', __('nb_comments')), ' ', isset($item['nb_comments']) ? link_to($item['nb_comments'], '@document_comment?module=outings&id=' . $item_i18n['id'] . '&lang=' . $item_i18n['culture']) : '0';
?>
</div>
예제 #3
0
function summarize_route($route, $show_activities = true, $add_tooltips = false, $avalaible_activities = null, $list_format = true)
{
    $max_elevation = is_scalar($route['max_elevation']) ? $route['max_elevation'] . __('meters') : NULL;
    $height_diff_up = is_scalar($route['height_diff_up']) ? $route['height_diff_up'] . __('meters') : NULL;
    if (is_scalar($route['difficulties_height'])) {
        $difficulties_height = $route['difficulties_height'] . __('meters');
    } else {
        $difficulties_height = NULL;
    }
    $facing = field_data_from_list_if_set($route, 'facing', 'app_routes_facings', array('raw' => true));
    if ($add_tooltips) {
        if (!empty($max_elevation)) {
            $max_elevation = '<span title="' . __('max_elevation') . ' ' . $max_elevation . '">' . $max_elevation . '</span>';
        }
        if (!empty($height_diff_up)) {
            $height_diff_up = '<span title="' . __('height_diff_up') . ' ' . $height_diff_up . '">' . $height_diff_up . '</span>';
        }
        if (!empty($difficulties_height)) {
            $difficulties_height = '<span title="' . __('difficulties_height') . ' ' . $difficulties_height . '">' . $difficulties_height . '</span>';
        }
        if (!empty($facing)) {
            $facing = '&nbsp;<span title="' . __('facing') . ' ' . $facing . '">' . $facing . '</span> ';
        }
    }
    $height = array();
    if (!empty($height_diff_up)) {
        $height_diff_up = '+' . $height_diff_up;
        $height[] = $height_diff_up;
    }
    if (!empty($difficulties_height)) {
        $difficulties_height = '(' . $difficulties_height . ')';
        $height[] = $difficulties_height;
    }
    $ratings = field_route_ratings_data($route, $show_activities, $add_tooltips, false, $list_format ? 'html' : 'table', $avalaible_activities);
    if ($list_format) {
        $height = implode(' ', $height);
        $route_data = array($max_elevation, $height, $facing, $ratings);
        foreach ($route_data as $key => $value) {
            $value = trim($value);
            if (empty($value)) {
                unset($route_data[$key]);
            }
        }
        if (empty($route_data)) {
            $route_data = '';
        } else {
            array_unshift($route_data, '');
            $route_data = implode('&nbsp; ', $route_data);
        }
    } else {
        $route_data = array($max_elevation, $height_diff_up, $difficulties_height, $facing);
        $route_data = '<td>' . implode('</td><td>', $route_data) . '</td>' . $ratings;
    }
    return $route_data;
}
예제 #4
0
<?php

use_helper('Field');
$doc_id = $data->get('id');
$ratings = field_route_ratings_data($data);
$facing = _get_field_value_in_list(sfConfig::get('app_routes_facings'), $data->get('facing'));
$height = $data->get('height_diff_up');
if ($height) {
    $height .= ' ' . __('meters');
}
$data = array();
if ($facing) {
    $data[] = $facing;
}
if ($height) {
    $data[] = $height;
}
if ($ratings) {
    $data[] = $ratings;
}
$link = link_to(__('Show the route'), '@document_by_id?module=routes&id=' . $doc_id, array('onclick' => "window.open(this.href);return false;"));
echo __('Short description: '), implode(' - ', $data), ' (', $link, '</a>)';
예제 #5
0
     $item->addChild('geom', "{$lon},{$lat}");
     $item->addChild('elevation', $ele);
 } elseif ($associated_routes = Association::findAllAssociatedDocs($id, $fields = array('id', 'lon', 'lat', 'elevation'), 'ro')) {
     // find highest route
     $max_ele = 0;
     foreach ($associated_routes as $route) {
         if (($ele = $route['elevation']) && $ele > $max_ele && ($lon = $route['lon']) && ($lat = $route['lat'])) {
             $highest_route = $route;
             $max_ele = $ele;
         }
     }
     // get route facing and rating if there is just one associated route:
     // fetch additional fields :
     if (count($associated_routes) == 1) {
         $single_route = Document::find('Route', $route['id'], array('global_rating', 'facing', 'engagement_rating', 'equipment_rating', 'toponeige_technical_rating', 'toponeige_exposition_rating', 'labande_ski_rating', 'labande_global_rating', 'ice_rating', 'mixed_rating', 'rock_free_rating', 'rock_required_rating', 'aid_rating', 'hiking_rating', 'snowshoeing_rating'));
         if ($rating = trim(field_route_ratings_data($single_route, false, false, true))) {
             $item->addChild('rating', $rating);
         }
         if ($facing = $single_route['facing']) {
             $item->addChild('facing', $facing);
         }
     }
     if ($max_ele > 0) {
         $item->addChild('geom', "{$lon},{$lat}");
         $item->addChild('elevation', $max_ele);
     } else {
         // could not find any geolocalized route to link
         // => we go to the next step : find highest associated summits to these routes
         $coords = Route::findHighestAssociatedSummitCoords($associated_routes);
         if ($coords['ele'] > 0) {
             if (strlen($coords['lon']) && strlen($coords['lat'])) {
예제 #6
0
?>
</time></td>
<td><?php 
echo get_paginated_activities($activities);
?>
</td>
<td><?php 
echo displayWithSuffix($item['max_elevation'], 'meters');
?>
</td>
<td><?php 
echo displayWithSuffix($item['height_diff_up'], 'meters');
?>
</td>
<td><?php 
echo isset($item['linked_routes']) ? field_route_ratings_data($item, false, true, false, 'html', $activities) : '';
?>
</td>
<td><?php 
echo get_paginated_value($item['conditions_status'], 'mod_outings_conditions_statuses_list');
?>
</td>
<td><?php 
echo field_frequentation_picto_if_set($item, true);
?>
</td>
<td><?php 
include_partial('documents/regions4list', array('geoassociations' => $item['geoassociations']));
?>
</td>
<td><?php 
예제 #7
0
<?php

use_helper('Field', 'SmartFormat', 'sfBBCode');
$item_i18n = $item->getRaw('RouteI18n');
$item_i18n = $item_i18n[0];
$summit = $item['associations'][0]['Summit'][0]['SummitI18n'][0]['name'];
$activities_list = sfConfig::get('app_activities_list');
$facing_list = sfConfig::get('app_routes_facings');
$facing = $item['facing'];
$properties = array('module' => 'routes', 'name' => $summit . __(' :') . ' ' . $item_i18n['name'], 'url' => jsonlist_url($item_i18n, 'routes', $summit), 'activities' => $use_keys ? BaseDocument::convertStringToArray($item['activities']) : BaseDocument::convertStringToArrayTranslate($item['activities'], $activities_list), 'ratings' => field_route_ratings_data($item, false, false, false, $use_keys ? 'jsonkeys' : 'json'), 'maxElevation' => doctrine_value($item['max_elevation']), 'heightDiffUp' => doctrine_value($item['height_diff_up']), 'difficultiesHeight' => doctrine_value($item['difficulties_height']), 'mainFacing' => $use_keys ? $facing : @$facing_list[doctrine_value($facing)], 'nbLinkedImages' => isset($item['nb_images']) ? $item['nb_images'] : 0, 'nbLinkedOutings' => isset($item['nb_linked_docs']) ? $item['nb_linked_docs'] : 0, 'nbComments' => isset($item['nb_comments']) ? $item['nb_comments'] : 0, 'hasTrack' => strlen($item['geom_wkt']) > 0 ? true : false, 'linkedAreas' => json_decode(get_partial('documents/regions4jsonlist', array('geoassociations' => $item['geoassociations'], 'use_keys' => $use_keys))), 'linkedParkings' => json_decode(get_partial('parkings/parkings4jsonlist', array('parkings' => isset($item['linked_docs']) ? $item['linked_docs'] : array(), 'use_keys' => $use_keys))));
if ($add_all_fields) {
    $route_types_list = sfConfig::get('mod_routes_route_types_list');
    $durations_list = sfConfig::get('mod_routes_durations_list');
    $configurations_list = sfConfig::get('mod_routes_configurations_list');
    $sub_activities_list = sfConfig::get('mod_routes_sub_activities_list');
    $route_type = doctrine_value($item['route_type']);
    $duration = doctrine_value($item['duration']);
    $configuration = $use_keys ? BaseDocument::convertStringToArray($item['configuration']) : BaseDocument::convertStringToArrayTranslate($item['configuration'], $configurations_list);
    $sub_activities = BaseDocument::convertStringToArray($item['sub_activities']);
    $snowboarding = in_array(2, $sub_activities);
    $beginner_proof = in_array(4, $sub_activities);
    $mountain_bike_approach = in_array(6, $sub_activities);
    $lift_approach = in_array(8, $sub_activities);
    $is_on_glacier = doctrine_value($item['is_on_glacier']);
    $is_on_glacier = empty($is_on_glacier) ? false : true;
    $slope = $item->getRaw('slope');
    if (!check_not_empty($slope) || $slope instanceof sfOutputEscaperObjectDecorator) {
        $slope = null;
    }
    $properties = array_merge($properties, array('minElevation' => doctrine_value($item['min_elevation']), 'heightDiffDown' => doctrine_value($item['height_diff_down']), 'routeType' => $use_keys ? $route_type : @$route_types_list[$route_type], 'duration' => $use_keys ? $duration : @$durations_list[$duration], 'configuration' => $configuration, 'snowboardingProof' => $snowboarding, 'beginnerProof' => $beginner_proof, 'mountainBikeApproach' => $mountain_bike_approach, 'liftApproach' => $lift_approach, 'requiresGlacierGear' => $is_on_glacier, 'slope' => $slope));
    if ($add_text) {
예제 #8
0
<?php

use_helper('Language', 'Viewer', 'sfBBCode', 'SmartFormat', 'Field', 'SmartDate');
// lang-independent content starts here
$i18n = $item['OutingI18n'][0];
echo '<span class="item_title">' . format_date($item['date'], 'dd/MM/yyyy') . ' - ' . get_paginated_activities($item['activities']) . ' - ' . link_to($i18n['name'], '@document_by_id_lang_slug?module=outings&id=' . $i18n['id'] . '&lang=' . $i18n['culture'] . '&slug=' . make_slug($i18n['name'])) . ' - ' . displayWithSuffix($item['max_elevation'], 'meters') . ' - ' . field_route_ratings_data($item, false, true);
if (isset($item['nb_images'])) {
    echo ' - ' . picto_tag('picto_images', __('nb_linked_images')) . '&nbsp;' . $item['nb_images'];
}
if (isset($item['nb_comments'])) {
    echo ' - ' . picto_tag('action_comment', __('nb_comments')) . '&nbsp;' . link_to($item['nb_comments'], '@document_comment?module=outings&id=' . $item['OutingI18n'][0]['id'] . '&lang=' . $item['OutingI18n'][0]['culture']);
}
echo '</span>';
$participants = _format_text_data('participants', $i18n['participants'], null, array('needs_translation' => false, 'show_label' => false, 'show_images' => false));
$documents_versions_id = null;
foreach ($item['versions'] as $version) {
    if (!$documents_versions_id || $version['documents_versions_id'] < $documents_versions_id) {
        $documents_versions_id = $version['documents_versions_id'];
        $author_info_name = $version['history_metadata']['user_private_data']['topo_name'];
        $author_info_id = $version['history_metadata']['user_private_data']['id'];
    }
}
$author = _format_data('author', link_to($author_info_name, '@document_by_id?module=users&id=' . $author_info_id));
echo '<div class="all_associations col_left col_66">';
include_partial('documents/association', array('associated_docs' => array(), 'extra_docs' => array($author, $participants), 'module' => 'users', 'inline' => true));
echo '</div>';
$geoassociations = $item['geoassociations'];
echo '<div class="all_associations col_right col_33">';
include_partial('areas/association', array('associated_docs' => $geoassociations, 'module' => 'areas'));
echo '</div>';
?>
예제 #9
0
    $summit_name = $summit_2['name'];
}
echo list_link($item_i18n, 'routes', $summit_name) . ' ' . $has_gps_track;
if (isset($item['name']) && $summit_name != $summit_2['name']) {
    $link = list_link($summit_2, 'summits');
    echo '<br /><small>', __('route linked with', array('%1%' => $link)), '</small>';
}
?>
</div>
<div>
<?php 
$height_diff_up = is_scalar($item['height_diff_up']) ? $item['height_diff_up'] . __('meters') : NULL;
if ($height_diff_up != NULL && is_scalar($item['difficulties_height'])) {
    $height_diff_up .= ' (' . $item['difficulties_height'] . __('meters') . ')';
}
echo _implode(' - ', array(displayWithSuffix($item['max_elevation'], 'meters'), get_paginated_value($item['facing'], 'app_routes_facings'), $height_diff_up, field_route_ratings_data($item, false)));
?>
</div>
<div><?php 
if (isset($item['linked_docs'])) {
    echo __('access'), ' ';
    include_partial('parkings/parkings4list', array('parkings' => $item['linked_docs']));
}
?>
</div>
<div><?php 
include_partial('documents/regions4list', array('geoassociations' => $item['geoassociations']));
?>
</div>
<div><?php 
echo picto_tag('picto_images', __('nb_linked_images')), ' ', isset($item['nb_images']) ? $item['nb_images'] : '0', ' ', picto_tag('action_comment', __('nb_comments')), ' ', isset($item['nb_comments']) ? link_to($item['nb_comments'], '@document_comment?module=routes&id=' . $item_i18n['id'] . '&lang=' . $item_i18n['culture']) : '0', ' ', picto_tag('picto_outings', __('nb_outings')), ' ', isset($item['nb_linked_docs']) ? $item['nb_linked_docs'] : '0';
예제 #10
0
<?php

use_helper('Field');
$feedItem = new sfGeoFeedItem();
$i18n = $item['RouteI18n'][0];
$summit_i18n = $item['associations'][0]['Summit'][0]['SummitI18n'][0];
$feedItem->setTitle($summit_i18n['name'] . __('&nbsp;:') . ' ' . $i18n['name']);
$id = $item['id'];
$lang = $i18n['culture'];
$feedItem->setLink("@document_by_id_lang_slug?module=routes&id={$id}&lang={$lang}&slug=" . make_slug($summit_i18n['name'] . '-' . $i18n['name']));
$feedItem->setUniqueId(sfRouting::getInstance()->getCurrentInternalUri() . '_' . $id);
$feedItem->setAuthorName($item['creator']);
$feedItem->setPubdate(strtotime($item['creation_date']));
$data = array();
$²data[] = get_paginated_activities($item['activities'], true);
$data[] = get_paginated_value($item['facing'], 'app_routes_facings');
$data[] = $item['height_diff_up'] . __('meters');
$data[] = field_route_ratings_data($item, false);
if (isset($item['geoassociations']) && count($item['geoassociations'])) {
    $data[] = get_paginated_areas($item['geoassociations']);
}
$feedItem->setDescription(implode(' - ', $data));
// FIXME: relevant? if yes, add lon/lat fields in model call
//$feedItem->setLongitude($item['lon']);
//$feedItem->setLatitude($item['lat']);
$feed->addItem($feedItem);