Esempio n. 1
0
 /**
  * Sets up the sidebar
  *
  * @param bool $user_section Adjust sidebar to user section?
  */
 protected function setupSidebar($user_section = false)
 {
     // Basic info and layout
     $sidebar = Sidebar::Get();
     $sidebar->setTitle(_('Konfiguration'));
     $sidebar->setImage(Assets::image_path('sidebar/admin-sidebar.png'));
     // Views
     $views = new ViewsWidget();
     $views->addLink(_('Globale Konfiguration'), $this->url_for('admin/configuration/configuration'))->setActive(!$user_section);
     $views->addLink(_('Personenkonfiguration'), $this->url_for('admin/configuration/user_configuration'))->setActive($user_section);
     $sidebar->addWidget($views);
     // Add section selector when not in user mode
     if (!$user_section) {
         $options = array();
         foreach (ConfigurationModel::getConfig() as $key => $value) {
             $options[$key] = $key ?: '- ' . _('Ohne Kategorie') . ' -';
         }
         $widget = new SelectWidget(_('Anzeigefilter'), $this->url_for('admin/configuration/configuration'), 'section', 'get');
         $widget->addElement(new SelectElement(-1, _('alle anzeigen')));
         $widget->setOptions($options);
         $sidebar->addWidget($widget);
     }
     // Add specific searches (specific user when in user mode, keyword
     // otherwise)
     if ($user_section) {
         $search = new SearchWidget($this->url_for('admin/configuration/user_configuration'));
         $search->addNeedle(_('Person suchen'), 'user_id', true, new StandardSearch('user_id'), 'function () { $(this).closest("form").submit(); }');
     } else {
         $search = new SearchWidget($this->url_for('admin/configuration/configuration'));
         $search->addNeedle(_('Suchbegriff'), 'needle', true);
     }
     $sidebar->addWidget($search);
 }