Пример #1
0
 /**
  * this action is the main action of the schedule-controller, setting the environment for the timetable,
  * accepting a comma-separated list of days.
  *
  * @param  string  a list of an arbitrary mix of the numbers 0-6, separated with a comma (e.g. 1,2,3,4,5 (for Monday to Friday, the default))
  */
 function index_action($days = false)
 {
     if ($GLOBALS['perm']->have_perm('admin')) {
         $inst_mode = true;
     }
     $my_schedule_settings = $GLOBALS['user']->cfg->SCHEDULE_SETTINGS;
     // set the days to be displayed
     if ($days === false) {
         if (Request::getArray('days')) {
             $this->days = array_keys(Request::getArray('days'));
         } else {
             $this->days = array(0, 1, 2, 3, 4, 5, 6);
         }
     } else {
         $this->days = explode(',', $days);
     }
     // try to find the correct institute-id
     $institute_id = Request::option('institute_id', $SessSemName[1] ? $SessSemName[1] : Request::option('cid', false));
     if (!$institute_id) {
         $institute_id = $GLOBALS['user']->cfg->MY_INSTITUTES_DEFAULT;
     }
     if (!$institute_id || in_array(get_object_type($institute_id), words('inst fak')) === false) {
         throw new Exception(sprintf(_('Kann Einrichtungskalendar nicht anzeigen!' . 'Es wurde eine ungültige Instituts-Id übergeben (%s)!', $institute_id)));
     }
     // load semester-data and current semester
     $semdata = new SemesterData();
     $this->semesters = $semdata->getAllSemesterData();
     if (Request::option('semester_id')) {
         $this->current_semester = $semdata->getSemesterData(Request::option('semester_id'));
     } else {
         $this->current_semester = $semdata->getCurrentSemesterData();
     }
     $this->entries = (array) CalendarInstscheduleModel::getInstituteEntries($GLOBALS['user']->id, $this->current_semester, 8, 20, $institute_id, $this->days);
     Navigation::activateItem('/course/main/schedule');
     PageLayout::setHelpKeyword('Basis.TerminkalenderStundenplan');
     PageLayout::setTitle($GLOBALS['SessSemName']['header_line'] . ' - ' . _('Veranstaltungs-Stundenplan'));
     $zoom = Request::int('zoom', 0);
     $this->controller = $this;
     $this->calendar_view = new CalendarWeekView($this->entries, 'instschedule');
     $this->calendar_view->setHeight(40 + 20 * $zoom);
     $this->calendar_view->setRange($my_schedule_settings['glb_start_time'], $my_schedule_settings['glb_end_time']);
     $this->calendar_view->groupEntries();
     // if enabled, group entries with same start- and end-date
     URLHelper::addLinkParam('zoom', $zoom);
     URLHelper::addLinkParam('semester_id', $this->current_semester['semester_id']);
     $style_parameters = array('whole_height' => $this->calendar_view->getOverallHeight(), 'entry_height' => $this->calendar_view->getHeight());
     $factory = new Flexi_TemplateFactory($this->dispatcher->trails_root . '/views');
     PageLayout::addStyle($factory->render('calendar/stylesheet', $style_parameters));
     if (Request::option('printview')) {
         PageLayout::addStylesheet('print.css');
     } else {
         PageLayout::addStylesheet('print.css', array('media' => 'print'));
     }
 }
Пример #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);
 }
Пример #3
0
 /**
  * outputs the CalendarView with all (grouped) dates in columns.
  *
  * @param  array  $params  you can pass some additional variables to the templates
  *
  * @return string
  */
 public function render($params = array())
 {
     $style_parameters = array('whole_height' => $this->getOverallHeight(), 'entry_height' => $this->getHeight());
     $factory = new Flexi_TemplateFactory(dirname(__FILE__) . '/../../app/views');
     PageLayout::addStyle($factory->render('calendar/stylesheet', $style_parameters));
     $template = $GLOBALS['template_factory']->open("calendar/calendar_view.php");
     $template->set_attribute("calendar_view", $this);
     $template->set_attribute("view_id", $this->view_id);
     return $template->render($params);
 }
