Example #1
0
 /**
  * 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;
 }
Example #2
0
 /**
  * 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');
     }
 }
Example #3
0
 /**
  * main action
  */
 public function mainAction()
 {
     /**
      * get input
      */
     $node_id = $this->GET['node_id'];
     $type = $this->GET['type'];
     /**
      * check value
      */
     if (!is_numeric($node_id)) {
         return false;
     }
     /**
      * initialize
      */
     require_once 'models/common/common_node.php';
     $Node = new common_node();
     /**
      * increment value
      */
     $Node->incrementShareCounter($node_id);
     /**
      * if user is logged in save action
      */
     $this->saveClientAction($node_id, $type);
     return true;
 }
Example #4
0
 /**
  * main action
  */
 public function mainAction()
 {
     set_time_limit(0);
     require_once 'models/common/common_node.php';
     $Node = new common_node();
     $sitemap = $Node->getFlatSitemap();
     if (is_array($sitemap)) {
         if ($_SERVER['SSL_PROTOCOL'] || $_SERVER['HTTPS']) {
             $protocol = 'https';
         } else {
             $protocol = 'http';
         }
         foreach ($sitemap as $node) {
             $link = $Node->getSeoURL($node['id']);
             $item['loc'] = "{$protocol}://{$_SERVER['HTTP_HOST']}{$link}";
             $item['lastmod'] = $Node->getLastMod($node['id'], $node['modified']);
             $item['lastmod'] = substr($item['lastmod'], 0, 10);
             if ($node['parent'] == $Node->conf['id_map-global_navigation'] || $node['parent'] == $Node->conf['id_map-primary_navigation'] || $node['parent'] == $Node->conf['id_map-footer_navigation']) {
                 $item['priority'] = 1;
             } else {
                 $item['priority'] = 0.5;
             }
             $this->tpl->assign("ITEM", $item);
             $this->tpl->parse("content.item");
         }
     }
     header('Content-Type: text/xml; charset=UTF-8');
     return true;
 }
Example #5
0
 /**
  * main action
  */
 public function mainAction()
 {
     if (isset($this->GET['search'])) {
         $searchQuery = $this->GET['search']['query'];
         $count = strlen(trim($searchQuery));
         if ($count > 2) {
             require_once 'models/common/common_node.php';
             $Node = new common_node();
             $result = $Node->search($searchQuery);
             $added = array();
             foreach ($result as $r) {
                 if ($r['node_group'] != 'page') {
                     $active_pages = $Node->getActivePages($r['id']);
                     $r = $Node->detail($active_pages[0]);
                 }
                 if (!in_array($r['id'], $added) && $r['node_group'] == 'page') {
                     $this->tpl->assign('RESULT', $r);
                     $this->tpl->parse('content.result.item');
                     $added[] = $r['id'];
                 }
             }
             $this->tpl->parse('content.result');
         } else {
             msg("Please specify at least 3 characters", "error");
         }
     }
     return true;
 }
 /**
  * main action
  */
 public function mainAction()
 {
     require_once 'models/common/common_node.php';
     require_once 'models/ecommerce/ecommerce_product.php';
     $Node = new common_node();
     $Product = new ecommerce_product();
     $product_id = $this->GET['id'];
     //listing
     if (is_numeric($product_id)) {
         $current = $Product->findProductInNode($product_id);
         $this->tpl->assign('NODE', $Node->detail($current[0]['id']));
         foreach ($current as $key => $node_data) {
             //don't display homepage
             if ($key > 0) {
                 if ($node_data['publish'] == 0) {
                     $node_data['class'] = "class='disabled'";
                 }
                 $this->tpl->assign("ITEM", $node_data);
                 $_Onxshop_Request = new Onxshop_Request("component/breadcrumb~id={$node_data['id']}:create_last_link=1~");
                 $this->tpl->assign('BREADCRUMB', $_Onxshop_Request->getContent());
                 $this->tpl->parse("content.multiple.item");
             }
         }
         if (count($current) > 1) {
             $this->tpl->parse('content.multiple');
         }
     }
     return true;
 }
