new function get_coursemodule_from_id() is now used for obtaining of valid $cm from coursemodule id SC#283; backported from HEAD

This commit is contained in:
skodak
2006-08-10 15:51:44 +00:00
parent c20d676e5e
commit 6d36e511fb
76 changed files with 124 additions and 101 deletions
+32 -9
View File
@@ -2585,22 +2585,45 @@ function get_course_mods($courseid) {
/**
* Given an instance of a module, finds the coursemodule description
* Given an id of a course module, finds the coursemodule description
*
* @uses $CFG
* @param string $modulename ?
* @param string $instance ?
* @param int $courseid The id of the course as found in the 'course' table.
* @return array
* @todo Finish documenting this function
* @param string $modulename name of module type, eg. resource, assignment,...
* @param int $cmid course module id (id in course_modules table)
* @param int $courseid optional course id for extra validation
* @return object course module instance with instance and module name
*/
function get_coursemodule_from_id($modulename, $cmid, $courseid=0) {
global $CFG;
$courseselect = ($courseid) ? "cm.course = '$courseid' AND " : '';
return get_record_sql("SELECT cm.*, m.name, md.name as modname
FROM {$CFG->prefix}course_modules cm,
{$CFG->prefix}modules md,
{$CFG->prefix}$modulename m
WHERE $courseselect
cm.id = '$cmid' AND
cm.instance = m.id AND
md.name = '$modulename' AND
md.id = cm.module");
}
/**
* Given an instance number of a module, finds the coursemodule description
*
* @param string $modulename name of module type, eg. resource, assignment,...
* @param int $instance module instance number (id in resource, assignment etc. table)
* @param int $courseid optional course id for extra validation
* @return object course module instance with instance and module name
*/
function get_coursemodule_from_instance($modulename, $instance, $courseid=0) {
global $CFG;
$courseselect = ($courseid) ? "cm.course = '$courseid' AND " : '';
return get_record_sql("SELECT cm.*, m.name
return get_record_sql("SELECT cm.*, m.name, md.name as modname
FROM {$CFG->prefix}course_modules cm,
{$CFG->prefix}modules md,
{$CFG->prefix}$modulename m
+1 -1
View File
@@ -37,7 +37,7 @@ class assignment_base {
if ($cmid) {
if ($cm) {
$this->cm = $cm;
} else if (! $this->cm = get_record('course_modules', 'id', $cmid)) {
} else if (! $this->cm = get_coursemodule_from_id('assignment', $cmid)) {
error('Course Module ID was incorrect');
}
+1 -1
View File
@@ -8,7 +8,7 @@
$mode = optional_param('mode', 'all'); // What mode are we in?
if ($id) {
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('assignment', $id)) {
error("Course Module ID was incorrect");
}
+1 -1
View File
@@ -7,7 +7,7 @@
$id = required_param('id', PARAM_INT); // Course Module ID
$userid = required_param('userid', PARAM_INT); // User ID
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('assignment', $id)) {
error("Course Module ID was incorrect");
}
+1 -1
View File
@@ -7,7 +7,7 @@
$a = optional_param('a'); // Assignment ID
if ($id) {
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('assignment', $id)) {
error("Course Module ID was incorrect");
}
+2 -2
View File
@@ -5,8 +5,8 @@
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
$module->version = 2005060100;
$module->requires = 2005031000; // Requires this Moodle version
$module->version = 2005060101;
$module->requires = 2005060241; // Requires this Moodle version
$module->cron = 60;
?>
+1 -1
View File
@@ -8,7 +8,7 @@
if ($id) {
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('assignment', $id)) {
error("Course Module ID was incorrect");
}
+1 -1
View File
@@ -11,7 +11,7 @@
$deletesession = optional_param('deletesession', 0, PARAM_BOOL);
$confirmdelete = optional_param('confirmdelete', 0, PARAM_BOOL);
if (! $cm = get_record('course_modules', 'id', $id)) {
if (! $cm = get_coursemodule_from_id('chat', $id)) {
error('Course Module ID was incorrect');
}
if (! $chat = get_record('chat', 'id', $cm->instance)) {
+2 -2
View File
@@ -5,8 +5,8 @@
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
$module->version = 2005031000; // The (date) version of this module
$module->requires = 2005031000; // Requires this Moodle version
$module->version = 2005031001; // The (date) version of this module
$module->requires = 2005060241; // Requires this Moodle version
$module->cron = 300; // How often should cron check this module (seconds)?
?>
+1 -1
View File
@@ -12,7 +12,7 @@
$edit = optional_param('edit', '');
if ($id) {
if (! $cm = get_record('course_modules', 'id', $id)) {
if (! $cm = get_coursemodule_from_id('chat', $id)) {
error('Course Module ID was incorrect');
}
+1 -1
View File
@@ -8,7 +8,7 @@
$format = optional_param('format', CHOICE_PUBLISH_NAMES, PARAM_INT);
$download = optional_param('download', '', PARAM_ALPHA);
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('choice', $id)) {
error("Course Module ID was incorrect");
}
+2 -2
View File
@@ -5,8 +5,8 @@
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
$module->version = 2005041500;
$module->requires = 2005021600; // Requires this Moodle version
$module->version = 2005041501;
$module->requires = 2005060241; // Requires this Moodle version
$module->cron = 0;
?>
+1 -1
View File
@@ -5,7 +5,7 @@
require_variable($id); // Course Module ID
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('choice', $id)) {
error("Course Module ID was incorrect");
}
+1 -1
View File
@@ -35,7 +35,7 @@
$id = required_param('id', PARAM_INT); // Course Module ID
// get some esential stuff...
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('exercise', $id)) {
error("Course Module ID was incorrect");
}
+1 -1
View File
@@ -27,7 +27,7 @@
$id = required_param('id', PARAM_INT); // Course Module ID
// get some essential stuff...
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('exercise', $id)) {
error("Course Module ID was incorrect");
}
+1 -1
View File
@@ -8,7 +8,7 @@
$timenow = time();
// get some esential stuff...
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('exercise', $id)) {
error("Course Module ID was incorrect");
}
+2 -2
View File
@@ -5,8 +5,8 @@
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
$module->version = 2005031000;
$module->requires = 2005031000; // Requires this Moodle version
$module->version = 2005031001;
$module->requires = 2005060241; // Requires this Moodle version
$module->cron = 60;
?>
+1 -1
View File
@@ -22,7 +22,7 @@
$id = required_param('id', PARAM_INT); // Course Module ID
// get some esential stuff...
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('exercise', $id)) {
error("Course Module ID was incorrect");
}
+2 -2
View File
@@ -5,8 +5,8 @@
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
$module->version = 2005042600;
$module->requires = 2005031000; // Requires this Moodle version
$module->version = 2005042601;
$module->requires = 2005060241; // Requires this Moodle version
$module->cron = 60;
?>
+1 -1
View File
@@ -13,7 +13,7 @@
$search = optional_param('search', ''); // search string
if ($id) {
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('forum', $id)) {
error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
+1 -1
View File
@@ -9,7 +9,7 @@
$mode = optional_param('mode','approval', PARAM_ALPHA);
$hook = optional_param('hook','ALL', PARAM_CLEAN);
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
error("Course Module ID was incorrect");
}
+1 -1
View File
@@ -14,7 +14,7 @@
global $USER, $CFG;
if (! $cm = get_record('course_modules', 'id', $id)) {
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
error('Course Module ID was incorrect');
}
+1 -1
View File
@@ -9,7 +9,7 @@
global $USER, $CFG;
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
error("Course Module ID was incorrect");
}
+1 -1
View File
@@ -16,7 +16,7 @@
$entrydeleted = get_string("entrydeleted","glossary");
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
error("Course Module ID was incorrect");
}
+1 -1
View File
@@ -12,7 +12,7 @@ $confirm = optional_param('confirm',0, PARAM_INT); // proceed. Edit the edtry
$mode = optional_param('mode', '', PARAM_ALPHA); // categories if by category?
$hook = optional_param('hook', '', PARAM_ALPHANUM); // CategoryID
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
error("Course Module ID was incorrect");
}
+1 -1
View File
@@ -16,7 +16,7 @@
$action = strtolower($action);
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
error("Course Module ID was incorrect");
}
+1 -1
View File
@@ -9,7 +9,7 @@
$l = optional_param('l','', PARAM_ALPHANUM);
$cat = optional_param('cat',0, PARAM_ALPHANUM);
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
error("Course Module ID was incorrect");
}
+1 -1
View File
@@ -13,7 +13,7 @@
$PermissionGranted = 1;
$cm = get_record('course_modules','id',$id);
$cm = get_coursemodule_from_id('glossary', $id);
if ( ! $cm ) {
$PermissionGranted = 0;
} else {
+1 -1
View File
@@ -15,7 +15,7 @@
$mode = optional_param('mode', 'letter', PARAM_ALPHA );
$hook = optional_param('hook', 'ALL', PARAM_ALPHANUM);
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
error("Course Module ID was incorrect");
}
+1 -1
View File
@@ -14,7 +14,7 @@
$hook = optional_param('hook','ALL', PARAM_ALPHANUM); // what to show
$sortkey = optional_param('sortkey','UPDATE', PARAM_ALPHA); // Sorting key
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
error("Course Module ID was incorrect");
}
+2 -2
View File
@@ -5,8 +5,8 @@
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
$module->version = 2005041900;
$module->requires = 2005031000; // Requires this Moodle version
$module->version = 2005041901;
$module->requires = 2005060241; // Requires this Moodle version
$module->cron = 0; // Period for cron to check this module (secs)
$release = "1.5 development"; // User-friendly version number
+1 -1
View File
@@ -20,7 +20,7 @@
$show = optional_param('show', '', PARAM_ALPHA); // [ concept | alias ] => mode=term hook=$show
if (!empty($id)) {
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
+1 -1
View File
@@ -9,7 +9,7 @@
$hp = optional_param("hp"); // hotpot ID
if ($id) {
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('hotpot', $id)) {
error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
+1 -1
View File
@@ -11,7 +11,7 @@
$attempt = required_param("attempt"); // A particular attempt ID for review
if ($id) {
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('hotpot', $id)) {
error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
+3 -3
View File
@@ -5,9 +5,9 @@
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
$module->version = 2005031420; // release date of this version (see note below)
$module->release = 'v2.0.10'; // human-friendly version name (used in mod/hotpot/lib.php)
$module->requires = 2003091111; // Requires at least Moodle version 1.1.1
$module->version = 2005031421; // release date of this version (see note below)
$module->release = 'v2.0.11'; // human-friendly version name (used in mod/hotpot/lib.php)
$module->requires = 2005060241; // Requires at least Moodle version 1.5.4+
$module->cron = 0; // period for cron to check this module (secs)
// interpretation of YYYYMMDDXY version numbers
+1 -1
View File
@@ -9,7 +9,7 @@
$hp = optional_param("hp"); // hotpot ID
if ($id) {
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('hotpot', $id)) {
error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
+1 -1
View File
@@ -4,7 +4,7 @@
require_variable($id); // Course Module ID
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('journal', $id)) {
error("Course Module ID was incorrect");
}
+1 -1
View File
@@ -5,7 +5,7 @@
require_variable($id); // course module
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('journal', $id)) {
error("Course Module ID was incorrect");
}
+2 -2
View File
@@ -5,8 +5,8 @@
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
$module->version = 2005041100;
$module->requires = 2005031000; // Requires this Moodle version
$module->version = 2005041101;
$module->requires = 2005060241; // Requires this Moodle version
$module->cron = 60;
?>
+1 -1
View File
@@ -5,7 +5,7 @@
require_variable($id); // Course Module ID
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('journal', $id)) {
error("Course Module ID was incorrect");
}
+2 -2
View File
@@ -5,8 +5,8 @@
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
$module->version = 2004111200; // The current module version (Date: YYYYMMDDXX)
$module->requires = 2004052505; // Requires this Moodle version
$module->version = 2004111201; // The current module version (Date: YYYYMMDDXX)
$module->requires = 2005060241; // Requires this Moodle version
$module->cron = 0; // Period for cron to check this module (secs)
?>
+1 -1
View File
@@ -6,7 +6,7 @@
optional_variable($l); // Label ID
if ($id) {
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('label', $id)) {
error("Course Module ID was incorrect");
}
+1 -1
View File
@@ -8,7 +8,7 @@
$id = required_param('id', PARAM_INT); // Course Module ID
$pageid = optional_param('pageid', '', PARAM_INT); // Page ID
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('lesson', $id)) {
error("Course Module ID was incorrect");
}
+1 -1
View File
@@ -26,7 +26,7 @@
$action = required_param('action', PARAM_ALPHA); // Action
// get some esential stuff...
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('lesson', $id)) {
error("Course Module ID was incorrect");
}
+1 -1
View File
@@ -11,7 +11,7 @@
$pageid = optional_param('pageid', NULL, PARAM_INT); // Lesson Page ID
$action = optional_param('action'); // action to take
if (! $cm = get_record('course_modules', 'id', $id)) {
if (! $cm = get_coursemodule_from_id('lesson', $id)) {
error('Course Module ID was incorrect');
}
+2 -2
View File
@@ -5,8 +5,8 @@
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
$module->version = 2005060900; // The current module version (Date: YYYYMMDDXX)
$module->requires = 2005021600; // Requires this Moodle version
$module->version = 2005060901; // The current module version (Date: YYYYMMDDXX)
$module->requires = 2005060241; // Requires this Moodle version
$module->cron = 0; // Period for cron to check this module (secs)
?>
+1 -1
View File
@@ -10,7 +10,7 @@
$id = required_param('id', PARAM_INT); // Course Module ID
$pageid = optional_param('pageid', NULL, PARAM_INT); // Lesson Page ID
if (! $cm = get_record('course_modules', 'id', $id)) {
if (! $cm = get_coursemodule_from_id('lesson', $id)) {
error('Course Module ID was incorrect');
}
+1 -1
View File
@@ -32,7 +32,7 @@
}
if ($id) {
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('quiz', $id)) {
error("There is no coursemodule with id $id");
}
+1 -1
View File
@@ -11,7 +11,7 @@
optional_variable($mode, "overview"); // Report mode
if ($id) {
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('quiz', $id)) {
error("There is no coursemodule with id $id");
}
+2 -2
View File
@@ -5,8 +5,8 @@
// This fragment is called by moodle_needs_upgrading() and /admin/index.php
////////////////////////////////////////////////////////////////////////////////
$module->version = 2005060302; // The (date) version of this module
$module->requires = 2005021600; // Requires this Moodle version
$module->version = 2005060303; // The (date) version of this module
$module->requires = 2005060241; // Requires this Moodle version
$module->cron = 0; // How often should cron check this module (seconds)?
?>
+1 -1
View File
@@ -13,7 +13,7 @@
if ($id) {
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('quiz', $id)) {
error("There is no coursemodule with id $id");
}
+1 -1
View File
@@ -9,7 +9,7 @@
require_variable($id); // Course Module ID
require_variable($url); // url to fetch
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('resource', $id)) {
error("Course Module ID was incorrect");
}
+1 -1
View File
@@ -82,7 +82,7 @@ function resource_base($cmid=0) {
global $course; // Ugly hack, needed for course language ugly hack
if ($cmid) {
if (! $this->cm = get_record("course_modules", "id", $cmid)) {
if (! $this->cm = get_coursemodule_from_id('resource', $cmid)) {
error("Course Module ID was incorrect");
}
+2 -2
View File
@@ -5,8 +5,8 @@
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
$module->version = 2005041100;
$module->requires = 2005021600; // Requires this Moodle version
$module->version = 2005041101;
$module->requires = 2005060241; // Requires this Moodle version
$module->cron = 0;
?>
+1 -1
View File
@@ -20,7 +20,7 @@
}
} else if ($id) {
if (! $cm = get_record('course_modules', 'id', $id)) {
if (! $cm = get_coursemodule_from_id('resource', $id)) {
error('Course Module ID was incorrect');
}
+1 -1
View File
@@ -9,7 +9,7 @@
optional_variable($mode); // navigation mode
if ($id) {
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('scorm', $id)) {
error("Course Module ID was incorrect");
}
+1 -1
View File
@@ -6,7 +6,7 @@
optional_variable($a); // scorm IDa
if ($id) {
if (! $cm = get_record('course_modules', 'id', $id)) {
if (! $cm = get_coursemodule_from_id('scorm', $id)) {
error('Course Module ID was incorrect');
}
if (! $course = get_record('course', 'id', $cm->course)) {
+1 -1
View File
@@ -8,7 +8,7 @@
optional_variable($mode); // lesson mode
if ($id) {
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('scorm', $id)) {
error("Course Module ID was incorrect");
}
+1 -1
View File
@@ -9,7 +9,7 @@
optional_variable($a); // scorm ID
if ($id) {
if (! $cm = get_record('course_modules', 'id', $id)) {
if (! $cm = get_coursemodule_from_id('scorm', $id)) {
error('Course Module ID was incorrect');
}
+1 -1
View File
@@ -10,7 +10,7 @@
optional_variable($user); // User ID
if ($id) {
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('scorm', $id)) {
error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
+2 -2
View File
@@ -5,8 +5,8 @@
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
$module->version = 2005070600; // The (date) version of this module
$module->requires = 2005021600; // The version of Moodle that is required
$module->version = 2005070601; // The (date) version of this module
$module->requires = 2005060241; // The version of Moodle that is required
$module->cron = 0; // How often should cron check this module (seconds)?
?>
+1 -1
View File
@@ -10,7 +10,7 @@
$a = optional_param('a'); // scorm ID
if ($id) {
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('scorm', $id)) {
error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
+1 -1
View File
@@ -8,7 +8,7 @@
$type = optional_param('type', 'xls', PARAM_ALPHA);
$group = optional_param('group', 0, PARAM_INT);
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('survey', $id)) {
error("Course Module ID was incorrect");
}
+1 -1
View File
@@ -10,7 +10,7 @@
$sid = optional_param('sid', false, PARAM_INT); // Student ID
$qid = optional_param('qid', 0, PARAM_INT); // Group ID
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('survey', $id)) {
error("Course Module ID was incorrect");
}
+1 -1
View File
@@ -16,7 +16,7 @@
$id = required_param('id', PARAM_INT); // Course Module ID
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('survey', $id)) {
error("Course Module ID was incorrect");
}
+2 -2
View File
@@ -5,8 +5,8 @@
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
$module->version = 2005031600;
$module->requires = 2005031000; // Requires this Moodle version
$module->version = 2005031601;
$module->requires = 2005060241; // Requires this Moodle version
$module->cron = 0;
?>
+1 -1
View File
@@ -5,7 +5,7 @@
$id = required_param('id', PARAM_INT); // Course Module ID
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('survey', $id)) {
error("Course Module ID was incorrect");
}
+1 -1
View File
@@ -13,7 +13,7 @@
$groupid = optional_param('groupid', 0, PARAM_INT); // Group wiki.
if ($id) {
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('wiki', $id)) {
error("Course Module ID was incorrect");
}
+2 -2
View File
@@ -5,8 +5,8 @@
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
$module->version = 2005031000; // The current module version (Date: YYYYMMDDXX)
$module->requires = 2005031000; // The current module version (Date: YYYYMMDDXX)
$module->version = 2005031001; // The current module version (Date: YYYYMMDDXX)
$module->requires = 2005060241; // The current module version (Date: YYYYMMDDXX)
$module->cron = 0; // Period for cron to check this module (secs)
?>
+1 -1
View File
@@ -23,7 +23,7 @@
if ($id) {
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('wiki', $id)) {
error("Course Module ID was incorrect");
}
+1 -1
View File
@@ -35,7 +35,7 @@
// get some useful stuff...
if ($id) {
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('workshop', $id)) {
error("Course Module ID was incorrect");
}
if (! $workshop = get_record("workshop", "id", $cm->instance)) {
+1 -1
View File
@@ -26,7 +26,7 @@
$timenow = time();
// get some useful stuff...
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('workshop', $id)) {
error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
+1 -1
View File
@@ -7,7 +7,7 @@
require_variable($id); // CM ID
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('workshop', $id)) {
error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
+2 -2
View File
@@ -5,8 +5,8 @@
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
$module->version = 2005041200;
$module->requires = 2005031000; // Requires this Moodle version
$module->version = 2005041201;
$module->requires = 2005060241; // Requires this Moodle version
$module->cron = 60;
?>
+1 -1
View File
@@ -25,7 +25,7 @@
$timenow = time();
// get some useful stuff...
if (! $cm = get_record("course_modules", "id", $id)) {
if (! $cm = get_coursemodule_from_id('workshop', $id)) {
error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
+1 -1
View File
@@ -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 = 2005060240; // YYYYMMDD = Moodle 1.5 Date
$version = 2005060241; // YYYYMMDD = Moodle 1.5 Date
// X = Moodle 1.5 Point release (0,1,2...)
// Y = Interim incrementer