예제 #1
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;
 }
예제 #3
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;
 }
예제 #4
0
 /**
  * main action
  */
 public function mainAction()
 {
     require_once 'models/common/common_node.php';
     require_once 'models/ecommerce/ecommerce_recipe.php';
     $Node = new common_node();
     $Recipe = new ecommerce_recipe();
     $recipe_id = $this->GET['id'];
     /**
      * find recipe homepage
      */
     $recipe_homepage = $Recipe->getRecipeHomepage($recipe_id);
     /**
      * allow to insert new
      */
     if (!is_array($recipe_homepage) && !is_numeric($this->GET['add_to_parent'])) {
         $this->tpl->parse('content.not_exists');
     }
     /**
      * move page if requested
      */
     if (is_numeric($this->GET['add_to_parent'])) {
         if (is_array($recipe_homepage)) {
             //moving
             $recipe_homepage = $this->moveRecipeNode($recipe_id, $this->GET['add_to_parent']);
         } else {
             //insert new
             $recipe_homepage = $this->insertNewRecipeToNode($recipe_id, $this->GET['add_to_parent']);
         }
     }
     /**
      * display recipe homepage detail
      */
     if (is_array($recipe_homepage)) {
         //parent detail
         $parent_detail = $Node->detail($recipe_homepage['parent']);
         $this->tpl->assign("PARENT_DETAIL", $parent_detail);
         //breadcrumb
         $_Onxshop_Request = new Onxshop_Request("component/breadcrumb~id={$recipe_homepage['id']}:create_last_link=1~");
         $this->tpl->assign('BREADCRUMB', $_Onxshop_Request->getContent());
         //children node list
         $_Onxshop_Request = new Onxshop_Request("bo/component/node_list~id={$recipe_homepage['id']}:node_group=content~");
         $this->tpl->assign('NODE_LIST', $_Onxshop_Request->getContent());
         //parse
         $this->tpl->parse('content.recipe_node');
     }
     return true;
 }
예제 #5
0
 /**
  * main action
  */
 public function mainAction()
 {
     // get selected store for detail
     $node_id = (int) $this->GET['node_id'];
     if ($node_id > 0) {
         $Node = new common_node();
         $node = $Node->detail($node_id);
         $siblings = $Node->listing("node_group = 'page' AND node_controller = 'store' AND content ~ '[0-9]+' AND parent = {$node['parent']}");
         if (count($siblings) > 0) {
             foreach ($siblings as $i => $sibling) {
                 $column = $i % 3 + 1;
                 $this->tpl->assign("STORE", $sibling);
                 $this->tpl->parse("content.list.column{$column}");
             }
             $this->tpl->parse("content.list");
         }
     }
     return true;
 }
예제 #6
0
 /**
  * main action
  */
 public function mainAction()
 {
     if (is_numeric($this->GET['id'])) {
         $node_id = $this->GET['id'];
     } else {
         msg('node_edit: node_id is not numeric', 'error');
         return false;
     }
     require_once 'models/common/common_node.php';
     $Node = new common_node();
     $node_data = $Node->detail($node_id);
     $this->tpl->assign("NODE", $node_data);
     $_SESSION['active_pages'] = $Node->getActiveNodes($node_id, array('page', 'container'));
     $_SESSION['full_path'] = $Node->getFullPath($node_id);
     if ($_POST['node']['node_controller'] != '') {
         $node_controller = $_POST['node']['node_controller'];
     } else {
         $node_controller = $node_data['node_controller'];
     }
     $controller = "bo/node/{$node_data['node_group']}/{$node_controller}";
     if (getTemplateDir($controller . ".html") == '') {
         $controller_html = "bo/node/{$node_data['node_group']}/default";
     } else {
         $controller_html = $controller;
     }
     if (file_exists(ONXSHOP_DIR . "controllers/{$controller}.php") || file_exists(ONXSHOP_PROJECT_DIR . "controllers/{$controller}.php")) {
         $controller_php = $controller;
     } else {
         $controller_php = "bo/node/{$node_data['node_group']}/default";
     }
     $_Onxshop_Request = new Onxshop_Request("{$controller_php}@{$controller_html}&id={$node_id}&orig={$this->GET['orig']}&popup={$this->GET['popup']}", $this);
     $this->setContent($_Onxshop_Request->getContent());
     $this->tpl->assign("SUB_CONTENT", $this->content);
     if ($this->GET['ajax'] == 0) {
         $this->tpl->parse('content.form');
     }
     return true;
 }
예제 #7
0
 /**
  * main action
  */
 public function mainAction()
 {
     /**
      * create objects
      */
     require_once 'models/common/common_node.php';
     require_once 'models/ecommerce/ecommerce_product_to_product.php';
     $Node = new common_node();
     $PtP = new ecommerce_product_to_product();
     /**
      * Set variables
      */
     if (is_numeric($this->GET['product_node_id'])) {
         $product_node_data = $Node->detail($this->GET['product_node_id']);
         $product_id = $product_node_data['content'];
     } else {
         if (is_numeric($this->GET['id'])) {
             $product_id = $this->GET['id'];
         }
     }
     if (is_numeric($this->GET['limit'])) {
         $limit = $this->GET['limit'];
     } else {
         $limit = 5;
     }
     /**
      * relation type
      */
     switch ($this->GET['type']) {
         case 'static':
             $type = 'static';
             $this->tpl->assign("TITLE", I18N_RELATED_PRODUCTS_STATIC);
             break;
         case 'dynamic':
         default:
             $type = 'dynamic';
             $this->tpl->assign("TITLE", I18N_RELATED_PRODUCTS_DYNAMIC);
             break;
     }
     /**
      * template
      */
     switch ($this->GET['product_list_template']) {
         case '2columns':
             $product_list_template = 'product_list_2columns';
             break;
         case '4columns':
             $product_list_template = 'product_list_4columns';
             break;
         case '3columns':
         default:
             $product_list_template = 'product_list_3columns';
             break;
     }
     /**
      * listing
      */
     if (is_numeric($product_id)) {
         $related = $PtP->getRelatedProduct($product_id, $limit, $type);
         /**
          * Pass product_id_list to product_list controller
          */
         if (is_array($related) && count($related) > 0) {
             /**
              * prepare HTTP query for product_list component
              */
             $related_list['product_id_list'] = $related;
             $query = http_build_query($related_list, '', ':');
             /**
              * check request for image width and customize query in that case
              */
             if (is_numeric($this->GET['image_width'])) {
                 $image_width = $this->GET['image_width'];
                 $query = $query . ":image_width={$image_width}";
             }
             /**
              * call controller
              */
             $_Onxshop_Request = new Onxshop_Request("component/ecommerce/{$product_list_template}~{$query}~");
             $this->tpl->assign('ITEMS', $_Onxshop_Request->getContent());
             $this->tpl->parse('content.product_related');
         }
     }
     return true;
 }
