mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 08:22:07 +02:00
MDL-10107 Fixed the definition of message providers ... it now works through files very similar to those for events and capabilities, which makes them easy to add/remove/change as necessary
This commit is contained in:
parent
e70e036c9f
commit
120b375891
@ -179,9 +179,13 @@
|
||||
// Install the roles system.
|
||||
moodle_install_roles();
|
||||
|
||||
// install core event handlers
|
||||
// Install core event handlers
|
||||
events_update_definition();
|
||||
|
||||
// Install core message providers
|
||||
require_once($CFG->libdir .'/messagelib.php'); // Messagelib functions
|
||||
message_update_providers();
|
||||
|
||||
/// This is used to handle any settings that must exist in $CFG but which do not exist in
|
||||
/// admin_get_root()/$ADMIN as admin_setting objects (there are some exceptions).
|
||||
apply_default_exception_settings(array('auth' => 'email',
|
||||
@ -332,9 +336,13 @@
|
||||
print_error('cannotupgradecapabilities', 'debug');
|
||||
}
|
||||
|
||||
// update core events
|
||||
// Update core events
|
||||
events_update_definition();
|
||||
|
||||
// Update core message providers
|
||||
require_once($CFG->libdir .'/messagelib.php'); // Messagelib functions
|
||||
message_update_providers();
|
||||
|
||||
if (set_config("version", $version)) {
|
||||
remove_dir($CFG->dataroot . '/cache', true); // flush cache
|
||||
notify($strdatabasesuccess, "green");
|
||||
|
@ -160,6 +160,8 @@ $string['markunreadbutton'] = 'Mark<br />unread';
|
||||
$string['maxattachmentsize'] = 'Maximum attachment size';
|
||||
$string['maxtimehaspassed'] = 'Sorry, but the maximum time for editing this post ($a) has passed!';
|
||||
$string['message'] = 'Message';
|
||||
$string['messageprovider:posts'] = 'Subscribed forum posts';
|
||||
$string['messageprovider:digests'] = 'Subscribed forum digests';
|
||||
$string['missingsearchterms'] = 'The following search terms occur only in the HTML markup of this message:';
|
||||
$string['modeflatnewestfirst'] = 'Display replies flat, with newest first';
|
||||
$string['modeflatoldestfirst'] = 'Display replies flat, with oldest first';
|
||||
|
@ -914,6 +914,8 @@ $string['maximumupload'] = 'Maximum upload size';
|
||||
$string['maxsize'] = 'Max size: $a';
|
||||
$string['memberincourse'] = 'People in the course';
|
||||
$string['messagebody'] = 'Message body';
|
||||
$string['messageprovider:errors'] = 'Important errors with the site';
|
||||
$string['messageprovider:notices'] = 'Notices about minor problems';
|
||||
$string['messagedselectedusers'] = 'Selected users have been messaged and the recipient list has been reset.';
|
||||
$string['messagedselectedusersfailed'] = 'Something went wrong while messaging selected users. Some may have received the email.';
|
||||
$string['messageselect'] = 'Select this user as an email recipient';
|
||||
|
@ -24,6 +24,7 @@ require_once($CFG->libdir.'/xmldb/xmldb_statement.php');
|
||||
|
||||
/// Add other libraries
|
||||
require_once($CFG->libdir.'/xmlize.php');
|
||||
require_once($CFG->libdir .'/messagelib.php'); // Messagelib functions
|
||||
|
||||
function upgrade_main_savepoint($result, $version) {
|
||||
global $CFG;
|
||||
@ -322,6 +323,9 @@ function upgrade_plugins($type, $dir, $return) {
|
||||
/// Install events
|
||||
events_update_definition($type.'/'.$plug);
|
||||
|
||||
/// Install message providers
|
||||
message_update_providers($type.'/'.$plug);
|
||||
|
||||
/// Run local install function if there is one
|
||||
if (is_readable($fullplug .'/lib.php')) {
|
||||
include_once($fullplug .'/lib.php');
|
||||
@ -357,12 +361,17 @@ function upgrade_plugins($type, $dir, $return) {
|
||||
}
|
||||
/// Now analyze upgrade results
|
||||
if ($newupgrade_status) { // No upgrading failed
|
||||
// OK so far, now update the plugins record
|
||||
/// OK so far, now update the plugins record
|
||||
set_config($pluginversion, $plugin->version);
|
||||
if (!update_capabilities($type.'/'.$plug)) {
|
||||
print_error('cannotupdateplugincap', '', '', $plugin->name);
|
||||
}
|
||||
/// Update events
|
||||
events_update_definition($type.'/'.$plug);
|
||||
|
||||
/// Update message providers
|
||||
message_update_providers($type.'/'.$plug);
|
||||
|
||||
notify(get_string('modulesuccess', '', $plugin->name), 'notifysuccess');
|
||||
} else {
|
||||
notify('Upgrading '. $plugin->name .' from '. $CFG->$pluginversion .' to '. $plugin->version .' FAILED!');
|
||||
@ -518,8 +527,13 @@ function upgrade_activity_modules($return) {
|
||||
if (!update_capabilities('mod/'.$module->name)) {
|
||||
print_error('cannotupdatemodcap', '', '', $module->name);
|
||||
}
|
||||
|
||||
/// Update events
|
||||
events_update_definition('mod/'.$module->name);
|
||||
|
||||
/// Update message providers
|
||||
message_update_providers('mod/'.$module->name);
|
||||
|
||||
$updated_modules = true;
|
||||
|
||||
} else {
|
||||
@ -566,6 +580,9 @@ function upgrade_activity_modules($return) {
|
||||
/// Events
|
||||
events_update_definition('mod/'.$module->name);
|
||||
|
||||
/// Message providers
|
||||
message_update_providers('mod/'.$module->name);
|
||||
|
||||
/// Run local install function if there is one
|
||||
$installfunction = $module->name.'_install';
|
||||
if (function_exists($installfunction)) {
|
||||
|
@ -1310,7 +1310,13 @@ function upgrade_blocks_plugins($continueto) {
|
||||
print_error('nopermissiontoupdateblock', '', '', $block->name);
|
||||
}
|
||||
|
||||
// Update events
|
||||
events_update_definition($component);
|
||||
|
||||
// Update message providers
|
||||
require_once($CFG->libdir .'/messagelib.php'); // Messagelib functions
|
||||
message_update_providers($component);
|
||||
|
||||
notify(get_string('blocksuccess', '', $blocktitle), 'notifysuccess');
|
||||
} else {
|
||||
notify('Upgrading block '. $block->name .' from '. $currblock->version .' to '. $block->version .' FAILED!');
|
||||
@ -1378,7 +1384,13 @@ function upgrade_blocks_plugins($continueto) {
|
||||
notify('Could not set up '.$block->name.' capabilities!');
|
||||
}
|
||||
|
||||
// Update events
|
||||
events_update_definition($component);
|
||||
|
||||
// Update message providers
|
||||
require_once($CFG->libdir .'/messagelib.php'); // Messagelib functions
|
||||
message_update_providers($component);
|
||||
|
||||
notify(get_string('blocksuccess', '', $blocktitle), 'notifysuccess');
|
||||
if (!defined('CLI_UPGRADE')|| !CLI_UPGRADE) {
|
||||
echo '<hr />';
|
||||
|
@ -31,34 +31,7 @@
|
||||
|
||||
$handlers = array (
|
||||
|
||||
/*
|
||||
* Messaging Events
|
||||
*/
|
||||
/*
|
||||
* required parameters (object):
|
||||
* modulename -
|
||||
* modulefile -
|
||||
*
|
||||
*/
|
||||
'message_provider_register' => array (
|
||||
'handlerfile' => '/lib/messagelib.php',
|
||||
'handlerfunction' => 'message_provider_register_handler',
|
||||
'schedule' => 'instant'
|
||||
),
|
||||
|
||||
/*
|
||||
* required parameters (object):
|
||||
* modulename -
|
||||
*
|
||||
*/
|
||||
|
||||
'message_provider_unregister' => array (
|
||||
'handlerfile' => '/lib/messagelib.php',
|
||||
'handlerfunction' => 'message_provider_unregister_handler',
|
||||
'schedule' => 'instant'
|
||||
),
|
||||
|
||||
/* required parameters (object):
|
||||
/* Messaging required parameters (object):
|
||||
* modulename -
|
||||
* userfrom
|
||||
* userto
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<XMLDB PATH="lib/db" VERSION="20080630" COMMENT="XMLDB file for core Moodle tables"
|
||||
<XMLDB PATH="lib/db" VERSION="20080731" COMMENT="XMLDB file for core Moodle tables"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
|
||||
>
|
||||
@ -74,8 +74,7 @@
|
||||
<FIELD NAME="enrolenddate" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="enrolstartdate" NEXT="enrol"/>
|
||||
<FIELD NAME="enrol" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="enrolenddate" NEXT="defaultrole"/>
|
||||
<FIELD NAME="defaultrole" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="The default role given to participants who self-enrol" PREVIOUS="enrol" NEXT="enablecompletion"/>
|
||||
<FIELD NAME="enablecompletion" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="1 = allow use of 'completion' progress-tracking on this course.
|
||||
0 = disable completion tracking on this course." PREVIOUS="defaultrole"/>
|
||||
<FIELD NAME="enablecompletion" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="1 = allow use of 'completion' progress-tracking on this course. 0 = disable completion tracking on this course." PREVIOUS="defaultrole"/>
|
||||
</FIELDS>
|
||||
<KEYS>
|
||||
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
|
||||
@ -149,10 +148,7 @@
|
||||
<FIELD NAME="groupmode" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="visibleold" NEXT="groupingid"/>
|
||||
<FIELD NAME="groupingid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="groupmode" NEXT="groupmembersonly"/>
|
||||
<FIELD NAME="groupmembersonly" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="only members of any group are allowed to access the activity" PREVIOUS="groupingid" NEXT="completion"/>
|
||||
<FIELD NAME="completion" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Whether the completion-tracking facilities are enabled for this activity.
|
||||
0 = not enabled (database default)
|
||||
1 = manual tracking, user can tick this activity off (UI default for most activity types)
|
||||
2 = automatic tracking, system should mark completion according to rules specified in course_moduleS_completion" PREVIOUS="groupmembersonly" NEXT="completiongradeitemnumber"/>
|
||||
<FIELD NAME="completion" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Whether the completion-tracking facilities are enabled for this activity. 0 = not enabled (database default) 1 = manual tracking, user can tick this activity off (UI default for most activity types) 2 = automatic tracking, system should mark completion according to rules specified in course_moduleS_completion" PREVIOUS="groupmembersonly" NEXT="completiongradeitemnumber"/>
|
||||
<FIELD NAME="completiongradeitemnumber" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="Grade-item number used to track automatic completion, if applicable." PREVIOUS="completion" NEXT="completionview"/>
|
||||
<FIELD NAME="completionview" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Controls whether a page view is part of the automatic completion requirements for this activity. 0 = view not required 1 = view required" PREVIOUS="completiongradeitemnumber" NEXT="completionexpected"/>
|
||||
<FIELD NAME="completionexpected" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Date at which students are expected to complete this activity. This field is used when displaying student progress." PREVIOUS="completionview"/>
|
||||
@ -174,16 +170,8 @@
|
||||
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="coursemoduleid"/>
|
||||
<FIELD NAME="coursemoduleid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="Activity that has been completed (or not)." PREVIOUS="id" NEXT="userid"/>
|
||||
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="ID of user who has (or hasn't) completed the activity." PREVIOUS="coursemoduleid" NEXT="completionstate"/>
|
||||
<FIELD NAME="completionstate" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="Whether or not the user has completed the activity. Available states:
|
||||
0 = not completed [if there's no row in this table, that also counts as 0]
|
||||
1 = completed
|
||||
2 = completed, show passed
|
||||
3 = completed, show failed" PREVIOUS="userid" NEXT="viewed"/>
|
||||
|
||||
<FIELD NAME="viewed" TYPE="int" LENGTH="1" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="Tracks whether or not this activity has been viewed.
|
||||
NULL = we are not tracking viewed for this activity
|
||||
0 = not viewed
|
||||
1 = viewed" PREVIOUS="completionstate" NEXT="timemodified"/>
|
||||
<FIELD NAME="completionstate" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="Whether or not the user has completed the activity. Available states: 0 = not completed [if there's no row in this table, that also counts as 0] 1 = completed 2 = completed, show passed 3 = completed, show failed" PREVIOUS="userid" NEXT="viewed"/>
|
||||
<FIELD NAME="viewed" TYPE="int" LENGTH="1" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="Tracks whether or not this activity has been viewed. NULL = we are not tracking viewed for this activity 0 = not viewed 1 = viewed" PREVIOUS="completionstate" NEXT="timemodified"/>
|
||||
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="Time at which the completion state last changed." PREVIOUS="viewed"/>
|
||||
</FIELDS>
|
||||
<KEYS>
|
||||
@ -192,7 +180,6 @@ NULL = we are not tracking viewed for this activity
|
||||
<INDEXES>
|
||||
<INDEX NAME="coursemoduleid" UNIQUE="false" FIELDS="coursemoduleid" COMMENT="For quick access via course-module (e.g. when displaying course module settings page and we need to determine whether anyone has completed it)." NEXT="userid"/>
|
||||
<INDEX NAME="userid" UNIQUE="false" FIELDS="userid" COMMENT="Index on user ID. Used when obtaining completion information for normal course page view." PREVIOUS="coursemoduleid"/>
|
||||
|
||||
</INDEXES>
|
||||
</TABLE>
|
||||
<TABLE NAME="course_sections" COMMENT="to define the sections for each course" PREVIOUS="course_modules_completion" NEXT="course_request">
|
||||
@ -1762,13 +1749,17 @@ NULL = we are not tracking viewed for this activity
|
||||
</TABLE>
|
||||
<TABLE NAME="message_providers" COMMENT="This table stores the message providers (modules and core systems)" PREVIOUS="portfolio_instance_user" NEXT="message_processors">
|
||||
<FIELDS>
|
||||
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="true" ENUM="false" COMMENT="id of the table, please edit me" NEXT="modulename"/>
|
||||
<FIELD NAME="modulename" TYPE="char" LENGTH="166" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="Module Name" PREVIOUS="id" NEXT="modulefile"/>
|
||||
<FIELD NAME="modulefile" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="The main module file" PREVIOUS="modulename"/>
|
||||
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="true" ENUM="false" COMMENT="id of the table, please edit me" NEXT="name"/>
|
||||
<FIELD NAME="name" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="The full name of the message provider in standard form" PREVIOUS="id" NEXT="component"/>
|
||||
<FIELD NAME="component" TYPE="char" LENGTH="200" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="The name of the component that produces these messages" PREVIOUS="name" NEXT="capability"/>
|
||||
<FIELD NAME="capability" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" ENUM="false" COMMENT="Optional: permission that is required on the user's setting screen to see this message provider." PREVIOUS="component"/>
|
||||
</FIELDS>
|
||||
<KEYS>
|
||||
<KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the table, please edit me"/>
|
||||
</KEYS>
|
||||
<INDEXES>
|
||||
<INDEX NAME="componentname" UNIQUE="true" FIELDS="component, name" COMMENT="Unique index"/>
|
||||
</INDEXES>
|
||||
</TABLE>
|
||||
<TABLE NAME="message_processors" COMMENT="List of message output plugins" PREVIOUS="message_providers" NEXT="message_working">
|
||||
<FIELDS>
|
||||
@ -1813,7 +1804,7 @@ NULL = we are not tracking viewed for this activity
|
||||
<SENTENCE TEXT="(name, display_name, xmlrpc_server_url, sso_land_url) VALUES ('mahara','Mahara','/api/xmlrpc/server.php', '/auth/xmlrpc/land.php')" />
|
||||
</SENTENCES>
|
||||
</STATEMENT>
|
||||
<STATEMENT NAME="insert log_display" TYPE="insert" TABLE="log_display" COMMENT="Initial insert of records on table log_display" PREVIOUS="insert mnet_application" NEXT="insert message_providers">
|
||||
<STATEMENT NAME="insert log_display" TYPE="insert" TABLE="log_display" COMMENT="Initial insert of records on table log_display" PREVIOUS="insert mnet_application">
|
||||
<SENTENCES>
|
||||
<SENTENCE TEXT="(module, action, mtable, field) VALUES ('user', 'view', 'user', 'CONCAT(firstname," ",lastname)')" />
|
||||
<SENTENCE TEXT="(module, action, mtable, field) VALUES ('course', 'user report', 'user', 'CONCAT(firstname," ",lastname)')" />
|
||||
@ -1835,10 +1826,5 @@ NULL = we are not tracking viewed for this activity
|
||||
<SENTENCE TEXT="(module, action, mtable, field) VALUES ('group', 'view', 'groups', 'name')" />
|
||||
</SENTENCES>
|
||||
</STATEMENT>
|
||||
<STATEMENT NAME="insert message_providers" TYPE="insert" TABLE="message_providers" COMMENT="Initial insert of moodle record in message_providers" PREVIOUS="insert log_display">
|
||||
<SENTENCES>
|
||||
<SENTENCE TEXT="(modulename, modulefile) VALUES ('moodle', 'index.php')" />
|
||||
</SENTENCES>
|
||||
</STATEMENT>
|
||||
</STATEMENTS>
|
||||
</XMLDB>
|
||||
</XMLDB>
|
||||
|
46
lib/db/messages.php
Normal file
46
lib/db/messages.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php // $Id$
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Defines message providers (types of messages being sent) //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// NOTICE OF COPYRIGHT //
|
||||
// //
|
||||
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
|
||||
// http://moodle.org //
|
||||
// //
|
||||
// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation; either version 2 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License for more details: //
|
||||
// //
|
||||
// http://www.gnu.org/copyleft/gpl.html //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
$messageproviders = array (
|
||||
|
||||
/// Notices that an admin might be interested in
|
||||
'notices' => array (
|
||||
'capability' => 'moodle/site:config'
|
||||
),
|
||||
|
||||
/// Important errors that an admin ought to know about
|
||||
'errors' => array (
|
||||
'capability' => 'moodle/site:config'
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
@ -264,26 +264,13 @@ function xmldb_main_upgrade($oldversion=0) {
|
||||
}
|
||||
|
||||
if ($result && $oldversion < 2008072400) {
|
||||
/// Create the database tables for message_processors and message_providers
|
||||
$table = new xmldb_table('message_providers');
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
|
||||
$table->add_field('modulename', XMLDB_TYPE_CHAR, '166', null, XMLDB_NOTNULL, null, null, null, null);
|
||||
$table->add_field('modulefile', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null, null);
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
|
||||
$dbman->create_table($table);
|
||||
|
||||
/// Create the database tables for message_processors
|
||||
$table = new xmldb_table('message_processors');
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
|
||||
$table->add_field('name', XMLDB_TYPE_CHAR, '166', null, XMLDB_NOTNULL, null, null, null, null);
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
|
||||
$dbman->create_table($table);
|
||||
|
||||
|
||||
$provider = new object();
|
||||
$provider->modulename = 'moodle';
|
||||
$provider->modulefile = 'index.php';
|
||||
$DB->insert_record('message_providers', $provider);
|
||||
|
||||
/// delete old and create new fields
|
||||
$table = new xmldb_table('message');
|
||||
$field = new xmldb_field('messagetype');
|
||||
@ -450,6 +437,34 @@ function xmldb_main_upgrade($oldversion=0) {
|
||||
/// Main savepoint reached
|
||||
upgrade_main_savepoint($result, 2008073000);
|
||||
}
|
||||
|
||||
if ($result && $oldversion < 2008073104) {
|
||||
/// Drop old table that might exist for some people
|
||||
$table = new xmldb_table('message_providers');
|
||||
if ($dbman->table_exists($table)) {
|
||||
$dbman->drop_table($table);
|
||||
}
|
||||
|
||||
/// Define table message_providers to be created
|
||||
$table = new xmldb_table('message_providers');
|
||||
|
||||
/// Adding fields to table message_providers
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
|
||||
$table->add_field('name', XMLDB_TYPE_CHAR, '100', null, XMLDB_NOTNULL, null, null, null, null);
|
||||
$table->add_field('component', XMLDB_TYPE_CHAR, '200', null, XMLDB_NOTNULL, null, null, null, null);
|
||||
$table->add_field('capability', XMLDB_TYPE_CHAR, '255', null, null, null, null, null, null);
|
||||
|
||||
/// Adding keys to table message_providers
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
|
||||
|
||||
/// Adding indexes to table message_providers
|
||||
$table->add_index('componentname', XMLDB_INDEX_UNIQUE, array('component', 'name'));
|
||||
|
||||
/// Create table for message_providers
|
||||
$dbman->create_table($table);
|
||||
|
||||
upgrade_main_savepoint($result, 2008073104);
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO:
|
||||
|
@ -24,9 +24,9 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* messagelib.php - Contains the events handlers for the message system
|
||||
* messagelib.php - Contains generic messaging functions for the message system
|
||||
*
|
||||
* @author Luis Rodrigues
|
||||
* @author Luis Rodrigues and Martin Dougiamas
|
||||
* @version $Id$
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
|
||||
* @package
|
||||
@ -35,42 +35,11 @@
|
||||
|
||||
define('TIMETOSHOWUSERS', 300);
|
||||
|
||||
/**
|
||||
* Is trigged by an events_trigger in the MODULE_install function when
|
||||
* a module wants to be a message provider provider.
|
||||
* @param object $eventdata the information about the message provider (name and file)
|
||||
* @return boolean success
|
||||
*/
|
||||
function message_provider_register_handler($eventdata) {
|
||||
global $DB;
|
||||
$return = true;
|
||||
|
||||
$provider = new object();
|
||||
$provider->modulename = $eventdata->modulename;
|
||||
$provider->modulefile = $eventdata->modulefile;
|
||||
if (!$DB->insert_record('message_providers', $provider)) {
|
||||
$return = false;
|
||||
}
|
||||
|
||||
// everything ok :-)
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* To be used to ungegister a message provider (curently not used)
|
||||
* @param object $eventdata the information about the message provider (name and file)
|
||||
* @return boolean success
|
||||
*/
|
||||
function message_provider_unregister_handler($eventdata) {
|
||||
// everything ok :-)
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggered when a message provider wants to send a message.
|
||||
* This functions checks the user's processor configuration to send the given type of message,
|
||||
* then tries to send it.
|
||||
* @param object $eventdata information about he message (origin, destination, type, content)
|
||||
* @param object $eventdata information about the message (origin, destination, type, content)
|
||||
* @return boolean success
|
||||
*/
|
||||
function message_send_handler($eventdata){
|
||||
@ -107,7 +76,7 @@ function message_send_handler($eventdata){
|
||||
// to be able to distinguish between a user who has no settings and one who doesn't want contact
|
||||
// ... perhaps a "none" setting
|
||||
|
||||
$processor = get_user_preferences('message_provider_'.$eventdata->modulename.'_'.$userstate, 'email', $eventdata->userto->id);
|
||||
$processor = get_user_preferences('message_provider_'.$eventdata->component.$eventdata->name.'_'.$userstate, 'email', $eventdata->userto->id);
|
||||
|
||||
/// Now process the message
|
||||
|
||||
@ -150,4 +119,164 @@ function message_send_handler($eventdata){
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This code updates the message_providers table with the current set of providers
|
||||
* @param $component - examples: 'moodle', 'mod/forum', 'block/quiz_results'
|
||||
* @return boolean
|
||||
*/
|
||||
function message_update_providers($component='moodle') {
|
||||
global $DB;
|
||||
|
||||
// load message providers from files
|
||||
$fileproviders = message_get_providers_from_file($component);
|
||||
|
||||
// load message providers from the database
|
||||
$dbproviders = message_get_providers_from_db($component);
|
||||
|
||||
foreach ($fileproviders as $messagename => $fileprovider) {
|
||||
|
||||
if (!empty($dbproviders[$messagename])) { // Already exists in the database
|
||||
|
||||
if ($dbproviders[$messagename]->capability == $fileprovider['capability']) { // Same, so ignore
|
||||
// exact same message provider already present in db, ignore this entry
|
||||
unset($dbproviders[$messagename]);
|
||||
continue;
|
||||
|
||||
} else { // Update existing one
|
||||
$provider = new object();
|
||||
$provider->id = $dbproviders[$messagename]->id;
|
||||
$provider->capability = $fileprovider['capability'];
|
||||
$DB->update_record('message_providers', $provider);
|
||||
unset($dbproviders[$messagename]);
|
||||
continue;
|
||||
}
|
||||
|
||||
} else { // New message provider, add it
|
||||
|
||||
$provider = new object();
|
||||
$provider->name = $messagename;
|
||||
$provider->component = $component;
|
||||
$provider->capability = $fileprovider['capability'];
|
||||
|
||||
$DB->insert_record('message_providers', $provider);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($dbproviders as $dbprovider) { // Delete old ones
|
||||
$DB->delete_records('message_providers', array('id' => $dbprovider->id));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the active providers for the current user, based on capability
|
||||
* @return array of message providers
|
||||
*/
|
||||
function message_get_my_providers() {
|
||||
global $DB;
|
||||
|
||||
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
|
||||
$providers = $DB->get_records('message_providers');
|
||||
|
||||
// Remove all the providers we aren't allowed to see now
|
||||
foreach ($providers as $providerid => $provider) {
|
||||
if (!empty($provider->capability)) {
|
||||
if (!has_capability($provider->capability, $systemcontext)) {
|
||||
unset($providers[$providerid]); // Not allowed to see this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $providers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the message providers that are in the database for this component.
|
||||
* @param $component - examples: 'moodle', 'mod/forum', 'block/quiz_results'
|
||||
* @return array of message providers
|
||||
*
|
||||
* INTERNAL - to be used from messagelib only
|
||||
*/
|
||||
function message_get_providers_from_db($component) {
|
||||
global $DB;
|
||||
|
||||
if ($dbproviders = $DB->get_records('message_providers', array('component'=>$component), '',
|
||||
'name, id, component, capability')) { // Name is unique per component
|
||||
return $dbproviders;
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the messages definitions for the component (from file). If no
|
||||
* messages are defined for the component, we simply return an empty array.
|
||||
* @param $component - examples: 'moodle', 'mod/forum', 'block/quiz_results'
|
||||
* @return array of message providerss or empty array if not exists
|
||||
*
|
||||
* INTERNAL - to be used from messagelib only
|
||||
*/
|
||||
function message_get_providers_from_file($component) {
|
||||
global $CFG;
|
||||
|
||||
if ($component == 'moodle') {
|
||||
$defpath = $CFG->libdir.'/db/messages.php';
|
||||
|
||||
} else if ($component == 'unittest') {
|
||||
$defpath = $CFG->libdir.'/simpletest/fixtures/messages.php';
|
||||
|
||||
} else {
|
||||
$compparts = explode('/', $component);
|
||||
|
||||
if ($compparts[0] == 'block') {
|
||||
// Blocks are an exception. Blocks directory is 'blocks', and not
|
||||
// 'block'. So we need to jump through hoops.
|
||||
$defpath = $CFG->dirroot.'/blocks/'.$compparts[1].'/db/messages.php';
|
||||
|
||||
} else if ($compparts[0] == 'format') {
|
||||
// Similar to the above, course formats are 'format' while they
|
||||
// are stored in 'course/format'.
|
||||
$defpath = $CFG->dirroot.'/course/format/'.$compparts[1].'/db/messages.php';
|
||||
|
||||
} else if ($compparts[0] == 'gradeimport') {
|
||||
$defpath = $CFG->dirroot.'/grade/import/'.$compparts[1].'/db/messages.php';
|
||||
|
||||
} else if ($compparts[0] == 'gradeexport') {
|
||||
$defpath = $CFG->dirroot.'/grade/export/'.$compparts[1].'/db/messages.php';
|
||||
|
||||
} else if ($compparts[0] == 'gradereport') {
|
||||
$defpath = $CFG->dirroot.'/grade/report/'.$compparts[1].'/db/messages.php';
|
||||
|
||||
} else {
|
||||
$defpath = $CFG->dirroot.'/'.$component.'/db/messages.php';
|
||||
}
|
||||
}
|
||||
|
||||
$messageproviders = array();
|
||||
|
||||
if (file_exists($defpath)) {
|
||||
require($defpath);
|
||||
}
|
||||
|
||||
foreach ($messageproviders as $name => $messageprovider) { // Fix up missing values if required
|
||||
if (empty($messageprovider['capability'])) {
|
||||
$messageproviders[$name]['capability'] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return $messageproviders;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all message providers
|
||||
* @param $component - examples: 'moodle', 'mod/forum', 'block/quiz_results'
|
||||
*/
|
||||
function message_uninstall($component) {
|
||||
return $DB->delete_records('message_providers', array('component' => $component));
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
@ -35,6 +35,7 @@
|
||||
require_once('../config.php');
|
||||
|
||||
require_once($CFG->dirroot.'/message/edit_form.php');
|
||||
require_once($CFG->libdir.'/messagelib.php');
|
||||
|
||||
|
||||
httpsrequired();
|
||||
@ -100,18 +101,19 @@ $preferences->blocknoncontacts = get_user_preferences( 'message_blocknoncontac
|
||||
$preferences->beepnewmessage = get_user_preferences( 'message_beepnewmessage', '', $user->id);
|
||||
$preferences->noframesjs = get_user_preferences( 'message_noframesjs', '', $user->id);
|
||||
|
||||
//for every message provider get preferences for the form
|
||||
$providers = $DB->get_records('message_providers');
|
||||
// Get all the known providers
|
||||
$providers = message_get_my_providers();
|
||||
|
||||
foreach ( $providers as $providerid => $provider){
|
||||
foreach (array('loggedin', 'loggedoff') as $state){
|
||||
$linepref = get_user_preferences('message_provider_'.$provider->modulename.'_'.$state, '', $user->id);
|
||||
$linepref = get_user_preferences('message_provider_'.$provider->component.'_'.$state, '', $user->id);
|
||||
if ($linepref == ''){
|
||||
continue;
|
||||
}
|
||||
$lineprefarray = explode(',', $linepref);
|
||||
$preferences->{$provider->modulename.'_'.$state} = array();
|
||||
$preferences->{$provider->component.'_'.$state} = array();
|
||||
foreach ($lineprefarray as $pref){
|
||||
$preferences->{$provider->modulename.'_'.$state}[$provider->modulename.'_'.$state.'_'.$pref] = 1;
|
||||
$preferences->{$provider->component.'_'.$state}[$provider->component.'_'.$state.'_'.$pref] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -149,12 +151,11 @@ if ($messageconf = $userform->get_data()) {
|
||||
$preferences['message_beepnewmessage'] = $messageconf->beepnewmessage?1:0;
|
||||
$preferences['message_noframesjs'] = $messageconf->noframesjs?1:0;
|
||||
|
||||
//get a listing of all the message processors and process the form
|
||||
$providers = $DB->get_records('message_providers');
|
||||
//get a listing of all the message providers and process the form
|
||||
foreach ( $providers as $providerid => $provider){
|
||||
foreach (array('loggedin', 'loggedoff') as $state){
|
||||
$linepref = '';
|
||||
foreach ($messageconf->{$provider->modulename.'_'.$state} as $process=>$one){
|
||||
foreach ($messageconf->{$provider->component.'_'.$state} as $process=>$one){
|
||||
$parray = explode( '_', $process);
|
||||
if ($linepref == ''){
|
||||
$linepref = $parray[2];
|
||||
@ -162,7 +163,7 @@ if ($messageconf = $userform->get_data()) {
|
||||
$linepref .= ','.$parray[2];
|
||||
}
|
||||
}
|
||||
$preferences[ 'message_provider_'.$provider->modulename.'_'.$state ] = $linepref;
|
||||
$preferences[ 'message_provider_'.$provider->component.'_'.$state ] = $linepref;
|
||||
}
|
||||
}
|
||||
|
||||
@ -209,7 +210,7 @@ $navlinks[] = array('name' => $streditmymessage, 'link' => null, 'type' => 'misc
|
||||
$navigation = build_navigation($navlinks);
|
||||
|
||||
if ($course->id != SITEID) {
|
||||
print_header("$course->shortname: $streditmymessage", "$course->fullname: $streditmessage", $navigation);
|
||||
print_header("$course->shortname: $streditmymessage", "$course->fullname: $streditmymessage", $navigation);
|
||||
} else {
|
||||
print_header("$course->shortname: $streditmymessage", $course->fullname, $navigation);
|
||||
}
|
||||
|
@ -60,26 +60,24 @@ class user_edit_form extends moodleform {
|
||||
|
||||
//create the providers config section
|
||||
$mform->addElement('header', 'providers_config', get_string('providers_config', 'message') );
|
||||
$providers = $DB->get_records('message_providers');
|
||||
$providers = message_get_my_providers();
|
||||
foreach ( $providers as $providerid => $provider){
|
||||
if ( $provider->modulename == 'moodle'){
|
||||
$p = 'Moodle';
|
||||
} else {
|
||||
$p = get_string('modulename', $provider->modulename);
|
||||
}
|
||||
$mform->addElement('static', 'label'.$provider->modulename, get_string('providerstag', 'message').$p, '');
|
||||
|
||||
$providername = get_string('messageprovider:'.$provider->name, $provider->component);
|
||||
|
||||
$mform->addElement('static', 'label'.$provider->component, $providername, '');
|
||||
|
||||
$test = array();
|
||||
foreach ( $processors as $processorid => $processor){
|
||||
$test[] = &$mform->createElement('checkbox', $provider->modulename.'_loggedin_'.$processor->name, $processor->name, $processor->name);
|
||||
$test[] = &$mform->createElement('checkbox', $provider->component.'_loggedin_'.$processor->name, $processor->name, $processor->name);
|
||||
}
|
||||
$mform->addGroup($test, $provider->modulename.'_loggedin', get_string('loggedin', 'message'));
|
||||
$mform->addGroup($test, $provider->component.'_loggedin', get_string('loggedin', 'message'));
|
||||
|
||||
$test = array();
|
||||
foreach ( $processors as $processorid => $processor){
|
||||
$test[] = &$mform->createElement('checkbox', $provider->modulename.'_loggedoff_'.$processor->name, $processor->name, $processor->name);
|
||||
$test[] = &$mform->createElement('checkbox', $provider->component.'_loggedoff_'.$processor->name, $processor->name, $processor->name);
|
||||
}
|
||||
$mform->addGroup($test, $provider->modulename.'_loggedoff', get_string('loggedoff', 'message'));
|
||||
$mform->addGroup($test, $provider->component.'_loggedoff', get_string('loggedoff', 'message'));
|
||||
}
|
||||
|
||||
//create the processors config section (need to get config items from processor's lib.php
|
||||
|
@ -36,15 +36,6 @@ function xmldb_assignment_upgrade($oldversion=0) {
|
||||
upgrade_mod_savepoint($result, 2007101511, 'assignment');
|
||||
}
|
||||
|
||||
if ($result && $oldversion < 2008072401) {
|
||||
$eventdata = new object();
|
||||
$eventdata->modulename = 'assignment';
|
||||
$eventdata->modulefile = 'mod/assignment/index.php';
|
||||
events_trigger('message_provider_register', $eventdata);
|
||||
|
||||
upgrade_mod_savepoint($result, 2008072401, 'assignment');
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -1968,14 +1968,8 @@ class assignment_base {
|
||||
|
||||
/**
|
||||
* Code to be executed when a module is installed
|
||||
* now is just used to register the module as message provider
|
||||
*/
|
||||
function assignment_install() {
|
||||
$eventdata = new object();
|
||||
$eventdata->modulename = 'assignment';
|
||||
$eventdata->modulefile = 'mod/assignment/index.php';
|
||||
events_trigger('message_provider_register', $eventdata);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -233,16 +233,6 @@ function xmldb_feedback_upgrade($oldversion=0) {
|
||||
upgrade_mod_savepoint($result, 2008050105, 'feedback');
|
||||
}
|
||||
|
||||
if ($result and $oldversion < 2008072401) {
|
||||
$eventdata = new object();
|
||||
$eventdata->modulename = 'feedback';
|
||||
$eventdata->modulefile = 'mod/feedback/index.php';
|
||||
events_trigger('message_provider_register', $eventdata);
|
||||
|
||||
upgrade_mod_savepoint($result, 2008072401, 'feedback');
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -31,14 +31,8 @@ if(!isset($SESSION->feedback) OR !is_object($SESSION->feedback)) {
|
||||
|
||||
/**
|
||||
* Code to be executed when a module is installed
|
||||
* now is just used to register the module as message provider
|
||||
*/
|
||||
function feedback_install() {
|
||||
$eventdata = new object();
|
||||
$eventdata->modulename = 'feedback';
|
||||
$eventdata->modulefile = 'mod/feedback/index.php';
|
||||
events_trigger('message_provider_register', $eventdata);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
42
mod/forum/db/messages.php
Normal file
42
mod/forum/db/messages.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php // $Id$
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Defines message providers (types of messages being sent) //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// NOTICE OF COPYRIGHT //
|
||||
// //
|
||||
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
|
||||
// http://moodle.org //
|
||||
// //
|
||||
// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation; either version 2 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License for more details: //
|
||||
// //
|
||||
// http://www.gnu.org/copyleft/gpl.html //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
$messageproviders = array (
|
||||
|
||||
/// Ordinary single forum posts
|
||||
'posts' => array (
|
||||
),
|
||||
|
||||
/// Digests
|
||||
'digests' => array (
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
|
||||
?>
|
@ -78,15 +78,6 @@ function xmldb_forum_upgrade($oldversion=0) {
|
||||
upgrade_mod_savepoint($result, 2007101512, 'forum');
|
||||
}
|
||||
|
||||
if ($result and $oldversion < 2008072401) {
|
||||
$eventdata = new object();
|
||||
$eventdata->modulename = 'forum';
|
||||
$eventdata->modulefile = 'mod/forum/index.php';
|
||||
events_trigger('message_provider_register', $eventdata);
|
||||
|
||||
upgrade_mod_savepoint($result, 2008072401, 'forum');
|
||||
}
|
||||
|
||||
if ($result && $oldversion < 2008072800) {
|
||||
/// Define field completiondiscussions to be added to forum
|
||||
$table = new xmldb_table('forum');
|
||||
|
@ -31,14 +31,8 @@ define ('FORUM_AGGREGATE_SUM', 5);
|
||||
|
||||
/**
|
||||
* Code to be executed when a module is installed
|
||||
* now is just used to register the module as message provider
|
||||
*/
|
||||
function forum_install() {
|
||||
$eventdata = new object();
|
||||
$eventdata->modulename = 'forum';
|
||||
$eventdata->modulefile = 'mod/forum/index.php';
|
||||
events_trigger('message_provider_register', $eventdata);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -543,7 +537,8 @@ function forum_cron() {
|
||||
$posthtml, '', '', $CFG->forum_replytouser)) {
|
||||
*/
|
||||
$eventdata = new object();
|
||||
$eventdata->modulename = 'forum';
|
||||
$eventdata->component = 'mod/forum';
|
||||
$eventdata->name = 'posts';
|
||||
$eventdata->userfrom = $userfrom;
|
||||
$eventdata->userto = $userto;
|
||||
$eventdata->subject = $postsubject;
|
||||
@ -843,7 +838,8 @@ function forum_cron() {
|
||||
'', '', $CFG->forum_replytouser)) {
|
||||
*/
|
||||
$eventdata = new object();
|
||||
$eventdata->modulename = 'forum';
|
||||
$eventdata->component = 'mod/forum';
|
||||
$eventdata->name = 'posts';
|
||||
$eventdata->userfrom = $site->shortname;
|
||||
$eventdata->userto = $userto;
|
||||
$eventdata->subject = $postsubject;
|
||||
|
@ -5,7 +5,7 @@
|
||||
// This fragment is called by /admin/index.php
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
$module->version = 2008072800;
|
||||
$module->version = 2008073100;
|
||||
$module->requires = 2008072401; // Requires this Moodle version
|
||||
$module->cron = 60;
|
||||
|
||||
|
@ -44,15 +44,6 @@ function xmldb_lesson_upgrade($oldversion=0) {
|
||||
upgrade_mod_savepoint($result, 2007072201, 'lesson');
|
||||
}
|
||||
|
||||
if ($result and $oldversion < 2008072401) {
|
||||
$eventdata = new object();
|
||||
$eventdata->modulename = 'lesson';
|
||||
$eventdata->modulefile = 'mod/lesson/index.php';
|
||||
events_trigger('message_provider_register', $eventdata);
|
||||
|
||||
upgrade_mod_savepoint($result, 2008072401, 'lesson');
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -13,14 +13,8 @@ define("LESSON_MAX_EVENT_LENGTH", "432000"); // 5 days maximum
|
||||
|
||||
/**
|
||||
* Code to be executed when a module is installed
|
||||
* now is just used to register the module as message provider
|
||||
*/
|
||||
function lesson_install() {
|
||||
$eventdata = new object();
|
||||
$eventdata->modulename = 'lesson';
|
||||
$eventdata->modulefile = 'mod/lesson/index.php';
|
||||
events_trigger('message_provider_register', $eventdata);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -77,15 +77,6 @@ function xmldb_quiz_upgrade($oldversion=0) {
|
||||
upgrade_mod_savepoint($result, 2008062001, 'quiz');
|
||||
}
|
||||
|
||||
if ($result and $oldversion < 2008072401) {
|
||||
$eventdata = new object();
|
||||
$eventdata->modulename = 'quiz';
|
||||
$eventdata->modulefile = 'mod/quiz/index.php';
|
||||
events_trigger('message_provider_register', $eventdata);
|
||||
|
||||
upgrade_mod_savepoint($result, 2008072401, 'quiz');
|
||||
}
|
||||
|
||||
if ($result && $oldversion < 2008072402) {
|
||||
|
||||
/// Define field lastcron to be added to quiz_report
|
||||
|
@ -60,14 +60,8 @@ define("QUIZ_MAX_EVENT_LENGTH", 5*24*60*60); // 5 days maximum
|
||||
|
||||
/**
|
||||
* Code to be executed when a module is installed
|
||||
* now is just used to register the module as message provider
|
||||
*/
|
||||
function quiz_install() {
|
||||
$eventdata = new object();
|
||||
$eventdata->modulename = 'quiz';
|
||||
$eventdata->modulefile = 'mod/quiz/index.php';
|
||||
events_trigger('message_provider_register', $eventdata);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
// This is compared against the values stored in the database to determine
|
||||
// whether upgrades should be performed (see lib/db/*.php)
|
||||
|
||||
$version = 2008073000; // YYYYMMDD = date of the last version bump
|
||||
$version = 2008073104; // YYYYMMDD = date of the last version bump
|
||||
// XX = daily increments
|
||||
|
||||
$release = '2.0 dev (Build: 20080731)'; // Human-friendly version name
|
||||
|
Loading…
x
Reference in New Issue
Block a user