Пример #1
0
 function update_action($range_id)
 {
     $vote_id = self::ensureMD5(Request::option('vote_id'));
     $choice = self::ensureMD5(Request::option('choice'));
     $q = \Cliqr\Question::find($vote_id);
     # no such active question in this range_id
     if (!$q->isActiveIn($range_id)) {
         throw new Trails_Exception(400);
     }
     $status = $q->recordAnswer($choice);
     if (Request::isXhr()) {
         if ($status) {
             $this->response->set_status(204, "No Content");
             return $this->render_nothing();
         } else {
             throw new Trails_Exception(500, "Could not record");
         }
     } else {
         if ($status) {
             $this->response->set_status(204, "No Content");
         } else {
             $this->response->set_status(500, "Could not record");
         }
         # TODO
         $this->render_nothing();
     }
 }
Пример #2
0
 public static function build()
 {
     self::$get = (object) $_GET;
     self::$post = (object) $_POST;
     // pegando parametros via :(:+) ou ?(&+)
     $options = clone self::$get;
     unset($options->controller);
     unset($options->method);
     unset($options->ident);
     if (preg_match("/[:]/", $_SERVER['REQUEST_URI'])) {
         $opt = array();
         $tmp = explode(":", $options->options);
         foreach ($tmp as $t) {
             $o = explode("=", $t);
             $o[1] = isset($o[1]) ? $o[1] : TRUE;
             $opt[$o[0]] = $o[1];
         }
         $options = (object) $opt;
     } else {
         foreach ($options as $key => $value) {
             if ($value == "") {
                 $options->{$key} = TRUE;
             }
         }
     }
     self::$option = empty($options) ? NULL : $options;
 }
Пример #3
0
 public function index_action()
 {
     if ($_SESSION['sem_portal']['bereich'] != "all") {
         $class = $GLOBALS['SEM_CLASS'][$_SESSION['sem_portal']['bereich']];
         $this->anzahl_seminare_class = $class->countSeminars();
         $sem_status = array_keys($class->getSemTypes());
     } else {
         $sem_status = false;
     }
     $init_data = array("level" => "f", "cmd" => "qs", "show_class" => $_SESSION['sem_portal']['bereich'], "group_by" => 0, "default_sem" => ($default_sem = SemesterData::GetSemesterIndexById($_SESSION['_default_sem'])) !== false ? $default_sem : "all", "sem_status" => $sem_status);
     if (Request::option('reset_all')) {
         $_SESSION['sem_browse_data'] = null;
     }
     $this->sem_browse_obj = new SemBrowse($init_data);
     $sem_browse_data['show_class'] = $_SESSION['sem_portal']['bereich'];
     if (!$GLOBALS['perm']->have_perm("root")) {
         $this->sem_browse_obj->target_url = "dispatch.php/course/details/";
         $this->sem_browse_obj->target_id = "sem_id";
     } else {
         $this->sem_browse_obj->target_url = "seminar_main.php";
         $this->sem_browse_obj->target_id = "auswahl";
     }
     $this->toplist_entries = $this->getToplistEntries($sem_status);
     $this->controller = $this;
 }
Пример #4
0
 /**
  * show and search log events
  */
 function show_action()
 {
     $this->action_id = Request::option('action_id');
     $this->object_id = Request::option('object_id');
     $this->log_actions = $this->event_log->get_used_log_actions();
     $this->types = $this->event_log->get_object_types();
     // restrict log events to object scope
     if (Request::get('search') && Request::get('search') != '') {
         $this->type = Request::get('type');
         $this->search = Request::get('search');
         $objects = $this->event_log->find_objects($this->type, $this->search, $this->action_id);
         if (count($objects) > 0) {
             $this->objects = $objects;
         } else {
             $this->error_msg = _('Kein passendes Objekt gefunden.');
         }
     }
     // find all matching log events
     if (Request::get('search') === '' || isset($this->object_id)) {
         $this->start = (int) Request::int('start');
         $this->format = Request::quoted('format');
         $this->num_entries = $this->event_log->count_log_events($this->action_id, $this->object_id);
         if (Request::get('back') || Request::submitted('back')) {
             $this->start = max(0, $this->start - 50);
         } else {
             if (Request::get('forward') || Request::submitted('forward')) {
                 $this->start = min($this->num_entries, $this->start + 50);
             }
         }
         $this->log_events = $this->event_log->get_log_events($this->action_id, $this->object_id, $this->start);
     }
 }
