• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP c2cTools类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: executeView

 /**
  * Executes view action.
  */
 public function executeView()
 {
     parent::executeView();
     if (!$this->document->isArchive() && $this->document['redirects_to'] == NULL) {
         $user = $this->getUser();
         $prefered_cultures = $user->getCulturesForDocuments();
         $associated_parkings = c2cTools::sortArray(array_filter($this->associated_docs, array('c2cTools', 'is_parking')), 'elevation');
         if (count($associated_parkings)) {
             $associated_parkings = Association::createHierarchyWithBestName($associated_parkings, $prefered_cultures, array('type' => 'pp'));
             $associated_parkings = Parking::getAssociatedParkingsData($associated_parkings);
         }
         $this->associated_parkings = $associated_parkings;
         $related_portals = array();
         Portal::getLocalPortals($related_portals, $this->associated_areas);
         $this->related_portals = $related_portals;
         $product_type_list = sfConfig::get('mod_products_types_list');
         $product_type_index_list = $this->document->get('product_type');
         $product_type_name_list = array();
         foreach ($product_type_index_list as $product_type_index) {
             $product_type_name_list[] = $this->__($product_type_list[$product_type_index]);
         }
         $product_types = implode(', ', $product_type_name_list);
         $doc_name = $this->document->get('name');
         $title = $doc_name;
         if ($this->document->isArchive()) {
             $version = $this->getRequestParameter('version');
             $title .= ' :: ' . $this->__('revision') . ' ' . $version;
         }
         $title .= ' :: ' . $product_types;
         $this->setPageTitle($title);
         $description = array($product_types . ' :: ' . $doc_name, $this->getAreasList());
         $this->getResponse()->addMeta('description', implode(' - ', $description));
     }
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:37,代码来源:actions.class.php


示例2: executeSwitchformfactor

 public function executeSwitchformfactor()
 {
     $user = $this->getUser();
     if ($user->getAttribute('form_factor', 'desktop') === 'mobile') {
         $user->setAttribute('form_factor', 'desktop');
         if (!c2cTools::mobileRegexp()) {
             // delete form_factor cookie (not needed)
             $this->getResponse()->setCookie('form_factor', null, -1);
         } else {
             // set cookie so that we are sure to prevent redirection on next sessions
             $this->getResponse()->setCookie('form_factor', 'desktop', time() + 60 * 60 * 24 * 30);
         }
     } else {
         $user->setAttribute('form_factor', 'mobile');
         if (c2cTools::mobileRegexp()) {
             // delete form_factor cookie (not needed)
             $this->getResponse()->setCookie('form_factor', null, -1);
         } else {
             // set cookie so that we are sure to set form factor correctly on next sessions
             $this->getResponse()->setCookie('form_factor', 'mobile', time() + 60 * 60 * 24 * 30);
         }
     }
     // redirect to referer
     return $this->redirect($this->getRequest()->getReferer());
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:25,代码来源:actions.class.php


示例3: execute

 public function execute($filterChain)
 {
     $context = $this->getContext();
     $user = $context->getUser();
     if ($this->isFirstCall() && !$user->hasAttribute('form_factor')) {
         // if you make changes here, be sure also to check web/forums/include/common.php
         // and check varnish vcl file
         $cookie = $context->getRequest()->getCookie('form_factor');
         if ($cookie === 'mobile' || $cookie === null && c2cTools::mobileRegexp()) {
             $user->setAttribute('form_factor', 'mobile');
         } else {
             $user->setAttribute('form_factor', 'desktop');
         }
     }
     if ($user->getAttribute('form_factor', 'desktop') === 'mobile') {
         // change layout for mobile_layout
         $context->getResponse()->setParameter($context->getModuleName() . '_' . $context->getActionName() . '_layout', 'mobile_layout', 'symfony/action/view');
         $context->getResponse()->addStylesheet('/static/css/mobile.css', 'last');
     } else {
         $context->getResponse()->addStylesheet('/static/css/default.css');
         $context->getResponse()->addStylesheet('/static/css/menu.css');
         $context->getResponse()->addStylesheet('/static/css/print.css', 'print');
     }
     // execute next filter
     $filterChain->execute();
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:26,代码来源:FormFactorFilter.class.php


示例4: loadRessources

function loadRessources()
{
    $response = sfContext::getInstance()->getResponse();
    if (!c2cTools::mobileVersion()) {
        $response->addJavascript('/static/js/modal.js', 'last');
        $response->addStylesheet('/static/css/modal.css', 'last');
    }
}
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:8,代码来源:ModalBoxHelper.php


示例5: execute

 public function execute(&$value, &$error)
 {
     // file upload check
     foreach ($value['error'] as $error_code) {
         if ($error_code) {
             $error = $this->getParameter('upload_error');
             return false;
         }
     }
     $validation = sfConfig::get('app_images_validation');
     // weight check
     foreach ($value['size'] as $file_size) {
         if ($file_size > $validation['weight']) {
             $error = $this->getParameter('weight_error');
             return false;
         }
     }
     // type check
     // FIXME with symfony 1.0, the type is the one given by the browser
     // we prefer to use or own mime type checker (this is what is done in further
     // versions of symfony, using system file check)
     foreach ($value['tmp_name'] as $file) {
         $file_type = c2cTools::getMimeType($file);
         if (!in_array($file_type, $validation['mime_types'])) {
             $error = $this->getParameter('type_error');
             return false;
         }
     }
     foreach ($value['tmp_name'] as $k => $filename) {
         if ($value['type'][$k] != 'image/svg+xml') {
             list($width, $height) = getimagesize($filename);
         } else {
             // are there any script?
             if (SVG::hasScript($filename)) {
                 $error = $this->getParameter('svg_script_error');
                 return false;
             }
             // dimensions
             $dimensions = SVG::getSize($filename);
             if ($dimensions === false) {
                 $error = $this->getParameter('svg_error');
                 return false;
             } else {
                 list($width, $height) = $dimensions;
             }
         }
         // height/width check
         if ($width > $validation['max_size']['width'] || $height > $validation['max_size']['height']) {
             $error = $this->getParameter('max_dim_error');
             return false;
         }
         if ($width < $validation['min_size']['width'] || $height < $validation['min_size']['height']) {
             $error = $this->getParameter('min_dim_error');
             return false;
         }
     }
     return true;
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:58,代码来源:myImagesValidator.class.php


示例6: 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;
    }
}
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:14,代码来源:LinkHelper.php


示例7: 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;
    }
}
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:17,代码来源:FlashHelper.php


