/**
  * Load all config panes from @see Dashboard::$config
  *
  */
 private function loadConfigPanes()
 {
     $items = $this->config;
     foreach ($items->keys() as $key) {
         $item = $this->config->get($key, false);
         if (false === strstr($key, '.')) {
             $this->addPane(Pane::fromIni($key, $item));
         } else {
             list($paneName, $title) = explode('.', $key, 2);
             $pane = $this->getPane($paneName);
             $pane->addComponent(DashboardComponent::fromIni($title, $item, $pane));
         }
     }
 }
Exemple #2
0
 /**
  * Add a component to this pane, optionally creating it if $component is a string
  *
  * @param string|Component $component               The component object or title
  *                                                  (if a new component will be created)
  * @param string|null $url                          An Url to be used when component is a string
  *
  * @return self
  * @throws \Icinga\Exception\ConfigurationError
  */
 public function addComponent($component, $url = null)
 {
     if ($component instanceof Component) {
         $this->components[$component->getTitle()] = $component;
     } elseif (is_string($component) && $url !== null) {
         $this->components[$component] = new Component($component, $url, $this);
     } else {
         throw new ConfigurationError('Invalid component added: ' . $component);
     }
     return $this;
 }