示例#1
0
 /**
  * Things to do before every page load.
  */
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     // AJAX request, so no page layout.
     if (Request::isXhr()) {
         $this->via_ajax = true;
         $this->set_layout(null);
         $request = Request::getInstance();
         foreach ($request as $key => $value) {
             $request[$key] = studip_utf8decode($value);
         }
         // Open base layout for normal
     } else {
         $layout = $GLOBALS['template_factory']->open('layouts/base');
         $this->set_layout($layout);
         PageLayout::setTitle(_('Anmeldesets'));
         // Get only own courses if user doesn't have permission to edit institute-wide coursesets.
         $this->onlyOwnCourses = true;
         if ($GLOBALS['perm']->have_perm('admin') || $GLOBALS['perm']->have_perm('dozent') && get_config('ALLOW_DOZENT_COURSESET_ADMIN')) {
             // We have access to institute-wide course sets, so all courses may be assigned.
             $this->onlyOwnCourses = false;
             Navigation::activateItem('/tools/coursesets/sets');
         } else {
             throw new AccessDeniedException();
         }
     }
     PageLayout::addSqueezePackage('admission');
     $this->set_content_type('text/html;charset=windows-1252');
     $views = new ViewsWidget();
     $views->setTitle(_('Aktionen'));
     $views->addLink(_('Anmeldeset anlegen'), $this->url_for('admission/courseset/configure'))->setActive($action == 'configure');
     Sidebar::Get()->addWidget($views);
 }
示例#2
0
文件: userlist.php 项目: ratbird/hope
 /**
  * @see AuthenticatedController::before_filter
  */
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     if (Request::isXhr()) {
         $this->via_ajax = true;
         $this->set_layout(null);
         $request = Request::getInstance();
         foreach ($request as $key => $value) {
             $request[$key] = studip_utf8decode($value);
         }
     } else {
         $layout = $GLOBALS['template_factory']->open('layouts/base');
         $this->set_layout($layout);
         PageLayout::setTitle(_('Personenlisten'));
         Navigation::activateItem('/tools/coursesets/userlists');
     }
     PageLayout::addSqueezePackage('admission');
     $this->set_content_type('text/html;charset=windows-1252');
     $views = new ViewsWidget();
     $views->setTitle(_('Aktionen'));
     $views->addLink(_('Personenliste anlegen'), $this->url_for('admission/userlist/configure'))->setActive($action == 'configure');
     Sidebar::Get()->addWidget($views);
 }
示例#3
0
文件: contact.php 项目: ratbird/hope
 private function initSidebar($active_id = null)
 {
     $sidebar = Sidebar::Get();
     $letterlist = new SidebarWidget();
     foreach (range('A', 'Z') as $letter) {
         if ($this->contacts[$letter]) {
             $html .= "<a href='#letter_{$letter}'>{$letter}</a>";
         } else {
             $html .= "<span>{$letter}</span>";
         }
     }
     $letterlist->setTitle(_('Schnellzugriff'));
     $letterlist->addElement(new WidgetElement("<div class='letterlist'>{$html}</div>"));
     $sidebar->addWidget($letterlist);
     // Groups
     $actions = new ActionsWidget();
     $actions->addLink(_('Neue Gruppe anlegen'), $this->url_for('contact/editGroup'), Icon::create('group3+add', 'clickable'))->asDialog('size=auto');
     $actions->addLink(_('Nachricht an alle'), $this->url_for('messages/write', array('rec_uname' => $this->allContacts->pluck('username'))), Icon::create('mail', 'clickable'))->asDialog();
     $actions->addLink(_('E-Mail an alle'), URLHelper::getLink('mailto:' . join(',', $this->allContacts->pluck('email'))), Icon::create('mail', 'clickable'));
     $actions->addLink(_('Alle vCards herunterladen'), $this->url_for('contact/vcard/' . $this->filter), Icon::create('vcard', 'clickable'));
     $sidebar->addWidget($actions);
     // Groups navigation
     $groupsWidget = new ViewsWidget();
     $groupsWidget->setTitle(_('Gruppen'));
     $groupsWidget->addLink(_('Alle Kontakte'), URLHelper::getLink('dispatch.php/contact/index'))->setActive(!$active_id);
     foreach ($this->groups as $group) {
         $groupsWidget->addLink($group->name, URLHelper::getLink('dispatch.php/contact/index/' . $group->id))->setActive($group->id == $active_id);
     }
     $sidebar->addWidget($groupsWidget);
 }