本文整理汇总了PHP中c2cTools::Module2Letter方法的典型用法代码示例。如果您正苦于以下问题:PHP c2cTools::Module2Letter方法的具体用法?PHP c2cTools::Module2Letter怎么用?PHP c2cTools::Module2Letter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类c2cTools
的用法示例。
在下文中一共展示了c2cTools::Module2Letter方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeDiff
/**
* Display differences between given document versions.
*/
public function executeDiff()
{
$id = $this->getRequestParameter('id');
$old_version = $this->getRequestParameter('old');
$new_version = $this->getRequestParameter('new');
$lang = $this->getRequestParameter('lang');
$module = $this->getRequestParameter('module');
if ($this->getContext()->getRequest()->getMethod() == sfRequest::POST) {
$this->redirect('@document_diff?module=' . $this->getModuleName() . "&id={$id}&lang={$lang}&new={$new_version}&old={$old_version}");
}
// Diff displaying is performed in view using Diff helper
$this->old_document = $this->getDocument($id, $lang, $old_version);
$this->new_document = $this->getDocument($id, $lang, $new_version);
$this->old_metadata = $this->old_document->getMetadatas();
$this->new_metadata = $this->new_document->getMetadatas();
$this->current_version = self::getCurrentVersionNb($id, $lang);
$this->fields = Document::getVisibleFieldNamesByObject($this->old_document);
// we need associated images for displaying them
$prefered_cultures = $this->getUser()->getCulturesForDocuments();
$association_type = c2cTools::Module2Letter($module) . 'i';
$this->associated_images = Document::fetchAdditionalFieldsFor(Association::findAllWithBestName($id, $prefered_cultures, $association_type), 'Image', array('filename', 'image_type'));
// nb comments
$this->nb_comments = PunbbComm::retrieveNbComments($id . '_' . $lang);
$this->setTemplate('../../documents/templates/diff');
$this->setPageTitle($this->new_document->get('name') . ' :: ' . $this->__('diff') . ' ' . $old_version . ' > ' . $new_version);
$this->getResponse()->addMeta('robots', 'noindex, nofollow');
}
示例2: use_helper
<?php
use_helper('AutoComplete', 'General', 'Field');
$has_associated_docs = count($associated_docs);
$has_extra_docs = isset($extra_docs) && check_not_empty($extra_docs);
$show_link_to_delete = isset($show_link_to_delete) ? $show_link_to_delete : false;
if (isset($document)) {
$id = $document->get('id');
}
// correctly set main_id and linked_id
$module_letter = c2cTools::Module2Letter($module);
$revert_ids = isset($type) ? substr($type, 0, 1) != $module_letter : null;
// ghost summit-huts case
if (isset($ghost_module)) {
$ghost_module_letter = c2cTools::Module2Letter($ghost_module);
$revert_ghost_ids = isset($ghost_type) ? substr($ghost_type, 0, 1) != $ghost_module_letter : null;
}
if ($has_associated_docs || $has_extra_docs) {
?>
<div class="one_kind_association">
<div class="association_content">
<?php
echo '<div class="assoc_img picto_' . $module . '" title="' . ucfirst(__($module)) . '"><span>' . ucfirst(__($module)) . __(' :') . '</span></div>';
if ($has_associated_docs) {
$is_inline = isset($inline);
//case for users list in outings
$has_merge_inline = isset($merge_inline) && trim($merge_inline) != '';
if ($is_inline) {
echo '<div class="linked_elt">';
}
$is_first = true;
示例3: end_section_tag
}
echo end_section_tag();
include_partial($mobile_version ? 'documents/mobile_map_section' : 'documents/map_section', array('document' => $document));
if ($is_not_archive && $is_not_merged) {
echo start_section_tag('Linked documents', 'associated_docs');
$id_no_associated_docs = "no_associated_docs";
$id_list_associated_docs = "list_associated_docs";
if (!count($associated_documents)) {
echo '<p class="default_text" id="' . $id_no_associated_docs . '">' . __("No document uses this picture.") . '</p>';
}
if (count($associated_documents) > 0) {
echo '<ul id="' . $id_list_associated_docs . '">';
foreach ($associated_documents as $doc) {
$doc_id = $doc['id'];
$module = $doc['module'];
$type = c2cTools::Module2Letter($module) . 'i';
$idstring = $type . '_' . $doc_id;
echo '<li id="', $idstring, '">';
echo picto_tag('picto_' . $module, __($module));
echo ' ' . link_to($doc['name'], "@document_by_id_lang_slug?module={$module}&id=" . $doc_id . '&lang=' . $doc['culture'] . '&slug=' . make_slug($doc['name']));
if ($show_link_to_delete) {
echo c2c_link_to_delete_element($type, $doc_id, $id, false, 1);
}
echo '</li>';
}
echo '</ul>';
} elseif ($show_link_tool) {
echo '<ul id="' . $id_list_associated_docs . '"><li style="display:none"></li></ul>';
}
if ($show_link_tool) {
?>
示例4: link_to_associated_images
function link_to_associated_images($label, $join = '', $orderby = array())
{
$params = array();
$rename_params['users'] = 'ousers';
$perso = array();
if (!empty($join)) {
$perso_param = c2cPersonalization::getDefaultFiltersUrlParam($join, array('ifon'));
if (!empty($perso_param)) {
$perso['perso'] = $perso_param;
}
$rename_params['act'] = c2cTools::Module2Letter($join) . 'act';
$rename_params['id'] = $join;
$join = substr($join, 0, -1);
$params['join'] = $join;
}
$params = array_merge($params, $orderby);
$uri = '/images/list';
$uri .= _addUrlParameters($uri, array('orderby', 'orderby2', 'orderby3', 'order', 'order2', 'order3', 'page'), $params, $rename_params, $perso);
return link_to($label, $uri, array('rel' => 'nofollow'));
}
示例5: use_helper
<?php
use_helper('Sections', 'Field');
if (!isset($related_articles)) {
$related_articles = array();
}
if (count($related_articles) || count($related_portals)) {
echo start_section_tag('Annex', 'annex');
if (count($related_articles)) {
$module = $document->get('module');
$fixed_type = c2cTools::Module2Letter($module) . 'c';
include_partial('articles/association', array('document' => $document, 'associated_documents' => $related_articles, 'show_link_to_delete' => $show_link_to_delete, 'show_link_tool' => false, 'show_default_text' => false, 'fixed_type' => $fixed_type, 'id_list_associated_docs' => 'list_associated_articles'));
}
if (count($related_portals)) {
echo '<ul id="list_related_portals" class="no_print">';
foreach ($related_portals as $portal) {
$portal_config = sfConfig::get('app_portals_' . $portal);
$text = __($portal_config['name']);
if (isset($portal_config['url']) || isset($portal_config['annex_url'])) {
if (isset($portal_config['url'])) {
$portal_url = $portal_config['url'];
} else {
$portal_url = $portal_config['annex_url'];
}
$portal_url = $portal_url;
} else {
$portal_url = '@document_by_id?module=portals&id=' . $portal_config['id'];
}
$html = link_to($text, $portal_url);
echo li(picto_tag('picto_portals') . ' ' . $html);
}
示例6: buildPersoCriteria
public static function buildPersoCriteria(&$conditions, &$values, &$joins, &$params_list, $module, $activity_param = 'act', $na_activities = array())
{
$has_merged = self::buildConditionItem($conditions, $values, $joins, $params_list, 'ItemNull', 'm.redirects_to', 'merged', 'merged');
if ($has_merged) {
$joins['merged'] = $has_merged;
} else {
$conditions[] = 'm.redirects_to IS NULL';
}
self::buildConditionItem($conditions, $values, $joins, $params_list, 'Config', '', 'all', 'all');
if (isset($joins['all'])) {
if ($joins['all']) {
return;
} else {
unset($joins['all']);
}
}
$perso = c2cTools::getArrayElement($params_list, 'perso');
if (!empty($perso)) {
$perso = explode('-', $perso);
} else {
$perso = array();
}
$filters_active_and_on = c2cPersonalization::getInstance()->areFiltersActiveAndOn($module);
if (!$has_merged) {
if ($filters_active_and_on && (empty($params_list) || count($perso) == 1 && in_array('ifon', $perso))) {
list($langs_enable, $areas_enable, $activities_enable) = c2cPersonalization::getDefaultFilters($module);
if ($langs_enable) {
$perso[] = 'cult';
}
if ($areas_enable) {
$perso[] = 'areas';
}
if ($activities_enable) {
$perso[] = 'act';
}
} elseif (!$filters_active_and_on && in_array('ifon', $perso)) {
$perso = array();
}
} else {
$perso = array();
}
if (!empty($perso)) {
$params = array_keys($params_list);
if (!array_intersect(array('areas', 'bbox', 'around'), $params) && array_intersect(array('areas', 'yes', 'all'), $perso)) {
$areas = c2cPersonalization::getInstance()->getPlacesFilter();
if (count($areas)) {
$params_list['areas'] = implode('-', $areas);
}
}
if (!in_array($activity_param, $params) && array_intersect(array('act', 'yes', 'all'), $perso)) {
$activities = c2cPersonalization::getInstance()->getActivitiesFilter();
$activities = array_udiff($activities, $na_activities, 'strcmp');
if (count($activities)) {
$params_list[$activity_param] = implode('-', $activities);
}
}
$culture_param = c2cTools::Module2Letter($module) . 'cult';
if (!in_array($culture_param, $params) && array_intersect(array('cult', 'yes', 'all'), $perso)) {
$cultures = c2cPersonalization::getInstance()->getLanguagesFilter();
if (count($cultures)) {
$params_list[$culture_param] = implode('-', $cultures);
}
}
if (isset($params_list['perso'])) {
unset($params_list['perso']);
}
if (empty($params_list)) {
$joins['all'] = true;
}
}
if (isset($params_list[$activity_param])) {
$joins['act'] = $params_list[$activity_param];
} else {
$joins['act'] = '';
}
}