Exemple #1
0
 public function index_action()
 {
     if (Request::isPost() && Request::option("termin_id") && Request::get("topic_title")) {
         $date = new CourseDate(Request::option("termin_id"));
         $seminar_id = $date['range_id'];
         $title = Request::get("topic_title");
         $topic = CourseTopic::findByTitle($seminar_id, $title);
         if (!$topic) {
             $topic = new CourseTopic();
             $topic['title'] = $title;
             $topic['seminar_id'] = $seminar_id;
             $topic['author_id'] = $GLOBALS['user']->id;
             $topic['description'] = "";
             $topic->store();
         }
         $success = $date->addTopic($topic);
         if ($success) {
             PageLayout::postMessage(MessageBox::success(_("Thema wurde hinzugefügt.")));
         } else {
             PageLayout::postMessage(MessageBox::info(_("Thema war schon mit dem Termin verknüpft.")));
         }
     }
     Navigation::activateItem('/course/schedule/dates');
     object_set_visit_module("schedule");
     $this->last_visitdate = object_get_visit(Course::findCurrent()->id, 'schedule');
     $this->dates = Course::findCurrent()->getDatesWithExdates();
     $this->lecturer_count = Course::findCurrent()->countMembersWithStatus('dozent');
 }
Exemple #2
0
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     // Lock context to user id
     $this->owner = $GLOBALS['user'];
     $this->context_id = $this->owner->id;
     $this->full_access = true;
     if (Config::get()->PERSONALDOCUMENT_OPEN_ACCESS) {
         $username = Request::username('username', $GLOBALS['user']->username);
         $user = User::findByUsername($username);
         if ($user && $user->id !== $GLOBALS['user']->id) {
             $this->owner = $user;
             $this->context_id = $user->id;
             $this->full_access = Config::get()->PERSONALDOCUMENT_OPEN_ACCESS_ROOT_PRIVILEDGED && $GLOBALS['user']->perms === 'root';
             URLHelper::bindLinkParam('username', $username);
         }
     }
     $this->limit = $GLOBALS['user']->cfg->PERSONAL_FILES_ENTRIES_PER_PAGE ?: Config::get()->ENTRIES_PER_PAGE;
     $this->userConfig = DocUsergroupConfig::getUserConfig($GLOBALS['user']->id);
     if ($this->userConfig['area_close'] == 1) {
         $this->redirect('document/closed/index');
     }
     if (Request::isPost()) {
         CSRFProtection::verifySecurityToken();
     }
     if (($ticket = Request::get('studip-ticket')) && !check_ticket($ticket)) {
         $message = _('Bei der Verarbeitung Ihrer Anfrage ist ein Fehler aufgetreten.') . "\n" . _('Bitte versuchen Sie es erneut.');
         PageLayout::postMessage(MessageBox::error($message));
         $this->redirect('document/files/index');
     }
 }
 public function fetchData()
 {
     if ($this->already_fetched) {
         return;
     }
     $this->already_fetched = true;
     try {
         if (!$this->customImportEnabled()) {
             if (in_array($this['source'], array("csv_upload", "extern"))) {
                 return;
             } elseif ($this['source'] === "database") {
                 $this->fetchDataFromDatabase();
                 return;
             } elseif ($this['source'] === "csv_weblink") {
                 $this->fetchDataFromWeblink();
                 return;
             } elseif ($this['source'] === "csv_studipfile") {
                 $output = $this->getCSVDataFromFile(get_upload_file_path($this['tabledata']['weblink']['file_id']), ";");
                 $headline = array_shift($output);
                 $this->createTable($headline, $output);
                 return;
             }
         } else {
             $this->getPlugin()->fetchData();
         }
     } catch (Exception $e) {
         PageLayout::postMessage(MessageBox::error(sprintf(_("Konnte Tabelle '%s' nicht mit Daten befüllen."), $this['name'])));
     }
 }
Exemple #4
0
 function index_action()
 {
     $form_fields['comment'] = array('caption' => _("Kommentar"), 'type' => 'textarea', 'attributes' => array('rows' => 4, 'style' => 'width:100%'));
     $form_fields['snd_message'] = array('caption' => _("Benachrichtigung über ausfallende Termine an alle Teilnehmer verschicken"), 'type' => 'checkbox', 'attributes' => array('style' => 'vertical-align:middle'));
     $form_buttons['save_close'] = array('caption' => _('OK'), 'info' => _("Termine absagen und Dialog schließen"));
     $form = new StudipForm($form_fields, $form_buttons, 'cancel_dates', false);
     if ($form->isClicked('save_close')) {
         $sem = Seminar::getInstance($this->course_id);
         $comment = $form->getFormFieldValue('comment');
         foreach ($this->dates as $date) {
             $sem->cancelSingleDate($date->getTerminId(), $date->getMetadateId());
             $date->setComment($comment);
             $date->setExTermin(true);
             $date->store();
         }
         if ($form->getFormFieldValue('snd_message') && count($this->dates)) {
             $snd_messages = raumzeit_send_cancel_message($comment, $this->dates);
             if ($snd_messages) {
                 $msg = sprintf(_("Es wurden %s Benachrichtigungen gesendet."), $snd_messages);
             }
         }
         PageLayout::postMessage(MessageBox::success(_("Folgende Termine wurden abgesagt") . ($msg ? ' (' . $msg . '):' : ':'), array_map(function ($d) {
             return $d->toString();
         }, $this->dates)));
         $this->redirect($this->url_for('course/dates'));
     }
     $this->form = $form;
 }