Пример #5
0
 /**
  * Stores the user domain settings of a user.
  */
 public function store_action()
 {
     $this->check_ticket();
     $any_change = false;
     $userdomain_delete = Request::optionArray('userdomain_delete');
     if (count($userdomain_delete) > 0) {
         foreach ($userdomain_delete as $id) {
             $domain = new UserDomain($id);
             $domain->removeUser($this->user->user_id);
         }
         $any_change = true;
     }
     $new_userdomain = Request::option('new_userdomain');
     if ($new_userdomain && $new_userdomain != 'none') {
         $domain = new UserDomain($new_userdomain);
         $domain->addUser($this->user->user_id);
         $any_change = true;
     }
     if ($any_change) {
         $this->reportSuccess(_('Die Zuordnung zu Nutzerdomänen wurde geändert.'));
         setTempLanguage($this->user->user_id);
         $this->postPrivateMessage(_("Die Zuordnung zu Nutzerdomänen wurde geändert!\n"));
         restoreLanguage();
     }
     $this->redirect('settings/userdomains');
 }
Пример #6
0
 public function testOptionParam()
 {
     $this->assertNull(Request::option('null'));
     $this->assertSame(Request::option('a'), 'test');
     $this->assertNull(Request::option('b'));
     $this->assertNull(Request::option('v1'));
 }
Пример #7
0
 /**
  * Stores the privacy settings concerning the appearance of a user inside
  * the system.
  */
 public function global_action()
 {
     $this->check_ticket();
     $visibility = Request::option('global_visibility');
     // Globally visible or unknown -> set local visibilities accordingly.
     if ($visibility != 'no') {
         $online = Request::int('online') ?: 0;
         $search = Request::int('search') ?: 0;
         $email = Request::int('email') ?: 0;
         $foaf_show_identity = Request::int('foaf_show_identity') ?: 0;
         // Globally invisible -> set all local fields to invisible.
     } else {
         $online = $search = $foaf_show_identity = 0;
         $email = get_config('DOZENT_ALLOW_HIDE_EMAIL') ? 0 : 1;
         $success = $this->about->change_all_homepage_visibility(VISIBILITY_ME);
     }
     $this->config->store('FOAF_SHOW_IDENTITY', $foaf_show_identity);
     $this->user->visible = $visibility;
     $this->user->store();
     $query = "INSERT INTO user_visibility\n                    (user_id, online, search, email, mkdate)\n                  VALUES (?, ?, ?, ?, UNIX_TIMESTAMP())\n                  ON DUPLICATE KEY\n                    UPDATE online = VALUES(online),\n                           search = VALUES(search), email = VALUES(email)";
     $statement = DBManager::get()->prepare($query);
     $statement->execute(array($this->user->user_id, $online, $search, $email));
     $this->reportSuccess(_('Ihre Sichtbarkeitseinstellungen wurden gespeichert.'));
     $this->redirect('settings/privacy');
 }
Пример #8
0
 /**
  * Stores a user's calendar settings
  */
 public function store_action()
 {
     $this->check_ticket();
     $this->config->store('CALENDAR_SETTINGS', array('view' => Request::option('cal_view'), 'start' => Request::option('cal_start'), 'end' => Request::option('cal_end'), 'step_day' => Request::option('cal_step_day'), 'step_week' => Request::option('cal_step_week'), 'type_week' => Request::option('cal_type_week'), 'holidays' => Request::option('cal_holidays'), 'sem_data' => Request::option('cal_sem_data'), 'delete' => Request::option('cal_delete'), 'step_week_group' => Request::option('cal_step_week_group'), 'step_day_group' => Request::option('cal_step_day_group')));
     $this->reportSuccess(_('Ihre Einstellungen wurden gespeichert'));
     $this->redirect('settings/calendar');
 }
