當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。