示例8: execute

 public function execute(&$value, &$error)
 {
     $allowed_mime_types = $this->getParameterHolder()->get('allowed');
     $allowed_mime_types = is_array($allowed_mime_types) ? $allowed_mime_types : array($allowed_mime_types);
     // FIXME with symfony 1.0, the type is the one given by the browser
     // we prefer to use or own mime type checker (this is what is done in further
     // versions of symfony, using system file check)
     $mime_type = c2cTools::getMimeType($value['tmp_name']);
     if (!in_array($mime_type, $allowed_mime_types)) {
         $error = $this->getParameter('type_error');
         return false;
     }
     return true;
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:14,代码来源:myFileMimeTypeValidator.class.php


示例9: 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;
}
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:16,代码来源:AutoCompleteHelper.php


示例10: moveAll

 /**
  * Move given image and its resized versions.
  */
 public static function moveAll($file, $pathFrom, $pathTo)
 {
     c2cTools::log("moving {$file} from {$pathFrom} to {$pathTo}");
     $types = sfConfig::get('app_images_types', array());
     list($file_name, $file_ext) = self::getFileNameParts($file);
     // move original
     $success = rename($pathFrom . DIRECTORY_SEPARATOR . $file, $pathTo . DIRECTORY_SEPARATOR . $file);
     // move thumbs
     foreach ($types as $type) {
         $success = $success && rename($pathFrom . DIRECTORY_SEPARATOR . $file_name . $type['suffix'] . $file_ext, $pathTo . DIRECTORY_SEPARATOR . $file_name . $type['suffix'] . $file_ext);
     }
     // move svg if any
     if (file_exists($pathFrom . DIRECTORY_SEPARATOR . $file_name . '.svg')) {
         $success = $success && rename($pathFrom . DIRECTORY_SEPARATOR . $file_name . '.svg', $pathTo . DIRECTORY_SEPARATOR . $file_name . '.svg');
     }
     return $success;
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:20,代码来源:Images.class.php


示例11: subscribe

 /**
  * Adds given address to given mailing list.
  * @param string listname
  * @param string email
  * @return boolean status (true=success, false=failure)
  */
 public static function subscribe($listname, $email)
 {
     $conn = sfDoctrine::Connection();
     try {
         $conn->beginTransaction();
         $sympa = new Sympa();
         $sympa->list_subscriber = $listname;
         $sympa->user_subscriber = $email;
         $sympa->save();
         $conn->commit();
         return true;
     } catch (Exception $e) {
         // Subscription failed! For instance because email address was already registered.
         $conn->rollback();
         c2cTools::log("Failed adding address {$email} to list {$listname}: " . $e->getMessage());
         return false;
     }
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:24,代码来源:Sympa.class.php


示例12: 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(' |&nbsp;', $items);
}
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:20,代码来源:LanguageHelper.php


示例13: 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));
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:21,代码来源:actions.class.php


