当前位置: 首页>>代码示例>>PHP>>正文


PHP Journal2Utils::getItemGrid方法代码示例

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


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

示例1: index


//.........这里部分代码省略.........
             $css[] = 'max-width: ' . $this->journal2->settings->get('site_width', 1024) . 'px';
             $css = array_merge($css, Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'module_background')));
             if (Journal2Utils::getProperty($module_data, 'module_padding')) {
                 $this->data['gutter_on_class'] = 'gutter-on';
                 $css[] = 'padding: 20px';
             }
         }
         $this->data['css'] = implode('; ', $css);
     }
     $cache_property = "module_journal_carousel_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}" . $this->journal2->cache->getRouteCacheKey();
     $cache = $this->journal2->cache->get($cache_property);
     if ($cache === null || self::$CACHEABLE !== true) {
         $module = mt_rand();
         $this->data['hide_on_mobile_class'] = Journal2Utils::getProperty($module_data, 'disable_mobile') ? 'hide-on-mobile' : '';
         /* set global module properties */
         $this->data['module'] = $module;
         $this->data['show_title'] = Journal2Utils::getProperty($module_data, 'show_title');
         $this->data['brand_name'] = Journal2Utils::getProperty($module_data, 'brand_name');
         $this->data['module_type'] = Journal2Utils::getProperty($module_data, 'module_type');
         $this->data['arrows'] = Journal2Utils::getProperty($module_data, 'arrows', 'top');
         $this->data['bullets'] = Journal2Utils::getProperty($module_data, 'bullets');
         $this->data['render_as'] = Journal2Utils::getProperty($module_data, 'display_as');
         if (Journal2Utils::getProperty($module_data, 'autoplay')) {
             $this->data['autoplay'] = (int) Journal2Utils::getProperty($module_data, 'transition_delay', 3000);
         } else {
             $this->data['autoplay'] = false;
         }
         $this->data['slide_speed'] = (int) Journal2Utils::getProperty($module_data, 'transition_speed', 400);
         $this->data['pause_on_hover'] = Journal2Utils::getProperty($module_data, 'pause_on_hover');
         $this->data['touch_drag'] = Journal2Utils::getProperty($module_data, 'touch_drag');
         $this->data['default_section'] = '';
         /* generate sections */
         $this->data['sections'] = array();
         $this->data['items'] = array();
         /* image dimensions */
         $this->data['image_width'] = Journal2Utils::getProperty($module_data, 'image_width', $this->config->get('config_image_product_width'));
         $this->data['image_height'] = Journal2Utils::getProperty($module_data, 'image_height', $height = $this->config->get('config_image_product_height'));
         $this->data['image_resize_type'] = Journal2Utils::getProperty($module_data, 'image_type', 'fit');
         $this->data['dummy_image'] = $this->model_tool_image->resize('data/journal2/transparent.png', $this->data['image_width'], $this->data['image_height']);
         /* image border */
         if (Journal2Utils::getProperty($module_data, 'image_border')) {
             $this->data['image_border_css'] = implode('; ', Journal2Utils::getBorderCssProperties(Journal2Utils::getProperty($module_data, 'image_border')));
         } else {
             $this->data['image_border_css'] = null;
         }
         /* image background color */
         if (Journal2Utils::getProperty($module_data, 'image_bgcolor.value.color')) {
             $this->data['image_bgcolor'] = 'background-color: ' . Journal2Utils::getColor(Journal2Utils::getProperty($module_data, 'image_bgcolor.value.color'));
         } else {
             $this->data['image_bgcolor'] = null;
         }
         switch ($this->data['module_type']) {
             case 'product':
                 $sections = Journal2Utils::getProperty($module_data, 'product_sections', array());
                 $sections = Journal2Utils::sortArray($sections);
                 $this->generateProductSections($sections);
                 $this->data['text_tax'] = $this->language->get('text_tax');
                 $this->data['button_cart'] = $this->language->get('button_cart');
                 $this->data['button_wishlist'] = $this->language->get('button_wishlist');
                 $this->data['button_compare'] = $this->language->get('button_compare');
                 break;
             case 'category':
                 $sections = Journal2Utils::getProperty($module_data, 'category_sections', array());
                 $sections = Journal2Utils::sortArray($sections);
                 $this->generateCategorySections($sections);
                 break;
             case 'manufacturer':
                 $sections = Journal2Utils::getProperty($module_data, 'manufacturer_sections', array());
                 $sections = Journal2Utils::sortArray($sections);
                 $this->generateManufacturerSections($sections);
                 break;
         }
         if (!$this->has_items) {
             return;
         }
         $columns = in_array($setting['position'], array('top', 'bottom')) ? 0 : $this->journal2->settings->get('config_columns_count', 0);
         $this->data['single_class'] = count($this->data['sections']) == 1 ? 'single-tab' : '';
         if (in_array($setting['position'], array('column_left', 'column_right'))) {
             $this->data['grid'] = array(array(0, 1), array(470, 1), array(760, 1), array(980, 1), array(1100, 1));
         } else {
             $grid = Journal2Utils::getItemGrid(Journal2Utils::getProperty($module_data, 'items_per_row.value'), $this->journal2->settings->get('site_width', 1024), $columns);
             $this->data['grid'] = array(array(0, (int) $grid['xs']), array(470, (int) $grid['sm']), array(760, (int) $grid['md']), array(980, (int) $grid['lg']), array(1100, (int) $grid['xl']));
         }
         if (count($this->data['sections']) > 1) {
             $this->data['show_title'] = 1;
         }
         $this->data['show_title_class'] = $this->data['show_title'] ? '' : 'no-heading';
         $this->template = $this->config->get('config_template') . "/template/journal2/module/carousel_{$this->data['module_type']}.tpl";
         if (self::$CACHEABLE === true && !$this->has_random_products) {
             $html = Minify_HTML::minify($this->render(), array('xhtml' => false, 'jsMinifier' => 'j2_js_minify'));
             $this->journal2->cache->set($cache_property, $html);
         }
     } else {
         $this->template = $this->config->get('config_template') . '/template/journal2/cache/cache.tpl';
         $this->data['cache'] = $cache;
     }
     $output = $this->render();
     Journal2::stopTimer(get_class($this));
     return $output;
 }
