コード例 #1
0
 function getNotificationEventByActionName($action_name)
 {
     $notification_events = NotificationsManager::getNotificationEvents();
     if ($notification_events[0]) {
         foreach ($notification_events as $notification_event) {
             if ($notification_event->event_action == $action_name) {
                 return $notification_event;
             }
         }
     } else {
         return false;
     }
 }
コード例 #2
0
ファイル: emails.php プロジェクト: parkmi/dolschool14
<?php

// no direct access
defined('_JEXEC') or die('Restricted access');
$_JLMS_PLUGINS =& JLMSFactory::getPlugins();
require_once _JOOMLMS_FRONT_HOME . DS . 'includes' . DS . 'notifications' . DS . 'notifications.manager.php';
require_once _JOOMLMS_FRONT_HOME . DS . 'includes' . DS . 'notifications' . DS . 'email.manager.php';
require_once _JOOMLMS_FRONT_HOME . DS . 'includes' . DS . 'classes' . DS . 'lms.acl.php';
$notific_events = NotificationsManager::getNotificationEvents();
if (isset($notific_events[0])) {
    foreach ($notific_events as $notific_event) {
        $_JLMS_PLUGINS->registerFunction($notific_event->event_action, 'sendNotification');
    }
}
function sendNotification($params)
{
    $db = JFactory::getDBO();
    $mailManager =& MailManager::getChildInstance();
    $app = JFactory::getApplication();
    $notification_event = NotificationsManager::getNotificationEventByActionName($params['action_name']);
    if (!$notification_event) {
        return '';
    }
    if (!isset($params['sender'])) {
        $params['sender'] = array($app->getCfg('mailfrom'), $app->getCfg('fromname'));
    }
    $sql = "SELECT learner_template, manager_template, selected_manager_roles, learner_template_disabled, manager_template_disabled,  disabled FROM #__lms_email_notifications WHERE id = " . $db->quote($notification_event->id);
    $db->setQuery($sql);
    $row = $db->loadObject();
    if ($row) {
        $notification_event->disabled = $row->disabled;