Пример #9
0
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     $course_id = Request::option('sem_id', $args[0]);
     if (empty($course_id)) {
         checkObject();
         //wirft Exception, wenn $SessionSeminar leer ist
         $course_id = $GLOBALS['SessionSeminar'];
     }
     $this->course = Course::find($course_id);
     if (!$this->course) {
         throw new Trails_Exception(400);
     }
     $this->send_from_search_page = Request::get('send_from_search_page');
     if ($GLOBALS['SessionSeminar'] != $this->course->id && !(int) $this->course->visible && !($GLOBALS['perm']->have_perm(Config::get()->SEM_VISIBILITY_PERM) || $GLOBALS['perm']->have_studip_perm('user', $this->course->id))) {
         throw new AccessDeniedException(_('Diese Veranstaltung ist versteckt. Hier gibt es nichts zu sehen.'));
     }
     if (!preg_match('/^(' . preg_quote($GLOBALS['CANONICAL_RELATIVE_PATH_STUDIP'], '/') . ')?([a-zA-Z0-9_-]+\\.php)([a-zA-Z0-9_?&=-]*)$/', $this->send_from_search_page)) {
         $this->send_from_search_page = '';
     }
     if ($this->course->getSemClass()->offsetGet('studygroup_mode')) {
         if ($GLOBALS['perm']->have_studip_perm('autor', $this->course->id)) {
             // participants may see seminar_main
             $link = URLHelper::getUrl('seminar_main.php', array('auswahl' => $this->course->id));
         } else {
             $link = URLHelper::getUrl('dispatch.php/course/studygroup/details/' . $this->course->id, array('send_from_search_page' => $this->send_from_search_page));
         }
         $this->redirect($link);
         return;
     }
 }
Пример #10
0
 public function trigger_automaticupdate_action($class)
 {
     $output = array();
     if (Request::isPost()) {
         $plugin = PluginManager::getInstance()->getPluginInfo($class);
         $low_cost_secret = md5($GLOBALS['STUDIP_INSTALLATION_ID'] . $plugin['id']);
         if ($plugin['automatic_update_url'] && $low_cost_secret === \Request::option("s")) {
             if ($plugin['automatic_update_secret'] && !$this->verify_secret($plugin['automatic_update_secret'])) {
                 $output['error'] = "Incorrect payload.";
             } else {
                 //everything fine, we can download and install the plugin
                 $update_url = $plugin['automatic_update_url'];
                 require_once 'app/models/plugin_administration.php';
                 $plugin_admin = new PluginAdministration();
                 try {
                     $plugin_admin->installPluginFromURL($update_url);
                 } catch (Exception $e) {
                     $output['exception'] = $e->getMessage();
                 }
             }
         } else {
             $output['error'] = "Wrong URL.";
         }
         if (!count($output)) {
             $output['message'] = "ok";
         }
     } else {
         $output['error'] = "Only POST requests allowed.";
     }
     $this->render_json($output);
 }
Пример #11
0
 /**
  * Administrtion view for smileys
  */
 public function index_action()
 {
     $this->view = Request::option('view', Smiley::getFirstUsedCharacter() ?: 'a');
     $this->smileys = Smiley::getGrouped($this->view);
     $this->favorites_enabled = SmileyFavorites::isEnabled();
     $this->setSidebar($this->view);
 }
Пример #12
0
 /**
  * common tasks for all actions
  */
 function before_filter(&$action, &$args)
 {
     global $perm;
     parent::before_filter($action, $args);
     if (Request::get('termin_id')) {
         $this->dates[0] = new SingleDate(Request::option('termin_id'));
         $this->course_id = $this->dates[0]->range_id;
     }
     if (Request::get('issue_id')) {
         $this->issue_id = Request::option('issue_id');
         $this->dates = array_values(array_map(function ($data) {
             $d = new SingleDate();
             $d->fillValuesFromArray($data);
             return $d;
         }, IssueDB::getDatesforIssue(Request::option('issue_id'))));
         $this->course_id = $this->dates[0]->range_id;
     }
     if (!get_object_type($this->course_id, array('sem')) || SeminarCategories::GetBySeminarId($this->course_id)->studygroup_mode || !$perm->have_studip_perm("tutor", $this->course_id)) {
         throw new Trails_Exception(400);
     }
     PageLayout::setHelpKeyword("Basis.VeranstaltungenVerwaltenAendernVonZeitenUndTerminen");
     PageLayout::setTitle(Course::findCurrent()->getFullname() . " - " . _("Veranstaltungstermine absagen"));
     $this->set_content_type('text/html;charset=windows-1252');
     if (Request::isXhr()) {
         $this->set_layout(null);
         $this->response->add_header('X-Title', PageLayout::getTitle());
         $request = Request::getInstance();
         foreach ($request as $key => $value) {
             $request[$key] = studip_utf8decode($value);
         }
     }
 }
