Exemplo n.º 1
0
 private static function identifySubpanel($thisModuleName, $sourceModuleName)
 {
     $module = get_module_info($thisModuleName);
     require_once 'include/SubPanel/SubPanelDefinitions.php';
     $spd = new SubPanelDefinitions($module);
     $subpanelNames = $spd->get_available_tabs();
     // actually these are the displayed subpanels
     $subPanels = array();
     foreach ($subpanelNames as $key => $name) {
         $GLOBALS['log']->debug($thisModuleName . " " . $name);
         $subPanel = $spd->load_subpanel($name);
         if (!isset($subPanel->_instance_properties['collection_list'])) {
             if ($sourceModuleName == $subPanel->_instance_properties['module']) {
                 return $subPanel->_instance_properties['subpanel_name'];
             }
         }
     }
     return null;
 }
Exemplo n.º 2
0
 static function getModuleSubpanels($module)
 {
     require_once 'include/SubPanel/SubPanelDefinitions.php';
     global $beanList, $beanFiles;
     if (!isset($beanList[$module])) {
         return array();
     }
     $class = $beanList[$module];
     require_once $beanFiles[$class];
     $mod = new $class();
     $spd = new SubPanelDefinitions($mod);
     $tabs = $spd->get_available_tabs(true);
     $ret_tabs = array();
     $reject_tabs = array('history' => 1, 'activities' => 1);
     foreach ($tabs as $key => $tab) {
         foreach ($tab as $k => $v) {
             if (!isset($reject_tabs[$k])) {
                 $ret_tabs[$k] = $v;
             }
         }
     }
     return $ret_tabs;
 }
Exemplo n.º 3
0
 function getModuleSubpanels($module)
 {
     require_once 'include/SubPanel/SubPanelDefinitions.php';
     $mod = BeanFactory::getBean($module);
     if (empty($mod)) {
         return array();
     }
     $spd = new SubPanelDefinitions($mod);
     $tabs = $spd->get_available_tabs(true);
     $ret_tabs = array();
     $reject_tabs = array('history' => 1, 'activities' => 1);
     foreach ($tabs as $key => $tab) {
         foreach ($tab as $k => $v) {
             if (!isset($reject_tabs[$k])) {
                 $ret_tabs[$k] = $v;
             }
         }
     }
     return $ret_tabs;
 }
Exemplo n.º 4
0
 /**
  * return all available subpanels that belong to the list of tab modules.  You can optionally return all
  * available subpanels, and also optionally group by module (prepends the key with the bean class name).
  */
 function get_all_subpanels($return_tab_modules_only = true, $group_by_module = false)
 {
     global $moduleList, $beanFiles, $beanList, $module;
     //use tab controller function to get module list with named keys
     require_once "modules/MySettings/TabController.php";
     $modules_to_check = TabController::get_key_array($moduleList);
     //change case to match subpanel processing later on
     $modules_to_check = array_change_key_case($modules_to_check);
     // Append on the CampaignLog module, because that is where the subpanels point, not directly to Campaigns
     $modules_to_check['campaignlog'] = "CampaignLog";
     $spd = '';
     $spd_arr = array();
     //iterate through modules and build subpanel array
     foreach ($modules_to_check as $mod_name) {
         //skip if module name is not in bean list, otherwise get the bean class name
         if (!isset($beanList[$mod_name])) {
             continue;
         }
         $class = $beanList[$mod_name];
         //skip if class name is not in file list, otherwise require the bean file and create new class
         if (!isset($beanFiles[$class]) || !file_exists($beanFiles[$class])) {
             continue;
         }
         //retrieve subpanels for this bean
         require_once $beanFiles[$class];
         $bean_class = new $class();
         //create new subpanel definition instance and get list of tabs
         $spd = new SubPanelDefinitions($bean_class);
         $sub_tabs = $spd->get_available_tabs();
         //add each subpanel to array of total subpanles
         foreach ($sub_tabs as $panel_key) {
             $panel_key = strtolower($panel_key);
             $panel_module = $panel_key;
             if (isset($spd->layout_defs['subpanel_setup'][$panel_key]['module'])) {
                 $panel_module = strtolower($spd->layout_defs['subpanel_setup'][$panel_key]['module']);
             }
             //if module_only flag is set, only if it is also in module array
             if ($return_tab_modules_only && !array_key_exists($panel_module, $modules_to_check)) {
                 continue;
             }
             $panel_key_name = $panel_module;
             //group_by_key_name is set to true, then array will hold an entry for each
             //subpanel, with the module name prepended in the key
             if ($group_by_module) {
                 $panel_key_name = $class . '_' . $panel_key_name;
             }
             //add panel name to subpanel array
             $spd_arr[$panel_key_name] = $panel_module;
         }
     }
     return $spd_arr;
 }
 protected static function loadSubpanelDefs($bean)
 {
     $module = $bean->module_dir;
     if (!isset(static::$subpanelDefs[$module])) {
         static::$subpanelDefs[$module] = array();
         $spd = new SubPanelDefinitions($bean);
         $subpanelNames = $spd->get_available_tabs();
         // actually these are the displayed subpanels
         foreach ($subpanelNames as $key => $name) {
             static::$subpanelDefs[$module][$name] = $spd->load_subpanel($name);
         }
     }
     return static::$subpanelDefs[$module];
 }