Exemplo n.º 1
0
 /**
  * Displays (a subset of) the smileys in the system
  *
  * @param mixed $view Subset to display, defaults to favorites if enabled
  */
 function index_action($view = null)
 {
     $this->view = $view ?: $this->default;
     $this->characters = Smiley::getUsedCharacters();
     $this->statistics = Smiley::getStatistics();
     // Redirect to index if favorites is selected but user is not logged in
     if (!$this->favorites_activated and $this->view == 'favorites') {
         $this->redirect('smileys');
     }
     $title = _('Smiley-Übersicht') . ' - ' . sprintf(_('%s Smileys vorhanden'), $this->statistics['count_all']);
     PageLayout::setTitle($title);
     $this->smileys = $this->view == 'favorites' ? Smiley::getByIds($this->favorites->get()) : Smiley::getGrouped($this->view);
 }
Exemplo n.º 2
0
 /**
  * Extends this controller with neccessary infobox
  *
  * @param String $view Currently viewed group
  */
 private function setSidebar($view)
 {
     $sidebar = Sidebar::Get();
     $sidebar->setImage('sidebar/smiley-sidebar.png');
     $sidebar->setTitle(PageLayout::getTitle() ?: _('Smileys'));
     // Render items
     $factory = new Flexi_TemplateFactory($this->dispatcher->trails_root . '/views/admin/smileys/');
     $actions = new ActionsWidget();
     $actions->addLink(_('Neues Smiley hochladen'), $this->url_for('admin/smileys/upload', $view), Icon::create('add', 'clickable'))->asDialog('size=auto');
     $actions->addLink(_('Smileys zählen'), $this->url_for('admin/smileys/count', $view), Icon::create('code', 'clickable'));
     $actions->addLink(_('Tabelle aktualisieren'), $this->url_for('admin/smileys/refresh', $view), Icon::create('refresh', 'clickable'));
     $actions->addLink(_('Smiley-Übersicht öffnen'), URLHelper::getLink('dispatch.php/smileys'), Icon::create('smiley', 'clickable'))->asDialog();
     $sidebar->addWidget($actions);
     $widget = new SidebarWidget();
     $filter = $factory->render('selector', array('characters' => Smiley::getUsedCharacters(), 'controller' => $this, 'view' => $view));
     $widget->setTitle(_('Filter'));
     $widget->addElement(new WidgetElement($filter));
     $sidebar->addWidget($widget);
     $widget = new SidebarWidget();
     $statistics = $factory->render('statistics', Smiley::getStatistics());
     $widget->setTitle(_('Statistiken'));
     $widget->addElement(new WidgetElement($statistics));
     $sidebar->addWidget($widget);
 }