Exemplo n.º 1
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;
    }
Exemplo n.º 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;
 }
Exemplo n.º 3
0
 /**
  * insert recipe to node
  */
 function insertNewRecipeToNode($recipe_id, $parent_id)
 {
     if (!is_numeric($recipe_id)) {
         return false;
     }
     if (!is_numeric($parent_id)) {
         return false;
     }
     $Node = new common_node();
     $Recipe = new ecommerce_recipe();
     /**
      * get recipe detail
      */
     $recipe_detail = $Recipe->detail($recipe_id);
     /**
      * prepare node data
      */
     $recipe_node['title'] = $recipe_detail['title'];
     $recipe_node['parent'] = $parent_id;
     $recipe_node['parent_container'] = 0;
     $recipe_node['node_group'] = 'page';
     $recipe_node['node_controller'] = 'recipe';
     $recipe_node['content'] = $recipe_id;
     //$recipe_node['layout_style'] = $Node->conf['page_recipe_layout_style'];
     //this need to be updated on each recipe update
     $recipe_node['priority'] = $recipe_detail['priority'];
     $recipe_node['publish'] = $recipe_detail['publish'];
     /**
      * insert node
      */
     if ($recipe_homepage = $Node->nodeInsert($recipe_node)) {
         return $recipe_homepage;
     } else {
         msg("Can't add recipe to node.");
         return false;
     }
 }
Exemplo n.º 4
0
 /**
  * insert store to node
  */
 function insertNewStoreToNode($store_id, $parent_id)
 {
     if (!is_numeric($store_id)) {
         return false;
     }
     if (!is_numeric($parent_id)) {
         return false;
     }
     $Node = new common_node();
     $Store = new ecommerce_store();
     /**
      * get store detail
      */
     $store_detail = $Store->detail($store_id);
     /**
      * prepare node data
      */
     $store_node['title'] = $store_detail['name'];
     $store_node['parent'] = $parent_id;
     $store_node['parent_container'] = 0;
     $store_node['node_group'] = 'page';
     $store_node['node_controller'] = 'store';
     $store_node['content'] = $store_id;
     //$store_node['layout_style'] = $Node->conf['page_store_layout_style'];
     //this need to be updated on each store update
     $store_node['priority'] = $store_detail['priority'];
     $store_node['publish'] = $store_detail['publish'];
     /**
      * insert node
      */
     if ($store_homepage = $Node->nodeInsert($store_node)) {
         msg("Store has been added into the node", 'ok');
         return $store_homepage;
     } else {
         msg("Can't add store to node.");
         return false;
     }
 }