本文整理汇总了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));
}
示例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;
}