本文整理汇总了PHP中MessageBox::error方法的典型用法代码示例。如果您正苦于以下问题:PHP MessageBox::error方法的具体用法?PHP MessageBox::error怎么用?PHP MessageBox::error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MessageBox
的用法示例。
在下文中一共展示了MessageBox::error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
}
}
示例2: add_new_host_action
public function add_new_host_action()
{
PageLayout::setTitle(_("Neue Lernmaterialien einstellen"));
if (Request::submitted("nothanx")) {
$_SESSION['Lernmarktplatz_no_thanx'] = true;
$this->redirect("admin/hosts");
} elseif (Request::isPost()) {
$host = LernmarktplatzHost::findOneByUrl(trim(Request::get("url")));
if (!$host) {
$host = new LernmarktplatzHost();
$host['url'] = trim(Request::get("url"));
$host['last_updated'] = time();
$host->fetchPublicKey();
if ($host['public_key']) {
$host->store();
PageLayout::postMessage(MessageBox::success(_("Server wurde gefunden und hinzugefügt.")));
} else {
PageLayout::postMessage(MessageBox::error(_("Server ist nicht erreichbar oder hat die Anfrage abgelehnt.")));
}
} else {
$host->fetchPublicKey();
PageLayout::postMessage(MessageBox::info(_("Server ist schon in Liste.")));
}
$this->redirect("admin/hosts");
}
}
示例3: edit_action
/**
* This method edits existing holidays or creates new holidays
*
* @param mixed $id Id of the holiday or null to create one
*/
public function edit_action($id = null)
{
$this->holiday = new SemesterHoliday($id);
PageLayout::setTitle($this->holiday->isNew() ? _('Ferien anlegen') : _('Ferien bearbeiten'));
if (Request::isPost()) {
CSRFProtection::verifyUnsafeRequest();
$this->holiday->name = Request::get('name');
$this->holiday->description = Request::get('description');
$this->holiday->beginn = $this->getTimeStamp('beginn');
$this->holiday->ende = $this->getTimeStamp('ende', '23:59:59');
$errors = array();
if (!$this->holiday->name) {
$errors[] = _('Bitte geben Sie einen Namen ein.');
}
if (!$this->holiday->beginn) {
$errors[] = _('Bitte geben Sie einen Ferienbeginn ein.');
}
if (!$this->holiday->ende) {
$errors[] = _('Bitte geben Sie ein Ferienende ein.');
}
if ($this->holiday->beginn > $this->holiday->ende) {
$errors[] = _('Das Ferienende liegt vor dem Beginn.');
}
if (!empty($errors)) {
PageLayout::postMessage(MessageBox::error(_('Ihre eingegebenen Daten sind ungültig.'), $errors));
} elseif ($this->holiday->isDirty() && !$this->holiday->store()) {
PageLayout::postMessage(MessageBox::error(_('Die Ferien konnten nicht gespeichert werden.')));
} else {
PageLayout::postMessage(MessageBox::success(_('Die Ferien wurden erfolgreich gespeichert.')));
$this->relocate('admin/holidays');
}
}
}
示例4: edit_action
/**
*
**/
public function edit_action($id = null)
{
$consumer = $id ? RESTAPI\Consumer\Base::find($id) : RESTAPI\Consumer\Base::create(Request::option('consumer_type') ?: 'oauth');
if (Request::submitted('store')) {
$errors = array();
$consumer->active = Request::int('active');
$consumer->title = Request::get('title');
$consumer->contact = Request::get('contact');
$consumer->email = Request::get('email');
$consumer->callback = Request::get('callback');
$consumer->url = Request::get('url');
$consumer->type = Request::get('type');
$consumer->commercial = Request::int('commercial');
$consumer->notes = Request::get('notes');
$consumer->description = Request::get('description');
if (!empty($errors)) {
$message = MessageBox::error(_('Folgende Fehler sind aufgetreten:'), $errors);
PageLayout::postMessage($message);
return;
}
$consumer->store();
if ($id) {
$message = MessageBox::success(_('Die Applikation wurde erfolgreich gespeichert.'));
} else {
$details = $this->render_keys($consumer->id);
$message = MessageBox::success(_('Die Applikation wurde erfolgreich erstellt, die Schlüssel finden Sie in den Details dieser Meldung.'), $details, true);
}
PageLayout::postMessage($message);
$this->redirect('admin/api/index#' . $consumer->id);
return;
}
$this->consumer = $consumer;
$this->id = $id;
}
示例5: 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');
}
}
示例6: 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'])));
}
}
示例7: 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;
}
示例8: display_action
public function display_action($range_id)
{
// Bind some params
URLHelper::bindLinkParam('show_expired', $null1);
URLHelper::bindLinkParam('preview', $null2);
URLHelper::bindLinkParam('revealNames', $null3);
URLHelper::bindLinkParam('sort', $null4);
// Bind range_id
$this->range_id = $range_id;
$this->nobody = !$GLOBALS['user']->id || $GLOBALS['user']->id == 'nobody';
/*
* Insert vote
*/
if ($vote = Request::get('vote')) {
$vote = new StudipVote($vote);
if (!$this->nobody && $vote && $vote->isRunning() && (!$vote->userVoted() || $vote->changeable)) {
try {
$vote->insertVote(Request::getArray('vote_answers'), $GLOBALS['user']->id);
} catch (Exception $exc) {
$GLOBALS['vote_message'][$vote->id] = MessageBox::error($exc->getMessage());
}
}
}
// Check if we need administration icons
$this->admin = $range_id == $GLOBALS['user']->id || $GLOBALS['perm']->have_studip_perm('tutor', $range_id);
// Load evaluations
if (!$this->nobody) {
$eval_db = new EvaluationDB();
$this->evaluations = StudipEvaluation::findMany($eval_db->getEvaluationIDs($range_id, EVAL_STATE_ACTIVE));
} else {
$this->evaluations = array();
}
$show_votes[] = 'active';
// Check if we got expired
if (Request::get('show_expired')) {
$show_votes[] = 'stopvis';
if ($this->admin) {
$this->evaluations = array_merge($this->evaluations, StudipEvaluation::findMany($eval_db->getEvaluationIDs($range_id, EVAL_STATE_STOPPED)));
$show_votes[] = 'stopinvis';
}
}
$this->votes = StudipVote::findBySQL('range_id = ? AND state IN (?) ORDER BY mkdate desc', array($range_id, $show_votes));
$this->visit();
}
示例9: admin_overview_action
/**
* Administration page for help content
*/
function admin_overview_action()
{
// check permission
if (!$GLOBALS['auth']->is_authenticated() || $GLOBALS['user']->id === 'nobody') {
throw new AccessDeniedException();
}
$GLOBALS['perm']->check('root');
// initialize
PageLayout::setTitle(_('Verwalten von Hilfe-Texten'));
PageLayout::setHelpKeyword('Basis.HelpContentAdmin');
// set navigation
Navigation::activateItem('/admin/config/help_content');
if (Request::get('help_content_filter') == 'set') {
$this->help_content_searchterm = Request::option('help_content_filter_term');
}
if (Request::submitted('reset_filter')) {
$this->help_content_searchterm = '';
}
if (Request::submitted('apply_help_content_filter')) {
if (Request::get('help_content_searchterm') and strlen(trim(Request::get('help_content_searchterm'))) < 3) {
PageLayout::postMessage(MessageBox::error(_('Der Suchbegriff muss mindestens 3 Zeichen lang sein.')));
}
if (strlen(trim(Request::get('help_content_searchterm'))) >= 3) {
$this->help_content_searchterm = htmlReady(Request::get('help_content_searchterm'));
$this->filter_text = sprintf(_('Angezeigt werden Hilfe-Texte zum Suchbegriff "%s".'), $this->help_content_searchterm);
}
}
// load help content
$this->help_contents = HelpContent::GetContentByFilter($this->help_content_searchterm);
// save settings
if (Request::submitted('save_help_content_settings')) {
foreach ($this->help_contents as $help_content_id => $help_content) {
// set status as chosen
if (Request::get('help_content_status_' . $help_content_id) == '1' and !$this->help_contents[$help_content_id]->visible) {
$this->help_contents[$help_content_id]->visible = 1;
$this->help_contents[$help_content_id]->store();
} elseif (Request::get('help_content_status_' . $help_content_id) != '1' and $this->help_contents[$help_content_id]->visible) {
$this->help_contents[$help_content_id]->visible = 0;
$this->help_contents[$help_content_id]->store();
}
}
}
}
示例10: favor_action
/**
* 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);
}
}
示例11: decline_inst_action
public function decline_inst_action($inst_id)
{
$institut = Institute::find($inst_id);
$ticket_check = Seminar_Session::check_ticket(Request::option('studipticket'));
if (Request::option('cmd') != 'kill' && Request::get('cmd') != 'back') {
$this->flash['decline_inst'] = true;
$this->flash['inst_id'] = $inst_id;
$this->flash['name'] = $institut->name;
$this->flash['studipticket'] = Seminar_Session::get_ticket();
} else {
if (Request::get('cmd') == 'kill' && $ticket_check && Request::get('cmd') != 'back') {
$query = "DELETE FROM user_inst WHERE user_id = ? AND Institut_id = ? AND inst_perms = 'user'";
$statement = DBManager::get()->prepare($query);
$statement->execute(array($GLOBALS['user']->id, $inst_id));
if ($statement->rowCount() > 0) {
PageLayout::postMessage(MessageBox::success(sprintf(_("Die Zuordnung zur Einrichtung %s wurde aufgehoben."), "<b>" . htmlReady($institut->name) . "</b>")));
} else {
PageLayout::postMessage(MessageBox::error(_('Datenbankfehler')));
}
}
}
$this->redirect('my_institutes/index');
}
示例12: edit_action
/**
*
**/
public function edit_action($key = null)
{
$this->consumer = $this->store->extractConsumerFromRequest($key);
if (Request::submitted('store')) {
$errors = $this->store->validate($this->consumer);
if (!empty($errors)) {
$message = MessageBox::error(_('Folgende Fehler sind aufgetreten:'), $errors);
PageLayout::postMessage($message);
return;
}
$consumer = $this->store->store($this->consumer, Request::int('enabled', 0));
if ($key) {
$message = MessageBox::success(_('Die Applikation wurde erfolgreich gespeichert.'));
} else {
$details = $this->render_keys($key, $consumer);
$message = MessageBox::success(_('Die Applikation wurde erfolgreich erstellt, die Schlüssel finden Sie in den Details dieser Meldung.'), $details, true);
}
PageLayout::postMessage($message);
$this->redirect('admin/index#' . $consumer['consumer_key']);
return;
}
$this->set_layout($GLOBALS['template_factory']->open('layouts/base_without_infobox'));
$this->id = $id;
}
示例13: decline_action
/**
* This action remove a user from course
* @param $course_id
*/
public function decline_action($course_id, $waiting = null)
{
$current_seminar = Seminar::getInstance($course_id);
$ticket_check = Seminar_Session::check_ticket(Request::option('studipticket'));
if (LockRules::Check($course_id, 'participants')) {
$lockdata = LockRules::getObjectRule($course_id);
PageLayout::postMessage(MessageBox::error(sprintf(_("Sie können sich nicht von der Veranstaltung <b>%s</b> abmelden."), htmlReady($current_seminar->name))));
if ($lockdata['description']) {
PageLayout::postMessage(MessageBox::info(formatLinks($lockdata['description'])));
}
$this->redirect('my_courses/index');
return;
}
if (Request::option('cmd') == 'back') {
$this->redirect('my_courses/index');
return;
}
if (Request::option('cmd') != 'kill' && Request::option('cmd') != 'kill_admission') {
if ($current_seminar->admission_binding && Request::get('cmd') != 'suppose_to_kill_admission' && !LockRules::Check($current_seminar->getId(), 'participants')) {
PageLayout::postMessage(MessageBox::error(sprintf(_("Die Veranstaltung <b>%s</b> ist als <b>bindend</b> angelegt.\n Wenn Sie sich abmelden wollen, müssen Sie sich an die Lehrende der Veranstaltung wenden."), htmlReady($current_seminar->name))));
$this->redirect('my_courses/index');
return;
}
if (Request::get('cmd') == 'suppose_to_kill') {
// check course admission
list(, $admission_end_time) = @array_values($current_seminar->getAdmissionTimeFrame());
$admission_enabled = $current_seminar->isAdmissionEnabled();
$admission_locked = $current_seminar->isAdmissionLocked();
if ($admission_enabled || $admission_locked || (int) $current_seminar->admission_prelim == 1) {
$message = sprintf(_('Wollen Sie sich von der teilnahmebeschränkten Veranstaltung "%s" wirklich abmelden? Sie verlieren damit die Berechtigung für die Veranstaltung und müssen sich ggf. neu anmelden!'), $current_seminar->name);
} else {
if (isset($admission_end_time) && $admission_end_time < time()) {
$message = sprintf(_('Wollen Sie sich von der teilnahmebeschränkten Veranstaltung "%s" wirklich abmelden? Der Anmeldzeitraum ist abgelaufen und Sie können sich nicht wieder anmelden!'), $current_seminar->name);
} else {
$message = sprintf(_('Wollen Sie sich von der Veranstaltung "%s" wirklich abmelden?'), $current_seminar->name);
}
}
$this->flash['cmd'] = 'kill';
} else {
if (admission_seminar_user_get_position($GLOBALS['user']->id, $course_id) === false) {
$message = sprintf(_('Wollen Sie sich von der Anmeldeliste der Veranstaltung "%s" wirklich abmelden?'), $current_seminar->name);
} else {
$message = sprintf(_('Wollen Sie sich von der Warteliste der Veranstaltung "%s" wirklich abmelden? Sie verlieren damit die bereits erreichte Position und müssen sich ggf. neu anmelden!'), $current_seminar->name);
}
$this->flash['cmd'] = 'kill_admission';
}
$this->flash['decline_course'] = true;
$this->flash['course_id'] = $course_id;
$this->flash['message'] = $message;
$this->flash['studipticket'] = Seminar_Session::get_ticket();
$this->redirect('my_courses/index');
return;
} else {
if (!LockRules::Check($course_id, 'participants') && $ticket_check && Request::option('cmd') != 'back' && Request::get('cmd') != 'kill_admission') {
$query = "DELETE FROM seminar_user WHERE user_id = ? AND Seminar_id = ?";
$statement = DBManager::get()->prepare($query);
$statement->execute(array($GLOBALS['user']->id, $course_id));
if ($statement->rowCount() == 0) {
PageLayout::postMessage(MessageBox::error(_('In der ausgewählten Veranstaltung wurde die gesuchten Personen nicht gefunden und konnte daher nicht ausgetragen werden.')));
} else {
// LOGGING
StudipLog::log('SEM_USER_DEL', $course_id, $GLOBALS['user']->id, 'Hat sich selbst ausgetragen');
// enable others to do something after the user has been deleted
NotificationCenter::postNotification('UserDidLeaveCourse', $course_id, $GLOBALS['user']->id);
// Delete from statusgroups
RemovePersonStatusgruppeComplete(get_username(), $course_id);
// Are successor available
update_admission($course_id);
PageLayout::postMessage(MessageBox::success(sprintf(_("Erfolgreich von Veranstaltung <b>%s</b> abgemeldet."), htmlReady($current_seminar->name))));
}
} else {
// LOGGING
StudipLog::log('SEM_USER_DEL', $course_id, $GLOBALS['user']->id, 'Hat sich selbst aus der Warteliste ausgetragen');
if ($current_seminar->isAdmissionEnabled()) {
$prio_delete = AdmissionPriority::unsetPriority($current_seminar->getCourseSet()->getId(), $GLOBALS['user']->id, $course_id);
}
$query = "DELETE FROM admission_seminar_user WHERE user_id = ? AND seminar_id = ?";
$statement = DBManager::get()->prepare($query);
$statement->execute(array($GLOBALS['user']->id, $course_id));
if ($statement->rowCount() || $prio_delete) {
//Warteliste neu sortieren
renumber_admission($course_id);
//Pruefen, ob es Nachruecker gibt
update_admission($course_id);
PageLayout::postMessage(MessageBox::success(sprintf(_("Der Eintrag in der Anmelde- bzw. Warteliste der Veranstaltung <b>%s</b> wurde aufgehoben.\n Wenn Sie an der Veranstaltung teilnehmen wollen, müssen Sie sich erneut bewerben."), htmlReady($current_seminar->name))));
}
}
$this->redirect('my_courses/index');
return;
}
}
示例14: my_error
function my_error($msg, $class="blank", $colspan=2, $add_row='', $small='')
{
echo '<tr><td class="'.$class.'" colspan="'.$colspan.'">';
echo MessageBox::error($msg);
echo '</td></tr>';
}
示例15: delete_action
/**
* 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);
}