本文整理匯總了PHP中PageLayout::postMessage方法的典型用法代碼示例。如果您正苦於以下問題:PHP PageLayout::postMessage方法的具體用法?PHP PageLayout::postMessage怎麽用?PHP PageLayout::postMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PageLayout
的用法示例。
在下文中一共展示了PageLayout::postMessage方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: index_action
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');
}
示例2: before_filter
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');
}
}
示例3: fetchData
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'])));
}
}
示例4: index_action
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;
}
示例5: overview_action
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();
}
}
}
示例6: authorize_action
/**
*
**/
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;
}
示例7: tabularasa_action
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');
}
示例8: delete_action
/**
* 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));
}
}
示例9: ask_for_hosts_action
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");
}
示例10: edit_action
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());
}
}
示例11: onEnable
/**
*
**/
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));
}
}
示例12: edit_action
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());
}
}
}
示例13: perform
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'));
}
}
示例14: validate
/**
* 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;
}
示例15: approve_action
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');
}