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; }
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'); }
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'); }
/** * 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)); } }
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 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()); } } }
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')); } }
/** * createEvaluationHeader: generate the head of an evaluation (title and base text) * @param the evaluation * @returns a table row */ function createEvaluationHeader($eval, $votedNow, $votedEarlier) { $br = new HTMpty("br"); $tr = new HTM("tr"); $td = new HTM("td"); $td->attr("class", "table_row_even"); $table2 = new HTM("table"); $table2->attr("width", "100%"); $tr2 = new HTM("tr"); $td2 = new HTM("td"); $td2->attr("width", "90%"); $td2->attr("valign", "top"); if ($eval->isError()) { $td2->html(EvalCommon::createErrorReport($eval, _("Fehler"))); $td2->html($br); } $span = new HTM("span"); $span->attr("class", "eval_title"); $span->html(htmlReady($eval->getTitle())); $td2->cont($span); $td2->cont($br); $td2->cont($br); if ($votedNow) { $message = new HTML('div'); $message->_content = array((string) MessageBox::success(_("Vielen Dank für Ihre Teilnahme."))); $td2->cont($message); } elseif ($votedEarlier) { $message = new HTML('div'); $message->_content = array((string) MessageBox::info(_("Sie haben an dieser Evaluation bereits teilgenommen."))); $td2->cont($message); } else { $td2->html(formatReady($eval->getText())); $td2->cont($br); } $tr2->cont($td2); $td2 = new HTM("td"); $td2->attr("width", "250"); $td2->attr("valign", "top"); $td2->html(EvalShow::createInfoBox($eval, $votedNow || $votedEarlier)); $tr2->cont($td2); $table2->cont($tr2); $td->cont($table2); $tr->cont($td); return $tr; }
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'); }
/** * 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); } }
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))); } }
/** * **/ 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'); }
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); }
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); }
/** * 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; }
/** * 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); } }
public function save_action() { if (count($_POST) === 0) { throw new Exception("Kein Zugriff über GET"); } $sem_class = $GLOBALS['SEM_CLASS'][Request::int("sem_class_id")]; foreach (Request::getArray("core_module_slots") as $slot => $module) { $sem_class->setSlotModule($slot, studip_utf8decode($module)); } $sem_class->setModules(Request::getArray("modules")); $sem_class->set('name', Request::get("sem_class_name")); $sem_class->set('description', studip_utf8decode(Request::get("sem_class_description"))); $sem_class->set('title_dozent', Request::get("title_dozent") ? studip_utf8decode(Request::get("title_dozent")) : null); $sem_class->set('title_dozent_plural', Request::get("title_dozent_plural") ? studip_utf8decode(Request::get("title_dozent_plural")) : null); $sem_class->set('title_tutor', Request::get("title_tutor") ? studip_utf8decode(Request::get("title_tutor")) : null); $sem_class->set('title_tutor_plural', Request::get("title_tutor_plural") ? studip_utf8decode(Request::get("title_tutor_plural")) : null); $sem_class->set('title_autor', Request::get("title_autor") ? studip_utf8decode(Request::get("title_autor")) : null); $sem_class->set('title_autor_plural', Request::get("title_autor_plural") ? studip_utf8decode(Request::get("title_autor_plural")) : null); $sem_class->set('compact_mode', Request::int("compact_mode")); $sem_class->set('workgroup_mode', Request::int("workgroup_mode")); $sem_class->set('studygroup_mode', Request::int("studygroup_mode")); $sem_class->set('only_inst_user', Request::int("only_inst_user")); $sem_class->set('turnus_default', Request::int("turnus_default")); $sem_class->set('default_read_level', Request::int("default_read_level")); $sem_class->set('default_write_level', Request::int("default_write_level")); $sem_class->set('bereiche', Request::int("bereiche")); $sem_class->set('show_browse', Request::int("show_browse")); $sem_class->set('write_access_nobody', Request::int("write_access_nobody")); $sem_class->set('topic_create_autor', Request::int("topic_create_autor")); $sem_class->set('visible', Request::int("visible")); $sem_class->set('course_creation_forbidden', Request::int("course_creation_forbidden")); $sem_class->set('create_description', studip_utf8decode(Request::get("create_description"))); $sem_class->set('admission_prelim_default', Request::int("admission_prelim_default")); $sem_class->set('admission_type_default', Request::int("admission_type_default")); $sem_class->store(); if (!count($sem_class->getSemTypes())) { $notice = "<br>" . _("Beachten Sie, dass es noch keine Veranstaltungstypen gibt!"); } $output = array('html' => studip_utf8encode((string) MessageBox::success(_("Änderungen wurden gespeichert." . " " . '<a href="' . URLHelper::getLink("dispatch.php/admin/sem_classes/overview") . '">' . _("Zurück zur Übersichtsseite.") . '</a>') . $notice))); echo json_encode($output); $this->render_nothing(); }
/** * **/ 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'); }
/** * 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')); }
/** * 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'); }
/** * 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); }
} else { if ($secret == $hash) { $query = "UPDATE auth_user_md5 SET perms = 'autor' WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($user->id)); if ($statement->rowCount() == 0) { $error = _('Fehler! Bitte wenden Sie sich an den Systemadministrator.'); $details = array($query); $message = MessageBox::error($error, $details); } else { $success = _('Ihr Status wurde erfolgreich auf <em>autor</em> gesetzt.<br> Damit dürfen Sie in den meisten Veranstaltungen schreiben, für die Sie sich anmelden.'); $details = array(); $details[] = _('Einige Veranstaltungen erfordern allerdings bei der Anmeldung die Eingabe eines Passwortes. Dieses Passwort erfahren Sie von den Lehrenden der Veranstaltung.'); $message = MessageBox::success($success, $details); // Auto-Inserts AutoInsert::instance()->saveUser($user->id, "autor"); $auth->logout(); // einen Logout durchführen, um erneuten Login zu erzwingen $info = sprintf(_('Die Statusänderung wird erst nach einem erneuten %sLogin%s wirksam!<br> Deshalb wurden Sie jetzt automatisch ausgeloggt.'), '<a href="index.php?again=yes"><em>', '</em></a>'); $message .= MessageBox::info($info); } } } } } $template = $GLOBALS['template_factory']->open('email-validation'); $template->set_layout($GLOBALS['template_factory']->open('layouts/base_without_infobox')); $template->message = $message;
/** * Set the selected semester and redirects to index * @param null $sem */ public function set_semester_action() { $sem = Request::option('sem_select', null); if (!is_null($sem)) { $GLOBALS['user']->cfg->store('MY_COURSES_SELECTED_CYCLE', $sem); PageLayout::postMessage(MessageBox::success(_('Das gewünschte Semester bzw. die gewünschte Semester Filteroption wurde ausgewählt!'))); } $this->redirect('my_courses/index'); }
<? # Lifter010: TODO use Studip\Button, Studip\LinkButton; ?> <? if (isset($flash['message'])): ?> <?php echo MessageBox::success($flash['message']); ?> <? endif ?> <h3> <?php echo _('Standard-Aktivierung in Veranstaltungen'); ?> : <?php echo htmlReady($plugin_name); ?> </h3> <form action="<?php echo $controller->url_for('admin/plugin/save_default_activation', $plugin_id); ?> " method="post"> <?php echo CSRFProtection::tokenTag(); ?> <input type="hidden" name="studip_ticket" value="<?php echo get_ticket(); ?> ">
/** * 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); }
/** * @deprecated since Stud.IP version 1.10 * * @param unknown_type $text * @param unknown_type $colspan */ static function showSuccessMessage($text, $colspan = 2) { echo MessageBox::success($text); }
/** * Displays upload form and processes the upload command * * @param String $view View to return to if canceled */ public function upload_action($view) { PageLayout::setTitle(_('Neues Smiley hochladen')); if (!Request::submitted('upload')) { $this->view = $view; return; } // File submitted? $upload = $_FILES['smiley_file']; if (empty($upload) or empty($upload['name'])) { $error = _('Sie haben keine Datei zum Hochladen ausgewählt!'); PageLayout::postMessage(MessageBox::error($error)); return; } // Error upon upload? if ($upload['error']) { $error = _('Es gab einen Fehler beim Upload. Bitte versuchen Sie es erneut.'); PageLayout::postMessage(MessageBox::error($error)); return; } // Correct mime-type? $no_image = !empty($upload['type']) && substr($upload['type'], 0, 5) != 'image'; if (!$no_image) { $image_info = getimagesize($upload['tmp_name']); // Used later on! $no_gif = $image_info[2] != IMAGETYPE_GIF; } if ($no_image) { $error = _('Die Datei ist keine Bilddatei'); PageLayout::postMessage(MessageBox::error($error)); return; } // Extract smiley information $smiley_file = $upload['name']; $smiley_name = substr($smiley_file, 0, strrpos($smiley_file, '.')); // Replace smiley? $smiley = Smiley::getByName($smiley_name); $replace = Request::int('replace'); if ($smiley->id && !$replace) { $error = sprintf(_('Es ist bereits eine Bildatei mit dem Namen "%s" vorhanden.'), $smiley_file); PageLayout::postMessage(MessageBox::error($error)); return; } // Copy file into file system $destination = Smiley::getFilename($smiley_file); if (!move_uploaded_file($upload['tmp_name'], $destination)) { $error = _('Es ist ein Fehler beim Kopieren der Datei aufgetreten. Das Bild wurde nicht hochgeladen!'); PageLayout::postMessage(MessageBox::error($error)); return; } // set permissions for uploaded file chmod($destination, 0666 & ~umask()); // Import smiley into database Smiley::refresh($destination); // Output appropriate wurde message $message = $replace ? sprintf(_('Die Bilddatei "%s" wurde erfolgreich ersetzt.'), $smiley_file) : sprintf(_('Die Bilddatei "%s" wurde erfolgreich hochgeladen.'), $smiley_file); PageLayout::postMessage(MessageBox::success($message)); // Return to index and display the view the uploaded smiley is in $this->redirect('admin/smileys?view=' . $smiley_file[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(); }
function my_msg($msg, $class="blank", $colspan=2, $add_row='', $small='') { echo '<tr><td class="'.$class.'" colspan="'.$colspan.'">'; echo MessageBox::success($msg); echo '</td></tr>'; }