Esempio n. 1
0
 function aSubPanel($name, $instance_properties, $parent_bean, $reload = false, $original_only = false)
 {
     $this->_instance_properties = $instance_properties;
     $this->name = $name;
     $this->parent_bean = $parent_bean;
     //set language
     global $current_language;
     if (!isset($parent_bean->mbvardefs)) {
         $mod_strings = return_module_language($current_language, $parent_bean->module_dir);
     }
     $this->mod_strings = $mod_strings;
     if ($this->isCollection()) {
         $this->load_sub_subpanels();
         //load sub-panel definition.
     } else {
         if (!is_dir('modules/' . $this->_instance_properties['module'])) {
             _pstack_trace();
         }
         $def_path = 'modules/' . $this->_instance_properties['module'] . '/metadata/subpanels/' . $this->_instance_properties['subpanel_name'] . '.php';
         require $def_path;
         if (!$original_only && isset($this->_instance_properties['override_subpanel_name']) && file_exists('custom/modules/' . $this->_instance_properties['module'] . '/metadata/subpanels/' . $this->_instance_properties['override_subpanel_name'] . '.php')) {
             $cust_def_path = 'custom/modules/' . $this->_instance_properties['module'] . '/metadata/subpanels/' . $this->_instance_properties['override_subpanel_name'] . '.php';
             require $cust_def_path;
         }
         // check that the loaded subpanel definition includes a $subpanel_layout section - some, such as projecttasks/default do not...
         $this->panel_definition = array();
         if (isset($subpanel_layout)) {
             $this->panel_definition = $subpanel_layout;
         }
         $this->load_module_info();
         //load module info from the module's bean file.
     }
 }
Esempio n. 2
0
 function aSubPanel($name, $instance_properties, $parent_bean, $reload = false, $original_only = false)
 {
     $this->_instance_properties = $instance_properties;
     $this->name = $name;
     $this->parent_bean = $parent_bean;
     //set language
     global $current_language;
     if (!isset($parent_bean->mbvardefs)) {
         $mod_strings = return_module_language($current_language, $parent_bean->module_dir);
     }
     $this->mod_strings = $mod_strings;
     if ($this->isCollection()) {
         $this->canDisplay = $this->load_sub_subpanels();
         //load sub-panel definition.
     } else {
         if (!is_dir('modules/' . $this->_instance_properties['module'])) {
             _pstack_trace();
         }
         $def_path = 'modules/' . $this->_instance_properties['module'] . '/metadata/subpanels/' . $this->_instance_properties['subpanel_name'] . '.php';
         $orig_exists = is_file($def_path);
         $loaded = false;
         if ($orig_exists) {
             require $def_path;
             $loaded = true;
         }
         if (is_file("custom/{$def_path}") && (!$original_only || !$orig_exists)) {
             require "custom/{$def_path}";
             $loaded = true;
         }
         if (!$original_only && isset($this->_instance_properties['override_subpanel_name']) && file_exists('custom/modules/' . $this->_instance_properties['module'] . '/metadata/subpanels/' . $this->_instance_properties['override_subpanel_name'] . '.php')) {
             $cust_def_path = 'custom/modules/' . $this->_instance_properties['module'] . '/metadata/subpanels/' . $this->_instance_properties['override_subpanel_name'] . '.php';
             require $cust_def_path;
             $loaded = true;
         }
         if (!$loaded) {
             $GLOBALS['log']->fatal("Failed to load original or custom subpanel data for {$name} in {$def_path}");
             $this->canDisplay = false;
         }
         // load module info from the module's bean file
         $this->load_module_info();
         // check that the loaded subpanel definition includes a $subpanel_layout section - some, such as
         // projecttasks/default do not...
         $this->panel_definition = array();
         if (isset($subpanel_layout) && is_array($subpanel_layout)) {
             $this->set_panel_definition($subpanel_layout);
         }
     }
 }
 function __construct($name, $instance_properties, $parent_bean, $reload = false, $original_only = false, $search_query = '', $collections = array())
 {
     $this->_instance_properties = $instance_properties;
     if (isset($instance_properties['collection_list'])) {
         $this->base_collection_list = $instance_properties['collection_list'];
     }
     if (!empty($collections) && isset($instance_properties['collection_list'])) {
         foreach ($instance_properties['collection_list'] as $cname => $value) {
             if (!in_array($value['module'], $collections)) {
                 unset($instance_properties['collection_list'][$cname]);
             }
         }
     }
     if (isset($instance_properties['type']) && $instance_properties['type'] != 'collection' && !empty($collections)) {
         $instance = $this->_instance_properties;
         $BreakDownCollections = $collections;
         $newTable = strtolower($instance['module']);
         $collection = array_shift(array_values($BreakDownCollections));
         $table = strtolower($collection['module']);
         //tasks or contacts.
         $search_query = str_replace($table, $newTable, $search_query);
     }
     $this->search_query = $search_query;
     $this->name = $name;
     $this->parent_bean = $parent_bean;
     //set language
     global $current_language;
     if (!isset($parent_bean->mbvardefs)) {
         $mod_strings = return_module_language($current_language, $parent_bean->module_dir);
     }
     $this->mod_strings = $mod_strings;
     if ($this->isCollection()) {
         $this->canDisplay = $this->load_sub_subpanels();
         //load sub-panel definition.
     } else {
         if (!is_dir('modules/' . $this->_instance_properties['module'])) {
             _pstack_trace();
         }
         $def_path = 'modules/' . $this->_instance_properties['module'] . '/metadata/subpanels/' . $this->_instance_properties['subpanel_name'] . '.php';
         $orig_exists = is_file($def_path);
         $loaded = false;
         if ($orig_exists) {
             require $def_path;
             $loaded = true;
         }
         if (is_file("custom/{$def_path}") && (!$original_only || !$orig_exists)) {
             require "custom/{$def_path}";
             $loaded = true;
         }
         if (!$original_only && isset($this->_instance_properties['override_subpanel_name']) && file_exists('custom/modules/' . $this->_instance_properties['module'] . '/metadata/subpanels/' . $this->_instance_properties['override_subpanel_name'] . '.php')) {
             $cust_def_path = 'custom/modules/' . $this->_instance_properties['module'] . '/metadata/subpanels/' . $this->_instance_properties['override_subpanel_name'] . '.php';
             require $cust_def_path;
             $loaded = true;
         }
         if (!$loaded) {
             $GLOBALS['log']->fatal("Failed to load original or custom subpanel data for {$name} in {$def_path}");
             $this->canDisplay = false;
         }
         // load module info from the module's bean file
         $this->load_module_info();
         // check that the loaded subpanel definition includes a $subpanel_layout section - some, such as
         // projecttasks/default do not...
         $this->panel_definition = array();
         if (isset($subpanel_layout) && is_array($subpanel_layout)) {
             $this->set_panel_definition($subpanel_layout);
         }
     }
 }