Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/message/output/popup/message_output_popup.php
Go to the documentation of this file.
00001 <?php
00002 
00003 // This file is part of Moodle - http://moodle.org/
00004 //
00005 // Moodle is free software: you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation, either version 2 of the License, or
00008 // (at your option) any later version.
00009 //
00010 // Moodle is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
00017 
00026 require_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/config.php'); //included from messagelib (how to fix?)
00027 require_once($CFG->dirroot.'/message/output/lib.php');
00028 
00029 class message_output_popup extends message_output{
00030 
00039     public function send_message($eventdata) {
00040         global $DB;
00041 
00042         //hold onto the popup processor id because /admin/cron.php sends a lot of messages at once
00043         static $processorid = null;
00044 
00045         //prevent users from getting popup notifications of messages to themselves (happens with forum notifications)
00046         if ($eventdata->userfrom->id!=$eventdata->userto->id) {
00047             if (empty($processorid)) {
00048                 $processor = $DB->get_record('message_processors', array('name'=>'popup'));
00049                 $processorid = $processor->id;
00050             }
00051             $procmessage = new stdClass();
00052             $procmessage->unreadmessageid = $eventdata->savedmessageid;
00053             $procmessage->processorid     = $processorid;
00054 
00055             //save this message for later delivery
00056             $DB->insert_record('message_working', $procmessage);
00057         }
00058 
00059         return true;
00060     }
00061 
00062     function config_form($preferences) {
00063         return null;
00064     }
00065 
00066     public function process_form($form, &$preferences) {
00067         return true;
00068     }
00069     public function load_data(&$preferences, $userid) {
00070         global $USER;
00071         return true;
00072     }
00073 }
 All Data Structures Namespaces Files Functions Variables Enumerations