Exemple #5
0
 public function overview_action()
 {
     Navigation::activateItem("/admin/locations/sem_classes");
     if (count($_POST) && Request::submitted('delete') && Request::get("delete_sem_class")) {
         $sem_class = $GLOBALS['SEM_CLASS'][Request::get("delete_sem_class")];
         if ($sem_class->delete()) {
             PageLayout::postMessage(MessageBox::success(_("Veranstaltungskategorie wurde gelöscht.")));
             $GLOBALS['SEM_CLASS'] = SemClass::refreshClasses();
         }
     }
     if (count($_POST) && Request::get("add_name")) {
         $statement = DBManager::get()->prepare("SELECT 1 FROM sem_classes WHERE name = :name");
         $statement->execute(array('name' => Request::get("add_name")));
         $duplicate = $statement->fetchColumn();
         if ($duplicate) {
             $message = sprintf(_("Es existiert bereits eine Veranstaltungskategorie mit dem Namen \"%s\""), Request::get("add_name"));
             PageLayout::postMessage(MessageBox::error($message));
             $this->redirect('admin/sem_classes/overview');
         } else {
             $statement = DBManager::get()->prepare("INSERT INTO sem_classes SET name = :name, mkdate = UNIX_TIMESTAMP(), chdate = UNIX_TIMESTAMP() " . "");
             $statement->execute(array('name' => Request::get("add_name")));
             $id = DBManager::get()->lastInsertId();
             if (Request::get("add_like")) {
                 $sem_class = clone $GLOBALS['SEM_CLASS'][Request::get("add_like")];
                 $sem_class->set('name', Request::get("add_name"));
                 $sem_class->set('id', $id);
                 $sem_class->store();
             }
             $this->redirect(URLHelper::getURL($this->url_for('admin/sem_classes/details'), array('id' => $id)));
             PageLayout::postMessage(MessageBox::success(_("Veranstaltungskategorie wurde erstellt.")));
             $GLOBALS['SEM_CLASS'] = SemClass::refreshClasses();
         }
     }
 }
 /**
  *
  **/
 public function authorize_action()
 {
     global $user, $auth;
     $auth->login_if($user->id == 'nobody');
     $user_id = OAuthUser::getMappedId($user->id);
     // Fetch the oauth store and the oauth server.
     $store = OAuthStore::instance();
     $server = new OAuthServer();
     try {
         // Check if there is a valid request token in the current request
         // Returns an array with the consumer key, consumer secret, token, token secret and token type.
         $rs = $server->authorizeVerify();
         if (isset($_POST['allow'])) {
             // See if the user clicked the 'allow' submit button (or whatever you choose)
             $authorized = array_key_exists('allow', $_POST);
             // Set the request token to be authorized or not authorized
             // When there was a oauth_callback then this will redirect to the consumer
             $server->authorizeFinish($authorized, $user_id);
             // No oauth_callback, show the user the result of the authorization
             // ** your code here **
             PageLayout::postMessage(Messagebox::success(_('Sie haben der Applikation Zugriff auf Ihre Daten gewährt.')));
             $this->redirect('user#' . $rs['consumer_key']);
         }
     } catch (OAuthException $e) {
         // No token to be verified in the request, show a page where the user can enter the token to be verified
         // **your code here**
         die('invalid');
     }
     PageLayout::disableHeader();
     $this->set_layout($GLOBALS['template_factory']->open('layouts/base_without_infobox'));
     $this->rs = $rs;
 }
Exemple #7
0
 public function tabularasa_action($timestamp = null)
 {
     $institutes = MyRealmModel::getMyInstitutes();
     foreach ($institutes as $index => $institut) {
         MyRealmModel::setObjectVisits($institutes[$index], $institut['institut_id'], $GLOBALS['user']->id, $timestamp);
     }
     PageLayout::postMessage(MessageBox::success(_('Alles als gelesen markiert!')));
     $this->redirect('my_institutes/index');
 }
Exemple #8
0
 /**
  * This method is called to remove an avatar for a course.
  *
  * @return void
  */
 function delete_action()
 {
     CourseAvatar::getAvatar($this->course_id)->reset();
     PageLayout::postMessage(MessageBox::success(_("Veranstaltungsbild gelöscht.")));
     if ($this->studygroup_mode) {
         $this->redirect(URLHelper::getUrl('dispatch.php/course/studygroup/edit/' . $this->course_id));
     } else {
         $this->redirect(URLHelper::getUrl('dispatch.php/course/avatar/update/' . $this->course_id));
     }
 }
