check('root'); Navigation::activateItem('/admin/config/vips'); PageLayout::setHelpKeyword('Basis.VipsEinstellungen'); PageLayout::setTitle(_('Einstellungen für Aufgaben')); } public function index_action() { $this->fields = DataField::getDataFields('user'); $this->config = Config::get(); $widget = new ActionsWidget(); $widget->addLink( _('Anstehende Klausuren anzeigen'), $this->pending_assignmentsURL(), Icon::create('doctoral_cap') )->asDialog('size=big'); Sidebar::get()->addWidget($widget); } public function save_action() { CSRFProtection::verifyUnsafeRequest(); $exam_mode = Request::int('exam_mode', 0); $exam_terms = trim(Request::get('exam_terms')); $exam_terms = Studip\Markup::purifyHtml($exam_terms); $config = Config::get(); $config->store('VIPS_EXAM_RESTRICTIONS', $exam_mode); $config->store('VIPS_EXAM_TERMS', $exam_terms); $room = Request::getArray('room'); $ip_range = Request::getArray('ip_range'); $ip_ranges = []; foreach ($room as $i => $name) { $name = preg_replace('/[ ,]+/', '_', trim($name)); if ($name !== '') { $ip_ranges[$name] = trim($ip_range[$i]); } } if ($ip_ranges) { ksort($ip_ranges); $config->store('VIPS_EXAM_ROOMS', $ip_ranges); } PageLayout::postSuccess(_('Die Einstellungen wurden gespeichert.')); $this->redirect('vips/config'); } public function pending_assignments_action() { $this->assignments = VipsAssignment::findBySQL( "range_type = 'course' AND type = 'exam' AND start BETWEEN UNIX_TIMESTAMP(NOW() - INTERVAL 1 DAY) AND UNIX_TIMESTAMP(NOW() + INTERVAL 14 DAY) AND end > UNIX_TIMESTAMP() ORDER BY start" ); } }