当前位置: 首页>>代码示例>>PHP>>正文


PHP c2cTools::extractHighestName方法代码示例

本文整理汇总了PHP中c2cTools::extractHighestName方法的典型用法代码示例。如果您正苦于以下问题:PHP c2cTools::extractHighestName方法的具体用法?PHP c2cTools::extractHighestName怎么用?PHP c2cTools::extractHighestName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在c2cTools的用法示例。


在下文中一共展示了c2cTools::extractHighestName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: redirectToView

 /**
  * overrides function from parent in order to correctly display slug
  * with summit name
  */
 protected function redirectToView()
 {
     sfLoader::loadHelpers(array('General'));
     $prefered_cultures = $this->getUser()->getCulturesForDocuments();
     $summits = Association::findAllWithBestName($this->document->get('id'), $prefered_cultures, 'sr');
     $summit_name = c2cTools::extractHighestName($summits);
     $this->redirect('@document_by_id_lang_slug?module=' . $this->getModuleName() . '&id=' . $this->document->get('id') . '&lang=' . $this->document->getCulture() . '&slug=' . make_slug($summit_name) . '-' . get_slug($this->document));
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:12,代码来源:actions.class.php

示例2: populateCustomFields

 /**
  * populates custom fields (for instance if we are creating a new outing, already associated with a route)
  * overrides the one in documentsActions class.
  */
 protected function populateCustomFields()
 {
     $document = $this->document;
     if ($this->getRequestParameter('link') && ($linked_doc = Document::find('Document', $this->getRequestParameter('link'), array('module')))) {
         $prefered_cultures = $this->getUser()->getCulturesForDocuments();
         switch ($linked_doc->get('module')) {
             case 'routes':
                 $linked_doc = Document::find('Route', $this->getRequestParameter('link'), array('activities', 'max_elevation', 'min_elevation', 'height_diff_up', 'height_diff_down'));
                 $linked_doc->setBestCulture($prefered_cultures);
                 $this->linked_doc = $linked_doc;
                 // FIXME: this "field getting" triggers an additional request to the db (yet already hydrated),
                 // probably because activities field has been hydrated into object as a string and not as an array
                 // cf filterGetActivities and filterSetActivities in Route.class.php ...
                 $activities = $linked_doc->get('activities');
                 $document->set('activities', $activities);
                 if ($max_elevation = $linked_doc->get('max_elevation')) {
                     $document->set('max_elevation', $max_elevation);
                 }
                 if ($min_elevation = $linked_doc->get('min_elevation')) {
                     $document->set('access_elevation', $min_elevation);
                     if (in_array(1, $activities)) {
                         $document->set('up_snow_elevation', $min_elevation);
                         $document->set('down_snow_elevation', $min_elevation);
                     }
                 }
                 if ($height_diff_up = $linked_doc->get('height_diff_up')) {
                     $document->set('height_diff_up', $height_diff_up);
                 }
                 if ($height_diff_down = $linked_doc->get('height_diff_down')) {
                     $document->set('height_diff_down', $height_diff_down);
                 }
                 // find associated summits to this route, extract the highest and create document with this name.
                 $associated_summits = array_filter(Association::findAllWithBestName($linked_doc->get('id'), $prefered_cultures), array('c2cTools', 'is_summit'));
                 $this->highest_summit_name = c2cTools::extractHighestName($associated_summits);
                 $document->set('name', $this->highest_summit_name . $this->__(' :') . ' ' . $linked_doc->get('name'));
                 break;
             case 'sites':
                 $linked_doc = Document::find('Site', $this->getRequestParameter('link'), array('mean_rating'));
                 $linked_doc->setBestCulture($prefered_cultures);
                 $document->set('name', $linked_doc->get('name'));
                 $document->set('activities', array(4));
                 $this->linked_doc = $linked_doc;
                 break;
             default:
                 $this->setErrorAndRedirect('You cannot create an outing without linking it to an existing route or site', '@default_index?module=outings');
         }
     }
     $this->document = $document;
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:53,代码来源:actions.class.php


注:本文中的c2cTools::extractHighestName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。