Exemple #9
0
 public function ask_for_hosts_action($host_id)
 {
     $host = new LernmarktplatzHost($host_id);
     $added = $this->askForHosts($host);
     if ($added > 0) {
         PageLayout::postMessage(MessageBox::success(sprintf(_("%s neue Server hinzugefügt."), $added)));
     } else {
         PageLayout::postMessage(MessageBox::info(_("Keine neuen Server gefunden.")));
     }
     $this->redirect("admin/hosts");
 }
 public function edit_action($material_id = null)
 {
     $this->material = new LernmarktplatzMaterial($material_id);
     Pagelayout::setTitle($this->material->isNew() ? _("Neues Material hochladen") : _("Material bearbeiten"));
     if ($this->material['user_id'] && $this->material['user_id'] !== $GLOBALS['user']->id) {
         throw new AccessDeniedException();
     }
     if (Request::submitted("delete") && Request::isPost()) {
         $this->material->pushDataToIndexServers("delete");
         $this->material->delete();
         PageLayout::postMessage(MessageBox::success(_("Ihr Material wurde gelöscht.")));
         $this->redirect("market/overview");
     } elseif (Request::isPost()) {
         $was_new = $this->material->setData(Request::getArray("data"));
         $this->material['user_id'] = $GLOBALS['user']->id;
         $this->material['host_id'] = null;
         $this->material['license'] = "CC BY 4.0";
         if ($_FILES['file']['tmp_name']) {
             $this->material['content_type'] = $_FILES['file']['type'];
             if (in_array($this->material['content_type'], array("application/x-zip-compressed", "application/zip", "application/x-zip"))) {
                 $tmp_folder = $GLOBALS['TMP_PATH'] . "/temp_folder_" . md5(uniqid());
                 mkdir($tmp_folder);
                 unzip_file($_FILES['file']['tmp_name'], $tmp_folder);
                 $this->material['structure'] = $this->getFolderStructure($tmp_folder);
                 rmdirr($tmp_folder);
             } else {
                 $this->material['structure'] = null;
             }
             $this->material['filename'] = $_FILES['file']['name'];
             move_uploaded_file($_FILES['file']['tmp_name'], $this->material->getFilePath());
         }
         if ($_FILES['image']['tmp_name']) {
             $this->material['front_image_content_type'] = $_FILES['image']['type'];
             move_uploaded_file($_FILES['image']['tmp_name'], $this->material->getFrontImageFilePath());
         }
         if (Request::get("delete_front_image")) {
             $this->material['front_image_content_type'] = null;
         }
         $this->material->store();
         //Topics:
         $topics = Request::getArray("tags");
         foreach ($topics as $key => $topic) {
             if (!trim($topic)) {
                 unset($topics[$key]);
             }
         }
         $this->material->setTopics($topics);
         $this->material->pushDataToIndexServers();
         PageLayout::postMessage(MessageBox::success(_("Lernmaterial erfolgreich gespeichert.")));
         $this->redirect("market/details/" . $this->material->getId());
     }
 }
 /**
  *
  **/
 public static function onEnable($pluginId)
 {
     # TODO performance - use cache on success ?
     $role_persistence = new RolePersistence();
     $plugin_roles = $role_persistence->getAssignedPluginRoles($pluginId);
     $role_names = array_map(function ($role) {
         return $role->getRolename();
     }, $plugin_roles);
     if (!in_array('Nobody', $role_names)) {
         $message = _('Das OAuth-Plugin ist aktiviert, aber nicht für die Rolle "Nobody" freigegeben.');
         $details = array();
         $details[] = _('Dies behindert die Kommunikation externer Applikationen mit dem System.');
         $details[] = sprintf(_('Klicken Sie <a href="%s">hier</a>, um die Rollenzuweisung zu bearbeiten.'), URLHelper::getLink('dispatch.php/admin/role/assign_plugin_role/' . $pluginId));
         PageLayout::postMessage(Messagebox::info($message, $details));
     }
 }
Exemple #12
0
 public function edit_action($process_id = null)
 {
     $this->process = new FleximportProcess($process_id);
     if (Request::isPost()) {
         if (Request::submitted("delete_process")) {
             $this->process->delete();
             PageLayout::postMessage(MessageBox::success(_("Prozess wurde gelöscht.")));
             $processes = FleximportProcess::findBySQL("1=1 ORDER BY name ASC");
             $this->redirect("import/overview" . (count($processes) ? "/" . $processes[0]['process_id'] : ""));
         } else {
             $this->process->setData(Request::getArray("data"));
             $this->process->store();
             PageLayout::postMessage(MessageBox::success(_("Prozess wurde gespeichert")));
             $this->redirect("import/overview/" . $this->process->getId());
         }
     }
 }