Пример #4
0
 /**
  * this action is the main action of the schedule-controller, setting the environment
  * for the timetable, accepting a comma-separated list of days.
  *
  * @param  string  $days  a list of an arbitrary mix of the numbers 0-6, separated
  *                        with a comma (e.g. 1,2,3,4,5 (for Monday to Friday, the default))
  * @return void
  */
 function index_action($days = false)
 {
     global $user;
     $schedule_settings = CalendarScheduleModel::getScheduleSettings();
     if ($GLOBALS['perm']->have_perm('admin')) {
         $inst_mode = true;
     }
     if ($inst_mode) {
         // try to find the correct institute-id
         $institute_id = Request::option('institute_id', $SessSemName[1] ? $SessSemName[1] : Request::option('cid', false));
         if (!$institute_id) {
             $institute_id = UserConfig::get($user->id)->MY_INSTITUTES_DEFAULT;
         }
         if (!$institute_id || !in_array(get_object_type($institute_id), words('fak inst'))) {
             throw new Exception('Cannot display institute-calender. No valid ID given!');
         }
         Navigation::activateItem('/browse/my_courses/schedule');
     } else {
         Navigation::activateItem('/calendar/schedule');
     }
     // check, if the hidden seminar-entries shall be shown
     $show_hidden = Request::int('show_hidden', 0);
     // load semester-data and current semester
     $semdata = new SemesterData();
     $this->semesters = array_reverse($semdata->getAllSemesterData());
     if (Request::option('semester_id')) {
         $this->current_semester = $semdata->getSemesterData(Request::option('semester_id'));
     } else {
         $this->current_semester = $semdata->getCurrentSemesterData();
     }
     // check type-safe if days is false otherwise sunday (0) cannot be chosen
     if ($days === false) {
         if (Request::getArray('days')) {
             $this->days = array_keys(Request::getArray('days'));
         } else {
             $this->days = $schedule_settings['glb_days'];
             foreach ($this->days as $key => $day_number) {
                 $this->days[$key] = ($day_number + 6) % 7;
             }
         }
     } else {
         $this->days = explode(',', $days);
     }
     $this->controller = $this;
     $this->calendar_view = $inst_mode ? CalendarScheduleModel::getInstCalendarView($institute_id, $show_hidden, $this->current_semester, $this->days) : CalendarScheduleModel::getUserCalendarView($GLOBALS['user']->id, $show_hidden, $this->current_semester, $this->days);
     // have we chosen an entry to display?
     if ($this->flash['entry']) {
         if ($inst_mode) {
             $this->show_entry = $this->flash['entry'];
         } else {
             if ($this->flash['entry']['id'] == null) {
                 $this->show_entry = $this->flash['entry'];
             } else {
                 foreach ($this->calendar_view->getColumns() as $entry_days) {
                     foreach ($entry_days->getEntries() as $entry) {
                         if ($this->flash['entry']['cycle_id']) {
                             if ($this->flash['entry']['id'] . '-' . $this->flash['entry']['cycle_id'] == $entry['id']) {
                                 $this->show_entry = $entry;
                                 $this->show_entry['id'] = reset(explode('-', $this->show_entry['id']));
                             }
                         } else {
                             if ($entry['id'] == $this->flash['entry']['id']) {
                                 $this->show_entry = $entry;
                             }
                         }
                     }
                 }
             }
         }
     }
     $style_parameters = array('whole_height' => $this->calendar_view->getOverallHeight(), 'entry_height' => $this->calendar_view->getHeight());
     $factory = new Flexi_TemplateFactory($this->dispatcher->trails_root . '/views');
     PageLayout::addStyle($factory->render('calendar/stylesheet', $style_parameters), 'screen, print');
     if (Request::option('printview')) {
         $this->calendar_view->setReadOnly();
         PageLayout::addStylesheet('print.css');
     } else {
         PageLayout::addStylesheet('print.css', array('media' => 'print'));
     }
     $this->show_hidden = $show_hidden;
     $inst = get_object_name($institute_id, 'inst');
     $this->inst_mode = $inst_mode;
     $this->institute_name = $inst['name'];
     $this->institute_id = $institute_id;
     if (Request::get('show_settings')) {
         $this->show_settings = true;
     }
 }
 function index_action($step = 'manifest')
 {
     $step = Request::option('step', $step);
     $this->previous = $this->next = $last = false;
     foreach ($this->actions as $action) {
         if ($last == $step) {
             $this->next = $action;
         }
         if ($action == $step) {
             $this->previous = $last;
         }
         $last = $action;
     }
     // if (Request::isPost()) {    # since Stud.IP 2.1
     if ($_SERVER['REQUEST_METHOD'] === 'POST') {
         $this->plugin = array_merge($this->plugin, $this->extract($step, $errors));
         $_SESSION['plugin-generator']['passed'][$step] = empty($errors);
     }
     if (!empty($errors)) {
         PageLayout::postMessage(Messagebox::error(_('Es sind Fehler aufgetreten:'), $errors));
     } elseif (Request::submitted('action')) {
         $action = Request::option('action');
         if (!in_array($action, array('display download install'))) {
             $generator = new Generator($this->dispatcher->plugin->getPluginPath(), '/templates', '/environments');
         }
         $generator->populate($this->plugin);
         $generator->{$action}();
         if ($action === 'install') {
             $this->redirect(URLHelper::getURL('dispatch.php/admin/plugin'));
             return;
         }
         #            PageLayout::postMessage(Messagebox::success('Jipp.'));
     } elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
         if (Request::submitted('back')) {
             $step = Request::option('back', $this->previous);
         } else {
             if (Request::submitted('forward')) {
                 $step = Request::option('forward', $this->next);
             }
         }
         $this->redirect('generator/' . $step);
         return;
     }
     $this->step = $step;
     switch ($step) {
         case 'manifest':
             $this->interfaces = array('HomepagePlugin' => _('Homepage eines Nutzers'), 'PortalPlugin' => _('Startseite (Portalseite)'), 'StandardPlugin' => _('Veranstaltungen und Einrichtungen'), 'StudienmodulManagementPlugin' => _('Studienmodulsuche'), 'SystemPlugin' => _('Systemweite Erweiterungen'));
             $this->versions = words('2.0 2.1 2.2 2.3 2.4');
             break;
         case 'assets':
             $this->environments = array('default' => _('Standard'), 'trails' => _('Trails'));
             break;
         case 'polyfill':
             $this->polyfills = Polyfill::getVersions();
             break;
     }
     $variables = array('step' => $step, 'controller' => $this);
     $factory = new Flexi_TemplateFactory($this->dispatcher->plugin->getPluginPath() . '/app/views/');
     $progress = $factory->render('infobox-route', $variables);
     $this->setInfoboxImage($this->dispatcher->plugin->getPluginURL() . '/assets/images/puzzle.jpg')->addToInfobox(_('Fortschritt'), $progress)->addToInfobox(_('Aktionen'), sprintf('<a href="%s">Reset</a>', $this->url_for('generator/' . $step . '?reset=1')), Assets::image_path('icons/16/black/refresh.png'));
 }