示例14: execute

 public function execute($filterChain)
 {
     $context = $this->getContext();
     $session_user = $context->getUser();
     $cookie_name = sfConfig::get('app_remember_key_cookie_name', 'c2corg_remember');
     $cookie_value = $context->getRequest()->getCookie($cookie_name);
     if ($this->isFirstCall() && !$session_user->isConnected() && !is_null($cookie_value)) {
         c2cTools::log('{rememberFilter} user has a cookie, trying to auto login');
         $remember_key = RememberKey::getKey($cookie_value);
         if ($remember_key) {
             c2cTools::log('{rememberFilter} user found from his cookie');
             $user = $remember_key->getUser();
             if ($user->exists()) {
                 $session_user->signIn($user->get('private_data')->getLoginName(), $user->get('private_data')->getPassword(), true, true);
             }
             // User has signed in, and is now correctly in symfony session. However, forums
             // and several personnalization functions rely on cookies, that will be sent with the request,
             // but are not yet 'available' from javascript if the value expired from previous sessions (they will be on next page)
             // easiest solution is to force the browser to reload the current page
             // we only do this for GET requests
             $request = $this->getContext()->getRequest();
             if ($request->getMethod() == sfRequest::GET) {
                 // symfony 1.0 getUriPrefix is not working well with https on haproxy
                 // it then tries to redirect to https://site.org:80, which is wrong
                 $proto = $request->isSecure() ? 'https' : 'http';
                 $request_uri = $proto . '://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
                 $this->getContext()->getController()->redirect($request_uri);
                 exit;
             }
         } else {
             // delete cookie value in client so that no more requests are made to the db
             sfContext::getInstance()->getResponse()->setCookie($cookie_name, '');
             // log this
             c2cTools::log('{rememberFilter} user has unknown remember key!');
             c2cActions::statsdIncrement('bad_remember_cookie', 'symfony.' . sfConfig::get('sf_environment') . '.users.');
         }
     }
     $filterChain->execute();
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:39,代码来源:rememberFilter.class.php


示例15: 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;
}
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:23,代码来源:SectionsHelper.php