Example #7
0
    /**
     * main action
     */
    public function mainAction()
    {
        require_once 'models/common/common_node.php';
        $Node = new common_node();
        $news_list_detail = $Node->getDetail($this->GET['blog_node_id']);
        $this->tpl->assign("NEWS_LIST", $news_list_detail);
        $node_data = $_POST['node'];
        if ($_POST['save']) {
            /**
             * pre-populate content
             */
            $node_data['description'] = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.';
            $node_data['content'] = '
		<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
		<ul>
		<li>velit esse cillum dolore</li>
		<li>consectetur adipisicing elit</li>
		<li>occaecat cupidatat non proident</li>
		</ul>
		<p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
			';
            /**
             * insert a new node
             */
            if ($id = $Node->nodeInsert($node_data)) {
                msg(ucfirst($node_data['node_group']) . " has been added.");
                //quick pages builder
                //$Page_builder = new Onxshop_Request("bo/page_builder@blank&parent=$id&node_group={$node_data['node_group']}&node_controller={$node_data['node_controller']}");
            }
        }
        $this->tpl->assign('NODE', $node_data);
        return true;
    }
Example #8
0
 /**
  * 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;
 }
Example #9
0
 /**
  * get list
  */
 public function getList($publish = 1)
 {
     require_once 'models/common/common_node.php';
     /**
      * what node elements to display?
      */
     if ($this->GET['parent_type'] !== '') {
         switch ($this->GET['parent_type']) {
             case 'layout':
                 $node_group = 'page';
                 break;
             case 'content':
                 $node_group = 'layout';
                 break;
             case 'page':
             default:
                 $node_group = 'page';
                 break;
         }
     } else {
         $node_group = 'page';
     }
     $Node = new common_node();
     $list = $Node->getTree(0, $node_group);
     return $list;
 }
Example #10
0
 /**
  * main action
  */
 public function mainAction()
 {
     /**
      * check input variables
      */
     if (is_numeric($_POST['node_id'])) {
         $node_id = $_POST['node_id'];
     } else {
         msg("node_bin: node_id is not numeric", 'error');
         return false;
     }
     /**
      * initialise Node object
      */
     require_once 'models/common/common_node.php';
     $Node = new common_node();
     /**
      * the request seems to be valid, try to bin the node
      */
     if ($Node->moveToBin($node_id)) {
         msg("Node (id={$node_id}) moved to Bin", 'ok');
     } else {
         msg("Cannot move Node (id={$node_id}) to Bin", 'error');
     }
     return true;
 }
Example #11
0
 /**
  * main action
  */
 public function mainAction()
 {
     $node_id = $this->GET['node_id'];
     if (!is_numeric($node_id)) {
         return false;
     }
     if ($this->GET['mail_template'] && trim($this->GET['mail_template']) != '') {
         $this->mail_template = $this->GET['mail_template'];
     } else {
         $this->mail_template = 'notify_author';
     }
     $this->tpl->assign('MAIL_TEMPLATE', $this->mail_template);
     require_once 'models/common/common_node.php';
     $Node = new common_node();
     $node_detail = $Node->getDetail($node_id);
     $this->tpl->assign('NODE', $node_detail);
     $this->tpl->assign('CONF', $GLOBALS['onxshop_conf']);
     if ($this->GET['confirm'] == 1) {
         $this->sendEmail($node_detail);
     } else {
         $this->previewEmail($node_detail);
     }
     $this->showPreviouslySentEmails($node_detail['author_detail']['email']);
     return true;
 }
Example #12
0
 /**
  * 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;
 }
Example #13
0
 /**
  * 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}&amp;node_id={$node_data['id']}&amp;mail_to={$node_data['component']['mail_to']}&amp;mail_toname={$node_data['component']['mail_toname']}&amp;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;
 }
Example #14
0
 /**
  * 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;
 }
Example #15
0
 /**
  * main action
  */
 public function mainAction()
 {
     /**
      * initialise
      */
     require_once 'models/common/common_node.php';
     $Node = new common_node();
     /**
      * input data
      */
     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'];
     }
     if ($this->GET['date_part'] == 'year-month') {
         $date_part = 'year-month';
     } else {
         $date_part = "year";
     }
     if (!$this->GET['created']) {
         $this->tpl->assign('ACTIVE_CLASS_ALL', 'active');
     }
     $this->tpl->assign('BLOG_NODE_ID', $blog_node_id);
     /**
      * process
      */
     if ($article_archive = $Node->getBlogArticleArchive($blog_node_id, 1, $date_part)) {
         foreach ($article_archive as $item) {
             if ($date_part == 'year-month') {
                 //archive by year-month
                 $item['created'] = trim($item['date_part'], '()');
                 $item['created'] = preg_replace('/,/', '-', $item['created']);
                 //add leading 0 to month 1 to 9 (January to September)
                 $item['created'] = preg_replace('/^([0-9]{4})-([0-9]{1})$/', '\\1-0\\2', $item['created']);
                 //formating can be done in template, but in this case formating depends on input
                 //custom formating can still be done in the template, e.g. {ITEM.created|strtotime|strftime('%B %Y', %s)}
                 $item['created_formated'] = strftime('%B %Y', strtotime($item['created']));
             } else {
                 //archive by year
                 $item['created'] = $item['date_part'];
                 $item['created_formated'] = $item['created'];
             }
             //active css class
             if ($item['created'] == $this->GET['created']) {
                 $this->tpl->assign('ACTIVE_CLASS', 'active');
             } else {
                 $this->tpl->assign('ACTIVE_CLASS', '');
             }
             $this->tpl->assign('ITEM', $item);
             $this->tpl->parse('content.list.item');
         }
         $this->tpl->parse('content.list');
     }
     return true;
 }