Пример #13
0
 /**
  * manages the session variables used for the open/close thing
  *
  * @access   private
  */
 function handleOpenRanges()
 {
     global $_REQUEST;
     $this->open_ranges[$this->start_item_id] = true;
     if (Request::option('close_item') || Request::option('open_item')) {
         $toggle_item = Request::option('close_item') ? Request::option('close_item') : Request::option('open_item');
         if (!$this->open_items[$toggle_item]) {
             $this->open_items[$toggle_item] = true;
         } else {
             unset($this->open_items[$toggle_item]);
         }
         if ($this->tree->hasKids(Request::option('open_item'))) {
             $this->start_item_id = Request::option('open_item');
             $this->open_ranges = null;
             $this->open_items = null;
             $this->open_items[Request::option('open_item')] = true;
             $this->open_ranges[Request::option('open_item')] = true;
         }
         $this->anchor = $toggle_item;
     }
     if ($this->start_item_id == "root") {
         $this->open_ranges = null;
         $this->open_ranges[$this->start_item_id] = true;
     }
 }
Пример #14
0
 /**
  * set connection
  *
  * sets connection with seminar
  * @access public
  * @param string $seminar_id seminar-id
  * @return boolean successful
  */
 function setConnection($seminar_id)
 {
     global $connected_cms, $messages;
     $write_permission = Request::option("write_permission");
     $crs_id = ObjectConnections::getConnectionModuleId($seminar_id, "crs", $this->cms_type);
     $connected_cms[$this->cms_type]->soap_client->setCachingStatus(false);
     $connected_cms[$this->cms_type]->soap_client->clearCache();
     // Check, ob Kurs in ILIAS gelöscht wurde
     if ($crs_id != false and $connected_cms[$this->cms_type]->soap_client->getObjectByReference($crs_id) == false) {
         ObjectConnections::unsetConnection($seminar_id, $crs_id, "crs", $this->cms_type);
         $messages["info"] .= _("Der zugeordnete ILIAS-Kurs (ID {$crs_id}) existiert nicht mehr. Ein neuer Kurs wird angelegt.") . "<br>";
         $crs_id = false;
     }
     $crs_id == $connected_cms[$this->cms_type]->createCourse($seminar_id);
     if ($crs_id == false) {
         return false;
     }
     $ref_id = $this->getId();
     if (Request::get("copy_object") == "1") {
         $connected_cms[$this->cms_type]->soap_client->user_type = 'user';
         $ref_id = $connected_cms[$this->cms_type]->soap_client->copyObject($this->id, $crs_id);
         $connected_cms[$this->cms_type]->soap_client->user_type = 'admin';
     } else {
         $ref_id = $connected_cms[$this->cms_type]->soap_client->addReference($this->id, $crs_id);
     }
     if (!$ref_id) {
         $messages["error"] .= _("Zuordnungs-Fehler: Objekt konnte nicht angelegt werden.");
         return false;
     }
     $local_roles = $connected_cms[$this->cms_type]->soap_client->getLocalRoles($crs_id);
     $member_operations = $connected_cms[$this->cms_type]->permissions->getOperationArray(array(OPERATION_VISIBLE, OPERATION_READ));
     $admin_operations = $connected_cms[$this->cms_type]->permissions->getOperationArray(array(OPERATION_VISIBLE, OPERATION_READ, OPERATION_WRITE, OPERATION_DELETE));
     $admin_operations_no_delete = $connected_cms[$this->cms_type]->permissions->getOperationArray(array(OPERATION_VISIBLE, OPERATION_READ, OPERATION_WRITE));
     $admin_operations_readonly = $connected_cms[$this->cms_type]->permissions->getOperationArray(array(OPERATION_VISIBLE, OPERATION_READ, OPERATION_DELETE));
     foreach ($local_roles as $key => $role_data) {
         // check only if local role is il_crs_member, -tutor or -admin
         if (strpos($role_data["title"], "il_crs_") === 0) {
             if (strpos($role_data["title"], 'il_crs_member') === 0) {
                 $operations = $write_permission == "autor" ? $admin_operations_no_delete : $member_operations;
             } elseif (strpos($role_data["title"], 'il_crs_tutor') === 0) {
                 $operations = $write_permission == "tutor" || $write_permission == "autor" ? $admin_operations : $admin_operations_readonly;
             } elseif (strpos($role_data["title"], 'il_crs_admin') === 0) {
                 $operations = $write_permission == "dozent" || $write_permission == "tutor" || $write_permission == "autor" ? $admin_operations : $admin_operations_readonly;
             } else {
                 continue;
             }
             $connected_cms[$this->cms_type]->soap_client->revokePermissions($role_data["obj_id"], $ref_id);
             $connected_cms[$this->cms_type]->soap_client->grantPermissions($operations, $role_data["obj_id"], $ref_id);
         }
     }
     if ($ref_id) {
         $this->setId($ref_id);
         return ContentModule::setConnection($seminar_id);
     } else {
         $messages["error"] .= _("Die Zuordnung konnte nicht gespeichert werden.");
     }
     return false;
 }
Пример #15
0
 public function export_action($id)
 {
     $this->table = FleximportTable::find($id);
     if (Request::option("secret") !== $this->table->getExportSecret()) {
         throw new AccessDeniedException();
     }
     $this->table->fetchData();
     $this->render_csv();
 }
Пример #16
0
 /**
  * Gets the configuration settings for a userfilter field. The type of the
  * field is set via the request.
  */
 public function configure_action()
 {
     $this->conditionFields = UserFilterField::getAvailableFilterFields();
     if ($className = Request::option('fieldtype')) {
         list($fieldType, $param) = explode('_', $className);
         $this->className = $className;
         $this->field = new $fieldType($param);
     }
 }
Пример #17
0
 /**
  * show institute overview page
  *
  * @return void
  */
 function index_action()
 {
     $this->sidebar = Sidebar::get();
     $this->sidebar->setImage('sidebar/institute-sidebar.png');
     if (get_config('NEWS_RSS_EXPORT_ENABLE') && $this->institute_id) {
         $rss_id = StudipNews::GetRssIdFromRangeId($this->institute_id);
         if ($rss_id) {
             PageLayout::addHeadElement('link', array('rel' => 'alternate', 'type' => 'application/rss+xml', 'title' => 'RSS', 'href' => 'rss.php?id=' . $rss_id));
         }
     }
     URLHelper::bindLinkParam("inst_data", $this->institut_main_data);
     // (un)subscribe to institute
     if (Config::get()->ALLOW_SELFASSIGN_INSTITUTE && $GLOBALS['user']->id !== 'nobody' && !$GLOBALS['perm']->have_perm('admin')) {
         $widget = new ActionsWidget();
         if (!$GLOBALS['perm']->have_studip_perm('user', $this->institute_id)) {
             $url = URLHelper::getLink('dispatch.php/institute/overview', array('follow_inst' => 'on'));
             $widget->addLink(_('Einrichtung abonnieren'), $url);
         } elseif (!$GLOBALS['perm']->have_studip_perm('autor', $this->institute_id)) {
             $url = URLHelper::getLink('dispatch.php/institute/overview', array('follow_inst' => 'off'));
             $widget->addLink(_('Austragen aus der Einrichtung'), $url);
         }
         $this->sidebar->addWidget($widget);
         if (!$GLOBALS['perm']->have_studip_perm('user', $this->institute_id) and Request::option('follow_inst') == 'on') {
             $query = "INSERT IGNORE INTO user_inst\n                          (user_id, Institut_id, inst_perms)\n                          VALUES (?, ?, 'user')";
             $statement = DBManager::get()->prepare($query);
             $statement->execute(array($GLOBALS['user']->user_id, $this->institute_id));
             if ($statement->rowCount() > 0) {
                 log_event('INST_USER_ADD', $this->institute_id, $GLOBALS['user']->user_id, 'user');
                 PageLayout::postMessage(MessageBox::success(_("Sie haben die Einrichtung abonniert.")));
                 header('Location: ' . URLHelper::getURL('', array('cid' => $this->institute_id)));
                 die;
             }
         } elseif (!$GLOBALS['perm']->have_studip_perm('autor', $this->institute_id) and Request::option('follow_inst') == 'off') {
             $query = "DELETE FROM user_inst\n                          WHERE user_id = ?  AND Institut_id = ?";
             $statement = DBManager::get()->prepare($query);
             $statement->execute(array($GLOBALS['user']->user_id, $this->institute_id));
             if ($statement->rowCount() > 0) {
                 log_event('INST_USER_DEL', $this->institute_id, $GLOBALS['user']->user_id, 'user');
                 PageLayout::postMessage(MessageBox::success(_("Sie haben sich aus der Einrichtung ausgetragen.")));
                 header('Location: ' . URLHelper::getURL('', array('cid' => $this->institute_id)));
                 die;
             }
         }
     }
     // Fetch news
     $response = $this->relay('news/display/' . $this->institute_id);
     $this->news = $response->body;
     // Fetch  votes
     if (get_config('VOTE_ENABLE')) {
         $response = $this->relay('questionnaire/widget/' . $this->institute_id . '/institute');
         $this->questionnaires = $response->body;
     }
     // Fetch dates
     $response = $this->relay("calendar/contentbox/display/{$this->institute_id}/1210000");
     $this->dates = $response->body;
 }
 function getColumnName($id, $print_view = false)
 {
     $res_obj = ResourceObject::Factory($this->show_columns[$id]);
     if (!$print_view) {
         $ret = '<a class="tree" href="' . URLHelper::getLink('?show_object=' . $this->show_columns[$id] . '&view=' . (Request::option('view') == 'openobject_group_schedule' ? 'openobject_schedule' : 'view_schedule')) . '">' . htmlReady($res_obj->getName()) . '</a>' . ($res_obj->getSeats() ? '<br>(' . $res_obj->getSeats() . ')' : '');
     } else {
         $ret = '<span style="font-size:10pt;">' . htmlReady($res_obj->getName()) . '</span>';
     }
     return $ret . chr(10);
 }
