/** * main action */ public function mainAction() { /** * initialise node and get detail */ require_once 'models/common/common_node.php'; $Node = new common_node(); $node_data = $Node->nodeDetail($this->GET['id']); /** * get node component options */ if ($node_data['component']['provider'] == '') { $node_data['component']['provider'] = 'vimeo'; } if ($node_data['component']['autoplay']) { $autoplay_param = ":autoplay=1"; } else { $autoplay_param = ''; } /** * pass to menu component */ $Onxshop_Request = new Onxshop_Request("component/video_{$node_data['component']['provider']}~video_id={$node_data['component']['video_id']}{$autoplay_param}~"); $this->tpl->assign("VIDEO", $Onxshop_Request->getContent()); $this->tpl->assign("NODE", $node_data); if ($node_data['display_title']) { $this->tpl->parse('content.title'); } return true; }
/** * hook before parsing */ public function parseContentTagsBeforeHook() { parent::parseContentTagsBeforeHook(); /** * pass GET.recipe_id into template */ $Node = new common_node(); $node_data = $Node->nodeDetail($this->GET['id']); $this->GET['recipe_id'] = $node_data['content']; /** * pass GET.taxonomy_ids into template */ $Recipe_Taxonomy = new ecommerce_recipe_taxonomy(); $taxonomy_ids = (array) $Recipe_Taxonomy->getRelationsToRecipe($this->GET['recipe_id']); $this->GET['taxonomy_tree_id'] = implode(",", $taxonomy_ids); /** * rating & reviews */ require_once 'models/ecommerce/ecommerce_recipe_review.php'; $Review = new ecommerce_recipe_review(); $review_data = $Review->getRating($this->GET['recipe_id']); if ($review_data['count'] > 0) { $rating = round($review_data['rating']); $_Onxshop_Request = new Onxshop_Request("component/rating_stars~rating={$rating}~"); $this->tpl->assign('RATING_STARS', $_Onxshop_Request->getContent()); if ($review_data['count'] == 1) { $this->tpl->assign('REVIEWS', 'Review'); } else { $this->tpl->assign('REVIEWS', 'Reviews'); } $this->tpl->assign('REVIEW', $review_data); $this->tpl->parse('content.reviews'); } }
/** * main action */ public function mainAction() { require_once 'models/common/common_node.php'; $Node = new common_node(); $node_data = $Node->nodeDetail($this->GET['id']); require_once 'models/common/common_file.php'; $File = new common_file(); if (is_numeric($this->GET['id'])) { $files = $File->listFiles($this->GET['id']); } if (is_array($files)) { foreach ($files as $file) { $this->tpl->assign('FILE', $file); $this->tpl->parse('content.item'); } } $this->tpl->assign('NODE', $node_data); /** * display title */ if ($node_data['display_title']) { if ($node_data['link_to_node_id'] > 0) { $this->tpl->parse('content.title_link'); } else { $this->tpl->parse('content.title'); } } return true; }
/** * main action */ public function mainAction() { require_once 'models/common/common_node.php'; $Node = new common_node(); //get data $node_data = $Node->nodeDetail($this->GET['id']); $rss_options = $node_data['component']; //detect feed specific controller if (preg_match('/api.twitter.com/', $rss_options['url'])) { $feed_controller = 'feed_twitter'; } else { $feed_controller = 'feed'; } $this->tpl->assign('FEED_CONTROLLER', $feed_controller); //prepare data $rss_options['url'] = base64_encode(urlencode(trim($rss_options['url']))); //get RSS_RESULT $nsite_request = "component/{$feed_controller}~url={$rss_options['url']}:items_limit={$rss_options['items_limit']}:channel_title={$rss_options['channel_title']}:image={$rss_options['image']}:copyright={$rss_options['copyright']}:description={$rss_options['description']}:content={$rss_options['content']}:pubdate={$rss_options['pubdate']}~"; $_Onxshop_Request = new Onxshop_Request($nsite_request); $this->tpl->assign("RSS_RESULT", $_Onxshop_Request->getContent()); //if ajax option enable, allow to update dynamicaly if ($rss_options['ajax'] == 1) { //AJAX METHOD $this->tpl->assign("RSS_OPTIONS", $rss_options); $this->tpl->parse('content.ajax'); } $this->tpl->assign('NODE', $node_data); if ($node_data['display_title']) { $this->tpl->parse('content.title'); } return true; }
/** * main action */ public function mainAction() { require_once 'models/common/common_node.php'; $Node = new common_node(); $node_data = $Node->nodeDetail($this->GET['id']); if (!is_array($node_data['component'])) { $node_data['component'] = array(); $node_data['component']['node_controller'] = 'common_simple'; } if ($node_data['component']['sending_failed'] == '') { $node_data['component']['sending_failed'] = 'The provided data is not valid! Required items are marked with an asterisk (*)'; } if ($node_data['component']['text'] == '') { $node_data['component']['text'] = "Thank you for your feedback."; } $this->tpl->assign("NODE", $node_data); $template_folder = "component/contact_form/"; $template_name = "{$template_folder}{$node_data['component']['node_controller']}"; /** * check template file exists */ if (!templateExists($template_name)) { // try fallback to old _contact_form folder in case it was locally created (used prior to Onxshop 1.7.6) $template_folder = "component/_contact_form/"; $template_name = "{$template_folder}{$node_data['component']['node_controller']}"; if (!templateExists($template_name)) { msg("selected template {$template_name} was not found"); return false; } } /** * execute controller */ $Form = new Onxshop_Request("component/contact_form@{$template_name}&node_id={$node_data['id']}&mail_to={$node_data['component']['mail_to']}&mail_toname={$node_data['component']['mail_toname']}&spam_protection={$node_data['component']['spam_protection']}"); $this->tpl->assign("FORM", $Form->getContent()); $reg_key = "form_notify_" . $node_data['id']; if (Zend_Registry::isRegistered($reg_key)) { if (Zend_Registry::get($reg_key) == 'sent') { //forward msg($node_data['component']['text'], 'ok'); if ($node_data['component']['href'] != '') { onxshopGoTo($node_data['component']['href']); } } else { if (Zend_Registry::get($reg_key) == 'failed') { msg($node_data['component']['sending_failed'], 'error'); $this->tpl->parse('content.form'); } else { $this->tpl->parse('content.form'); } } } else { $this->tpl->parse('content.form'); } if ($node_data['display_title']) { $this->tpl->parse('content.title'); } return true; }
/** * main action */ public function mainAction() { /** * initialise node and get detail */ require_once 'models/common/common_node.php'; $Node = new common_node(); $node_data = $Node->nodeDetail($this->GET['id']); /** * get node component options */ switch ($node_data['component']['template']) { case 'menu_SELECT': $template = 'component/menu_select'; break; case 'menu_GRID': $template = 'component/menu_grid'; break; case 'menu_STACK': $template = 'component/menu_stack'; break; default: $template = 'component/menu'; } if (is_numeric($node_data['component']['level'])) { $level = $node_data['component']['level']; } else { $level = 0; } if (is_numeric($node_data['component']['display_all'])) { $display_all = $node_data['component']['display_all']; } else { $display_all = 0; } if (is_numeric($node_data['component']['open'])) { $open = $node_data['component']['open']; } else { $open = ''; } /** * image size */ if ($template == 'component/menu_grid' || $template == 'component/menu_stack') { $image_o = $this->getImageSizeOptions($node_data); } /** * pass to menu component */ $Onxshop_Request = new Onxshop_Request("{$template}~id={$node_data['component']['node_id']}:display_teaser={$node_data['component']['display_teaser']}:level={$level}:expand_all={$display_all}:open={$open}:image_width={$image_o['width']}:image_height={$image_o['height']}:image_fill={$image_o['fill']}~"); $this->tpl->assign("MENU", $Onxshop_Request->getContent()); $this->tpl->assign("NODE", $node_data); if ($node_data['display_title']) { $this->tpl->parse('content.title'); } return true; }
/** * main action */ public function mainAction() { /** * input */ if ($this->GET['sort']['by']) { $sort_by = $this->GET['sort']['by']; } else { $sort_by = null; } if ($this->GET['sort']['direction']) { $sort_direction = $this->GET['sort']['direction']; } else { $sort_direction = null; } /** * initialize node */ require_once 'models/common/common_node.php'; $Node = new common_node(); $node_data = $Node->nodeDetail($this->GET['id']); /** * prepare query */ $query_raw = array(); if ($node_data['component']['template']) { $query_raw['template'] = $node_data['component']['template']; } if ($node_data['component']['offer_group_id']) { $query_raw['offer_group_id'] = $node_data['component']['offer_group_id']; } if ($node_data['component']['campaign_category_id']) { $query_raw['campaign_category_id'] = $node_data['component']['campaign_category_id']; } if ($node_data['component']['campaign_category_id']) { $query_raw['campaign_category_id'] = $node_data['component']['campaign_category_id']; } $query_raw['sort']['by'] = $sort_by; $query_raw['sort']['direction'] = $sort_direction; $query_raw['limit_per_page'] = 999; $query = http_build_query($query_raw, '', ':'); /** * call special offer component */ $_Onxshop_Request = new Onxshop_Request("component/ecommerce/special_offer_list~{$query}~"); $content = $_Onxshop_Request->getContent(); if (empty($content)) { return true; } $this->tpl->assign('PRODUCT_LIST', $content); $this->tpl->assign('NODE', $node_data); if ($node_data['display_title']) { $this->tpl->parse('content.title'); } return true; }
protected function nodeUsesCaptcha($node_id) { if ($this->GET['nocheck']) { return true; } // confirm the noded uses javascript captcha require_once 'models/common/common_node.php'; $Node = new common_node(); $node_data = $Node->nodeDetail($node_id); return $node_data['component']['spam_protection'] == 'captcha_text_js' || $node_data['node_controller'] == 'news'; }
/** * main action */ public function mainAction() { // set transparent cache //$rss->cache_dir = ONXSHOP_PROJECT_DIR . 'var/tmp/'; //$rss->cache_time = 3600; // one hour require_once 'models/common/common_node.php'; $Node = new common_node(); $node_data = $Node->nodeDetail($this->GET['id']); if ($this->GET['link']) { $url = base64_decode($this->GET['link']); } else { $url = trim($node_data['component']['url']); } msg("Opening {$url}", 'ok', 2); $wget_url = base64_encode($url); $_Onxshop_Request = new Onxshop_Request("component/wget&url={$wget_url}"); $source = $_Onxshop_Request->getContent(); $source = translateLinks("", $source); //$source = preg_replace("/.*\<body\>(.*)\<\/body\>.*/i", '\\1', $source); //grab with pregmatch $source = preg_replace("/[\r\n ]{1,}/", " ", $source); preg_match("/<body>(?!body)(.*)<\\/body>/mi", $source, $match); $source = $match[1]; //grab by XML /* //init simple XML require_once('lib/simplexml44/class/IsterXmlSimpleXMLImpl.php'); $SimpleXML = new IsterXmlSimpleXMLImpl; // load some source file if ($doc = $SimpleXML->load_string($source)) { $component['content'] = ''; if (is_object($doc->html->body)) { foreach( $doc->html->body->children() as $child ) { $component['content'] .= $child->asXML(); } } else { msg("Source is not valid XHTML", 'error'); } $this->tpl->assign("COMPONENT", $component); } else { msg ("Could not open '$url'", 'error'); } */ $this->tpl->assign("RESULT", $source); $this->tpl->assign('NODE', $node_data); if ($node_data['display_title']) { $this->tpl->parse('content.title'); } return true; }
/** * main action */ public function mainAction() { require_once 'models/common/common_node.php'; $Node = new common_node(); $node_data = $Node->nodeDetail($this->GET['id']); $this->tpl->assign("NODE", $node_data); if ($node_data['display_title']) { $this->tpl->parse('content.title'); } return true; }
/** * main action */ public function mainAction() { require_once 'models/common/common_node.php'; $Node = new common_node(); $node_data = $Node->nodeDetail($this->GET['id']); $_Onxshop_Request = new Onxshop_Request("component/comment~node_id={$node_data['id']}:allow_anonymouse_submit={$node_data['component']['allow_anonymouse_submit']}~"); $node_data['content'] = $_Onxshop_Request->getContent(); $this->tpl->assign("NODE", $node_data); if ($node_data['display_title']) { $this->tpl->parse('content.title'); } return true; }
/** * main action */ public function mainAction() { require_once 'models/common/common_node.php'; $Node = new common_node(); $node_data = $Node->nodeDetail($this->GET['id']); $linked_node_id = $node_data['component']['node_id']; if (is_numeric($linked_node_id)) { $_Onxshop_Request = new Onxshop_Request("node~id={$linked_node_id}:fe_edit=0:shared=1~"); $node_data['content'] = $_Onxshop_Request->getContent(); $this->tpl->assign("NODE", $node_data); } else { msg("Please select a content"); } return true; }
/** * main action */ public function mainAction() { require_once 'models/common/common_node.php'; $Node = new common_node(); $node_data = $Node->nodeDetail($this->GET['id']); if ($node_data['component']['template'] == '') { $node_data['component']['template'] = 'menu_UL'; } $Onxshop_Request = new Onxshop_Request("component/menu&type=taxonomy&level=2&display_all=1&id={$node_data['component']['node_id']}&template={$node_data['component']['template']}"); $this->tpl->assign("FILTER", $Onxshop_Request->getContent()); $this->tpl->assign("NODE", $node_data); if ($node_data['display_title']) { $this->tpl->parse('content.title'); } return true; }
/** * main action */ public function mainAction() { require_once 'models/common/common_node.php'; $Node = new common_node(); $node_data = $Node->nodeDetail($this->GET['id']); $this->tpl->assign("NODE", $node_data); if ($node_data['component']['href'] != '') { header("HTTP/1.1 301 Moved Permanently"); if (preg_match('/\\:\\/\\//', $node_data['component']['href'])) { onxshopGoTo($node_data['component']['href'], 2); } else { onxshopGoTo($node_data['component']['href']); } } return true; }
/** * process layout */ public function processLayout() { require_once 'models/common/common_node.php'; $Node = new common_node(); $node_data = $Node->nodeDetail($this->GET['id']); if ($node_data['page_title'] == '') { $node_data['page_title'] = $node_data['title']; } if (!isset($node_data['display_title'])) { $node_data['display_title'] = $GLOBALS['onxshop_conf']['global']['display_title']; } $this->tpl->assign("NODE", $node_data); /** * display title */ $this->displayTitle($node_data); }
/** * main action */ public function mainAction() { /** * get node detail */ require_once 'models/common/common_node.php'; $Node = new common_node(); $node_data = $Node->nodeDetail($this->GET['id']); /** * assign variables */ if ($node_data['page_title'] == '') { $node_data['page_title'] = $node_data['title']; } $this->tpl->assign("NODE", $node_data); return true; }
/** * main action */ public function mainAction() { require_once 'models/common/common_node.php'; $Node = new common_node(); $node_data = $Node->nodeDetail($this->GET['id']); $node_data['component']['template'] = str_replace('.html', '', $node_data['component']['template']); $node_data['component']['controller'] = str_replace('.php', '', $node_data['component']['controller']); if ($node_data['component']['controller'] == "") { $request = "component/{$node_data['component']['template']}"; } else { $request = "component/{$node_data['component']['controller']}@component/{$node_data['component']['template']}"; } $_Onxshop_Request = new Onxshop_Request("{$request}&node_id={$node_data['id']}&fe_edit=0&{$node_data['component']['parameter']}"); $node_data['content'] = $_Onxshop_Request->getContent(); $this->tpl->assign("NODE", $node_data); $this->displayTitle($node_data); return true; }
/** * main action */ public function mainAction() { require_once 'models/common/common_node.php'; $Node = new common_node(); $node_data = $Node->nodeDetail($this->GET['id']); if (!is_array($node_data['component'])) { $node_data['component'] = array(); $node_data['component']['node_controller'] = 'common_simple'; } if ($node_data['component']['sending_failed'] == '') { $node_data['component']['sending_failed'] = 'The provided data is not valid! Required items are marked with an asterisk (*)'; } if ($node_data['component']['text'] == '') { $node_data['component']['text'] = "Thank you for your feedback."; } $this->tpl->assign("NODE", $node_data); $Form = new Onxshop_Request("component/contact_form@component/_contact_form/{$node_data['component']['node_controller']}&node_id={$node_data['id']}&mail_to={$node_data['component']['mail_to']}&mail_toname={$node_data['component']['mail_toname']}&spam_protection={$node_data['component']['spam_protection']}"); $this->tpl->assign("FORM", $Form->getContent()); $reg_key = "form_notify_" . $node_data['id']; if (Zend_Registry::isRegistered($reg_key)) { if (Zend_Registry::get($reg_key) == 'sent') { //forward msg($node_data['component']['text'], 'ok'); if ($node_data['component']['href'] != '') { onxshopGoTo($node_data['component']['href']); } } else { if (Zend_Registry::get($reg_key) == 'failed') { msg($node_data['component']['sending_failed'], 'error'); $this->tpl->parse('content.form'); } else { $this->tpl->parse('content.form'); } } } else { $this->tpl->parse('content.form'); } if ($node_data['display_title']) { $this->tpl->parse('content.title'); } return true; }
/** * main action */ public function mainAction() { /** * initialize node */ require_once 'models/common/common_node.php'; $Node = new common_node(); $node_data = $Node->nodeDetail($this->GET['id']); $survey_id = $node_data['component']['survey_id']; /** * init parameters */ switch ($node_data['component']['template']) { case 'image_poll': $component = 'survey_image_poll'; break; case 'survey': default: $component = 'survey'; break; } $limit = (string) $node_data['component']['limit']; $votes_per_day = (int) $node_data['component']['votes_per_day']; $restriction = (string) $node_data['component']['restriction']; $spam_protection = (string) $node_data['component']['spam_protection']; $require_user_details = (int) $node_data['component']['require_user_details']; $require_t_and_c = (int) $node_data['component']['require_t_and_c']; $display_results = (int) $node_data['component']['display_results']; $href = (string) $node_data['component']['href']; $message_after_submission = urlencode((string) $node_data['component']['message_after_submission']); /** * call controller */ $_Onxshop_Request = new Onxshop_Request("component/{$component}~node_id={$node_data['id']}:survey_id={$survey_id}:limit={$limit}:votes_per_day={$votes_per_day}:restriction={$restriction}:spam_protection={$spam_protection}:require_user_details={$require_user_details}:require_t_and_c={$require_t_and_c}:display_results={$display_results}:href={$href}:message_after_submission={$message_after_submission}~"); $this->tpl->assign('SURVEY', $_Onxshop_Request->getContent()); $this->tpl->assign('NODE', $node_data); if ($node_data['display_title']) { $this->tpl->parse('content.title'); } return true; }
/** * process containers */ public function processContainers() { /** * check node id value */ if (!is_numeric($this->GET['id'])) { msg("node/default: id not numeric", 'error'); return false; } else { $node_id = $this->GET['id']; } /** * initialize */ require_once 'models/common/common_node.php'; $Node = new common_node(); $node_data = $Node->nodeDetail($node_id); //find child nodes $contentx = $Node->parseChildren($node_id); //assign to this controller as CONTAINER variable if (is_array($contentx)) { foreach ($contentx as $content) { $container[$content['container']] .= $content['content']; } } /** * node add icons * front-end node edit and node move (sort) icons are inserted in controller/node * */ if ($_SESSION['fe_edit_mode'] == 'edit' || $_SESSION['fe_edit_mode'] == 'move') { //normally we support container.0 to container.6 in default templates, but why not to have some reserve, e.g. 20 $min_container_id = 0; $max_container_id = 20; for ($key = $min_container_id; $key < $max_container_id + 1; $key++) { $container[$key] = "<div class='onxshop_layout_container' id='onxshop_layout_container_{$node_id}_{$key}'>{$container[$key]}</div>"; } } $this->tpl->assign("CONTAINER", $container); $this->tpl->assign("NODE", $node_data); }
/** * main action */ public function mainAction() { //input data if (is_numeric($this->GET['id'])) { $node_id = $this->GET['id']; } else { return false; } //initialise require_once 'models/common/common_node.php'; $Node = new common_node(); //get node detail $node_data = $Node->nodeDetail($node_id); //parent page is blog article container $blog_node_id = $node_data['parent']; $this->tpl->assign('BLOG_NODE_ID', $blog_node_id); //show comments only when enabled if ($node_data['component']['allow_comment'] == 1) { $_Onxshop_Request = new Onxshop_Request("component/comment~node_id={$node_id}:allow_anonymouse_submit=1~"); $this->tpl->assign("COMMENT", $_Onxshop_Request->getContent()); $this->tpl->parse("content.comment"); } /** * empty author helper class */ if (trim($node_data['component']['author']) == '') { $this->tpl->assign('AUTHOR_EMPTY', 'author_empty'); } else { $this->tpl->assign('AUTHOR_EMPTY', ''); } /** * getRelatedTaxonomy */ $related_taxonomy = $Node->getRelatedTaxonomy($node_id); $this->tpl->assign('TAXONOMY', $related_taxonomy); //standard page actions $this->processContainers(); $this->processPage(); return true; }
/** * process content */ public function processContent() { $node_id = $this->GET['id']; if (!is_numeric($node_id)) { msg('node/content/default: id not numeric', 'error'); return false; } require_once 'models/common/common_node.php'; $Node = new common_node(); $node_data = $Node->nodeDetail($node_id); if ($node_data['page_title'] == '') { $node_data['page_title'] = $node_data['title']; } if (!isset($node_data['display_title'])) { $node_data['display_title'] = $GLOBALS['onxshop_conf']['global']['display_title']; } $this->tpl->assign("NODE", $node_data); /** * display title */ $this->displayTitle($node_data); return true; }
/** * main action */ public function mainAction() { /* we need to include config*/ require_once 'models/common/common_image.php'; $common_image_conf = common_image::initConfiguration(); require_once 'models/common/common_node.php'; $Node = new common_node(); $node_data = $Node->nodeDetail($this->GET['id']); if ($node_data['component']['template'] == '') { $node_data['component']['template'] = 'single'; } /** * image size: set width */ if (is_numeric($node_data['component']['main_image_width']) && $node_data['component']['main_image_width'] > 0) { $image_width = $node_data['component']['main_image_width']; } else { if ($node_data['component']['main_image_constrain']) { $Image = new common_image(); $image_list = $Image->listFiles($node_data['id']); $image_width = 9999; foreach ($image_list as $item) { if ($item['imagesize']['width'] < $image_width) { $image_width = $item['imagesize']['width'] - $item['imagesize']['width'] % 5; } } if ($image_width == 9999) { $image_width = 0; } } else { $image_width = 0; } } /** * image size: check constrain and set appropriate height */ switch ($node_data['component']['main_image_constrain']) { case '1-1': $image_height = $image_width; break; case '2_39-1': // 2.39:1 $image_height = (int) ($image_width / 2.39 * 1); break; case '16-9': $image_height = (int) ($image_width / 16 * 9); break; case '4-3': $image_height = (int) ($image_width / 16 * 9); break; case '0': default: $image_height = 0; break; } /** * image size: fill cropping option * */ if (is_numeric($node_data['component']['image_fill'])) { $fill = $node_data['component']['image_fill']; } else { $fill = 1; } /** * what controller */ if (file_exists(ONXSHOP_PROJECT_DIR . "controllers/component/image_gallery/{$node_data['component']['template']}.php") || file_exists(ONXSHOP_DIR . "controllers/component/image_gallery/{$node_data['component']['template']}.php")) { $image_controller = 'component/image_gallery/' . $node_data['component']['template']; } else { $image_controller = 'component/image_gallery'; } /** * what template */ if (file_exists(ONXSHOP_PROJECT_DIR . "templates/component/image_gallery/{$node_data['component']['template']}.html") || file_exists(ONXSHOP_DIR . "templates/component/image_gallery/{$node_data['component']['template']}.html")) { $image_template = 'component/image_gallery/' . $node_data['component']['template']; } else { $image_template = 'component/image_gallery'; } /** * check cycle link_to_node_id */ if ($node_data['component']['cycle']['link_to_node_id']) { $cycle['link_to_node_id'] = $node_data['component']['cycle']['link_to_node_id']; } else { $cycle['link_to_node_id'] = ''; } /** * timeout for slideshow */ if ($node_data['component']['cycle']['fx']) { $cycle['fx'] = $node_data['component']['cycle']['fx']; } else { $cycle['fx'] = $common_image_conf['cycle_fx']; } if ($node_data['component']['cycle']['easing']) { $cycle['easing'] = $node_data['component']['cycle']['easing']; } else { $cycle['easing'] = $common_image_conf['cycle_easing']; } if (is_numeric($node_data['component']['cycle']['speed'])) { $cycle['speed'] = $node_data['component']['cycle']['speed']; } else { $cycle['speed'] = $common_image_conf['cycle_speed']; } if (is_numeric($node_data['component']['cycle']['timeout'])) { $cycle['timeout'] = $node_data['component']['cycle']['timeout']; } else { $cycle['timeout'] = $common_image_conf['cycle_timeout']; } /** * disable limit */ $image_limit = ''; /** * call controller */ $Onxshop_Request = new Onxshop_Request("{$image_controller}@{$image_template}~relation=node:role=main:width={$image_width}:height={$image_height}:fill={$fill}:node_id={$node_data['id']}:limit={$image_limit}:cycle_fx={$cycle['fx']}:cycle_easing={$cycle['easing']}:cycle_timeout={$cycle['timeout']}:cycle_speed={$cycle['speed']}:cycle_link_to_node_id={$cycle['link_to_node_id']}~"); $this->tpl->assign("CONTENT", $Onxshop_Request->getContent()); $this->tpl->assign('NODE', $node_data); $this->tpl->assign('IMAGE_CONF', $common_image_conf); /** * display title */ $this->displayTitle($node_data); return true; }
/** * main action */ public function mainAction() { //do nothing if basket is not initialized if (!is_numeric($_SESSION['basket']['id'])) { return true; } /** * create object */ require_once 'models/ecommerce/ecommerce_basket.php'; $Basket = new ecommerce_basket(); $basket_content_ids = $Basket->getContentItemsProductIdList($_SESSION['basket']['id']); $viewed_list_ids = array(); $Node = new common_node(); $viewed_products = array(); /** * go through history */ foreach ($_SESSION['history'] as $item) { if (is_numeric($item['node_id'])) { $node_data = $Node->nodeDetail($item['node_id']); if ($node_data['node_controller'] == 'product') { if (!in_array($node_data['content'], $basket_content_ids) && !in_array($node_data['content'], $viewed_list_ids) && $_SESSION['active_pages'][0] != $node_data['id']) { $viewed_products[] = $node_data['content']; } } } } /** * Pass product_id_list to product_list controller */ if (is_array($viewed_products) && count($viewed_products) > 0) { /** * prepare HTTP query for product_list component */ $viewed_list['product_id_list'] = $viewed_products; $query = http_build_query($viewed_list, '', ':'); /** * detect controller for product list */ switch ($this->GET['template']) { case 'scroll': $controller = 'product_list_scroll'; break; case '3col': $controller = 'product_list_3columns'; break; case '2col': $controller = 'product_list_2columns'; break; case '1col': default: $controller = 'product_list'; break; } /** * call controller */ $_Onxshop_Request = new Onxshop_Request("component/ecommerce/{$controller}~{$query}:image_width={$this->GET['image_width']}~"); $this->tpl->assign('ITEMS', $_Onxshop_Request->getContent()); $this->tpl->parse('content.recently_viewed'); } return true; }
/** * process page */ public function processPage() { if (!is_numeric($this->GET['id'])) { return false; } /** * get node detail */ require_once 'models/common/common_node.php'; $Node = new common_node(); $node_data = $Node->nodeDetail($this->GET['id']); /** * prepare titles */ if (trim($node_data['page_title']) == '') { $node_data['page_title'] = $node_data['title']; } // page title is also used component/page_header, this will be effective only if page_title is directly in page template if (trim($node_data['browser_title']) == '') { $node_data['browser_title'] = $node_data['page_title']; } /** * fallback on options to global configuration */ if (!isset($node_data['display_title'])) { $node_data['display_title'] = $GLOBALS['onxshop_conf']['global']['display_title']; } if (!isset($node_data['display_secondary_navigation'])) { $node_data['display_secondary_navigation'] = $GLOBALS['onxshop_conf']['global']['display_secondary_navigation']; } /** * display page header */ if ($node_data['display_title']) { $_Onxshop_Request = new Onxshop_Request("component/page_header~id={$node_data['id']}~"); $this->tpl->assign('PAGE_HEADER', $_Onxshop_Request->getContent()); } /** * display secondary navigation */ if ($node_data['display_secondary_navigation'] == 1) { $first_page_id = $Node->getFirstParentPage($_SESSION['active_pages']); //type=page_and_products $_Onxshop_Request = new Onxshop_Request("component/menu~level=0:expand_all=0:display_teaser=1:id={$first_page_id}:open={$node_data['id']}~"); $this->tpl->assign('SECONDARY_NAVIGATION', $_Onxshop_Request->getContent()); $this->tpl->parse('content.secondary_navigation'); } /** * get related_taxonomy */ $related_taxonomy = $this->getNodeRelatedTaxonomy($node_data); /** * create taxonomy class */ $node_data['taxonomy_class'] = $this->createTaxonomyClass($related_taxonomy); /** * create hierarchy CSS class */ $node_data['hierarchy_class'] = $this->createHierarchyClass($_SESSION['full_path']); /** * save node_controller, page css_class, current node id, breadcrumb and taxonomy_class into registry to be used in sys/(x)html* as body class */ $body_css_class = "{$node_data['node_controller']} {$node_data['css_class']} {$node_data['taxonomy_class']} node_id_{$this->GET['id']} {$node_data['hierarchy_class']}"; $this->saveBodyCssClass($body_css_class); /** * save node_id to registry */ Zend_Registry::set('node_id', $this->GET['id']); /** * process open graph tags */ $this->processOpenGraph($node_data); /** * assign to template */ $this->tpl->assign("NODE", $node_data); return true; }
/** * main action */ public function mainAction() { /** * initialize node */ require_once 'models/common/common_node.php'; $Node = new common_node(); $node_data = $Node->nodeDetail($this->GET['id']); $taxonomy_ids = $Node->getTaxonomyForNode($node_data['id']); if (is_array($node_data['component']['related']) || count($taxonomy_ids) > 0) { /** * prepare HTTP query for product_list component */ $product_id_list = array(); if (count($node_data['component']['related']) > 0) { foreach ($node_data['component']['related'] as $item) { if (is_numeric($item)) { $product_id_list[] = $item; } } } /** * Get product id list by category if catogory specified */ $this->extentProductIdListByTaxonomy($taxonomy_ids, $product_id_list); /** * build query */ $query_raw = array(); // sorting if ($node_data['component']['display_sorting'] == 1) { $query_raw['display_sorting'] = 1; } // force sorting as listed $query_raw['product_id_list_force_sorting_as_listed'] = 1; // image role if ($node_data['component']['image_role']) { $query_raw['image_role'] = $node_data['component']['image_role']; } // image width if ($node_data['component']['image_width'] > 0) { $query_raw['image_width'] = $node_data['component']['image_width']; } /** * product_id_list */ $query_raw['product_id_list'] = $product_id_list; //dont continue if list is empty if (count($query_raw['product_id_list']) == 0) { return true; } $query = http_build_query($query_raw, '', ':'); /** * detect controller for product list */ switch ($node_data['component']['template']) { case 'stack': $controller = 'product_list_stack'; break; case 'scroll': $controller = 'product_list_scroll'; break; case '6col': $controller = 'product_list_6columns'; break; case '5col': $controller = 'product_list_5columns'; break; case '4col': $controller = 'product_list_4columns'; break; case '3col': $controller = 'product_list_3columns'; break; case '2col': $controller = 'product_list_2columns'; break; case '1col': default: $controller = 'product_list_shelf'; break; } /** * call controller */ $_Onxshop_Request = new Onxshop_Request("component/ecommerce/{$controller}~{$query}~"); $this->tpl->assign('PRODUCT_LIST', $_Onxshop_Request->getContent()); } $this->tpl->assign('NODE', $node_data); if ($node_data['display_title']) { $this->tpl->parse('content.title'); } return true; }
/** * hook before parsing */ public function parseContentTagsBeforeHook() { /** * set active pages */ $this->setActivePages(); /** * pass GET.product_id into template */ require_once 'models/common/common_node.php'; $Node = new common_node(); $node_data = $Node->nodeDetail($this->GET['id']); $this->GET['product_id'] = $node_data['content']; /** * pass GET.image_width into template */ //include product image conf require_once 'models/ecommerce/ecommerce_product_image.php'; $ecommerce_product_image_conf = ecommerce_product_image::initConfiguration(); if (is_numeric($this->GET['image_width'])) { $image_width = $this->GET['image_width']; } else { $image_width = $GLOBALS['onxshop_conf']['global']['product_detail_image_width']; } $this->GET['image_width'] = $image_width; return true; }
/** * main action */ public function mainAction() { /** * initialize node */ require_once 'models/common/common_node.php'; $Node = new common_node(); $node_data = $Node->nodeDetail($this->GET['id']); /** * detect controller for recipe list */ switch ($node_data['component']['template']) { case 'shelf': $controller = 'recipe_list_shelf'; break; case 'stack': $controller = 'recipe_list_stack'; break; case '4col': $controller = 'recipe_list_4columns'; break; case '3col': default: $controller = 'recipe_list_3columns'; break; case '2col': $controller = 'recipe_list_2columns'; break; } /** * get related categories */ require_once 'models/common/common_node_taxonomy.php'; $Node_Taxonomy = new common_node_taxonomy(); $taxonomy_ids = $Node_Taxonomy->getRelationsToNode($node_data['id']); $taxonomy_ids = implode(",", $taxonomy_ids); /** * sorting */ $sort_by = $node_data['component']['sort']['by']; $sort_direction = $node_data['component']['sort']['direction']; /** * limit */ if (is_numeric($this->GET['limit_from']) && is_numeric($this->GET['limit_per_page'])) { $limit_from = $this->GET['limit_from']; $limit_per_page = $this->GET['limit_per_page']; } else { if (is_numeric($node_data['component']['limit'])) { $limit_from = 0; $limit_per_page = $node_data['component']['limit']; } else { $limit_from = ''; $limit_per_page = ''; } } /** * pagination */ if ($node_data['component']['pagination'] == 1) { $display_pagination = 1; } else { $display_pagination = 0; } /** * call controller */ $_Onxshop_Request = new Onxshop_Request("component/ecommerce/{$controller}~taxonomy_tree_id={$taxonomy_ids}:sort[by]={$sort_by}:sort[direction]={$sort_direction}:limit_from={$limit_from}:limit_per_page={$limit_per_page}:display_pagination={$display_pagination}~"); $this->tpl->assign('RECIPE_LIST', $_Onxshop_Request->getContent()); $this->tpl->assign('NODE', $node_data); if ($node_data['display_title']) { $this->tpl->parse('content.title'); } return true; }
/** * main action */ public function mainAction() { /** * initialise */ require_once 'models/common/common_node.php'; $Node = new common_node(); /** * input data */ $node_id = $this->GET['id']; if (is_numeric($this->GET['blog_node_id'])) { $blog_node_id = $this->GET['blog_node_id']; } else { $blog_node_id = $Node->conf['id_map-blog']; } /** * get node detail */ $node_data = $Node->nodeDetail($node_id); /** * filtering * TODO: support for multiple taxonomy * */ if (is_numeric($this->GET['taxonomy_tree_id'])) { $taxonomy_tree_id = $this->GET['taxonomy_tree_id']; } else { if ($taxonomy = $Node->getTaxonomyForNode($node_data['id'])) { $taxonomy_tree_id = $taxonomy[0]; } else { $taxonomy_tree_id = ''; } } if (is_numeric($this->GET['limit_from']) && is_numeric($this->GET['limit_per_page'])) { $limit_from = $this->GET['limit_from']; $limit_per_page = $this->GET['limit_per_page']; } else { if (is_numeric($node_data['component']['limit'])) { $limit_from = 0; $limit_per_page = $node_data['component']['limit']; } else { $limit_from = ''; $limit_per_page = ''; } } /** * template */ switch ($node_data['component']['template']) { case 'full': $template = 'news_list'; break; case 'teaser': $template = 'news_list_teaser'; break; case 'grid': $template = 'news_list_grid'; break; case 'stack': $template = 'news_list_stack'; break; case 'latest': default: $template = 'news_list_latest'; break; } /** * pagination */ if ($node_data['component']['pagination'] == 1) { $display_pagination = 1; } else { $display_pagination = 0; } /** * image size */ $image_o = $this->getImageSizeOptions($node_data); /** * call controller */ $_Onxshop = new Onxshop_Request("component/{$template}~blog_node_id={$blog_node_id}:id={$node_id}:limit_from={$limit_from}:limit_per_page={$limit_per_page}:display_pagination={$display_pagination}:publish=1:taxonomy_tree_id={$taxonomy_tree_id}:image_width={$image_o['width']}:image_height={$image_o['height']}:image_fill={$image_o['fill']}~"); $this->tpl->assign('NEWS_LIST', $_Onxshop->getContent()); $this->tpl->assign('NODE', $node_data); /** * display title */ $this->displayTitle($node_data); return true; }