/**
  * Scan all controllers with given name in the application and (loaded) module folders and collects their provided
  * tabs
  *
  * @param   string  $controllerName The name of the controllers to use for tab collection
  *
  * @return  Tabs                    A {@link Tabs} instance containing the application tabs first followed by the
  *                                  tabs provided from the modules
  */
 public static function collectControllerTabs($controllerName)
 {
     $controller = '\\Icinga\\' . Dispatcher::CONTROLLER_NAMESPACE . '\\' . $controllerName;
     $applicationTabs = $controller::createProvidedTabs();
     $moduleTabs = self::collectModuleTabs($controllerName);
     $tabs = new Tabs();
     foreach ($applicationTabs as $name => $tab) {
         $tabs->add($name, $tab);
     }
     foreach ($moduleTabs as $name => $tab) {
         // Don't overwrite application tabs if the module wants to
         if ($tabs->has($name)) {
             continue;
         }
         $tabs->add($name, $tab);
     }
     return $tabs;
 }
 /**
  * Scan all controllers with the provided name
  * in the application and (loaded) module folders and collects their provided tabs
  *
  * @param string $controller        The name of the controllers to use for tab collection
  *
  * @return Tabs                     A @see Tabs instance containing the application tabs first
  *                                  followed by the tabs provided from the modules
  */
 public static function collectControllerTabs($controller)
 {
     require_once Icinga::app()->getApplicationDir('/controllers/' . $controller . '.php');
     $applicationTabs = $controller::createProvidedTabs();
     $moduleTabs = self::collectModuleTabs($controller);
     $tabs = new Tabs();
     foreach ($applicationTabs as $name => $tab) {
         $tabs->add($name, $tab);
     }
     foreach ($moduleTabs as $name => $tab) {
         // don't overwrite application tabs if the module wants to
         if ($tabs->has($name)) {
             continue;
         }
         $tabs->add($name, $tab);
     }
     return $tabs;
 }
Esempio n. 3
0
 /**
  * Return the tab object used to navigate through this dashboard
  *
  * @return Tabs
  */
 public function getTabs()
 {
     $url = Url::fromPath('dashboard')->getUrlWithout($this->tabParam);
     if ($this->tabs === null) {
         $this->tabs = new Tabs();
         foreach ($this->panes as $key => $pane) {
             $this->tabs->add($key, array('title' => sprintf(t('Show %s', 'dashboard.pane.tooltip'), $pane->getTitle()), 'label' => $pane->getTitle(), 'url' => clone $url, 'urlParams' => array($this->tabParam => $key)));
         }
     }
     return $this->tabs;
 }
Esempio n. 4
0
 /**
  * Return the tab object used to navigate through this dashboard
  *
  * @return Tabs
  */
 public function getTabs()
 {
     $url = Url::fromRequest()->getUrlWithout($this->tabParam);
     if ($this->tabs === null) {
         $this->tabs = new Tabs();
         foreach ($this->panes as $key => $pane) {
             $this->tabs->add($key, array('title' => $pane->getTitle(), 'url' => clone $url, 'urlParams' => array($this->tabParam => $key)));
         }
     }
     return $this->tabs;
 }
Esempio n. 5
0
 /**
  * Applies the format selectio to the provided tabset
  *
  * @param   Tabs $tabs The tabs object to extend with
  *
  * @see     Tabextension::apply()
  */
 public function apply(Tabs $tabs)
 {
     foreach ($this->tabs as $tab) {
         $tabs->addAsDropdown($tab->getName(), $tab);
     }
 }
Esempio n. 6
0
 /**
  * Apply this tabextension to the provided tabs
  *
  * @param Tabs $tabs The tabbar to modify
  */
 public function apply(Tabs $tabs)
 {
     $tabs->addAsDropdown('dashboard_add', array('icon' => 'img/icons/dashboard.png', 'label' => t('Add New Pane Or Dashlet'), 'url' => Url::fromPath('dashboard/new-dashlet')));
     $tabs->addAsDropdown('dashboard_settings', array('icon' => 'img/icons/dashboard.png', 'label' => t('Settings'), 'url' => Url::fromPath('dashboard/settings')));
 }
Esempio n. 7
0
 /**
  * Applies the dashboard actions to the provided tabset
  *
  * @param   Tabs $tabs The tabs object to extend with
  */
 public function apply(Tabs $tabs)
 {
     $tabs->addAsDropdown('dashboard', array('icon' => 'dashboard', 'label' => t('Add To Dashboard'), 'url' => Url::fromPath('dashboard/new-dashlet'), 'urlParams' => array('url' => rawurlencode(Url::fromRequest()->getRelativeUrl()))));
 }
Esempio n. 8
0
 /**
  * Applies the dashboard actions to the provided tabset
  *
  * @param   Tabs $tabs The tabs object to extend with
  */
 public function apply(Tabs $tabs)
 {
     $tabs->addAsDropdown('basket', array('title' => 'URL Basket', 'url' => Url::fromPath('basket/add'), 'urlParams' => array('url' => Url::fromRequest()->getRelativeUrl())));
 }
Esempio n. 9
0
 /**
  * Applies the menu actions to the provided tabset
  *
  * @param   Tabs $tabs The tabs object to extend with
  */
 public function apply(Tabs $tabs)
 {
     $tabs->addAsDropdown('menu-entry', array('icon' => 'menu', 'label' => t('Add To Menu'), 'url' => Url::fromPath('navigation/add'), 'urlParams' => array('url' => rawurlencode(Url::fromRequest()->getRelativeUrl()))));
 }
 /**
  * Applies the dashboard actions to the provided tabset
  *
  * @param   Tabs $tabs The tabs object to extend with
  */
 public function apply(Tabs $tabs)
 {
     $tabs->addAsDropdown('dashboard', array('icon' => 'img/icons/dashboard.png', 'title' => 'Add To Dashboard', 'url' => Url::fromPath('dashboard/addurl'), 'urlParams' => array('url' => Url::fromRequest()->getRelativeUrl())));
 }