Exemple #1
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;
 }
Exemple #2
0
 /**
  * set active pages
  */
 public function setActivePages()
 {
     require_once 'models/common/common_node.php';
     $Node = new common_node();
     $_SESSION['active_pages'] = $Node->getActivePages($this->GET['id']);
     $_SESSION['full_path'] = $Node->getFullPath($this->GET['id']);
 }
 /**
  * get configuration
  * 
  * @param integer $node_id
  * ID of node
  * 0 for default configuration
  * 
  * @return array
  * configuration
  * 
  * @see getDefaultCoreValues
  */
 function getConfiguration($node_id = 0)
 {
     if (!is_numeric($node_id)) {
         msg("common_configuration.getConfiguration: node_id is not numeric", 'error');
         $node_id = 0;
     }
     /**
      * Cache configuration wihtin a single HTTP request
      */
     if (!self::$localCache) {
         self::$localCache = array();
         $list = $this->listing();
         foreach ($list as $item) {
             self::$localCache[$item['node_id']][] = $item;
         }
     }
     $conf = array();
     if (is_array(self::$localCache[$node_id])) {
         foreach (self::$localCache[$node_id] as $c) {
             $conf[$c['object']][$c['property']] = $c['value'];
         }
     }
     /**
      * default core values (only for root node)
      */
     if ($node_id == 0) {
         $conf = $this->getDefaultCoreValues($conf);
     } else {
         /**
          * Try to inherit configuration from parent nodes
          */
         require_once 'models/common/common_node.php';
         $Node = new common_node();
         $path = $Node->getFullPath($node_id);
         for ($i = 1; $i < count($path); $i++) {
             $parent_id = $path[$i];
             if (is_array(self::$localCache[$parent_id])) {
                 foreach (self::$localCache[$parent_id] as $c) {
                     if (!isset($conf[$c['object']][$c['property']]) && $c['apply_to_children']) {
                         $conf[$c['object']][$c['property']] = $c['value'];
                     }
                 }
             }
         }
     }
     return $conf;
 }