__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

www-data@216.73.216.10: ~ $
---
layout: docs
title: "Notifications"
description: "Moodle notifications"
date: 2020-02-04T09:40:32+01:00
draft: false
weight: 50
tags:
- Available
- Needs review
---

## How it works

Notifications are coupled with actions and provide instant feedback to the action results. Moodle notifications are shown right above the actionable content or overlaying the user interface for JavaScript related actions.

## Example

{{< example show_markup="false">}}
<div class="alert alert-info alert-block fade in foo bar" role="alert" data-aria-autofocus="true" id="yui_3_17_2_1_1599746674354_24">
    <button type="button" class="btn-close" data-dismiss="alert">×</button>
    Hello
</div>
{{< /example >}}

## Source files

* `lib/amd/src/notification.js`
* `lib/templates/notification_info.mustache`
* `lib/templates/notification_success.mustache`
* `lib/templates/notification_warning.mustache`
* `lib/templates/notification_error.mustache`

## Core renderer

Notifications can be added in PHP using the core renderer notification method

{{< php >}}
  $OUTPUT->notification('message', 'info');
{{< / php >}}

## Notification templates

{{< mustache template="core/notification_info" >}}
{{< /mustache >}}

{{< mustache template="core/notification_success" >}}
{
    "message": "Your pants are on awesome!",
    "closebutton": 1,
    "announce": 1,
    "extraclasses": "foo bar"
}
{{< /mustache >}}

{{< mustache template="core/notification_warning" >}}
{
    "message": "Your pants are on down!",
    "closebutton": 1,
    "announce": 1,
    "extraclasses": "foo bar"
}
{{< /mustache >}}

{{< mustache template="core/notification_error" >}}
{
    "message": "Your pants are on fire!",
    "closebutton": 1,
    "announce": 1,
    "extraclasses": "foo bar"
}
{{< /mustache >}}

## JavaScript Notifications

{{< example >}}
<button class="btn btn-secondary" data-action="shownotification">Show JS Notification</button>
{{#js}}
require(
[
    'core/notification'
],
function(
    Notification
) {
    document.querySelector('[data-action="shownotification"]').addEventListener('click', function() {
        Notification.alert('Notification message', 'Extra content for notification message');
    });
});
{{/js}}
{{< /example >}}

## Toast Notifications

{{< example >}}
<button class="btn btn-secondary" data-action="showtoastnotification">Show Toast Notification</button>
{{#js}}
require(
[
    'core/toast'
],
function(
    Toast
) {
    document.querySelector('[data-action="showtoastnotification"]').addEventListener('click', function() {
        Toast.add('Toast message');
    });
});
{{/js}}
{{< /example >}}

Filemanager

Name Type Size Permission Actions
_index.md File 85 B 0777
actionmenu.md File 6.39 KB 0777
activityicons.md File 8.38 KB 0777
buttons.md File 5.9 KB 0777
coursecards.md File 6.26 KB 0777
dom-modal.md File 4.29 KB 0777
dropdowns.md File 13.23 KB 0777
dynamictabs.md File 2.87 KB 0777
example.md File 1.52 KB 0777
footer.md File 1.49 KB 0777
form-elements.md File 1.08 KB 0777
moodle-icons.md File 1.71 KB 0777
notifications.md File 2.55 KB 0777
search-input.md File 3.42 KB 0777
showmore.md File 1.18 KB 0777
toggle.md File 2.29 KB 0777
Filemanager