Exemple #13
0
 public function perform($unconsumed)
 {
     if ($unconsumed !== 'read_all') {
         return;
     }
     $global_news = StudipNews::GetNewsByRange('studip', true);
     foreach ($global_news as $news) {
         object_add_view($news['news_id']);
         object_set_visit($news['news_id'], 'news');
     }
     if (Request::isXhr()) {
         echo json_encode(true);
     } else {
         PageLayout::postMessage(MessageBox::success(_('Alle Ankündigungen wurden als gelesen markiert.')));
         header('Location: ' . URLHelper::getLink('dispatch.php/start'));
     }
 }
Exemple #14
0
 /**
  * checks, if tour step data is complete
  * 
  * @return boolean true or false
  */
 function validate()
 {
     if ($this->isNew()) {
     }
     if (!$this->orientation) {
         $this->orientation = 'B';
     }
     if (!$this->title and !$this->tip) {
         PageLayout::postMessage(MessageBox::error(_('Der Schritt muss einen Titel oder Inhalt besitzen.')));
         return false;
     }
     if (!$this->route) {
         PageLayout::postMessage(MessageBox::error(_('Ungültige oder fehlende Angabe zur Seite, für die der Schritt angezeigt werden soll.')));
         return false;
     }
     return true;
 }
Exemple #15
0
 public function approve_action($plugin_id)
 {
     $this->marketplugin = new MarketPlugin($plugin_id);
     if ($this->marketplugin['approved']) {
         throw new Exception("Plugin ist schon reviewt.");
     }
     $this->marketplugin['approved'] = (int) Request::int("approved");
     if (!$this->marketplugin['approved']) {
         $this->marketplugin['publiclyvisible'] = 0;
     }
     if ($this->marketplugin['approved'] && $this->marketplugin['publiclyvisible']) {
         $this->marketplugin['published'] = time();
     }
     $this->marketplugin->store();
     $messaging = new messaging();
     $messaging->insert_message(sprintf(_("Ihr Plugin %s wurde reviewt:"), $this->marketplugin['name']) . "\n\n" . ($this->marketplugin['approved'] ? _("Es ist in den Marktplatz aufgenommen worden!") : _("Es ist leider noch nicht in den Marktplatz aufgenommen.")) . "\n\n" . (Request::get("review") ? _("Begründung:") . "\n\n" . Request::get("review") : _("Ein ausführliches Review wurde nicht angegeben und muss bei Bedarf direkt angefragt werden.")), get_username($this->marketplugin['user_id']), '', '', '', '', '', _("Pluginreview"), true, 'normal', "pluginreview");
     PageLayout::postMessage(MessageBox::success(_("Review wurde gespeichert.")));
     $this->redirect('approving/overview');
 }
Exemple #16
0
 public function tablemapping_action($table_id)
 {
     PageLayout::setTitle(_("Datenmapping einstellen"));
     $this->table = new FleximportTable($table_id);
     Navigation::activateItem("/fleximport/process_" . $this->table['process_id']);
     if (Request::isPost()) {
         $tabledata = Request::getArray("tabledata");
         $tabledata = array_merge($this->table['tabledata'], $tabledata);
         $this->table['tabledata'] = $tabledata;
         $this->table->store();
         PageLayout::postMessage(MessageBox::success(_("Daten wurden gespeichert.")));
     }
     $datafield_object_types = array('User' => "user", 'Course' => "sem", 'CourseMember' => "usersemdata");
     $this->datafields = Datafield::findBySQL("object_type = :object_type", array('object_type' => $datafield_object_types[$this->table['import_type']]));
     if (Request::isAjax() && Request::isPost()) {
         $output = array('func' => "STUDIP.Fleximport.updateTable", 'payload' => array('table_id' => $table_id, 'name' => $this->table['name'], 'html' => $this->render_template_as_string("import/_table.php")));
         $this->response->add_header("X-Dialog-Execute", json_encode(studip_utf8encode($output)));
     }
 }
Exemple #17
0
 /**
  * Toggles whether a certain smiley is favored for the current user
  *
  * @param int    $id    Id of the smiley to favor/disfavor
  * @param String $view  View to return to
  */
 function favor_action($id, $view)
 {
     try {
         $state = $this->favorites->toggle($id);
         $message = $state ? _('Der Smiley wurde zu Ihren Favoriten hinzugefügt.') : _('Der Smiley gehört nicht mehr zu Ihren Favoriten.');
         $msg_box = MessageBox::success($message);
     } catch (OutOfBoundsException $e) {
         $state = $this->favorites->contain($id);
         $message = _('Maximale Favoritenzahl erreicht. Vielleicht sollten Sie mal ausmisten? :)');
         $msg_box = MessageBox::error($message);
     }
     if (Request::isXhr()) {
         $this->response->add_header('Content-Type', 'application/json');
         $this->render_text(json_encode(array('state' => $state, 'message' => studip_utf8encode($msg_box))));
     } else {
         PageLayout::postMessage($msg_box);
         $this->redirect('smileys/index/' . $view . '#smiley' . $id);
     }
 }
