本文整理汇总了PHP中Journal2Utils::getProductGridClasses方法的典型用法代码示例。如果您正苦于以下问题:PHP Journal2Utils::getProductGridClasses方法的具体用法?PHP Journal2Utils::getProductGridClasses怎么用?PHP Journal2Utils::getProductGridClasses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Journal2Utils
的用法示例。
在下文中一共展示了Journal2Utils::getProductGridClasses方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
//.........这里部分代码省略.........
}
}
if (Journal2Utils::getProperty($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, 'enable_on_desktop', '1') == '0') {
if ($device === 'desktop') {
return;
} else {
$this->data['disable_on_classes'][] = 'hide-on-desktop';
}
}
}
$this->data['css'] = '';
/* 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_cms_blocks_' . $setting['module_id'], implode('; ', $css));
$this->journal2->settings->set('module_journal2_cms_blocks_' . $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_cms_blocks_{$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'), '');
/* 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;
}
$css = array();
if (Journal2Utils::getColor(Journal2Utils::getProperty($section, 'icon_bg_color.value.color'))) {
$css[] = 'background-color: ' . Journal2Utils::getColor(Journal2Utils::getProperty($section, 'icon_bg_color.value.color'));
}
if (Journal2Utils::getProperty($section, 'icon_width')) {
$css[] = 'width: ' . Journal2Utils::getProperty($section, 'icon_width') . 'px';
}
if (Journal2Utils::getProperty($section, 'icon_height')) {
$css[] = 'height: ' . Journal2Utils::getProperty($section, 'icon_height') . 'px';
$css[] = 'line-height: ' . Journal2Utils::getProperty($section, 'icon_height') . 'px';
}
if (Journal2Utils::getProperty($section, 'icon_border')) {
$css = array_merge($css, Journal2Utils::getBorderCssProperties(Journal2Utils::getProperty($section, 'icon_border')));
}
if ($color = Journal2Utils::getProperty($section, 'bg_color.value.color')) {
$color = 'background-color: ' . Journal2Utils::getColor($color);
} else {
$color = null;
}
$this->data['sections'][] = array('css' => $color, 'has_icon' => Journal2Utils::getProperty($section, 'icon_status'), 'icon_position' => Journal2Utils::getProperty($section, 'icon_position', 'top'), 'icon' => Journal2Utils::getIconOptions2(Journal2Utils::getProperty($section, 'icon')), 'icon_css' => implode('; ', $css), 'type' => 'html', 'title' => Journal2Utils::getProperty($section, 'section_title.value.' . $this->config->get('config_language_id'), ''), 'content_align' => Journal2Utils::getProperty($section, 'text_align', 'left'), 'content' => Journal2Utils::getProperty($section, 'text.' . $this->config->get('config_language_id'), 'Not Translated'));
}
/* grid classes */
if (in_array($setting['position'], array('column_left', 'column_right'))) {
$this->data['grid_classes'] = 'xs-100 sm-100 md-100 lg-100 xl-100';
} else {
$columns = in_array($setting['position'], array('top', 'bottom')) ? 0 : $this->journal2->settings->get('config_columns_count', 0);
$this->data['grid_classes'] = Journal2Utils::getProductGridClasses(Journal2Utils::getProperty($module_data, 'items_per_row.value'), $this->journal2->settings->get('site_width', 1024), $columns);
}
$this->template = $this->config->get('config_template') . '/template/journal2/module/cms_blocks.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;
}
示例2: index
//.........这里部分代码省略.........
} 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':
case 'views':
$posts = $this->model_journal2_blog->getPosts(array('sort' => $module_type, 'start' => 0, 'limit' => $limit));
break;
case 'related':
if (isset($this->request->get['route']) && $this->request->get['route'] === 'product/product' && isset($this->request->get['product_id'])) {
$posts = $this->model_journal2_blog->getRelatedPosts($this->request->get['product_id'], $limit);
}
break;
case 'custom':
$custom_posts = Journal2Utils::getProperty($module_data, 'module_data.posts', array());
$custom_posts_ids = array();
foreach ($custom_posts as $custom_post) {
$post_id = (int) Journal2Utils::getProperty($custom_post, 'data.id', 0);
if ($post_id) {
$custom_posts_ids[$post_id] = $post_id;
}
}
if ($custom_posts_ids) {
$posts = $this->model_journal2_blog->getPosts(array('post_ids' => implode(',', $custom_posts_ids)));
}
break;
}
if (!$posts) {
return;
}
if (in_array($setting['position'], array('column_left', 'column_right'))) {
$this->data['is_column'] = true;
$this->data['grid_classes'] = 'xs-100 sm-100 md-100 lg-100 xl-100';
} else {
$this->data['is_column'] = false;
$columns = in_array($setting['position'], array('top', 'bottom')) ? 0 : $this->journal2->settings->get('config_columns_count', 0);
$this->data['grid_classes'] = Journal2Utils::getProductGridClasses(Journal2Utils::getProperty($module_data, 'module_data.items_per_row.value'), $this->journal2->settings->get('site_width', 1024), $columns);
}
$this->data['image_width'] = Journal2Utils::getProperty($module_data, 'module_data.image_width', 50);
$this->data['image_height'] = Journal2Utils::getProperty($module_data, 'module_data.image_height', 50);
$this->data['image_resize_type'] = Journal2Utils::getProperty($module_data, 'module_data.image_type', 'fit');
$this->data['show_description'] = Journal2Utils::getProperty($module_data, 'module_data.description', '1');
$char_limit = Journal2Utils::getProperty($module_data, 'module_data.description_limit', 150);
$this->data['posts'] = array();
foreach ($posts as $post) {
$this->data['posts'][] = array('name' => $post['name'], 'author' => $this->model_journal2_blog->getAuthorName($post), 'comments' => $post['comments'], 'description' => $this->data['show_description'] ? utf8_substr(strip_tags(html_entity_decode($post['description'], ENT_QUOTES, 'UTF-8')), 0, $char_limit) . '...' : false, 'date' => date($this->language->get('date_format_short'), strtotime($post['date'])), 'image' => Journal2Utils::resizeImage($this->model_tool_image, $post['image'] ? $post['image'] : 'data/journal2/no_image_large.jpg', $this->data['image_width'], $this->data['image_height'], $this->data['image_resize_type']), 'href' => $this->url->link('journal2/blog/post', 'journal_blog_post_id=' . $post['post_id']));
}
$this->template = $this->config->get('config_template') . '/template/journal2/module/blog_posts.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;
}
示例3: post
public function post()
{
$this->data['breadcrumbs'] = array();
$this->data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home'), 'separator' => false);
$this->data['breadcrumbs'][] = array('text' => $this->blog_title, 'href' => $this->url->link('journal2/blog'), 'separator' => $this->language->get('text_separator'));
if (isset($this->request->get['journal_blog_category_id'])) {
$category_id = $this->request->get['journal_blog_category_id'];
} else {
$category_id = 0;
}
$category_info = $this->model_journal2_blog->getCategory($category_id);
if ($category_info) {
$this->data['breadcrumbs'][] = array('text' => $category_info['name'], 'href' => $this->url->link('journal2/blog', 'journal_blog_category_id=' . $category_id), 'separator' => $this->language->get('text_separator'));
}
if (isset($this->request->get['journal_blog_post_id'])) {
$post_id = $this->request->get['journal_blog_post_id'];
} else {
$post_id = 0;
}
$post_info = $this->model_journal2_blog->getPost($post_id);
if ($post_info) {
$this->data['breadcrumbs'][] = array('text' => $post_info['name'], 'href' => $this->url->link('journal2/blog/post', ($category_info ? 'journal_blog_category_id=' . $category_id . '&' : '') . 'journal_blog_post_id=' . $post_info['post_id']), 'separator' => $this->language->get('text_separator'));
$this->data['text_tags'] = $this->language->get('text_tags');
$this->data['tab_related'] = $this->language->get(Front::$IS_OC2 ? 'text_related' : 'tab_related');
$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');
$this->blog_title = $post_info['name'];
$this->blog_heading_title = $post_info['name'];
$this->blog_meta_title = $post_info['meta_title'];
$this->blog_meta_description = $post_info['meta_description'];
$this->blog_meta_keywords = $post_info['meta_keywords'];
$this->data['post_id'] = $post_info['post_id'];
$this->data['post_author'] = $this->model_journal2_blog->getAuthorName($post_info);
$this->data['post_date'] = $post_info['date_created'];
$this->data['post_content'] = $post_info['description'];
$this->data['default_author_image'] = Journal2Utils::resizeImage($this->model_tool_image, 'data/journal2/misc/avatar.png', 70, 70);
$this->data['post_tags'] = array();
foreach (explode(',', $post_info['tags']) as $tag) {
$tag = trim($tag);
if (!$tag) {
continue;
}
$this->data['post_tags'][] = array('href' => $this->url->link('journal2/blog', 'journal_blog_tag=' . $tag), 'name' => $tag);
}
$results = $this->model_journal2_blog->getCategoriesByPostId($post_id);
$this->data['post_categories'] = array();
foreach ($results as $result) {
$this->data['post_categories'][] = array('href' => $this->url->link('journal2/blog', 'journal_blog_category_id=' . $result['category_id']), 'name' => $result['name']);
}
$this->data['grid_classes'] = Journal2Utils::getProductGridClasses($this->journal2->settings->get('config_blog_settings.related_products_per_row.value'), $this->journal2->settings->get('site_width', 1024), $this->journal2->settings->get('config_columns_count', 0));
$this->data['carousel'] = $this->journal2->settings->get('config_blog_settings.related_products_carousel');
$this->data['related_products'] = array();
if ($this->journal2->settings->get('config_blog_settings.related_products', '1')) {
$results = $this->model_journal2_blog->getRelatedProducts($post_id);
foreach ($results as $result) {
$image = Journal2Utils::resizeImage($this->model_tool_image, $result['image'], $this->config->get('config_image_related_width'), $this->config->get('config_image_related_height'), 'fit');
if ($this->config->get('config_customer_price') && $this->customer->isLogged() || !$this->config->get('config_customer_price')) {
$price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
} else {
$price = false;
}
if ((double) $result['special']) {
$special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')));
} else {
$special = false;
}
if ($this->config->get('config_review_status')) {
$rating = (int) $result['rating'];
} else {
$rating = false;
}
$date_end = false;
if (strpos($this->config->get('config_template'), 'journal2') === 0 && $special && $this->journal2->settings->get('show_countdown', 'never') !== 'never') {
$this->load->model('journal2/product');
$date_end = $this->model_journal2_product->getSpecialCountdown($result['product_id']);
if ($date_end === '0000-00-00') {
$date_end = false;
}
}
$additional_images = $this->model_catalog_product->getProductImages($result['product_id']);
$image2 = false;
if (count($additional_images) > 0) {
$image2 = $this->model_tool_image->resize($additional_images[0]['image'], $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'));
}
$this->data['related_products'][] = array('product_id' => $result['product_id'], 'thumb' => $image, 'thumb2' => $image2, 'labels' => $this->model_journal2_product->getLabels($result['product_id']), 'date_end' => $date_end, 'name' => $result['name'], 'price' => $price, 'special' => $special, 'rating' => $rating, 'reviews' => sprintf($this->language->get('text_reviews'), (int) $result['reviews']), 'href' => $this->url->link('product/product', 'product_id=' . $result['product_id']));
}
}
$this->data['allow_comments'] = $this->model_journal2_blog->getCommentsStatus($post_id);
$this->data['comments'] = $this->model_journal2_blog->getComments($post_id);
/* default comment fields */
if (version_compare(VERSION, '2.1', '<')) {
$this->load->library('user');
}
if ($this->customer->isLogged()) {
$this->load->model('account/customer');
$customer_info = $this->model_account_customer->getCustomer($this->customer->getId());
$this->data['default_name'] = trim($customer_info['firstname'] . ' ' . $customer_info['lastname']);
$this->data['default_email'] = $customer_info['email'];
} else {
//.........这里部分代码省略.........
示例4: generateMenuItem
//.........这里部分代码省略.........
case 'popup':
$menu['name'] = Journal2Utils::getProperty($menu_item, 'custom.menu_item.name.value.' . $this->config->get('config_language_id'), 'Not Translated');
$menu['href'] = "javascript:Journal.openPopup('" . Journal2Utils::getProperty($menu_item, 'custom.top.menu_item') . "')";
$menu['subcategories'] = $this->generateMenu(Journal2Utils::getProperty($menu_item, 'custom.items', array()));
break;
case 'blog_home':
$menu['name'] = $this->journal2->settings->get('config_blog_settings.title.value.' . $this->config->get('config_language_id'), 'Journal Blog');
$menu['href'] = $this->url->link('journal2/blog');
$menu['subcategories'] = $this->generateMenu(Journal2Utils::getProperty($menu_item, 'custom.items', array()));
break;
case 'blog_category':
$category_info = $this->model_journal2_blog->getCategory(Journal2Utils::getProperty($menu_item, 'custom.top.menu_item.id', -1));
if (!$category_info) {
continue;
}
$menu['name'] = $category_info['name'];
$menu['href'] = $this->url->link('journal2/blog', 'journal_blog_category_id=' . $category_info['category_id']);
$menu['subcategories'] = $this->generateMenu(Journal2Utils::getProperty($menu_item, 'custom.items', array()));
break;
case 'blog_post':
$post_info = $this->model_journal2_blog->getPost(Journal2Utils::getProperty($menu_item, 'custom.top.menu_item.id', -1));
if (!$post_info) {
continue;
}
$menu['name'] = $post_info['name'];
$menu['href'] = $this->url->link('journal2/blog/post', 'journal_blog_post_id=' . $post_info['post_id']);
$menu['subcategories'] = $this->generateMenu(Journal2Utils::getProperty($menu_item, 'custom.items', array()));
break;
case 'custom':
$menu['name'] = Journal2Utils::getProperty($menu_item, 'name.value.' . $this->config->get('config_language_id'), 'Not Translated');
$menu['href'] = Journal2Utils::getProperty($menu_item, 'custom.top.menu_item.url');
$menu['subcategories'] = $this->generateMenu(Journal2Utils::getProperty($menu_item, 'custom.items', array()));
break;
}
if ($name_overwrite = Journal2Utils::getProperty($menu_item, 'name.value.' . $this->config->get('config_language_id'))) {
$menu['name'] = $name_overwrite;
}
break;
/* html */
/* html */
case 'html':
$menu['type'] = 'mega-menu-html';
$menu['name'] = Journal2Utils::getProperty($menu_item, 'html.' . $this->config->get('config_language_id'));
$menu['html_blocks'] = array();
$menu['href'] = $this->model_journal2_menu->getLink(Journal2Utils::getProperty($menu_item, 'html_menu_link'));
foreach (Journal2Utils::sortArray(Journal2Utils::getProperty($menu_item, 'html_blocks', array())) as $block) {
if (!Journal2Utils::getProperty($block, 'status')) {
continue;
}
$menu['html_blocks'][] = array('title' => Journal2Utils::getProperty($block, 'title.value.' . $this->config->get('config_language_id'), ''), 'text' => Journal2Utils::getProperty($block, 'text.' . $this->config->get('config_language_id')), 'link' => $this->model_journal2_menu->getLink(Journal2Utils::getProperty($block, 'link')));
}
break;
/* mixed */
/* mixed */
case 'mixed':
$menu['type'] = 'mega-menu-mixed';
$menu['name'] = Journal2Utils::getProperty($menu_item, 'name.value.' . $this->config->get('config_language_id'));
$menu['html_blocks'] = array();
$menu['href'] = $this->model_journal2_menu->getLink(Journal2Utils::getProperty($menu_item, 'html_menu_link'));
$columns = Journal2Utils::getProperty($menu_item, 'mixed_columns', array());
$columns = Journal2Utils::sortArray($columns);
foreach ($columns as $column) {
$image_width = Journal2Utils::getProperty($column, 'image_width', 250);
$image_height = Journal2Utils::getProperty($column, 'image_height', 250);
$image_resize_type = Journal2Utils::getProperty($column, 'image_type', 'fit');
if (!Journal2Utils::getProperty($column, 'status', 1)) {
continue;
}
$class = Journal2Utils::getProperty($column, 'hide_on_mobile') ? 'hide-on-mobile' : '';
if ($class === 'hide-on-mobile' && (Journal2Cache::$mobile_detect->isMobile() || Journal2Cache::$mobile_detect->isTablet()) && $this->journal2->settings->get('responsive_design')) {
continue;
}
if (Journal2Utils::getProperty($column, 'hide_on_desktop', '0') === '1' && !Journal2Cache::$mobile_detect->isMobile()) {
continue;
}
$cms_blocks = array('top' => array(), 'bottom' => array());
foreach (Journal2Utils::getProperty($column, 'cms_blocks', array()) as $cms_block) {
if (!$cms_block['status']) {
return;
}
$cms_blocks[Journal2Utils::getProperty($cms_block, 'position', 'top')][] = array('content' => Journal2Utils::getProperty($cms_block, 'content.' . $this->config->get('config_language_id')), 'sort_order' => Journal2Utils::getProperty($cms_block, 'sort_order'));
}
$column_menu = array('top_cms_blocks' => Journal2Utils::sortArray($cms_blocks['top']), 'bottom_cms_blocks' => Journal2Utils::sortArray($cms_blocks['bottom']), 'name' => '', 'href' => '', 'items' => array(), 'type' => '', 'class' => $class, 'width' => Journal2Utils::getProperty($column, 'width', '25') . '%', 'classes' => Journal2Utils::getProductGridClasses(Journal2Utils::getProperty($column, 'items_per_row.value'), $this->journal2->settings->get('site_width', 1024)), 'limit' => Journal2Utils::getProperty($column, 'items_limit', 0), 'icon' => Journal2Utils::getIconOptions2(Journal2Utils::getProperty($menu_item, 'icon')), 'hide_text' => Journal2Utils::getProperty($menu_item, 'hide_text'));
$this->generateMenuItem($column_menu, $column, $image_width, $image_height, $image_resize_type);
$name_overwrite = Journal2Utils::getProperty($column, 'name.value.' . $this->config->get('config_language_id'));
if ($name_overwrite) {
$column_menu['name'] = $name_overwrite;
}
$menu['mixed_columns'][] = $column_menu;
}
break;
/* html block */
/* html block */
case 'html-block':
$menu['type'] = 'mega-menu-html-block';
$menu['name'] = Journal2Utils::getProperty($menu_item, 'html.' . $this->config->get('config_language_id'));
$menu['html_text'] = Journal2Utils::getProperty($menu_item, 'html_text.' . $this->config->get('config_language_id'));
break;
}
}
示例5: 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;
}
if (Journal2Cache::$mobile_detect->isMobile() && !Journal2Cache::$mobile_detect->isTablet() && $this->journal2->settings->get('responsive_design')) {
return;
}
$hash = isset($this->request->server['REQUEST_URI']) ? md5($this->request->server['REQUEST_URI']) : null;
$cache_property = "module_journal_blog_side_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'), 'Not Translated');
$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':
case 'views':
$posts = $this->model_journal2_blog->getPosts(array('sort' => $module_type, 'start' => 0, 'limit' => $limit));
break;
case 'related':
if (isset($this->request->get['route']) && $this->request->get['route'] === 'product/product' && isset($this->request->get['product_id'])) {
$posts = $this->model_journal2_blog->getRelatedPosts($this->request->get['product_id'], $limit);
}
break;
case 'custom':
$custom_posts = Journal2Utils::getProperty($module_data, 'module_data.posts', array());
$custom_posts_ids = array();
foreach ($custom_posts as $custom_post) {
$post_id = (int) Journal2Utils::getProperty($custom_post, 'data.id', 0);
if ($post_id) {
$custom_posts_ids[$post_id] = $post_id;
}
}
if ($custom_posts_ids) {
$posts = $this->model_journal2_blog->getPosts(array('post_ids' => implode(',', $custom_posts_ids)));
}
break;
}
if (!$posts) {
return;
}
if (in_array($setting['position'], array('column_left', 'column_right'))) {
$this->data['is_column'] = true;
$this->data['grid_classes'] = 'xs-100 sm-100 md-100 lg-100 xl-100';
} else {
$this->data['is_column'] = false;
$columns = in_array($setting['position'], array('top', 'bottom')) ? 0 : $this->journal2->settings->get('config_columns_count', 0);
$this->data['grid_classes'] = Journal2Utils::getProductGridClasses(Journal2Utils::getProperty($module_data, 'items_per_row.value'), $this->journal2->settings->get('site_width', 1024), $columns);
}
$this->data['image_width'] = $this->journal2->settings->get('side_post_image_width', 55);
$this->data['image_height'] = $this->journal2->settings->get('side_post_image_height', 55);
$this->data['posts'] = array();
foreach ($posts as $post) {
$this->data['posts'][] = array('name' => $post['name'], 'comments' => $post['comments'], 'date' => date($this->language->get('date_format_short'), strtotime($post['date'])), 'image' => Journal2Utils::resizeImage($this->model_tool_image, $post, $this->data['image_width'], $this->data['image_height'], 'crop'), 'href' => $this->url->link('journal2/blog/post', 'journal_blog_post_id=' . $post['post_id']));
}
$this->template = $this->config->get('config_template') . '/template/journal2/module/blog_side_posts.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;
}
示例6: index
//.........这里部分代码省略.........
$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_custom_sections_' . $setting['module_id'], implode('; ', $css));
$this->journal2->settings->set('module_journal2_custom_sections_' . $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_custom_sections_{$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();
/* set global module properties */
$this->data['module'] = $module;
$this->data['show_title'] = Journal2Utils::getProperty($module_data, 'show_title');
$this->data['show_title_class'] = $this->data['show_title'] ? '' : 'no-heading';
$this->data['brand_name'] = Journal2Utils::getProperty($module_data, 'brand_name');
$this->data['module_type'] = Journal2Utils::getProperty($module_data, 'module_type');
$this->data['render_as'] = Journal2Utils::getProperty($module_data, 'display_as');
$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-section' : '';
$this->data['grid_classes'] = Journal2Utils::getProductGridClasses(Journal2Utils::getProperty($module_data, 'items_per_row.value'), $this->journal2->settings->get('site_width', 1024), $columns);
$this->template = $this->config->get('config_template') . "/template/journal2/module/custom_sections_{$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;
}
$this->document->addScript('catalog/view/theme/journal2/lib/isotope/jquery.isotope.min.js');
$this->document->addScript('catalog/view/theme/journal2/lib/isotope/jquery.isotope.sloppy-masonry.min.js');
if ($this->journal2->html_classes->hasClass('mobile')) {
$this->document->addScript('catalog/view/theme/journal2/lib/lazy/jquery.lazy.1.6.min.js');
}
$output = $this->render();
Journal2::stopTimer(get_class($this));
return $output;
}
示例7: 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;
}
示例8: columns
public function columns()
{
$cols = 0;
if ($this->journal2->page->hasModules('column_left')) {
$cols++;
}
if ($this->journal2->page->hasModules('column_right')) {
$cols++;
}
if ($cols == 1) {
$this->journal2->html_classes->addClass('one-column');
}
if ($cols == 2) {
$this->journal2->html_classes->addClass('two-columns');
}
$this->journal2->settings->set('config_columns_count', $cols);
$this->journal2->settings->set('product_grid_classes', Journal2Utils::getProductGridClasses($this->journal2->settings->get('category_page_products_per_row'), $this->journal2->settings->get('site_width', 1024), $cols));
if (!$this->journal2->settings->get('related_products_carousel')) {
$this->journal2->settings->set('related_products_grid_classes', Journal2Utils::getProductGridClasses($this->journal2->settings->get('related_products_items_per_row'), $this->journal2->settings->get('site_width', 1024), $cols));
}
// product views
if ($this->journal2->page->getType() === 'product' || $this->journal2->page->getType() === 'quickview') {
$this->load->model('journal2/product');
if ($this->journal2->settings->get('product_page_options_views')) {
$this->journal2->settings->set('product_views', $this->model_journal2_product->getProductViews($this->journal2->page->getId()));
}
if ($this->journal2->settings->get('product_page_options_sold')) {
$text = $this->journal2->settings->get('product_page_options_sold_text', ' Product(s) Sold');
$count = '<span>' . $this->model_journal2_product->getProductSoldCount($this->journal2->page->getId()) . '</span>';
if (strpos($text, '%s') !== FALSE) {
$text = sprintf($text, $count);
} else {
$text = $count . $text;
}
$this->journal2->settings->set('product_sold', $text);
}
}
}
示例9: index
public function index($setting)
{
if (!defined('JOURNAL_INSTALLED')) {
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;
}
$module_data = $module_data['module_data'];
/* device detection */
$this->data['disable_on_classes'] = array();
if ($this->journal2->settings->get('responsive_design')) {
$device = Journal2Utils::getDevice();
if (Journal2Utils::getProperty($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, 'enable_on_tablet', '1') == '0') {
if ($device === 'tablet') {
return;
} else {
$this->data['disable_on_classes'][] = 'hide-on-tablet';
}
}
if (Journal2Utils::getProperty($module_data, 'enable_on_desktop', '1') == '0') {
if ($device === 'desktop') {
return;
} else {
$this->data['disable_on_classes'][] = 'hide-on-desktop';
}
}
}
$this->data['css'] = '';
/* 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_photo_gallery_' . $setting['module_id'], implode('; ', $css));
$this->journal2->settings->set('module_journal2_photo_gallery_' . $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';
}
$this->data['css'] = implode('; ', $css);
}
$cache_property = "module_journal_photo_gallery_{$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, 'gallery_name.value.' . $this->config->get('config_language_id'), '');
/* image border */
$this->data['image_border'] = implode('; ', Journal2Utils::getBorderCssProperties(Journal2Utils::getProperty($module_data, 'image_border')));
/* grid */
$this->data['is_column'] = in_array($setting['position'], array('column_left', 'column_right'));
if (in_array($setting['position'], array('column_left', 'column_right'))) {
$this->data['grid_classes'] = 'xs-33 sm-33 md-33 lg-33 xl-33';
} else {
$columns = in_array($setting['position'], array('top', 'bottom')) ? 0 : $this->journal2->settings->get('config_columns_count', 0);
$this->data['grid_classes'] = Journal2Utils::getProductGridClasses(Journal2Utils::getProperty($module_data, 'items_per_row.value'), $this->journal2->settings->get('site_width', 1024), $columns);
}
/* carousel */
$this->data['carousel'] = in_array($setting['position'], array('column_left', 'column_right')) ? false : Journal2Utils::getProperty($module_data, 'carousel');
if ($this->data['carousel']) {
$this->data['items_per_row'] = Journal2Utils::getProperty($module_data, 'items_per_row.value');
$this->data['arrows'] = Journal2Utils::getProperty($module_data, 'carousel_arrows');
$this->data['bullets'] = Journal2Utils::getProperty($module_data, 'carousel_bullets');
if (Journal2Utils::getProperty($module_data, 'autoplay')) {
$this->data['autoplay'] = 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');
}
/* sort images */
$images = Journal2Utils::getProperty($module_data, 'images', array());
$images = Journal2Utils::sortArray($images);
/* generate images */
$this->data['thumbs_limit'] = Journal2Utils::getProperty($module_data, 'thumbs_limit', PHP_INT_MAX);
$this->data['thumbs_width'] = Journal2Utils::getProperty($module_data, 'thumbs_width', 200);
$this->data['thumbs_height'] = Journal2Utils::getProperty($module_data, 'thumbs_height', 200);
$this->data['thumbs_type'] = Journal2Utils::getProperty($module_data, 'thumbs_type', 'crop');
$this->data['images'] = array();
//.........这里部分代码省略.........