Example #16
0
 /**
  * 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;
 }
Example #17
0
 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';
 }
Example #18
0
 /**
  * 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;
 }
Example #19
0
 /**
  * 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;
 }
Example #20
0
 /**
  * main action
  */
 public function mainAction()
 {
     /**
      * input data
      */
     if (is_numeric($this->GET['expand_all'])) {
         $expand_all = $this->GET['expand_all'];
     } else {
         $expand_all = 0;
     }
     /**
      * initialize
      */
     require_once 'models/common/common_node.php';
     $node_data = $_POST['node'];
     $Node = new common_node();
     if ($_POST['save']) {
         //$parent_data = $Node->getDetail($this->GET['parent']);
         if ($node_data['parent'] == $Node->conf['id_map-homepage'] && $node_data['node_group'] == 'page') {
             $home_page_data = $Node->getDetail($Node->conf['id_map-homepage']);
             $node_data['parent'] = $home_page_data['parent'];
             $home_page_parent_data = $Node->getDetail($home_page_data['parent']);
             msg("Inserting page under {$home_page_parent_data['title']}");
         }
         /**
          * insert a new node
          */
         if ($id = $Node->nodeInsert($node_data)) {
             //quick pages builder
             //is broken :) $Page_builder = new Onxshop_Request("bo/page_builder@blank&parent=$id&node_group={$node_data['node_group']}&node_controller={$node_data['node_controller']}");
             msg(ucfirst($node_data['node_group']) . " " . $node_data['title'] . " has been added.");
             $this->tpl->assign("INSERTED_NODE_ID", $id);
             $this->tpl->parse('content.inserted');
             // clean
             $node_data['title'] = '';
             //return true;
         }
     }
     $this->tpl->assign('NODE', $node_data);
     /**
      * prepare
      */
     $node_controller = $node_data['node_controller'];
     $node_group = $this->GET['node_group'];
     if ($node_group == 'container') {
         $node_group = 'page';
     }
     // get the list of node types
     $Node_type = new Onxshop_Request("bo/component/node_type_menu~id=new:open={$node_controller}:node_group={$node_group}:expand_all={$expand_all}~");
     $this->tpl->assign("NODE_TYPE", $Node_type->getContent());
     $this->tpl->parse('content.form');
     return true;
 }
Example #21
0
 /**
  * main action
  */
 public function mainAction()
 {
     /**
      * input
      */
     if (is_numeric($_POST['customer_id'])) {
         $customer_id = $_POST['customer_id'];
     } else {
         $customer_id = 0;
     }
     /**
      * bo users list
      */
     require_once 'models/client/client_customer.php';
     $Customer = new client_customer();
     $bo_users_list = $Customer->getCustomersWithRole();
     foreach ($bo_users_list as $customer) {
         $this->tpl->assign('CUSTOMER', $customer);
         if ($customer['id'] == $customer_id) {
             $this->tpl->assign('SELECTED', 'selected="selected"');
         } else {
             $this->tpl->assign('SELECTED', '');
         }
         $this->tpl->parse('content.item');
     }
     /**
      * stats
      */
     $author_stats = array();
     /**
      * common_node
      */
     require_once 'models/common/common_node.php';
     $Node = new common_node();
     $author_stats['common_node'] = $Node->getAuthorStats($customer_id);
     /**
      * common_image
      */
     require_once 'models/common/common_image.php';
     $Image = new common_image();
     $author_stats['common_image'] = $Image->getAuthorStats($customer_id);
     /**
      * common_revision
      */
     require_once 'models/common/common_revision.php';
     $Revision = new common_revision();
     $author_stats['common_revision'] = $Revision->getAuthorStats($customer_id);
     /**
      * assign
      */
     $this->tpl->assign('AUTHOR_STATS', $author_stats);
     return true;
 }
