Update to use print_js_config.
[moodle.git] / message / output / popup / message_output_popup.php
CommitLineData
3b120e46 1<?php
2
3///////////////////////////////////////////////////////////////////////////
4// //
5// NOTICE OF COPYRIGHT //
6// //
7// Moodle - Modular Object-Oriented Dynamic Learning Environment //
8// http://moodle.com //
9// //
10// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
11// //
12// This program is free software; you can redistribute it and/or modify //
13// it under the terms of the GNU General Public License as published by //
14// the Free Software Foundation; either version 2 of the License, or //
15// (at your option) any later version. //
16// //
17// This program is distributed in the hope that it will be useful, //
18// but WITHOUT ANY WARRANTY; without even the implied warranty of //
19// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
20// GNU General Public License for more details: //
21// //
22// http://www.gnu.org/copyleft/gpl.html //
23// //
24///////////////////////////////////////////////////////////////////////////
25
26/**
27 * Popup message processor - stores the message to be shown using the message popup
28 *
29 * @author Luis Rodrigues
30 * @version $Id$
31 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
32 * @package
33 */
34
9205ca2e 35require_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/config.php'); //included from messagelib (how to fix?)
3b120e46 36require_once($CFG->dirroot.'/message/output/lib.php');
37
38class message_output_popup extends message_output{
39
40 /**
41 * Process the popup message.
42 * The popup doesn't send data only saves in the database for later use,
43 * the popup_interface.php takes the message from the message table into
44 * the message_read.
45 * @param object $message the message to be sent
46 * @return true if ok, false if error
47 */
48 public function send_message($message){
49 global $DB;
50
51 //put the process record into db
52 $processor = $DB->get_record('message_processors', array('name'=>'popup'));
53 $procmessage = new object();
54 $procmessage->unreadmessageid = $message->id;
55 $procmessage->processorid = $processor->id;
56
57 if ( !$DB->insert_record('message_working', $procmessage) ) {
58 return false;
59 }
60
61 //should only save this message for later delivery
62 return true;
63 }
64
d18b1bbd 65 function config_form($preferences){
66 return true;
67 }
68
69 public function process_form($form, &$preferences){
3b120e46 70 return true;
71 }
72 public function load_data(&$preferences, $userid){
73 return true;
74 }
75}
76?>