Exemple #18
0
 /**
  *
  **/
 public function authorize_action()
 {
     global $user, $auth;
     $auth_plugin = Config::get()->API_OAUTH_AUTH_PLUGIN;
     if ($GLOBALS['user']->id === 'nobody' && $auth_plugin !== 'Standard' && !Request::option('sso')) {
         $params = $_GET;
         $params['sso'] = $auth_plugin;
         $this->redirect($this->url_for('api/oauth/authorize?' . http_build_query($params)));
         return;
     } else {
         $auth->login_if($user->id === 'nobody');
     }
     $user_id = RESTAPI\Consumer\OAuth::getOAuthId($GLOBALS['user']->id);
     try {
         $consumer = RESTAPI\Consumer\Base::detectConsumer('oauth', 'request');
         if (Request::submitted('allow')) {
             $result = $consumer->grantAccess($GLOBALS['user']->id);
             $redirect_uri = Request::get('oauth_callback', $consumer->callback);
             if ($redirect_uri) {
                 $this->redirect($redirect_uri);
             } else {
                 // No oauth_callback, show the user the result of the authorization
                 // ** your code here **
                 PageLayout::postMessage(MessageBox::success(_('Sie haben der Applikation Zugriff auf Ihre Daten gewährt.')));
                 $this->redirect('api/authorizations#' . $consumer->auth_key);
             }
             return;
         }
     } catch (OAuthException $e) {
         // No token to be verified in the request, show a page where the user can enter the token to be verified
         // **your code here**
         die('invalid');
     }
     PageLayout::disableHeader();
     PageLayout::setTitle(sprintf(_('"%s" bittet um Zugriff'), $consumer->title));
     $this->set_layout($GLOBALS['template_factory']->open('layouts/base.php'));
     $this->consumer = $consumer;
     $this->token = Request::option('oauth_token');
     $this->oauth_callback = Request::get('oauth_callback');
 }
Exemple #19
0
 public function process_action($process_id)
 {
     if (Request::isPost()) {
         if (Request::submitted("start")) {
             $protocol = array();
             $starttime = time();
             $this->process = FleximportProcess::find($process_id);
             $this->tables = $this->process->tables;
             foreach ($this->tables as $table) {
                 $table->fetchData();
             }
             foreach ($this->tables as $table) {
                 $table->doImport();
             }
             $duration = time() - $starttime;
             if ($duration >= 60) {
                 PageLayout::postMessage(MessageBox::success(sprintf(_("Import wurde durchgeführt und dauerte %s Minuten"), floor($duration / 60)), $protocol));
             } else {
                 PageLayout::postMessage(MessageBox::success(_("Import wurde durchgeführt"), $protocol));
             }
         } elseif ($_FILES['tableupload']) {
             foreach ($_FILES['tableupload']['tmp_name'] as $table_id => $tmp_name) {
                 if ($tmp_name) {
                     $table = new FleximportTable($table_id);
                     $output = $this->plugin->getCSVDataFromFile($tmp_name);
                     if ($table['tabledata']['source_encoding'] === "utf8") {
                         $output = studip_utf8decode($output);
                     }
                     $headline = array_shift($output);
                     $table->createTable($headline, $output);
                 }
             }
             PageLayout::postMessage(MessageBox::success(_("CSV-Datei hochgeladen")));
         }
     }
     $this->redirect("import/overview/" . $process_id);
 }
Exemple #20
0
 public function delete_release_action($release_id)
 {
     $release = new MarketRelease($release_id);
     if ($release->plugin->isWritable()) {
         $version = $release->version;
         $plugin = $release->plugin;
         $release->delete();
         PageLayout::postMessage(MessageBox::success(sprintf(_("Das Pluginrelease %s wurde gelöscht."), $version)));
         $this->redirect($this->url_for('presenting/details/' . $plugin->id));
         return;
     }
     $this->render_nothing();
 }
Exemple #21
0
 /**
  * Deletes a page.
  *
  * @param String $id Id of the page to delete
  */
 public function delete_action($id)
 {
     $ticket = Request::option('ticket');
     if ($ticket && check_ticket($ticket)) {
         $scm = new StudipScmEntry($id);
         if (!$scm->isNew() && $scm->range_id == $GLOBALS['SessSemName'][1]) {
             $scm->delete();
             PageLayout::postMessage(MessageBox::success(_('Der Eintrag wurde gelöscht.')));
         }
         $this->redirect('course/scm');
         return;
     }
     PageLayout::postMessage(MessageBox::error(_('Es ist ein Fehler aufgetreten. Bitte versuchen Sie erneut, diese Seite zu löschen.')));
     $this->redirect('course/scm/' . $id);
 }