示例16: 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) {
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:31,代码来源:viewSuccess.php


示例17: execute

 public function execute(&$value, &$error)
 {
     // whether the image was sent via plupload or not
     $plupload = (bool) (!$this->getContext()->getRequest()->getParameter('noplupload', false));
     // file upload check
     if ($value['error']) {
         // if plupload was used, most probably the resized image
         // was too big, so provide custom error message
         if ($plupload) {
             $error = $this->getParameter('upload_resize_error');
         } else {
             $error = $this->getParameter('upload_error');
         }
         return false;
     }
     $validation = sfConfig::get('app_images_validation');
     if ($value['size'] > $validation['weight']) {
         // same as above (in this case, max_file_size from php.ini is bigger than $validation['weight'])
         if ($plupload) {
             $error = $this->getParameter('weight_resize_error');
         } else {
             $error = $this->getParameter('weight_error');
         }
         return false;
     }
     // type check
     // with symfony 1.0, the type is the one given by the browser
     // we prefer to use or own mime type checker (this is what is done in further
     // versions of symfony, using system file check)
     $mime_type = c2cTools::getMimeType($value['tmp_name']);
     if (!in_array($mime_type, $validation['mime_types'])) {
         $error = $this->getParameter('type_error');
         return false;
     }
     if ($mime_type != 'image/svg+xml') {
         list($width, $height) = getimagesize($value['tmp_name']);
     } else {
         // are there any script?
         if (SVG::hasScript($value['tmp_name'])) {
             $error = $this->getParameter('svg_script_error');
             return false;
         }
         // dimensions
         $dimensions = SVG::getSize($value['tmp_name']);
         if ($dimensions === false) {
             $error = $this->getParameter('svg_error');
             return false;
         } else {
             list($width, $height) = $dimensions;
         }
     }
     // height/width check (max width not checked for SVG, it is automatically resized)
     if ($mime_type != 'image/svg+xml' && ($width > $validation['max_size']['width'] || $height > $validation['max_size']['height'])) {
         $error = $this->getParameter('max_dim_error');
         return false;
     }
     if ($width < $validation['min_size']['width'] || $height < $validation['min_size']['height']) {
         $error = $this->getParameter('min_dim_error');
         return false;
     }
     return true;
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:62,代码来源:myImageValidator.class.php


示例18: use_helper

<?php

use_helper('Language');
$module = $sf_context->getModuleName();
if (!$document->isArchive()) {
    ?>
    <div class="switch_lang">
        <div class="article_infos_titre">
        <?php 
    echo (c2cTools::mobileVersion() ? __('Switch lang short:') : __('Switch lang:')) . '</div>';
    echo language_select_list($module, $document->get('id'), $document->getCulture(), $sf_data->getRaw('languages'));
    // instead of $languages: XSS protection deactivation
    ?>
    </div>
<?php 
}
?>

<?php 
if ($document->isAvailable()) {
    ?>
    <div class="article_contenu">
        <?php 
    $i18n_args = array('document' => $document, 'needs_translation' => isset($needs_translation) ? $needs_translation : false, 'images' => isset($images) ? $images : null);
    if (isset($filter_image_type)) {
        $i18n_args['filter_image_type'] = $filter_image_type;
    }
    if (isset($associated_books)) {
        $i18n_args['associated_books'] = $associated_books;
        $i18n_args['main_id'] = $document->get('id');
    }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:31,代码来源:_i18n_section.php


示例19: button_next

function button_next($module, $current_id)
{
    $modname = strtolower(c2cTools::module2model($module));
    return link_to(__("next {$modname}"), "@goto_next?module={$module}&id={$current_id}", array('title' => __("Go to next {$modname}"), 'class' => 'action_next nav_edit'));
}
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:5,代码来源:ButtonHelper.php


示例20: use_helper

<?php

use_helper('Pagination', 'GeoJson');
$id = $sf_params->get('id');
$lang = $sf_params->get('lang');
$module = $sf_context->getModuleName();
$format = $sf_data->getRaw('format');
$use_keys = in_array('keys', $format);
$text_html = in_array('html', $format);
$add_gpx_track = in_array('track', $format);
$add_all_fields = in_array('full', $format);
$add_conditions = $add_all_fields || in_array('cond', $format);
$add_text = !in_array('notext', $format);
if (!isset($items) && $nb_results > 0) {
    $items = $pager->getResults('array', ESC_RAW);
    $items = Language::parseListItems($items, c2cTools::module2model($module));
} elseif ($nb_results == 0) {
    $items = array();
    $totalItems = $startIndex = $count = $hasPreviousPage = $hasNextPage = 0;
}
if (isset($pager)) {
    $totalItems = $pager->getNbResults();
    $startIndex = $pager->getMaxPerPage() * ($pager->getPage() - 1) + 1;
    $count = min($pager->getMaxPerPage(), $pager->getNbResults() - ($pager->getPage() - 1) * $pager->getMaxPerPage());
    $hasPreviousPage = $pager->getPage() != 1;
    $hasNextPage = $pager->getPage() != $pager->getLastPage() && $nb_results;
}
// compute prev and next uris
if ($hasPreviousPage || $hasNextPage) {
    $uri = _addUrlParameters(_getBaseUri(), array('page'));
    $uri .= _getSeparator($uri) . 'page=';
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:31,代码来源:jsonlistSuccess.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP cAdvancedSecurity类代码示例发布时间:2022-05-23
下一篇:
PHP c类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap