Пример #1
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;
 }
Пример #2
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;
 }
Пример #3
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;
    }
Пример #4
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;
 }
Пример #5
0
 /**
  * main action
  */
 public function mainAction()
 {
     /**
      * initialize
      */
     require_once 'models/common/common_node.php';
     $Node = new common_node();
     /**
      * get detail
      */
     $node_detail = $Node->getDetail($this->GET['id']);
     /**
      * other data (attributes) list
      */
     if (is_array($node_detail['other_data'])) {
         foreach ($node_detail['other_data'] as $key => $value) {
             $note['key'] = $key;
             $note['value'] = $value;
             $this->tpl->assign('OTHER_DATA', $note);
             $allow_to_add_more = true;
             // we curently support editing only for scalar values
             if (is_array($value)) {
                 $allow_to_add_more = false;
                 // don't allow editing
                 $this->tpl->parse('content.other_data.item_noneditable');
             } else {
                 if ($note['key'] != '') {
                     $this->tpl->parse('content.other_data.item_editable');
                 }
             }
         }
         if ($allow_to_add_more) {
             $this->tpl->parse('content.add');
         }
         if (count($node_detail['other_data']) > 0) {
             $this->tpl->parse('content.other_data');
         }
     }
     return true;
 }
Пример #6
0
 /**
  * main action
  */
 public function mainAction()
 {
     /**
      * input - selected blog
      */
     $blog_node_id = $this->GET['blog_node_id'];
     /**
      * create objects
      */
     $Conf = new common_configuration();
     $Node = new common_node();
     /**
      *  list all id_map-blog* configuration options
      */
     $conf = $Conf->listing("object = 'common_node' AND property LIKE 'id_map-blog%'");
     if (is_array($conf) && count($conf) > 0) {
         foreach ($conf as $item) {
             $id = (int) $item['value'];
             $list[$id] = $id;
         }
     } else {
         $node_conf = $Node::initConfiguration();
         $default_blog_node_id = (int) $node_conf['id_map-blog'];
         $list = array($default_blog_node_id => $default_blog_node_id);
     }
     /**
      * parse dropdown
      */
     if (count($list) > 0) {
         foreach ($list as $id) {
             $node = $Node->getDetail($id);
             $this->tpl->assign('NODE', $node);
             $this->tpl->assign('SELECTED', $id == $blog_node_id ? 'selected="selected"' : '');
             $this->tpl->parse('content.select.item');
         }
         $this->tpl->parse('content.select');
     }
     return true;
 }
Пример #7
0
 /**
  * main action
  */
 public function mainAction()
 {
     require_once 'models/common/common_node.php';
     if (!is_numeric($this->GET['id'])) {
         msg('node_child: id is not numeric', 'error');
         return false;
     }
     $Node = new common_node();
     $node_detail = $Node->getDetail($this->GET['id']);
     if (!is_array($node_detail)) {
         msg("node_child: Node not found", 'error');
         return false;
     }
     /**
      * set node group as parent if not provided
      */
     if ($this->GET['node_group'] != '') {
         $this->tpl->assign('NODE_GROUP', $this->GET['node_group']);
     } else {
         $this->tpl->assign('NODE_GROUP', $node_detail['node_group']);
     }
     $this->tpl->assign("NODE", $node_detail);
     //get children
     $children = $Node->getChildren($node_detail['id']);
     if (is_array($children) && count($children) > 0) {
         foreach ($children as $child) {
             if ($child['publish'] == 0) {
                 $child['class'] = 'disabled';
             }
             $this->tpl->assign("CHILD", $child);
             $this->tpl->parse('content.children.item');
         }
         $this->tpl->parse('content.children');
     } else {
         $this->tpl->parse('content.empty');
     }
     return true;
 }
Пример #8
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;
 }