Exemple #22
0
                    <th><?php 
echo _("Inhalt");
?>
</th>
                    <th></th>
                </tr>
                </thead>
                <? if (strcmp($group_field, 'sem_number') !== 0) : ?>
                    <?php 
echo $this->render_partial("my_courses/_group", compact('sem_key', 'course_group'));
?>
                <? else : ?>
                    <? $course_collection = $course_group ?>
                    <?php 
echo $this->render_partial("my_courses/_course", compact('course_collection'));
?>
                <? endif ?>
            </table>
        <? endforeach ?>
    </div>
<? else : ?>
    <?php 
echo PageLayout::postMessage(MessageBox::info(_('Es wurden keine Veranstaltungen gefunden. Mögliche Ursachen:'), array(sprintf(_('Sie haben zur Zeit keine Veranstaltungen belegt, an denen Sie teilnehmen können.<br>Bitte nutzen Sie %s<b>Veranstaltung suchen / hinzufügen</b>%s um sich für Veranstaltungen anzumelden.'), '<a href="' . URLHelper::getLink('dispatch.php/search/courses') . '">', '</a>'), _('In dem ausgewählten <b>Semester</b> wurden keine Veranstaltungen belegt.') . '<br>' . _('Wählen Sie links im <b>Semesterfilter</b> ein anderes Semester aus'))));
?>
<? endif ?>
<? if (count($my_bosses)) : ?>
    <?php 
echo $this->render_partial('my_courses/_deputy_bosses');
?>
<? endif ?>
Exemple #23
0
 public function index_action()
 {
     $this->prelim_discussion = vorbesprechung($this->course->id);
     $this->title = $this->course->getFullname();
     $this->course_domains = UserDomain::getUserDomainsForSeminar($this->course->id);
     $this->sem = new Seminar($this->course);
     if ($studienmodulmanagement = PluginEngine::getPlugin('StudienmodulManagement')) {
         foreach ($this->course->study_areas->filter(function ($m) {
             return $m->isModule();
         }) as $module) {
             $this->studymodules[] = array('nav' => $studienmodulmanagement->getModuleInfoNavigation($module->id, $this->course->start_semester->id), 'title' => $studienmodulmanagement->getModuleTitle($module->id, $this->course->start_semester->id));
         }
     }
     // Retrive display of sem_tree
     if (Config::get()->COURSE_SEM_TREE_DISPLAY) {
         $this->studyAreaTree = StudipStudyArea::backwards($this->course->study_areas);
     } else {
         $this->study_areas = $this->course->study_areas->filter(function ($m) {
             return !$m->isModule();
         });
     }
     if (Request::isXhr()) {
         $this->set_layout(null);
         $this->response->add_header('Content-Type', 'text/html;charset=Windows-1252');
         header('X-Title: ' . $this->title);
     } else {
         PageLayout::setHelpKeyword("Basis.InVeranstaltungDetails");
         PageLayout::setTitle($this->title . " - " . _("Details"));
         PageLayout::addSqueezePackage('admission');
         PageLayout::addSqueezePackage('enrolment');
         if ($GLOBALS['SessionSeminar'] == $this->course->id) {
             Navigation::activateItem('/course/main/details');
             SkipLinks::addIndex(Navigation::getItem('/course/main/details')->getTitle(), 'main_content', 100);
         } else {
             $sidebarlink = true;
             $enrolment_info = $this->sem->getEnrolmentInfo($GLOBALS['user']->id);
         }
         $sidebar = Sidebar::Get();
         if ($sidebarlink) {
             $sidebar->setContextAvatar(CourseAvatar::getAvatar($this->course->id));
         }
         $sidebar->setTitle(_('Details'));
         $links = new ActionsWidget();
         $links->addLink(_("Drucken"), URLHelper::getScriptLink("dispatch.php/course/details/index/" . $this->course->id), Icon::create('print', 'clickable'), array('class' => 'print_action', 'target' => '_blank'));
         if ($enrolment_info['enrolment_allowed'] && $sidebarlink) {
             if (in_array($enrolment_info['cause'], words('member root courseadmin'))) {
                 $abo_msg = _("direkt zur Veranstaltung");
             } else {
                 $abo_msg = _("Zugang zur Veranstaltung");
             }
             $links->addLink($abo_msg, URLHelper::getScriptLink("dispatch.php/course/enrolment/apply/" . $this->course->id), Icon::create('door-enter', 'clickable'), array('data-dialog' => ''));
         }
         if (Config::get()->SCHEDULE_ENABLE && !$GLOBALS['perm']->have_studip_perm("user", $this->course->id) && !$GLOBALS['perm']->have_perm('admin') && $this->sem->getMetaDateCount()) {
             $query = "SELECT COUNT(*) FROM schedule_seminare WHERE seminar_id = ? AND user_id = ?";
             if (!DBManager::Get()->fetchColumn($query, array($this->course->id, $GLOBALS['user']->id))) {
                 $links->addLink(_("Nur im Stundenplan vormerken"), URLHelper::getLink("dispatch.php/calendar/schedule/addvirtual/" . $this->course->id), Icon::create('info', 'clickable'));
             }
         }
         if ($this->send_from_search_page) {
             $links->addLink(_("Zurück zur letzten Auswahl"), URLHelper::getLink($this->send_from_search_page), Icon::create('link-intern', 'clickable'));
         }
         if ($links->hasElements()) {
             $sidebar->addWidget($links);
         }
         $sidebar->setImage('sidebar/seminar-sidebar.png');
         $sidebar->setContextAvatar(CourseAvatar::getAvatar($this->course->id));
         $sidebar = Sidebar::Get();
         $sidebar->setImage('sidebar/seminar-sidebar.png');
         $sidebar->setContextAvatar(CourseAvatar::getAvatar($this->course->id));
         if ($enrolment_info['description']) {
             PageLayout::postMessage(MessageBox::info($enrolment_info['description']));
         }
     }
 }