Пример #19
0
 /**
  * Return current seminar's identifier.
  *
  * @return mixed  Seminar identifier (string) or FALSE (boolean) if no
  *                seminar is selected.
  */
 public static function seminarId()
 {
     if (\Request::option('cid')) {
         return \Request::option('cid');
     }
     if ($GLOBALS['SessionSeminar']) {
         \URLHelper::bindLinkParam('cid', $GLOBALS['SessionSeminar']);
         return $GLOBALS['SessionSeminar'];
     }
     return false;
 }
Пример #20
0
 /**
  * Displays a list of all public courses
  */
 public function index_action()
 {
     $query = "SELECT Seminar_id, seminare.Name AS name, seminare.status, seminare.Schreibzugriff,\n                         Institute.Name AS Institut, Institut_id AS id\n                  FROM seminare\n                  LEFT JOIN Institute USING (Institut_id)\n                  WHERE Lesezugriff = '0' AND seminare.visible = '1'\n                  ORDER BY :order";
     $statement = DBManager::get()->prepare($query);
     $statement->bindParam(':order', Request::option('sortby', 'Name'), StudipPDO::PARAM_COLUMN);
     $statement->execute();
     $seminars = $statement->fetchGrouped(PDO::FETCH_ASSOC);
     $seminars = $this->get_seminar_navigations($seminars);
     $seminars = $this->get_plugin_navigations($seminars);
     $this->seminars = $seminars;
 }
Пример #21
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'));
     }
 }
Пример #22
0
 /**
  * Constructor: read auth information from remote SP.
  */
 function StudipAuthShib()
 {
     parent::__construct();
     if (Request::option('sso') && isset($this->validate_url) && isset($_REQUEST['token'])) {
         $auth = file_get_contents($this->validate_url . '/' . $_REQUEST['token']);
         $this->userdata = json_decode($auth, true);
         $this->userdata = array_map('utf8_decode', $this->userdata);
         if (isset($this->local_domain)) {
             $this->userdata['username'] = str_replace('@' . $this->local_domain, '', $this->userdata['username']);
         }
     }
 }
Пример #23
0
 /**
  * Common tasks for all actions
  *
  * @param String $action Called action
  * @param Array  $args   Possible arguments
  */
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     $course_id = $args[0];
     $this->course_id = Request::option('cid', $course_id);
     if (!get_object_type($this->course_id, array('sem')) || SeminarCategories::GetBySeminarId($this->course_id)->studygroup_mode || !$GLOBALS['perm']->have_studip_perm("tutor", $this->course_id)) {
         throw new Trails_Exception(400);
     }
     PageLayout::addSqueezePackage('raumzeit');
     PageLayout::setHelpKeyword('Basis.VeranstaltungenVerwaltenAendernVonZeitenUndTerminen');
     PageLayout::setTitle(Course::findCurrent()->getFullname() . " - " . _('Blockveranstaltungstermine anlegen'));
 }
