本文整理汇总了PHP中MessageBox类的典型用法代码示例。如果您正苦于以下问题:PHP MessageBox类的具体用法?PHP MessageBox怎么用?PHP MessageBox使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MessageBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateCommentsHTML
private function generateCommentsHTML()
{
$comments = $this->article->getComments();
$this->commentHTML = "";
if (getStyle()->doCommentHTML()) {
try {
$this->commentHTML = getStyle()->getCommentsHTML($comments);
} catch (Exception $e) {
$msgbox = new MessageBox("The style didn't generate the HTML code for the comments, therefore the default generator was used. <br /><br />To hide this message open <br />" . getStyle()->getStylePath() . "info.xml<br /> and set <strong>own_comment_html</strong> to <strong>false</strong>.");
$msgbox->bindException($e);
getDisplay()->addObject($msgbox);
foreach ($comments as $comment) {
$this->commentHTML .= $comment->toHTML();
}
}
} else {
foreach ($comments as $comment) {
$this->commentHTML .= $comment->toHTML();
}
}
$LCID = 0;
if (count($comments) != 0) {
$LCID = $comments[0]->getID();
}
$ajaxPC = new CommentPoster($this->article->getID());
$ajaxPC->start();
$ajaxLC = new CommentLoader($this->article->getID(), $LCID, count($comments));
$ajaxLC->start();
}
示例2: main
public function main($args)
{
if (!isset($args['error_code'])) {
$msgbox = new MessageBox("Can't render error frontend: missing argument 'error_code'!");
die($msgbox->getImports() . $msgbox->toHTML());
}
if (!is_numeric($args['error_code'])) {
$msgbox = new MessageBox("Can't render article frontend: wrong argument 'error_code'!");
die($msgbox->getImports() . $msgbox->toHTML());
}
$this->errorCode = $args['error_code'];
}
示例3: main
public function main($args)
{
if (!isset($args['page'])) {
$msgbox = new MessageBox("Can't render page frontend: missing argument 'page'!");
die($msgbox->getImports() . $msgbox->toHTML());
}
if ($args['page'] instanceof Page == false) {
$msgbox = new MessageBox("Can't render page frontend: wrong argument 'page'!");
die($msgbox->getImports() . $msgbox->toHTML());
}
$this->page = $args['page'];
}
示例4: 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');
}
示例5: _validPerform
protected function _validPerform($request, $response)
{
$mail_data = $this->dataspace->export();
if (isset($mail_data['sender_name'])) {
$sender_name = $mail_data['sender_name'];
} else {
$sender_name = $mail_data['sender_firstname'] . ' ' . $mail_data['sender_lastname'];
}
$body = sprintf(Strings::get('body_template', 'feedback'), $sender_name, $mail_data['sender_email'], $mail_data['body']);
$body = str_replace('<br>', "\n", $body);
$subject = $this->_getMailSubject();
$recipient_email = $this->_getEmail();
$mailer = $this->_getMailer();
$headers['From'] = $mail_data['sender_email'];
$headers['To'] = $recipient_email;
$headers['Subject'] = $subject;
if (!$recipient_email || !$mailer->send($recipient_email, $headers, $body)) {
MessageBox::writeNotice(Strings::get('mail_not_sent', 'feedback'));
$request->setStatus(Request::STATUS_FAILUER);
return;
}
MessageBox::writeNotice(Strings::get('message_was_sent', 'feedback'));
$request->setStatus(Request::STATUS_FORM_SUBMITTED);
$response->redirect($_SERVER['PHP_SELF']);
}
示例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: 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');
}
}
示例8: 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;
}
示例9: _validPerform
protected function _validPerform($request, $response)
{
$data = $this->dataspace->export();
$request->setStatus(Request::STATUS_FAILURE);
if ($request->hasAttribute('popup')) {
$response->write(closePopupResponse($request));
}
if (!isset($data['ids']) || !is_array($data['ids'])) {
return;
}
$objects = $this->_getObjectsToDelete(array_keys($data['ids']));
foreach ($objects as $id => $item) {
if ($item['delete_status'] !== 0) {
continue;
}
$site_object = wrapWithSiteObject($item);
try {
$site_object->delete();
} catch (LimbException $e) {
MessageBox::writeNotice("object {$id} - {$item['title']} couldn't be deleted!");
$request->setStatus(Request::STATUS_FAILURE);
throw $e;
}
}
$request->setStatus(Request::STATUS_SUCCESS);
$response->write(closePopupResponse($request));
}
示例10: _applyAccessPolicy
function _applyAccessPolicy($object, $action)
{
$access_policy = new AccessPolicy();
$access_policy->applyAccessTemplates($object, $action);
if (catch_error('LimbException', $e)) {
}
MessageBox::writeNotice("Access template of " . get_class($object) . " for action '{$action}' not defined!!!");
}
示例11: __construct
public function __construct($type = "", $message = "", $sfUser = null)
{
$this->type = $type;
$this->message = $message;
if ($sfUser != null) {
MessageBox::pushToSession($sfUser);
}
}
示例12: 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');
}
示例13: _applyAccessPolicy
protected function _applyAccessPolicy($object, $action)
{
try {
$access_policy = new AccessPolicy();
$access_policy->applyAccessTemplates($object, $action);
} catch (LimbException $e) {
MessageBox::writeNotice("Access template of " . get_class($object) . " for action '{$action}' not defined!!!");
}
}
示例14: perform
public function perform($request, $response)
{
$object = Limb::toolkit()->createSiteObject('UserObject');
if (!$object->activatePassword()) {
MessageBox::writeNotice('Password activation failed!');
$request->setStatus(Request::STATUS_FAILED);
$response->redirect('/');
}
}
示例15: 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));
}
}