Example #22
0
 /**
  * main action
  */
 public function mainAction()
 {
     // initialize
     require_once 'models/ecommerce/ecommerce_store.php';
     $Store = new ecommerce_store();
     // save
     if ($_POST['save']) {
         // set values
         if (!isset($_POST['store']['publish'])) {
             $_POST['store']['publish'] = 0;
         }
         $_POST['store']['modified'] = date('c');
         // handle other_data
         $_POST['store']['other_data'] = serialize($_POST['store']['other_data']);
         // force numeric types
         $_POST['store']['coordinates_x'] = (int) $_POST['store']['coordinates_x'];
         $_POST['store']['coordinates_y'] = (int) $_POST['store']['coordinates_y'];
         $_POST['store']['latitude'] = (double) $_POST['store']['latitude'];
         $_POST['store']['longitude'] = (double) $_POST['store']['longitude'];
         // serialize street_view_options
         $_POST['store']['street_view_options'] = serialize($_POST['store']['street_view_options']);
         // remove if country_id isn't numeric
         if (!is_numeric($_POST['store']['country_id'])) {
             unset($_POST['store']['country_id']);
         }
         // update store
         if ($id = $Store->update($_POST['store'])) {
             msg("Store ID={$id} updated");
             // update node info (if exists)
             $store_homepage = $Store->getStoreHomepage($_POST['store']['id']);
             if (is_array($store_homepage) && count($store_homepage) > 0) {
                 $store_homepage['publish'] = $_POST['store']['publish'];
                 require_once 'models/common/common_node.php';
                 $Node = new common_node();
                 $Node->nodeUpdate($store_homepage);
             }
             // forward to store list main page and exit
             onxshopGoTo("/backoffice/stores");
             return true;
         } else {
             msg("Cannot update store details", 'error');
         }
     }
     // store detail
     $store = $Store->detail($this->GET['id']);
     $store['publish'] = $store['publish'] == 1 ? 'checked="checked" ' : '';
     $store['street_view_options'] = unserialize($store['street_view_options']);
     $this->tpl->assign('STORE', $store);
     $this->tpl->assign('STREET_VIEW_IMAGE_' . (int) $store['street_view_options']['image'], 'checked="checked"');
     $this->parseTypeSelect($store['type_id']);
     return true;
 }
Example #23
0
 /**
  * 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;
 }
Example #24
0
 /**
  * main action
  */
 public function mainAction()
 {
     /**
      * include node configuration
      */
     require_once 'models/common/common_node.php';
     $Node = new common_node();
     /**
      * nothing to do here, forward first parent page
      */
     $first_parent_page_id = $Node->getParentPageId($this->GET['id']);
     onxshopGoTo("page/" . $first_parent_page_id);
     return true;
 }
Example #25
0
 /**
  * main action
  */
 public function mainAction()
 {
     parent::mainAction();
     $node_id = (int) $this->GET['id'];
     // display Dublin district menu when in Dublin county
     if (is_numeric($node_id) && $node_id > 0) {
         $Node = new common_node();
         $node = $Node->detail($node_id);
         if ($node_id == 1536 || $node['parent'] == 1536) {
             $this->tpl->parse("content.dublin_menu");
         }
     }
     return true;
 }
Example #26
0
 /**
  * Initialize data structures
  */
 protected function initializeData($node_id)
 {
     $this->profile = $this->getProfile();
     // load all pages
     $Node = new common_node();
     $sql = "publish = 1 AND display_in_menu = 1 AND node_group = 'page' AND node_controller <> 'symbolic'";
     if ($node_id) {
         $sql .= " AND id = {$node_id}";
     }
     $this->pageList = $Node->listing($sql);
     // Initialize the HTTP client
     $this->client = new Zend_Http_Client();
     $this->client->setConfig(array('maxredirects' => 0, 'timeout' => 30));
 }