Пример #24
0
 /**
  * Constructor
  *
  *
  * @access public
  *
  */
 function StudipAuthCAS()
 {
     parent::__construct();
     if (Request::option('sso')) {
         $this->cas = new CASClient(CAS_VERSION_2_0, false, $this->host, $this->port, $this->uri, false);
         if (isset($this->cacert)) {
             $this->cas->setCasServerCACert($this->cacert);
         } else {
             $this->cas->setNoCasServerValidation();
         }
     }
 }
Пример #25
0
 function createHiddenIDs()
 {
     $input = new HTML("input");
     $input->addAttr("type", "hidden");
     $input->addAttr("evalID", Request::option('evalID'));
     $input = new HTML("input");
     $input->addAttr("type", "hidden");
     $input->addAttr("itemID", Request::option('itemID'));
     $input = new HTML("input");
     $input->addAttr("type", "hidden");
     $input->addAttr("rangeID", Request::option("rangeID"));
     return;
 }
Пример #26
0
 /**
  * Common tasks for all actions.
  */
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     // user must have root permission
     $GLOBALS['perm']->check('root');
     // set navigation
     Navigation::activateItem('/admin/config/datafields');
     PageLayout::setTitle(_('Verwaltung von generischen Datenfeldern'));
     // Set variables used by (almost) all actions
     $this->allclasses = DataField::getDataClass();
     $this->class_filter = Request::option('class_filter', null);
     $this->createSidebar($action);
 }
Пример #27
0
function do_lit_import()
{
    global $_range_id;
    $cmd = Request::option('cmd');
    $xmlfile = $_FILES['xmlfile']['tmp_name'];
    $xmlfile_name = $_FILES['xmlfile']['name'];
    $xmlfile_size = $_FILES['xmlfile']['size'];
    $plugin_name = Request::get('plugin_name');
    if ($cmd == "import_lit_list" && $xmlfile) {
        StudipLitImportPluginAbstract::use_lit_import_plugins($xmlfile, $xmlfile_size, $xmlfile_name, $plugin_name, $_range_id);
        //header("Location: $PHP_SELF?_range_id=$_range_id&username=$username&_msg=".urlencode($_msg));
        //wozu dieses???
    }
}
Пример #28
0
 /**
  * Constructor
  * @access   public
  * @param    array  the eval's ID (optional - if not given, it must be in $_REQUEST).
  */
 function EvaluationTree($args)
 {
     if (isset($args['evalID'])) {
         $this->evalID = $args['evalID'];
     } else {
         $this->evalID = Request::option("evalID");
     }
     $this->load_mode = $args['load_mode'] ? $args['load_mode'] : EVAL_LOAD_NO_CHILDREN;
     if (empty($this->evalID)) {
         print _("Fehler in EvaluationTree: Es wurde keine evalID übergeben");
         exit;
     }
     /* ------------------------------------------------------------------- */
     parent::TreeAbstract();
 }
Пример #29
0
 /**
  * common tasks for all actions
  *
  * @param String $action Action that has been called
  * @param Array  $args   List of arguments
  */
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     // user must have root permission
     $GLOBALS['perm']->check('root');
     //setting title and navigation
     PageLayout::setTitle(_('Verwaltung von Ferien'));
     Navigation::activateItem('/admin/locations/holidays');
     // Extract and bind filter option
     $this->filter = Request::option('filter');
     if ($this->filter) {
         URLHelper::addLinkParam('filter', $this->filter);
     }
     $this->setSidebar();
 }
Пример #30
0
 /**
  * get link to create new account
  *
  * returns link to create new user-account
  * @access public
  * @return string html-code
  */
 function getNewAccountLink()
 {
     global $connected_cms, $cms_select, $current_module;
     $output .= "<form method=\"POST\" action=\"" . URLHelper::getLink() . "\">\n";
     $output .= CSRFProtection::tokenTag();
     $output .= "<input type=\"HIDDEN\" name=\"view\" value=\"" . Request::option('view') . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"ref_id\" value=\"" . htmlReady($connected_cms[$this->cms_type]->content_module[$current_module]->getId()) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"module_type\" value=\"" . htmlReady($connected_cms[$this->cms_type]->content_module[$current_module]->getModuleType()) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"search_key\" value=\"" . htmlReady(Request::get('search_key')) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"cms_select\" value=\"" . htmlReady($cms_select) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"new_account_cms\" value=\"" . htmlReady($this->cms_type) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"new_account_step\" value=\"0\">\n";
     $output .= Button::createAccept(_('Starten'), 'start');
     $output .= "</form>";
     return $output;
 }