Exemplo n.º 1
0
 function getTabs($showTabs = true, $selectedGroup = '')
 {
     global $current_user;
     //get all the "tabs" - this actually means all the subpanels available for display within a tab
     $tabs = $this->subpanel_definitions->get_available_tabs();
     if (!empty($selectedGroup)) {
         // Bug #44344 : Custom relationships under same module only show once in subpanel tabs
         // use object property instead new object to have ability run unit test (can override subpanel_definitions)
         $objSubPanelTilesTabs = new SubPanelTilesTabs($this->focus);
         $tabs = $objSubPanelTilesTabs->getTabs($tabs, $showTabs, $selectedGroup);
         unset($objSubPanelTilesTabs);
         return $tabs;
     } else {
         // see if user current user has custom subpanel layout
         $tabs = SubPanelTilesTabs::applyUserCustomLayoutToTabs($tabs);
         /* Check if the preference is set now,
          * because there's no point in executing this code if
          * we aren't going to render anything.
          */
         $subpanelLinksPref = $current_user->getPreference('subpanel_links');
         if (!isset($subpanelLinksPref)) {
             $subpanelLinksPref = $GLOBALS['sugar_config']['default_subpanel_links'];
         }
         if ($showTabs && $subpanelLinksPref) {
             require_once 'include/SubPanel/SugarTab.php';
             $sugarTab = new SugarTab();
             $displayTabs = array();
             foreach ($tabs as $tab) {
                 $displayTabs[] = array('key' => $tab, 'label' => translate($this->subpanel_definitions->layout_defs['subpanel_setup'][$tab]['title_key']));
                 //echo '<td nowrap="nowrap"><a class="subTabLink" href="#' . $tab . '">' .  translate($this->subpanel_definitions->layout_defs['subpanel_setup'][$tab]['title_key']) .  '</a></td><td> | </td>';
             }
             $sugarTab->setup(array(), array(), $displayTabs);
             $sugarTab->display();
         }
         //echo '<td width="100%">&nbsp;</td></tr></table>';
     }
     return $tabs;
 }
 function getTabs($showTabs = true, $selectedGroup = '')
 {
     global $current_user;
     //get all the tabs
     $tabs = $this->subpanel_definitions->get_available_tabs();
     if (!empty($selectedGroup)) {
         return SubPanelTilesTabs::getTabs($tabs, $showTabs, $selectedGroup);
     } else {
         // see if user current user has custom subpanel layout
         $tabs = SubPanelTilesTabs::applyUserCustomLayoutToTabs($tabs);
         /* Check if the preference is set now,
          * because there's no point in executing this code if
          * we aren't going to render anything. 
          */
         $subpanelLinksPref = $current_user->getPreference('subpanel_links');
         if (!isset($subpanelLinksPref)) {
             $subpanelLinksPref = $GLOBALS['sugar_config']['default_subpanel_links'];
         }
         if ($showTabs && $subpanelLinksPref) {
             require_once 'include/SubPanel/SugarTab.php';
             $sugarTab = new SugarTab();
             $displayTabs = array();
             foreach ($tabs as $tab) {
                 $displayTabs[] = array('key' => $tab, 'label' => translate($this->subpanel_definitions->layout_defs['subpanel_setup'][$tab]['title_key']));
                 //echo '<td nowrap="nowrap"><a class="subTabLink" href="#' . $tab . '">' .  translate($this->subpanel_definitions->layout_defs['subpanel_setup'][$tab]['title_key']) .  '</a></td><td> | </td>';
             }
             $sugarTab->setup(array(), array(), $displayTabs);
             $sugarTab->display();
         }
         //echo '<td width="100%">&nbsp;</td></tr></table>';
     }
     return $tabs;
 }