开发者ID:deepakdesai,项目名称:CressoyoWebApp,代码行数:101,代码来源:journal2_carousel.php

示例2: index

 public function index($setting)
 {
     if (!defined('JOURNAL_INSTALLED')) {
         return;
     }
     if (!$this->model_journal2_blog->isEnabled()) {
         return;
     }
     Journal2::startTimer(get_class($this));
     /* get module data from db */
     $module_data = $this->model_journal2_module->getModule($setting['module_id']);
     if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
         return;
     }
     /* device detection */
     $this->data['disable_on_classes'] = array();
     if ($this->journal2->settings->get('responsive_design')) {
         $device = Journal2Utils::getDevice();
         if (Journal2Utils::getProperty($module_data, 'module_data.enable_on_phone', '1') == '0') {
             if ($device === 'phone') {
                 return;
             } else {
                 $this->data['disable_on_classes'][] = 'hide-on-phone';
             }
         }
         if (Journal2Utils::getProperty($module_data, 'module_data.enable_on_tablet', '1') == '0') {
             if ($device === 'tablet') {
                 return;
             } else {
                 $this->data['disable_on_classes'][] = 'hide-on-tablet';
             }
         }
         if (Journal2Utils::getProperty($module_data, 'module_data.enable_on_desktop', '1') == '0') {
             if ($device === 'desktop') {
                 return;
             } else {
                 $this->data['disable_on_classes'][] = 'hide-on-desktop';
             }
         }
     }
     $hash = isset($this->request->server['REQUEST_URI']) ? md5($this->request->server['REQUEST_URI']) : null;
     if (in_array($setting['position'], array('top', 'bottom'))) {
         $padding = $this->journal2->settings->get('module_margins', 20) . 'px';
         /* outer */
         $css = Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'module_data.background'));
         $css[] = 'padding-top: ' . Journal2Utils::getProperty($module_data, 'module_data.margin_top', 0) . 'px';
         $css[] = 'padding-bottom: ' . Journal2Utils::getProperty($module_data, 'module_data.margin_bottom', 0) . 'px';
         $this->journal2->settings->set('module_journal2_blog_posts_' . $setting['module_id'], implode('; ', $css));
         $this->journal2->settings->set('module_journal2_blog_posts_' . $setting['module_id'] . '_classes', implode(' ', $this->data['disable_on_classes']));
         /* inner css */
         $css = array();
         if (Journal2Utils::getProperty($module_data, 'module_data.fullwidth')) {
             $css[] = 'max-width: 100%';
             $css[] = 'padding-left: ' . $padding;
             $css[] = 'padding-right: ' . $padding;
         } else {
             $css[] = 'max-width: ' . $this->journal2->settings->get('site_width', 1024) . 'px';
             $css = array_merge($css, Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'module_data.module_background')));
             if (Journal2Utils::getProperty($module_data, 'module_data.module_padding')) {
                 $this->data['gutter_on_class'] = 'gutter-on';
                 $css[] = 'padding: 20px';
             }
         }
         $this->data['css'] = implode('; ', $css);
     }
     $cache_property = "module_journal_blog_posts_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}_{$hash}";
     $cache = $this->journal2->cache->get($cache_property);
     if ($cache === null || self::$CACHEABLE !== true || $hash === null) {
         $module = mt_rand();
         $this->data['module'] = $module;
         $this->data['heading_title'] = Journal2Utils::getProperty($module_data, 'module_data.title.value.' . $this->config->get('config_language_id'));
         $this->data['display'] = Journal2Utils::getProperty($module_data, 'module_data.display', 'grid');
         $this->data['content_align'] = Journal2Utils::getProperty($module_data, 'module_data.content_align', 'center');
         /* carousel */
         $this->data['carousel'] = Journal2Utils::getProperty($module_data, 'module_data.carousel');
         if ($this->data['carousel']) {
             $columns = in_array($setting['position'], array('top', 'bottom')) ? 0 : $this->journal2->settings->get('config_columns_count', 0);
             if ($this->data['display'] === 'list') {
                 $this->data['grid'] = array(array(0, 1), array(470, 1), array(760, 1), array(980, 1), array(1100, 1));
             } else {
                 $this->data['grid'] = Journal2Utils::getItemGrid(Journal2Utils::getProperty($module_data, 'module_data.items_per_row.value'), $this->journal2->settings->get('site_width', 1024), $columns);
                 $this->data['grid'] = array(array(0, (int) $this->data['grid']['xs']), array(470, (int) $this->data['grid']['sm']), array(760, (int) $this->data['grid']['md']), array(980, (int) $this->data['grid']['lg']), array(1100, (int) $this->data['grid']['xl']));
             }
             $this->data['arrows'] = Journal2Utils::getProperty($module_data, 'module_data.carousel_arrows');
             $this->data['bullets'] = Journal2Utils::getProperty($module_data, 'module_data.carousel_bullets');
             if (Journal2Utils::getProperty($module_data, 'module_data.autoplay')) {
                 $this->data['autoplay'] = Journal2Utils::getProperty($module_data, 'module_data.transition_delay', 3000);
             } else {
                 $this->data['autoplay'] = false;
             }
             $this->data['slide_speed'] = (int) Journal2Utils::getProperty($module_data, 'module_data.transition_speed', 400);
             $this->data['pause_on_hover'] = Journal2Utils::getProperty($module_data, 'module_data.pause_on_hover');
             $this->data['touch_drag'] = Journal2Utils::getProperty($module_data, 'module_data.touch_drag');
         }
         $module_type = Journal2Utils::getProperty($module_data, 'module_data.module_type', 'newest');
         $limit = Journal2Utils::getProperty($module_data, 'module_data.limit', 5);
         $posts = array();
         switch ($module_type) {
             case 'newest':
             case 'comments':
//.........这里部分代码省略.........
开发者ID:SwayWebStudio,项目名称:night.com,代码行数:101,代码来源:journal2_blog_posts.php

示例3: index


//.........这里部分代码省略.........
             if ($device === 'desktop') {
                 return;
             } else {
                 $this->data['disable_on_classes'][] = 'hide-on-desktop';
             }
         }
     }
     /* css for top / bottom positions */
     if (in_array($setting['position'], array('top', 'bottom'))) {
         $padding = $this->journal2->settings->get('module_margins', 20) . 'px';
         /* outer */
         $css = Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'background'));
         $css[] = 'padding-top: ' . Journal2Utils::getProperty($module_data, 'margin_top', 0) . 'px';
         $css[] = 'padding-bottom: ' . Journal2Utils::getProperty($module_data, 'margin_bottom', 0) . 'px';
         $this->journal2->settings->set('module_journal2_static_banners_' . $setting['module_id'], implode('; ', $css));
         $this->journal2->settings->set('module_journal2_static_banners_' . $setting['module_id'] . '_classes', implode(' ', $this->data['disable_on_classes']));
         /* inner css */
         $css = array();
         if (Journal2Utils::getProperty($module_data, 'fullwidth')) {
             $css[] = 'max-width: 100%';
             $css[] = 'padding-left: ' . $padding;
             $css[] = 'padding-right: ' . $padding;
         } else {
             $css[] = 'max-width: ' . $this->journal2->settings->get('site_width', 1024) . 'px';
             $css = array_merge($css, Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'module_background')));
             if (Journal2Utils::getProperty($module_data, 'module_padding')) {
                 $this->data['gutter_on_class'] = 'gutter-on';
                 $css[] = 'padding: 20px';
             }
         }
         $this->data['css'] = implode('; ', $css);
     }
     $cache_property = "module_journal_static_banners_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}";
     $cache = $this->journal2->cache->get($cache_property);
     if ($cache === null || self::$CACHEABLE !== true) {
         $module = mt_rand();
         /* set global module properties */
         $this->data['module'] = $module;
         $this->data['title'] = Journal2Utils::getProperty($module_data, 'module_title.value.' . $this->config->get('config_language_id'), '');
         /* icon */
         $this->data['icon'] = Journal2Utils::getIconOptions2(Journal2Utils::getProperty($module_data, 'icon'));
         /* bgcolor*/
         $this->data['bgcolor'] = Journal2Utils::getProperty($module_data, 'bgcolor.value.color');
         /* image border */
         $this->data['image_border'] = implode('; ', Journal2Utils::getBorderCssProperties(Journal2Utils::getProperty($module_data, 'image_border')));
         /* sort sections */
         $sections = Journal2Utils::getProperty($module_data, 'sections', array());
         $sections = Journal2Utils::sortArray($sections);
         /* generate sections */
         $this->data['sections'] = array();
         foreach ($sections as $section) {
             if (!$section['status']) {
                 continue;
             }
             $image = Journal2Utils::getProperty($section, 'image');
             if (is_array($image)) {
                 $image = Journal2Utils::getProperty($image, $this->config->get('config_language_id'));
             }
             if (!$image || !file_exists(DIR_IMAGE . $image)) {
                 $image = Front::$IS_OC2 ? 'no_image.png' : 'no_image.jpg';
             }
             list($width, $height) = getimagesize(DIR_IMAGE . $image);
             $this->data['sections'][] = array('type' => 'image', 'link' => $this->model_journal2_menu->getLink(Journal2Utils::getProperty($section, 'link')), 'target' => Journal2Utils::getProperty($section, 'link_new_window') ? 'target="_blank"' : '', 'image' => Journal2Utils::resizeImage($this->model_tool_image, $image), 'image_title' => Journal2Utils::getProperty($section, 'image_title.value.' . $this->config->get('config_language_id'), ''), 'image_width' => $width, 'image_height' => $height);
         }
         /* carousel mode */
         $this->data['carousel'] = Journal2Utils::getProperty($module_data, 'carousel', '0');
         if (Journal2Utils::getProperty($module_data, 'autoplay')) {
             $this->data['autoplay'] = (int) Journal2Utils::getProperty($module_data, 'transition_delay', 3000);
         } else {
             $this->data['autoplay'] = false;
         }
         $this->data['slide_speed'] = (int) Journal2Utils::getProperty($module_data, 'transition_speed', 400);
         $this->data['pause_on_hover'] = Journal2Utils::getProperty($module_data, 'pause_on_hover');
         $this->data['touch_drag'] = Journal2Utils::getProperty($module_data, 'touch_drag');
         $this->data['default_section'] = '';
         $this->data['arrows'] = Journal2Utils::getProperty($module_data, 'arrows');
         $this->data['bullets'] = Journal2Utils::getProperty($module_data, 'bullets');
         /* grid classes */
         if (in_array($setting['position'], array('column_left', 'column_right'))) {
             $this->data['grid_classes'] = $this->data['carousel'] ? '' : 'xs-100 sm-100 md-100 lg-100 xl-100';
             $this->data['grid'] = $this->data['carousel'] ? array(array(0, 1), array(470, 1), array(760, 1), array(980, 1), array(1100, 1)) : array();
         } else {
             $columns = in_array($setting['position'], array('top', 'bottom')) ? 0 : $this->journal2->settings->get('config_columns_count', 0);
             $this->data['grid_classes'] = $this->data['carousel'] ? '' : Journal2Utils::getProductGridClasses(Journal2Utils::getProperty($module_data, 'items_per_row.value'), $this->journal2->settings->get('site_width', 1024), $columns);
             $grid = Journal2Utils::getItemGrid(Journal2Utils::getProperty($module_data, 'items_per_row.value'), $this->journal2->settings->get('site_width', 1024), $columns);
             $this->data['grid'] = $this->data['carousel'] ? array(array(0, (int) $grid['xs']), array(470, (int) $grid['sm']), array(760, (int) $grid['md']), array(980, (int) $grid['lg']), array(1100, (int) $grid['xl'])) : array();
         }
         $this->template = $this->config->get('config_template') . '/template/journal2/module/static_banners.tpl';
         if (self::$CACHEABLE === true) {
             $html = Minify_HTML::minify($this->render(), array('xhtml' => false, 'jsMinifier' => 'j2_js_minify'));
             $this->journal2->cache->set($cache_property, $html);
         }
     } else {
         $this->template = $this->config->get('config_template') . '/template/journal2/cache/cache.tpl';
         $this->data['cache'] = $cache;
     }
     $output = $this->render();
     Journal2::stopTimer(get_class($this));
     return $output;
 }
开发者ID:SwayWebStudio,项目名称:night.com,代码行数:101,代码来源:journal2_static_banners.php


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