예제 #8
0
 /**
  * main action
  */
 public function mainAction()
 {
     require_once 'models/common/common_node.php';
     $Node = new common_node();
     if (is_numeric($this->GET['id'])) {
         $delete_id = $this->GET['id'];
     } else {
         return false;
     }
     //delete
     if ($this->GET['delete'] && is_numeric($delete_id)) {
         $id_map = $Node->getIdMap();
         /**
          * create confirmation code
          */
         $confirmation_code = md5($delete_id . session_id());
         $this->tpl->assign('CONFIRMATION_CODE', $confirmation_code);
         /**
          * safety check we are not trying to delete some core page
          */
         if (!array_search($delete_id, $id_map)) {
             $node_data = $Node->detail($delete_id);
             if (!is_array($node_data)) {
                 msg("Content ID {$delete_id} does not exists", 'error');
                 return false;
             }
             if ($this->GET['confirm']) {
                 //delete only if confirmation code match
                 if ($this->GET['confirm'] === $confirmation_code) {
                     if ($Node->moveToBin($delete_id)) {
                         msg("{$node_data['node_group']} \"{$node_data['title']}\" (id={$node_data['id']}) has been deleted");
                         //if it was a "page", than go to parent page
                         if ($this->GET['ajax'] == 0) {
                             if ($node_data['node_group'] == 'page') {
                                 onxshopGoTo("/page/{$node_data['parent']}");
                             } else {
                                 onxshopGoTo($_SESSION['last_diff'], 2);
                             }
                         }
                     } else {
                         msg("Can't delete!", 'error');
                     }
                 } else {
                     msg("node_delete: incorrect confirmation code", 'error');
                 }
             } else {
                 //get children
                 $children = $Node->listing("parent = {$delete_id}");
                 foreach ($children as $child) {
                     $this->tpl->assign("CHILD", $child);
                     $this->tpl->parse('content.confirm.children.item');
                 }
                 if (count($children) > 0) {
                     $this->tpl->parse('content.confirm.children');
                 }
                 //get linked as shared content
                 $node_data = $Node->detail($delete_id);
                 $this->tpl->assign("NODE", $node_data);
                 $shared_linked = $Node->getShared($delete_id);
                 foreach ($shared_linked as $linked) {
                     $this->tpl->assign("LINKED", $linked);
                     $this->tpl->parse('content.confirm.linked.item');
                 }
                 if (count($shared_linked) > 0) {
                     $this->tpl->parse('content.confirm.linked');
                 }
                 $this->tpl->parse('content.confirm');
             }
         } else {
             msg("This can't be deleted", 'error');
         }
     }
     return true;
 }
예제 #9
0
 /**
  * display detail for node
  */
 function displayNodeInfo($relations_list)
 {
     require_once 'models/common/common_node.php';
     $Node = new common_node();
     foreach ($relations_list as $image_detail) {
         $node_detail = $Node->detail($image_detail['node_id']);
         if ($node_detail['node_group'] != 'page') {
             $image_detail['page_id'] = $Node->getParentPageId($image_detail['node_id']);
         } else {
             $image_detail['page_id'] = $image_detail['node_id'];
         }
         $this->tpl->assign('NODE_DETAIL', $node_detail);
         $this->tpl->assign('IMAGE_DETAIL', $image_detail);
         $this->tpl->parse('content.usage.node');
     }
 }
예제 #10
0
 /**
  * get request
  */
 function getRequest($node_id)
 {
     require_once 'models/common/common_node.php';
     $Node = new common_node();
     if ($Node->detail($node_id)) {
         $append = ".node~id={$node_id}~";
         if ($node_id == $this->conf['404_id']) {
             $append = "{$append}.sys/404";
         }
     } else {
         $append = ".node~id=" . $this->conf['404_id'] . "~.sys/404";
     }
     if (Onxshop_Bo_Authentication::getInstance()->isAuthenticated()) {
         //hack to pass _SESSION.fe_edit_mode even before it's called again from fe_edit
         //consider moving this to $Bootstrap->initPreAction
         //probably this whole block, _GET shouldn't be here!
         $_Onxshop_Request = new Onxshop_Request('bo/component/fe_edit_mode');
         $request = ONXSHOP_DEFAULT_TYPE . "~id={$node_id}~.bo/fe_edit~id={$node_id}~." . ONXSHOP_MAIN_TEMPLATE . "~id={$node_id}~{$append}";
     } else {
         $request = ONXSHOP_DEFAULT_LAYOUT . "~id={$node_id}~" . "{$append}";
     }
     return $request;
 }