Ejemplo n.º 1
0
 /**
  * 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;
 }
Ejemplo n.º 2
0
 /**
  * get taxonomy related to node
  */
 public function getNodeRelatedTaxonomy($node_data)
 {
     if (!is_array($node_data)) {
         return false;
     }
     require_once 'models/common/common_node.php';
     $Node = new common_node();
     $related_taxonomy = $Node->getRelatedTaxonomy($node_data['id']);
     return $related_taxonomy;
 }
Ejemplo n.º 3
0
 /**
  * main action
  */
 public function mainAction()
 {
     /**
      * initialize
      */
     require_once 'models/common/common_node.php';
     require_once 'models/common/common_image.php';
     $Node = new common_node();
     $Image = new common_image();
     /**
      * find node id
      */
     if (is_numeric($this->GET['id'])) {
         $id = $this->GET['id'];
     } else {
         $id = $Node->conf['id_map-blog'];
     }
     /**
      * set header 
      */
     header('Content-Type: text/xml; charset=UTF-8');
     // flash in IE with SSL dont like Cache-Control: no-cache and Pragma: no-coche
     header("Cache-Control: ");
     header("Pragma: ");
     /**
      * Initialize pagination variables
      */
     if (is_numeric($this->GET['limit_from'])) {
         $from = $this->GET['limit_from'];
     } else {
         $from = 0;
     }
     if (is_numeric($this->GET['limit_per_page'])) {
         $per_page = $this->GET['limit_per_page'];
     } else {
         $per_page = 25;
     }
     $limit = "{$from},{$per_page}";
     /**
      * latest date
      */
     $rss_date = date('r', time());
     $this->tpl->assign("RSS_DATE", $rss_date);
     /**
      * check
      */
     if (!is_numeric($id)) {
         msg('export rss: id is not numeric', 'error');
         return false;
     }
     /**
      * process
      */
     $node_data = $Node->getDetail($id);
     $channel_taxonomy_labels = array();
     if ($node_data['publish'] == 1) {
         $this->tpl->assign('NODE', $node_data);
         $taxonomy_filter = '';
         if (is_numeric($this->GET['taxonomy_tree_id']) && $this->GET['taxonomy_tree_id'] > 0) {
             $taxonomy_filter = " AND id IN (SELECT node_id FROM common_node_taxonomy WHERE taxonomy_tree_id = {$this->GET['taxonomy_tree_id']})";
         }
         $children = $Node->listing("parent = {$id} AND publish = 1 AND node_group='page' {$taxonomy_filter}", "created DESC", $limit);
         foreach ($children as $c) {
             /**
              * create public link
              */
             $link = $Node->getSeoURL($c['id']);
             $c['url'] = "http://{$_SERVER['HTTP_HOST']}{$link}";
             /**
              * format date
              */
             $c['rss_date'] = date('r', strtotime($c['created']));
             /**
              * get categories
              */
             $taxonomy_list = $Node->getRelatedTaxonomy($c['id']);
             foreach ($taxonomy_list as $taxonomy) {
                 $this->tpl->assign('CATEGORY', $taxonomy);
                 $this->tpl->parse('content.item.category');
                 $channel_taxonomy_labels[$taxonomy['label']['title']] = true;
             }
             /**
              * add image (not part of RSS spec)
              */
             $c['image'] = $this->processImage($Image->getTeaserImageForNodeId($c['id']));
             /**
              * assign
              */
             $this->tpl->assign('CHILD', $c);
             if ($c['image']) {
                 $this->tpl->parse("content.item.image");
             }
             $this->tpl->parse("content.item");
         }
     }
     // parse channel category list
     $i = 0;
     foreach ($channel_taxonomy_labels as $label => $item) {
         if ($i + 1 < count($channel_taxonomy_labels)) {
             $label = $label . "/";
         }
         $this->tpl->assign('CATEGORY', $label);
         $this->tpl->parse('content.category');
         $i++;
     }
     return true;
 }