Esempio n. 1
0
 public function new_button($type, $label, $href)
 {
     if ($this->fullscreen_table) {
         Base_ActionBarCommon::add($type, $label, $href);
     } else {
         if (!file_exists($type)) {
             $type = Base_ThemeCommon::get_template_file(Base_ActionBar::module_name(), 'icons/' . $type . '.png');
         }
         $this->more_add_button_stuff .= '<a class="record_browser_button" id="Base_ActionBar" ' . $href . '>' . '<img src="' . $type . '">' . '<div style="display:inline-block;position: relative;top:-8px;">' . $label . '</div>' . '</a>';
     }
 }
Esempio n. 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();
 }