protected function getHighestSummit() { $id = $this->getRequestParameter('id'); if (empty($id)) { return null; } $prefered_cultures = $this->getUser()->getCulturesForDocuments(); $associated_summits = Association::findAllWithBestName($id, $prefered_cultures, 'sr'); return c2cTools::extractHighest($associated_summits); }
echo '<div class="all_associations col_right col_66 no_print">'; include_partial('routes/association', array('associated_docs' => $associated_routes, 'module' => 'routes', 'document' => $document, 'show_link_to_delete' => $show_link_to_delete, 'type' => 'rr', 'strict' => false, 'display_info' => true, 'title' => 'variants')); if ($show_link_tool && !$mobile_version) { $modules_list = array('summits', 'sites', 'huts', 'parkings', 'routes', 'books', 'articles'); $options = array('field_prefix' => 'multi_1'); // try to determine the "center" of the route: // - centroid if it has track // - highest linked summits with coordinates if (check_not_empty_doc($document, 'lon')) { $options['suggest_near_docs'] = array('lon' => $document['lon'], 'lat' => $document['lat']); } else { $summits_with_geom = array_filter($sf_data->getRaw('associated_summits'), function ($n) { return isset($n['pointwkt']); }); if (count($summits_with_geom)) { $ref_summit = c2cTools::extractHighest($summits_with_geom); $options['suggest_near_docs'] = array('lon' => $ref_summit['lon'], 'lat' => $ref_summit['lat']); } } if (isset($options['suggest_near_docs'])) { $options['suggest_exclude'] = array('summits' => get_directly_linked_ids($associated_summits), 'sites' => get_directly_linked_ids($associated_sites), 'huts' => get_directly_linked_ids($associated_huts), 'parkings' => get_directly_linked_ids($associated_parkings)); } echo c2c_form_add_multi_module('routes', $id, $modules_list, 3, $options); } echo '</div>'; } include_partial('documents/geom_warning', array('document' => $document, 'message' => 'No GPX track, please edit this document to add some')); } echo end_section_tag(); // lang-dependent content echo start_section_tag('Description', 'description');