Example #27
0
 /**
  * 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;
 }
Example #28
0
 /**
  * main action
  */
 public function mainAction()
 {
     require_once 'models/common/common_node.php';
     $Node = new common_node();
     $node_list = $Node->listing('', 'modified DESC', '0,20');
     foreach ($node_list as $item) {
         $item['latest_change_by'] = $Node->getCustomerIdForLastModified($item['id']);
         if ($item['publish'] == 0) {
             $item['class'] = 'disabled';
         }
         $this->tpl->assign("ITEM", $item);
         $this->tpl->parse('content.item');
     }
     return true;
 }
Example #29
0
 /**
  * main action
  */
 public function mainAction()
 {
     header('Content-Type: text/xml; charset=UTF-8');
     require_once 'models/common/common_node.php';
     $Node = new common_node();
     require_once 'models/ecommerce/ecommerce_product.php';
     $Product = new ecommerce_product();
     require_once 'models/ecommerce/ecommerce_product_image.php';
     $Image = new ecommerce_product_image();
     $products = $Product->getProductList();
     //print_r($products);exit;
     $this->tpl->assign('ITEM_TYPE', 'new');
     //new or bazaar
     $this->tpl->assign('DUES', 0);
     //poplatky mimo postovneho
     $this->tpl->assign('DELIVERY_DATE', 1);
     //doba expedice
     $this->tpl->assign('TOLLFREE', 0);
     foreach ($products as $p) {
         //get product detail URL
         $current = $Product->findProductInNode($p['id']);
         $product_node_data = $current[0];
         $page_id = $product_node_data['id'];
         $p['url'] = "http://{$_SERVER['HTTP_HOST']}" . $Node->getSeoURL($page_id);
         //description
         $p['description'] = html_entity_decode(strip_tags($p['description']), ENT_QUOTES, 'UTF-8');
         //image
         $images = $Image->listing("role = 'main' AND node_id=" . $p['id'], "priority DESC, id ASC", '0,1');
         $this->tpl->assign('IMAGE_PRODUCT', "http://{$_SERVER['HTTP_HOST']}/image/{$images[0]['src']}");
         //assign to template
         $this->tpl->assign('PRODUCT', $p);
         //variety list
         if (is_array($p['variety'])) {
             foreach ($p['variety'] as $v) {
                 //$v['description'] = html_entity_decode(strip_tags($v['description']));
                 $this->tpl->assign('VARIETY', $v);
                 $this->tpl->assign('PRICE', $v['price']['value']);
                 if ($v['publish'] == 1) {
                     $this->tpl->parse("content.item_product.item_variety");
                 }
             }
         }
         if ($p['publish'] == 1) {
             $this->tpl->parse("content.item_product");
         }
     }
     return true;
 }
Example #30
0
 /**
  * main action
  */
 public function mainAction()
 {
     /**
      * node_id is mandatory input
      */
     if (is_numeric($this->GET['node_id'])) {
         $node_id = $this->GET['node_id'];
     } else {
         msg("menu_prevnext: missing node_id", 'error');
         return false;
     }
     /**
      * get detail and list
      */
     $Node = new common_node();
     $first_parent_type_page_node_id = $Node->getParentPageId($node_id);
     $parent_page_detail = $Node->getDetail($first_parent_type_page_node_id);
     $current_node_detail = $Node->getDetail($node_id);
     if ($current_node_detail['node_group'] == 'page') {
         // the specific node_id is page type
         $current_page_detail = $current_node_detail;
         $parent_page_detail = $Node->getDetail($Node->getParentPageId($current_page_detail['parent']));
     } else {
         // we need to first parent type page
         $current_page_detail = $parent_page_detail;
         $parent_page_detail = $Node->getDetail($current_page_detail['parent']);
     }
     $siblings = $Node->listing("parent = {$current_page_detail['parent']} AND node_group = 'page' AND publish = 1", 'priority DESC, id ASC');
     if (is_array($siblings)) {
         /**
          * find prev/next node
          */
         foreach ($siblings as $k => $item) {
             if ($item['id'] == $current_page_detail['id']) {
                 $prev_node = $siblings[$k - 1];
                 $next_node = $siblings[$k + 1];
                 break;
             }
         }
         /**
          * cycle
          */
         if (!is_array($prev_node)) {
             $count = count($siblings);
             $prev_node = $siblings[$count - 1];
         }
         if (!is_array($next_node)) {
             $next_node = $siblings[0];
         }
     }
     /**
      * assign
      */
     $this->tpl->assign('PREV', $prev_node);
     $this->tpl->assign('ALL', $parent_page_detail);
     $this->tpl->assign('NEXT', $next_node);
     return true;
 }