[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 2 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * Popup message processor, stores messages to be shown using the message popup 19 * 20 * @package message_popup 21 * @copyright 2008 Luis Rodrigues 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v2 or later 23 */ 24 25 require_once(__DIR__ . '/../../../config.php'); //included from messagelib (how to fix?) 26 require_once($CFG->dirroot.'/message/output/lib.php'); 27 28 /** 29 * The popup message processor 30 * 31 * @package message_popup 32 * @copyright 2008 Luis Rodrigues and Martin Dougiamas 33 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 34 */ 35 class message_output_popup extends message_output{ 36 37 /** 38 * Process the popup message. 39 * The popup doesn't send data only saves in the database for later use, 40 * the popup_interface.php takes the message from the message table into 41 * the message_read. 42 * @param object $eventdata the event data submitted by the message sender plus $eventdata->savedmessageid 43 * @return true if ok, false if error 44 */ 45 public function send_message($eventdata) { 46 global $DB; 47 48 //hold onto the popup processor id because /admin/cron.php sends a lot of messages at once 49 static $processorid = null; 50 51 //prevent users from getting popup notifications of messages to themselves (happens with forum notifications) 52 if ($eventdata->userfrom->id!=$eventdata->userto->id) { 53 if (empty($processorid)) { 54 $processor = $DB->get_record('message_processors', array('name'=>'popup')); 55 $processorid = $processor->id; 56 } 57 $procmessage = new stdClass(); 58 $procmessage->unreadmessageid = $eventdata->savedmessageid; 59 $procmessage->processorid = $processorid; 60 61 //save this message for later delivery 62 $DB->insert_record('message_working', $procmessage); 63 } 64 65 return true; 66 } 67 68 /** 69 * Creates necessary fields in the messaging config form. 70 * 71 * @param array $preferences An array of user preferences 72 */ 73 function config_form($preferences) { 74 return null; 75 } 76 77 /** 78 * Parses the submitted form data and saves it into preferences array. 79 * 80 * @param stdClass $form preferences form class 81 * @param array $preferences preferences array 82 */ 83 public function process_form($form, &$preferences) { 84 return true; 85 } 86 87 /** 88 * Loads the config data from database to put on the form during initial form display 89 * 90 * @param array $preferences preferences array 91 * @param int $userid the user id 92 */ 93 public function load_data(&$preferences, $userid) { 94 global $USER; 95 return true; 96 } 97 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |