Example #1
0
 public static function get_options()
 {
     static $user;
     if (isset(self::$options) && $user == Acl::get_user()) {
         return self::$options;
     }
     $user = Acl::get_user();
     self::$options = array();
     $modules_menu = array();
     $menus = Base_MenuCommon::get_menus();
     //ksort($menus);
     foreach ($menus as $name => $ret) {
         if ($name == 'Base_Admin') {
             continue;
         }
         if ($name == Base_Menu_QuickAccessCommon::module_name()) {
             continue;
         }
         Base_MenuCommon::add_default_menu($ret, $name);
         $modules_menu = array_merge($modules_menu, self::check_for_links('', $ret, $name));
     }
     usort($modules_menu, function ($a, $b) {
         return strcmp($a['label'], $b['label']);
     });
     self::$options =& $modules_menu;
     return self::$options;
 }
Example #2
0
 /**
  * Displays action bar.
  */
 public function body()
 {
     $this->help('ActionBar basics', 'main');
     $icons = Base_ActionBarCommon::get();
     //sort
     usort($icons, array($this, 'compare'));
     //translate
     foreach ($icons as &$i) {
         $description = $i['description'];
         if ($i['description']) {
             $t = Utils_TooltipCommon::open_tag_attrs($description);
         } else {
             $t = '';
         }
         $i['open'] = '<a ' . $i['action'] . ' ' . $t . '>';
         $i['close'] = '</a>';
         $i['helpID'] = 'ActionBar_' . $i['icon'];
         if (strpos($i['icon'], '/') !== false && file_exists($i['icon'])) {
             $i['icon_url'] = $i['icon'];
             unset($i['icon']);
         }
         //if (isset(Base_ActionBarCommon::$available_icons[$i['icon']]))
         //	$i['icon'] = Base_ThemeCommon::get_template_file('Base_ActionBar','icons/'.$i['icon'].'.png');
     }
     $launcher = array();
     if (Base_AclCommon::is_user()) {
         $opts = Base_Menu_QuickAccessCommon::get_options();
         if (!empty($opts)) {
             self::$launchpad = array();
             foreach ($opts as $k => $v) {
                 if (Base_ActionBarCommon::$quick_access_shortcuts && Base_User_SettingsCommon::get(Base_Menu_QuickAccessCommon::module_name(), $v['name'] . '_d')) {
                     $ii = array();
                     $trimmed_label = trim(substr(strrchr($v['label'], ':'), 1));
                     $ii['label'] = $trimmed_label ? $trimmed_label : $v['label'];
                     $ii['description'] = $v['label'];
                     $arr = $v['link'];
                     if (isset($arr['__url__'])) {
                         $ii['open'] = '<a href="' . $arr['__url__'] . '" target="_blank">';
                     } else {
                         $ii['open'] = '<a ' . Base_MenuCommon::create_href($this, $arr) . '>';
                     }
                     $ii['close'] = '</a>';
                     if (isset($v['link']['__icon__'])) {
                         $icon = Base_ThemeCommon::get_template_file($v['module'], $v['link']['__icon__']);
                     } else {
                         $icon = Base_ThemeCommon::get_template_file($v['module'], 'icon.png');
                     }
                     if (!$icon) {
                         $icon = Base_ThemeCommon::get_template_file($this->get_type(), 'default_icon.png');
                     }
                     $ii['icon'] = $icon;
                     $launcher[] = $ii;
                 }
                 if (Base_User_SettingsCommon::get(Base_Menu_QuickAccessCommon::module_name(), $v['name'] . '_l')) {
                     $ii = array();
                     $trimmed_label = trim(substr(strrchr($v['label'], ':'), 1));
                     $ii['label'] = $trimmed_label ? $trimmed_label : $v['label'];
                     $ii['description'] = $v['label'];
                     $arr = $v['link'];
                     if (isset($arr['__url__'])) {
                         $ii['open'] = '<a href="' . $arr['__url__'] . '" target="_blank" onClick="actionbar_launchpad_deactivate()">';
                     } else {
                         $ii['open'] = '<a onClick="actionbar_launchpad_deactivate();' . Base_MenuCommon::create_href_js($this, $arr) . '" href="javascript:void(0)">';
                     }
                     $ii['close'] = '</a>';
                     if (isset($v['link']['__icon__'])) {
                         $icon = Base_ThemeCommon::get_template_file($v['module'], $v['link']['__icon__']);
                     } else {
                         $icon = Base_ThemeCommon::get_template_file($v['module'], 'icon.png');
                     }
                     if (!$icon) {
                         $icon = Base_ThemeCommon::get_template_file($this->get_type(), 'default_icon.png');
                     }
                     $ii['icon'] = $icon;
                     self::$launchpad[] = $ii;
                 }
             }
         }
     }
     //display
     $th = $this->pack_module(Base_Theme::module_name());
     $th->assign('icons', $icons);
     $th->assign('launcher', array_reverse($launcher));
     $th->display();
 }
Example #3
0
 public function quick_access_menu()
 {
     $this->set_inline_display(true);
     // preparing quick access menu
     if (ModuleManager::is_installed(Base_Menu_QuickAccessCommon::module_name()) >= 0) {
         $qaccess_menu = Base_Menu_QuickAccessCommon::quick_access_menu();
         if (is_array($qaccess_menu)) {
             Base_MenuCommon::add_default_menu($qaccess_menu, Base_Menu_QuickAccessCommon::module_name());
         } else {
             $qaccess_menu = array();
         }
     } else {
         $qaccess_menu = array();
     }
     if (empty($qaccess_menu)) {
         return;
     }
     $menu_mod = $this->init_module("Utils/Menu", "horizontal");
     $this->build_menu($menu_mod, $qaccess_menu, false);
     $theme = $this->init_module(Base_Theme::module_name());
     $menu_mod->set_inline_display();
     $theme->assign('menu', $this->get_html_of_module($menu_mod));
     $theme->display();
 }
Example #4
0
 public function quick_access_menu()
 {
     $this->set_inline_display(true);
     // preparing quick access menu
     if (array_key_exists('Base_Menu_QuickAccess', ModuleManager::$modules)) {
         $qaccess_menu = Base_Menu_QuickAccessCommon::quick_access_menu();
         if (is_array($qaccess_menu)) {
             Base_MenuCommon::add_default_menu($qaccess_menu, 'Base_Menu_QuickAccess');
         } else {
             $qaccess_menu = array();
         }
     } else {
         $qaccess_menu = array();
     }
     if (empty($qaccess_menu)) {
         return;
     }
     $menu_mod = $this->init_module("Utils/Menu", "horizontal");
     $this->build_menu($menu_mod, $qaccess_menu, false);
     $theme = $this->init_module('Base/Theme');
     $menu_mod->set_inline_display();
     $theme->assign('menu', $this->get_html_of_module($menu_mod));
     $theme->display();
 }