Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 310 and 311] [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403] [Versions 39 and 311]

Airnotifier manager class

Copyright: 2012 Jerome Mouneyrac <jerome@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 403 lines (17 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

message_airnotifier_manager:: (9 methods):
  include_device_ajax()
  get_user_devices()
  request_accesskey()
  create_token()
  is_system_configured()
  enable_device()
  check_configuration()
  send_test_notification()
  has_enabled_devices()


Class: message_airnotifier_manager  - X-Ref

Airnotifier helper manager class

include_device_ajax()   X-Ref
Include the relevant javascript and language strings for the device
toolbox YUI module

return: bool

get_user_devices($appname, $userid = null)   X-Ref
Return the user devices for a specific app.

param: string $appname the app name .
param: int $userid if empty take the current user.
return: array all the devices

request_accesskey()   X-Ref
Request and access key to Airnotifier

return: mixed The access key or false in case of error

create_token($token, $deviceplatform = '')   X-Ref
Create a device token in the Airnotifier instance

param: string $token The token to be created
param: string $deviceplatform The device platform (Android, iOS, iOS-fcm, etc...)
return: bool True if all was right

is_system_configured()   X-Ref
Tests whether the airnotifier settings have been configured

return: boolean true if airnotifier is configured

enable_device($deviceid, $enable)   X-Ref
Enables or disables a registered user device so it can receive Push notifications

param: int $deviceid the device id
param: bool $enable  true to enable it, false to disable it
return: bool true if the device was enabled, false in case of error

check_configuration()   X-Ref
Check the system configuration to detect possible issues.

return: array result checks

send_test_notification(stdClass $user)   X-Ref
Send a test notification to the given user.

param: stdClass $user user object

has_enabled_devices(string $appname, int $userid = null)   X-Ref
Check whether the given user has enabled devices or not for the given app.

param: string $appname the app to check
param: int $userid the user to check the devices for (empty for current user)
return: bool true when the user has enabled devices, false otherwise