Exemple #24
0
 function remove_action($group = null)
 {
     $contact = Contact::find(array(User::findCurrent()->id, User::findByUsername(Request::username('user'))->id));
     if ($contact) {
         if ($group) {
             $contact->group_assignments->unsetBy('statusgruppe_id', $group);
             if ($contact->store()) {
                 PageLayout::postMessage(MessageBox::success(_("Der Kontakt wurde aus der Gruppe entfernt.")));
             }
         } else {
             if ($contact->delete()) {
                 PageLayout::postMessage(MessageBox::success(_("Der Kontakt wurde entfernt.")));
             }
         }
     }
     $this->redirect('contact/index/' . $group);
 }
Exemple #25
0
/**
 * generates proper text for confirmation question and removes range_id from news
 *
 *
 * @param $remove_array array with $news_id as key and array of range_ids as value
 * @param string $range_id
 * @return string text for confirmation question or empty string after removal
 */
function remove_news($remove_array)
{
    $confirmed = false;
    $question_text = array();
    if (!is_array($remove_array)) {
        return false;
    }
    if (Request::submitted('yes') and Request::isPost()) {
        CSRFProtection::verifySecurityToken();
        $confirmed = true;
    }
    foreach ($remove_array as $news_id => $ranges) {
        $remove_news = new StudipNews($news_id);
        $remove_news_title = $remove_news->getValue('topic');
        if (!is_array($ranges)) {
            $ranges = array($ranges);
        }
        // should we delete news completely
        if (count($ranges) == count($remove_news->getRanges())) {
            $text = delete_news($news_id);
            if ($text) {
                $question_text[] = $text;
            }
            // or just remove range_id(s)?
        } else {
            $text = '';
            if ($confirmed and !$remove_news->isNew() and count($ranges)) {
                foreach ($ranges as $key => $range_id) {
                    if ($remove_news->havePermission('unassign', $range_id)) {
                        $remove_news->deleteRange($range_id);
                    } else {
                        unset($ranges[$key]);
                        PageLayout::postMessage(MessageBox::error(sprintf(_('Keine Berechtigung zum Entfernen der Ankündigung "%s" aus diesem Bereich.'), htmlReady($remove_news->getValue('topic')))));
                    }
                    if (count($ranges)) {
                        if (count($ranges) == 1) {
                            PageLayout::postMessage(MessageBox::success(sprintf(_('Ankündigung "%s" wurde aus dem Bereich entfernt.'), htmlReady($remove_news->getValue('topic')))));
                        } else {
                            PageLayout::postMessage(MessageBox::success(sprintf(_('Ankündigung "%s" wurde aus %s Bereichen entfernt.'), htmlReady($remove_news->getValue('topic')), count($ranges))));
                        }
                        $remove_news->store();
                    }
                }
            } elseif (!$confirmed) {
                if (count($ranges) == 1) {
                    $text = sprintf(_('- Die Ankündigung "%s" wird aus dem aktiven Bereich entfernt. ' . 'Sie wird dadurch nicht endgültig gelöscht. Es wird nur die Zuordnung entfernt.'), $remove_news_title) . "\n";
                } elseif (count($ranges) > 1) {
                    $text = sprintf(_('- Die Ankündigung "%s" wird aus den %s gewählten Bereichen entfernt. ' . 'Sie wird dadurch nicht endgültig gelöscht. Es werden nur die Zuordnungen entfernt.'), $remove_news_title, count($ranges)) . "\n";
                }
            }
            if ($text) {
                $question_text[] = $text;
            }
        }
    }
    if (count($question_text) > 1) {
        return _('Wollen Sie die folgenden Aktionen jetzt ausführen?') . "\n" . implode($question_text);
    } elseif (count($question_text) == 1) {
        return _('Wollen Sie diese Aktion jetzt ausführen?') . "\n" . implode($question_text);
    }
}
Exemple #26
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;
 }
