本文整理汇总了PHP中c2cTools::mobileVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP c2cTools::mobileVersion方法的具体用法?PHP c2cTools::mobileVersion怎么用?PHP c2cTools::mobileVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类c2cTools
的用法示例。
在下文中一共展示了c2cTools::mobileVersion方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadRessources
function loadRessources()
{
$response = sfContext::getInstance()->getResponse();
if (!c2cTools::mobileVersion()) {
$response->addJavascript('/static/js/modal.js', 'last');
$response->addStylesheet('/static/css/modal.css', 'last');
}
}
示例2: phone_link
function phone_link($phone = '')
{
if (!empty($phone) && c2cTools::mobileVersion()) {
$simple_phone = preg_replace('/\\(0\\)/', '', str_replace(array(' ', '.'), '', $phone));
// if number is not only digits,+,- do not try to present it as a link
if (!ereg('[0-9\\+-]+', $simple_phone)) {
return $phone;
}
$link = content_tag('a', $phone, array('href' => 'tel:' . $simple_phone));
return $link;
} else {
return $phone;
}
}
示例3: display_flash_message
/**
* Display flash message if needed
*/
function display_flash_message($type)
{
$flash = sfContext::getInstance()->getUser()->getAttribute($type, null, 'symfony/flash');
if ($flash) {
$message = '<div class="' . $type . '" id="' . $type . '"><div>' . $flash . '</div></div>';
if (!c2cTools::mobileVersion()) {
// show feedback div, highlight it, and then fade it out and remove it
$js = javascript_queue("\$('#{$type}').delay(3000).animate({opacity:0}, {duration:1500, complete: function() { \$(this).hide(); }});");
} else {
$js = javascript_queue("\$('#{$type}').click(function() { \$(this).hide(); });");
}
return $message . $js;
}
}
示例4: geocode_auto_complete
function geocode_auto_complete($name, $service)
{
$mobile_version = c2cTools::mobileVersion();
$service_class = $service === 'nominatim' ? ' nominatim' : ' geonames';
$out = input_tag($name, '', array('class' => 'geocode_auto_complete' . $service_class, 'placeholder' => __('enter place name'), 'data-noresult' => __('no results')));
if ($mobile_version) {
$out .= content_tag('span', '<br />' . __('autocomplete_help'), array('class' => 'mobile_auto_complete_background'));
$out .= content_tag('span', 'X', array('class' => 'mobile_auto_complete_escape'));
}
// following script will automatically intanciate geocode autocompleter
$out .= javascript_queue('$.ajax({
url: "' . minify_get_combined_files_url('/static/js/geocode_autocompleter.js') . '",
dataType: "script",
cache: true});');
return $out;
}
示例5: language_select_list
function language_select_list($module, $id, $current_language, $translated_languages)
{
$mobile_version = c2cTools::mobileVersion();
$items = array();
foreach (Language::getAll() as $language => $value) {
$lang = format_language_c2c($language);
if ($current_language == $language) {
$items[] = '<div class="current_lang">' . ($mobile_version ? $language : $lang) . '</div>';
} else {
$existing_lang = in_array($language, $translated_languages);
$options = $existing_lang ? array('class' => 'translated') : array('class' => 'not_translated', 'rel' => 'nofollow');
if (!$mobile_version) {
$items[] = link_to($lang, "@document_by_id_lang?module={$module}&id={$id}&lang={$language}", $options);
} else {
$items[] = $existing_lang ? link_to($language, "@document_by_id_lang?module={$module}&id={$id}&lang={$language}", $options) : '<span class="not_translated">' . $language . '</span>';
}
}
}
return implode(' | ', $items);
}
示例6: executeGetmultipleselect
public function executeGetmultipleselect()
{
$mobile_version = c2cTools::mobileVersion();
$separate_prefs = $this->hasRequestParameter('sep_prefs') ? $this->getRequestParameter('sep_prefs') : 'true';
$separate_prefs = $separate_prefs == 'false' ? false : true;
$area_type = $this->getRequestParameter('area_type');
if (!$mobile_version) {
$default_width = 'auto';
$default_height = '350px';
} else {
$default_width = '216px';
$default_height = '3.8em';
}
$height = $this->hasRequestParameter('height') ? $this->getRequestParameter('height') . 'px' : $default_height;
$width = $this->hasRequestParameter('width') ? $this->getRequestParameter('width') . 'px' : $default_width;
$select_id = $this->hasRequestParameter('select_id') ? $this->getRequestParameter('select_id') : 'places';
$select_name = $this->hasRequestParameter('select_id') ? $this->getRequestParameter('select_name') : 'areas';
$areas = $this->getAreas($area_type, $separate_prefs);
sfLoader::loadHelpers(array('Tag', 'Form'));
return $this->renderText(select_tag($select_name, options_for_select($areas, $separate_prefs ? null : c2cPersonalization::getInstance()->getPlacesFilter()), array('id' => $select_id, 'multiple' => true, 'style' => 'width:' . $width . '; height:' . $height . ';')) . input_hidden_tag($select_id . '_type', $area_type));
}
示例7: start_section_tag
function start_section_tag($label, $container_id, $state = 'opened', $map = false, $first = false, $hide = false, $show_tip = true)
{
$class = 'article_titre_bg';
if ($first) {
$class .= ' hfirst';
}
$picto_class = $state == 'opened' ? 'picto_close' : 'picto_open';
$status = __($state == 'opened' ? 'section close' : 'section open');
$label = picto_tag($picto_class, '', array('id' => $container_id . '_toggle')) . __($label);
if ($show_tip && !c2cTools::mobileVersion()) {
$label .= '<span id="tip_' . $container_id . '" class="tips">[' . $status . ']</span>';
$up = '<a href="#header">' . picto_tag('action_up', __('menu'), array('class' => 'go_up')) . '</a>';
} else {
$up = '';
}
$style = $hide ? '" style="display:none' : '';
$html = '<div class="' . $class . '" id="' . $container_id . '_tbg' . $style . '">' . '<div class="title" id="' . $container_id . '_section_title" title="' . $status . '">' . '<a href="#" id="' . $container_id . '" data-toggle-view="' . $container_id . '">' . $label . '</a>' . $up . '</div>' . '</div>';
if (!$map) {
$display = $state == 'opened' && !$hide ? '' : ' style="display:none;"';
$html .= '<section id="' . $container_id . '_section_container" class="section"' . $display . '>';
}
return $html;
}
示例8: use_helper
<?php
use_helper('Pagination', 'MyImage', 'Lightbox', 'JavascriptQueue', 'Link', 'Viewer', 'General');
$mobile_version = c2cTools::mobileVersion();
$id = $sf_params->get('id');
$lang = $sf_params->get('lang');
if (!$mobile_version) {
// add lightbox ressources
addLbMinimalRessources();
} else {
echo javascript_queue('C2C.swipe_i18n = {"Big size": "' . __('Big size') . '",' . '"Original image": "' . __('Original image') . '",' . '"Informations": "' . __('Informations') . '"};');
use_javascript('/static/js/swipe.js', 'last');
use_javascript('/static/js/swipe.wrapper.js', 'last');
}
echo display_title(__('images list'), $sf_params->get('module'), false, 'list_nav');
if (!c2cTools::mobileVersion()) {
echo '<div id="nav_space"> </div>';
include_partial('nav4list');
//include_partial('documents/nav_news');
}
echo display_content_top('list_content');
echo start_content_tag('images_content');
if (!$mobile_version) {
echo javascript_tag('lightbox_msgs = Array("' . __('View image details') . '","' . __('View original image') . '");');
}
echo '<p class="list_header">' . __('images presentation');
if ($nb_results == 0) {
echo '<br /><br />' . __('there is no %1% to show', array('%1%' => __('images'))) . '</p>';
} else {
echo '</p>';
$pager_navigation = pager_navigation($pager);
示例9: ucfirst
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;
$reduce_name = isset($reduce_name) && $reduce_name;
$has_route_list_link = isset($route_list_module) && !empty($route_list_ids) && !c2cTools::mobileVersion();
if ($has_route_list_link) {
$base_url = 'routes/list?';
$param2 = "{$route_list_module}={$route_list_ids}";
$link_text = substr(__('routes'), 0, 1);
$title = "routes linked to {$module} and {$route_list_module}";
}
foreach ($associated_docs as $doc) {
$is_doc = isset($doc['is_doc']) && $doc['is_doc'];
$doc_id = $doc['id'];
$idstring = isset($type) ? ' id="' . $type . '_' . ($revert_ids ? $id : $doc_id) . '"' : '';
$class = 'linked_elt';
$level = isset($doc['level']) ? $doc['level'] : 0;
if ($level > 1) {
$class .= ' level' . $level;
}
示例10: executeView
/**
* Executes view action.
*/
public function executeView()
{
parent::executeView();
$mobile_version = c2cTools::mobileVersion();
if (!$this->document->isArchive() && $this->document['redirects_to'] == NULL) {
sfLoader::loadHelpers(array('Pagination'));
$user = $this->getUser();
$prefered_cultures = $user->getCulturesForDocuments();
$document = $this->document;
$id = $this->document->get('id');
$topo_filter = $this->document->get('topo_filter');
$url_params = array();
$main_params = unpackUrlParameters($topo_filter, $main_url_params);
// map filter
$has_map = $this->document->get('has_map');
$has_map = !$mobile_version && !empty($has_map);
$this->has_map = $has_map;
if ($has_map) {
$map_filter_temp = $this->document->get('map_filter');
$map_filter_temp = str_replace(' ', '', $map_filter_temp);
$map_filter_temp = explode('|', $map_filter_temp);
$map_filter = array();
foreach ($map_filter_temp as $filter) {
$filter = explode(':', $filter);
if (isset($filter[1])) {
$map_filter[$filter[0]] = $filter[1];
}
}
if (empty($map_filter['objects'])) {
$map_filter['objects'] = null;
}
if (!empty($map_filter['lon']) || !empty($map_filter['lat']) || !empty($map_filter['zoom'])) {
if (empty($map_filter['lon'])) {
$lon = $this->document->get('lon');
if (is_null($lon)) {
$lon = 7;
}
} else {
$lon = $map_filter['lon'];
}
if (empty($map_filter['lat'])) {
$lat = $this->document->get('lat');
if (is_null($lat)) {
$lat = 45.5;
}
} else {
$lat = $map_filter['lat'];
}
if (empty($map_filter['zoom'])) {
$zoom = 6;
} else {
$zoom = $map_filter['zoom'];
}
$map_filter['center'] = array($lon, $lat, $zoom);
} else {
$map_filter['center'] = null;
}
if (empty($map_filter['height'])) {
$map_filter['height'] = null;
}
$this->map_filter = $map_filter;
$this->has_geom = false;
}
// user filters:
$perso = c2cPersonalization::getInstance();
$langs = $ranges = $activities = array();
if ($perso->isMainFilterSwitchOn()) {
$langs = $perso->getLanguagesFilter();
$names = array_keys($main_params);
if (!array_intersect($names, array('areas', 'summits', 'sites', 'huts', 'parkings', 'routes', 'books'))) {
$ranges = $perso->getPlacesFilter();
}
if (!in_array('act', $names)) {
$activities = $perso->getActivitiesFilter();
}
}
// latest outings
$nb_outings = $this->document->get('nb_outings');
$has_outings = !empty($nb_outings);
$this->has_outings = $has_outings;
if ($has_outings) {
$outing_url_params = array();
$outing_params = $this->document->get('outing_filter');
$outing_params = unpackUrlParameters($outing_params, $outing_url_params);
$outing_langs = $langs;
$outing_ranges = $ranges;
$outing_activities = $activities;
if (isset($outing_params['perso'])) {
$perso_params = explode('-', $outing_params['perso']);
if (array_intersect(array('areas', 'act', 'cult', 'no'), $perso_params)) {
if (!in_array('cult', $perso_params)) {
$outing_langs = array();
}
if (!in_array('areas', $perso_params)) {
$outing_ranges = array();
}
if (!in_array('act', $perso_params)) {
//.........这里部分代码省略.........
示例11: __
$license_url .= $sf_user->getCulture();
$license_name = 'Creative Commons ' . __($license);
$license_title = __("{$license} title");
$class = 'license_box';
if (isset($large) && $large) {
$class .= ' large';
}
?>
<footer class="<?php
echo $class;
?>
">
<?php
echo '<div class="cc">' . link_to(picto_tag(($iscopyright ? '' : 'cc-') . $license), getMetaArticleRoute('licenses', false, ($iscopyright ? '' : 'cc-') . $license), array('title' => $license != 'copyright' ? 'Creative Commons' : 'Copyright')) . '</div>';
echo ' ';
if ($iscopyright) {
echo __('Image under copyright license');
} else {
echo __('Page under %1% license', array('%1%' => "<a rel=\"license\" href=\"{$license_url}\" title=\"{$license_title}\">{$license_name}</a>"));
}
echo '<br />' . __('Images are under license specified in the original document of each image');
if (isset($version) && !c2cTools::mobileVersion()) {
echo '<br /><span class="doc_infos">', __('Version #%1%, date %2%', array('%1%' => $version, '%2%' => format_date($created_at, 'D')));
if ($sf_user->hasCredential(sfConfig::get('app_credentials_moderator'))) {
echo '<span class="no_print"> - ', __('Document generated %1% in %2%', array('%1%' => format_datetime(time()), '%2%' => round(1000 * $timer->getElapsedTime()))), '</span>';
}
echo '</span>';
}
?>
</footer>
示例12: implode
echo ' <span class="meta">(' . implode(' - ', $outing_data) . ')</span>';
}
if (isset($item['nb_images'])) {
$images = picto_tag('picto_images_light', format_number_choice('[1]1 image|(1,+Inf]%1% images', array('%1%' => $item['nb_images']), $item['nb_images'])) . ' ';
echo $images;
}
?>
</li>
<?php
}
?>
</ul>
<?php
}
?>
<div class="home_link_list">
<?php
echo link_to($custom_footer_text, $custom_footer_link) . ' - ' . link_to(__('recent conditions'), $conditions_link) . ' - ' . link_to(__('Prepare outing'), getMetaArticleRoute('prepare_outings'));
if ($sf_user->isConnected() && !c2cTools::mobileVersion()) {
echo ' - ' . button_wizard();
}
echo ' - ' . customize_link_to();
?>
</div>
</div>
<?php
$cookie_position = array_search('last_outings', sfConfig::get('app_personalization_cookie_fold_positions'));
echo javascript_tag('C2C.setSectionStatus(\'last_outings\', ' . $cookie_position . ', ' . (!$default_open ? 'false' : 'true') . ");");
?>
</div>
示例13: use_helper
<?php
use_helper('MyForm');
echo form_tag('documents/search', array('method' => 'get', 'class' => 'search'));
echo '<div class="sbox">';
$prefix = isset($prefix) ? $prefix : '';
$autocomplete = c2cTools::mobileVersion() ? false : (isset($autocomplete) ? $autocomplete : false);
echo search_box_tag($prefix, $autocomplete);
echo '</div></form>';
示例14: use_helper
<?php
use_helper('Language', 'Sections', 'Viewer', 'AutoComplete', 'General', 'MyForm');
$is_connected = $sf_user->isConnected();
$is_moderator = $sf_user->hasCredential(sfConfig::get('app_credentials_moderator'));
$id = $sf_params->get('id');
$lang = $document->getCulture();
$is_not_archive = !$document->isArchive();
$is_not_merged = !$document->get('redirects_to');
$mobile_version = c2cTools::mobileVersion();
$show_link_tool = $is_not_archive && $is_not_merged && $is_connected && !$mobile_version;
display_page_header('articles', $document, $id, $metadata, $current_version, array('item_type' => 'http://schema.org/Article', 'nb_comments' => $nb_comments));
// lang-dependent content
echo start_section_tag('Article', 'description');
include_partial('documents/i18n_section', array('document' => $document, 'languages' => $sf_data->getRaw('languages'), 'needs_translation' => $needs_translation, 'images' => $associated_images, 'filter_image_type' => $document->get('article_type') == 1));
echo end_section_tag();
// lang-independent content starts here
echo start_section_tag('Information', 'data');
include_partial('data', array('document' => $document, 'nb_comments' => $nb_comments));
if ($is_not_archive) {
echo '<div class="all_associations">';
include_partial('areas/association', array('associated_docs' => $associated_areas, 'module' => 'areas'));
echo '</div>';
}
echo end_section_tag();
if ($is_not_archive && $is_not_merged) {
$is_personal_article = $document->get('article_type') == 2;
// if the user is not a moderator, and personal article, use javascript to distinguish
// between document author(s) and others
$author_specific = !$is_moderator && $is_connected && $is_personal_article;
if ($author_specific) {
示例15: filterSortParameters
/**
* Parses REQUEST sent by filter form and keeps only relevant sort parameters.
* @return array
*/
protected function filterSortParameters($result_type = null)
{
$sort = array();
if (($npp = $this->getRequestParameter('npp')) && $npp != (c2cTools::mobileVersion() ? sfConfig::get('app_list_mobile_maxline_number') : sfConfig::get('app_list_maxline_number'))) {
$sort[] = "npp={$npp}";
}
$module = $this->getModuleName();
if ($module != $result_type && $result_type == 'outings') {
$sort[] = "orderby=date";
$sort[] = "order=desc";
} elseif (is_null($result_type) || $module == $result_type) {
$default_order = sfConfig::get('app_list_default_order', 'asc');
$has_orderby = $this->addParam($sort, 'orderby');
if ($has_orderby) {
$this->addParam($sort, 'order', $default_order);
}
$has_orderby = $this->addParam($sort, 'orderby2');
if ($has_orderby) {
$this->addParam($sort, 'order2', $default_order);
}
$has_orderby = $this->addParam($sort, 'orderby3');
if ($has_orderby) {
$this->addParam($sort, 'order3', $default_order);
}
}
return $sort;
}