Exemple #27
0
 /**
  *
  **/
 public function revoke_action($id)
 {
     RESTAPI\Consumer\Base::find($id)->revokeAccess($GLOBALS['user']->id);
     PageLayout::postMessage(MessageBox::success(_('Der Applikation wurde der Zugriff auf Ihre Daten untersagt.')));
     $this->redirect('api/authorizations');
 }
Exemple #28
0
 /**
  * Action to add multiple members to a group.
  *
  * @param string group id
  */
 public function memberAdd_action($group_id = null)
 {
     $mp = MultiPersonSearch::load("add_statusgroup" . $group_id);
     $this->group = new Statusgruppen($group_id);
     $countAdded = 0;
     foreach ($mp->getAddedUsers() as $a) {
         if (!$this->group->isMember(new User($a))) {
             $new_user = new StatusgruppeUser(array($group_id, $a));
             $new_user->store();
             $this->type['after_user_add']($a);
             $countAdded++;
         }
     }
     if ($countAdded > 0) {
         $message = sprintf(ngettext('Es wurde eine Person hinzugefügt.', 'Es wurden %u MitgliederInnen hinzugefügt.', $countAdded), $countAdded);
         PageLayout::postMessage(MessageBox::success($message));
     }
     $this->redirect('admin/statusgroups');
 }
Exemple #29
0
 /**
  * Deletes the given entry from step registry.
  * @param $id ID of the entry to delete
  */
 public function delete_action($id)
 {
     CSRFProtection::verifyUnsafeRequest();
     if (Request::submitted('delete')) {
         $step = CourseWizardStepRegistry::find($id);
         if ($step) {
             $name = $step->name;
             if (CourseWizardStepRegistry::unregisterStep($id)) {
                 PageLayout::postMessage(MessageBox::success(sprintf(_('Der Schritt "%s" wurde gelöscht.'), $name)));
             } else {
                 PageLayout::postMessage(MessageBox::error(sprintf(_('Der Schritt %s konnte nicht gelöscht werden.'), $name)));
             }
         }
     }
     $this->redirect($this->url_for('admin/coursewizardsteps'));
 }
Exemple #30
0
 /**
  * save tour data
  * 
  * @param String $tour_id    tour id
  */
 function save_action($tour_id = '')
 {
     // check permission
     $GLOBALS['perm']->check('root');
     // initialize
     Navigation::activateItem('/admin/config/tour');
     $this->tour = new HelpTour($tour_id);
     if ($tour_id and $this->tour->isNew()) {
         throw new AccessDeniedException(_('Die Tour mit der angegebenen ID existiert nicht.'));
     }
     if (Request::submitted('save_tour_details')) {
         CSRFProtection::verifySecurityToken();
         $this->tour->name = trim(Request::get('tour_name'));
         $this->tour->description = trim(Request::get('tour_description'));
         if (Request::option('tour_language')) {
             $this->tour->language = Request::option('tour_language');
         }
         $this->tour->type = Request::option('tour_type');
         $this->tour->settings->access = Request::option('tour_access');
         $this->tour->roles = implode(',', Request::getArray('tour_roles'));
         if ($this->tour->isNew()) {
             $this->tour->global_tour_id = md5(uniqid('help_tours', 1));
             $this->tour->settings->active = 0;
         }
         $this->tour->author_email = $GLOBALS['user']->Email;
         $this->tour->studip_version = $GLOBALS['SOFTWARE_VERSION'];
         if ($this->tour->validate()) {
             $this->tour->store();
             if (!count($this->tour->steps)) {
                 $step_data = array('title' => '', 'tip' => _('(Neue Tour)'), 'interactive' => 0, 'route' => trim(Request::get('tour_startpage')), 'css_selector' => '', 'action_prev' => '', 'action_next' => '', 'orientation' => '', 'mkdate' => time(), 'author_email' => $GLOBALS['user']->Email);
                 $this->tour->addStep($step_data, 1);
                 $this->tour_startpage = trim(Request::get('tour_startpage'));
             }
             PageLayout::postMessage(MessageBox::success(_('Die Angaben wurden gespeichert.')));
         } else {
             $roles = '';
             if (count(Request::getArray('tour_roles'))) {
                 foreach (Request::getArray('tour_roles') as $role) {
                     $roles .= '&tour_roles[]=' . $role;
                 }
             }
             $this->redirect('tour/admin_details?tour_name=' . Request::get('tour_name') . '&tour_language=' . Request::get('tour_language') . '&tour_description=' . Request::get('tour_description') . '&tour_type=' . Request::get('tour_type') . '&tour_access=' . Request::get('tour_access') . '&tour_startpage=' . Request::get('tour_startpage') . $roles);
         }
     }
     $this->redirect('tour/admin_details/' . $this->tour->tour_id);
 }