diff --git a/lib/datalib.php b/lib/datalib.php index 18a3118e66d..4f7a1c66df9 100644 --- a/lib/datalib.php +++ b/lib/datalib.php @@ -2596,22 +2596,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 object - * @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 diff --git a/mod/assignment/lib.php b/mod/assignment/lib.php index 45981b6d0d5..b8bd5465021 100644 --- a/mod/assignment/lib.php +++ b/mod/assignment/lib.php @@ -53,7 +53,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'); } diff --git a/mod/assignment/submissions.php b/mod/assignment/submissions.php index 6b5693d98bd..1256b29945f 100644 --- a/mod/assignment/submissions.php +++ b/mod/assignment/submissions.php @@ -8,7 +8,7 @@ $mode = optional_param('mode', 'all', PARAM_ALPHA); // 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"); } diff --git a/mod/assignment/type/online/file.php b/mod/assignment/type/online/file.php index af67bcf5e27..cc106618aae 100644 --- a/mod/assignment/type/online/file.php +++ b/mod/assignment/type/online/file.php @@ -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"); } diff --git a/mod/assignment/upload.php b/mod/assignment/upload.php index cfb862753b1..e866cdff023 100644 --- a/mod/assignment/upload.php +++ b/mod/assignment/upload.php @@ -7,7 +7,7 @@ $a = optional_param('a', 0, PARAM_INT); // 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"); } diff --git a/mod/assignment/version.php b/mod/assignment/version.php index 5966ec53c65..85ee874603e 100644 --- a/mod/assignment/version.php +++ b/mod/assignment/version.php @@ -5,8 +5,8 @@ // This fragment is called by /admin/index.php //////////////////////////////////////////////////////////////////////////////// -$module->version = 2006080800; -$module->requires = 2005031000; // Requires this Moodle version +$module->version = 2006080900; +$module->requires = 2006080900; // Requires this Moodle version $module->cron = 60; ?> diff --git a/mod/assignment/view.php b/mod/assignment/view.php index a773b773533..d38dcb8e34c 100644 --- a/mod/assignment/view.php +++ b/mod/assignment/view.php @@ -7,7 +7,7 @@ $a = optional_param('a', 0, PARAM_INT); // 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"); } diff --git a/mod/chat/report.php b/mod/chat/report.php index 4874c5281ed..5bcf6a61161 100644 --- a/mod/chat/report.php +++ b/mod/chat/report.php @@ -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)) { diff --git a/mod/chat/version.php b/mod/chat/version.php index fb90b69f224..5edab92c8dc 100644 --- a/mod/chat/version.php +++ b/mod/chat/version.php @@ -5,8 +5,8 @@ /// This fragment is called by moodle_needs_upgrading() and /admin/index.php ///////////////////////////////////////////////////////////////////////////////// -$module->version = 2006080800; // The (date) version of this module -$module->requires = 2005031000; // Requires this Moodle version +$module->version = 2006080900; // The (date) version of this module +$module->requires = 2006080900; // Requires this Moodle version $module->cron = 300; // How often should cron check this module (seconds)? ?> diff --git a/mod/chat/view.php b/mod/chat/view.php index e2b0df89b11..5a125ed3b76 100644 --- a/mod/chat/view.php +++ b/mod/chat/view.php @@ -12,7 +12,7 @@ $edit = optional_param('edit', -1, PARAM_BOOL); if ($id) { - if (! $cm = get_record('course_modules', 'id', $id)) { + if (! $cm = get_coursemodule_from_id('chat', $id)) { error('Course Module ID was incorrect'); } diff --git a/mod/choice/report.php b/mod/choice/report.php index 6f09637c44f..c813d58e0ed 100644 --- a/mod/choice/report.php +++ b/mod/choice/report.php @@ -8,7 +8,7 @@ $download = optional_param('download', '', PARAM_ALPHA); $action = optional_param('action', '', PARAM_ALPHA); - if (! $cm = get_record("course_modules", "id", $id)) { + if (! $cm = get_coursemodule_from_id('choice', $id)) { error("Course Module ID was incorrect"); } diff --git a/mod/choice/version.php b/mod/choice/version.php index 8acd83c2514..b9e78c19415 100644 --- a/mod/choice/version.php +++ b/mod/choice/version.php @@ -5,8 +5,8 @@ // This fragment is called by /admin/index.php //////////////////////////////////////////////////////////////////////////////// -$module->version = 2006080800; -$module->requires = 2005021600; // Requires this Moodle version +$module->version = 2006080900; +$module->requires = 2006080900; // Requires this Moodle version $module->cron = 0; ?> diff --git a/mod/choice/view.php b/mod/choice/view.php index bcc54fca258..ff052f7ec3c 100644 --- a/mod/choice/view.php +++ b/mod/choice/view.php @@ -7,7 +7,7 @@ $action = optional_param('action', '', PARAM_ALPHA); $attemptids = optional_param('attemptid', array(), PARAM_INT); // array of attempt ids for delete action - if (! $cm = get_record("course_modules", "id", $id)) { + if (! $cm = get_coursemodule_from_id('choice', $id)) { error("Course Module ID was incorrect"); } diff --git a/mod/data/edit.php b/mod/data/edit.php index 79a70545f00..a13ddaa562a 100755 --- a/mod/data/edit.php +++ b/mod/data/edit.php @@ -33,7 +33,7 @@ $mode ='addtemplate'; //define the mode for this page, only 1 mode available if ($id) { - if (! $cm = get_record('course_modules', 'id', $id)) { + if (! $cm = get_coursemodule_from_id('data', $id)) { error('Course Module ID was incorrect'); } if (! $course = get_record('course', 'id', $cm->course)) { diff --git a/mod/data/import.php b/mod/data/import.php index 56fd75acdc3..d29911500bb 100755 --- a/mod/data/import.php +++ b/mod/data/import.php @@ -35,7 +35,7 @@ $fieldenclosure = optional_param('fieldenclosure', '', PARAM_CLEANHTML); // characters used as record delimiters for csv file import if ($id) { - if (! $cm = get_record('course_modules', 'id', $id)) { + if (! $cm = get_coursemodule_from_id('data', $id)) { error('Course Module ID was incorrect'); } if (! $course = get_record('course', 'id', $cm->course)) { diff --git a/mod/data/version.php b/mod/data/version.php index 770c3418eb1..1e54d56e09a 100644 --- a/mod/data/version.php +++ b/mod/data/version.php @@ -5,8 +5,8 @@ // This fragment is called by /admin/index.php //////////////////////////////////////////////////////////////////////////////// -$module->version = 2006080800; -$module->requires = 2005060230; // Requires this Moodle version +$module->version = 2006080900; +$module->requires = 2006080900; // Requires this Moodle version $module->cron = 60; ?> diff --git a/mod/data/view.php b/mod/data/view.php index 6714592af97..9621ba24f77 100755 --- a/mod/data/view.php +++ b/mod/data/view.php @@ -44,7 +44,7 @@ $delete = optional_param('delete', 0, PARAM_INT); //delete recordid if ($id) { - if (! $cm = get_record('course_modules', 'id', $id)) { + if (! $cm = get_coursemodule_from_id('data', $id)) { error('Course Module ID was incorrect'); } if (! $course = get_record('course', 'id', $cm->course)) { diff --git a/mod/exercise/assessments.php b/mod/exercise/assessments.php index 0feab864703..4ebeab31406 100644 --- a/mod/exercise/assessments.php +++ b/mod/exercise/assessments.php @@ -39,7 +39,7 @@ $userid = optional_param('userid', 0, PARAM_INT); // 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"); } diff --git a/mod/exercise/submissions.php b/mod/exercise/submissions.php index 9f2b57b5d87..de637461c2c 100644 --- a/mod/exercise/submissions.php +++ b/mod/exercise/submissions.php @@ -31,7 +31,7 @@ $title = optional_param('title', '', PARAM_CLEAN); // 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"); } diff --git a/mod/exercise/upload.php b/mod/exercise/upload.php index e894dbdd83f..7f2e3d2c3ec 100644 --- a/mod/exercise/upload.php +++ b/mod/exercise/upload.php @@ -10,7 +10,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"); } diff --git a/mod/exercise/version.php b/mod/exercise/version.php index 7921b829243..1e54d56e09a 100644 --- a/mod/exercise/version.php +++ b/mod/exercise/version.php @@ -5,8 +5,8 @@ // This fragment is called by /admin/index.php //////////////////////////////////////////////////////////////////////////////// -$module->version = 2006080800; -$module->requires = 2005031000; // Requires this Moodle version +$module->version = 2006080900; +$module->requires = 2006080900; // Requires this Moodle version $module->cron = 60; ?> diff --git a/mod/exercise/view.php b/mod/exercise/view.php index 32b0032eca4..aa7a0afb3d1 100644 --- a/mod/exercise/view.php +++ b/mod/exercise/view.php @@ -24,7 +24,7 @@ $changegroup = optional_param('group', -1, PARAM_INT); // 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"); } diff --git a/mod/forum/version.php b/mod/forum/version.php index 7921b829243..1e54d56e09a 100644 --- a/mod/forum/version.php +++ b/mod/forum/version.php @@ -5,8 +5,8 @@ // This fragment is called by /admin/index.php //////////////////////////////////////////////////////////////////////////////// -$module->version = 2006080800; -$module->requires = 2005031000; // Requires this Moodle version +$module->version = 2006080900; +$module->requires = 2006080900; // Requires this Moodle version $module->cron = 60; ?> diff --git a/mod/forum/view.php b/mod/forum/view.php index 94c1942248c..123b8b0a607 100644 --- a/mod/forum/view.php +++ b/mod/forum/view.php @@ -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)) { diff --git a/mod/glossary/approve.php b/mod/glossary/approve.php index 426733b6870..5448d92447b 100644 --- a/mod/glossary/approve.php +++ b/mod/glossary/approve.php @@ -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"); } diff --git a/mod/glossary/comment.php b/mod/glossary/comment.php index 6c20a0d4954..316143197c5 100644 --- a/mod/glossary/comment.php +++ b/mod/glossary/comment.php @@ -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'); } diff --git a/mod/glossary/comments.php b/mod/glossary/comments.php index 8bf1851f509..38a54638d5d 100644 --- a/mod/glossary/comments.php +++ b/mod/glossary/comments.php @@ -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"); } diff --git a/mod/glossary/deleteentry.php b/mod/glossary/deleteentry.php index 9265193e65d..3d20b8124f1 100644 --- a/mod/glossary/deleteentry.php +++ b/mod/glossary/deleteentry.php @@ -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"); } diff --git a/mod/glossary/edit.php b/mod/glossary/edit.php index 01f216b1e30..95e6623acc0 100644 --- a/mod/glossary/edit.php +++ b/mod/glossary/edit.php @@ -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"); } diff --git a/mod/glossary/editcategories.php b/mod/glossary/editcategories.php index 77d106ff686..83d6dd55b8d 100644 --- a/mod/glossary/editcategories.php +++ b/mod/glossary/editcategories.php @@ -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"); } diff --git a/mod/glossary/export.php b/mod/glossary/export.php index 9649a8d0e67..712cf758cb1 100644 --- a/mod/glossary/export.php +++ b/mod/glossary/export.php @@ -10,7 +10,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"); } diff --git a/mod/glossary/exportentry.php b/mod/glossary/exportentry.php index a50dd42d884..8619cc684fe 100644 --- a/mod/glossary/exportentry.php +++ b/mod/glossary/exportentry.php @@ -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 { diff --git a/mod/glossary/exportfile.php b/mod/glossary/exportfile.php index d32b0344eb0..e4f163de5b4 100644 --- a/mod/glossary/exportfile.php +++ b/mod/glossary/exportfile.php @@ -8,7 +8,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"); } diff --git a/mod/glossary/import.php b/mod/glossary/import.php index bb4db245058..0f1c029af53 100644 --- a/mod/glossary/import.php +++ b/mod/glossary/import.php @@ -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"); } diff --git a/mod/glossary/print.php b/mod/glossary/print.php index 0879237d4cb..106017e6c47 100644 --- a/mod/glossary/print.php +++ b/mod/glossary/print.php @@ -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"); } diff --git a/mod/glossary/version.php b/mod/glossary/version.php index 0625d60479a..b8fed5571d1 100644 --- a/mod/glossary/version.php +++ b/mod/glossary/version.php @@ -5,8 +5,8 @@ /// This fragment is called by moodle_needs_upgrading() and /admin/index.php ///////////////////////////////////////////////////////////////////////////////// -$module->version = 2006080800; -$module->requires = 2005031000; // Requires this Moodle version +$module->version = 2006080900; +$module->requires = 2006080900; // Requires this Moodle version $module->cron = 0; // Period for cron to check this module (secs) ?> diff --git a/mod/glossary/view.php b/mod/glossary/view.php index 11376f1d586..d013974033d 100644 --- a/mod/glossary/view.php +++ b/mod/glossary/view.php @@ -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)) { diff --git a/mod/hotpot/README.TXT b/mod/hotpot/README.TXT index 443046b787d..83b3b16ff40 100644 --- a/mod/hotpot/README.TXT +++ b/mod/hotpot/README.TXT @@ -1,11 +1,11 @@ =============================================== -This is v2.1.21 of the HotPot module for Moodle +This is v2.2.0 of the HotPot module for Moodle =============================================== This module allows teachers to administer Hot Potatoes and TexToys quizzes via Moodle. It has been tested on: - Hot Potatoes 6 - - Moodle 1.1 thru 1.7 + - Moodle 1.7 - PHP 4.1 thru 5.1.2 - MySQL 4.x thru 5.0 - PostgreSQL 7.3 thru 8.2 diff --git a/mod/hotpot/report.php b/mod/hotpot/report.php index 58a229a45a7..b8005618798 100644 --- a/mod/hotpot/report.php +++ b/mod/hotpot/report.php @@ -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)) { diff --git a/mod/hotpot/review.php b/mod/hotpot/review.php index b4fb7120162..8d2b8fcad89 100644 --- a/mod/hotpot/review.php +++ b/mod/hotpot/review.php @@ -6,7 +6,7 @@ $hp = optional_param("hp"); // hotpot ID $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)) { diff --git a/mod/hotpot/version.php b/mod/hotpot/version.php index ab4a8735faa..6a3e843a6cc 100644 --- a/mod/hotpot/version.php +++ b/mod/hotpot/version.php @@ -3,8 +3,9 @@ /// Code fragment to define the version of hotpot /// This fragment is called by moodle_needs_upgrading() and /admin/index.php ///////////////////////////////////////////////////////////////////////////////// -$module->version = 2006080800; // release date of this version (see note below) -$module->release = 'v2.1.21'; // human-friendly version name (used in mod/hotpot/lib.php) +$module->version = 2006080900; // release date of this version (see note below) +$module->release = 'v2.2.0'; // human-friendly version name (used in mod/hotpot/lib.php) +$module->requires = 2006080900; // Requires this Moodle version $module->cron = 0; // period for cron to check this module (secs) // interpretation of YYYYMMDDXY version numbers // YYYY : year diff --git a/mod/hotpot/view.php b/mod/hotpot/view.php index 9d959d11fd6..ab9c01324dd 100644 --- a/mod/hotpot/view.php +++ b/mod/hotpot/view.php @@ -12,7 +12,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)) { diff --git a/mod/journal/edit.php b/mod/journal/edit.php index 0f3f247f41b..7d2045c17bf 100644 --- a/mod/journal/edit.php +++ b/mod/journal/edit.php @@ -4,7 +4,7 @@ $id = required_param('id', PARAM_INT); // 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"); } diff --git a/mod/journal/report.php b/mod/journal/report.php index a80e75d837a..b3477af9476 100644 --- a/mod/journal/report.php +++ b/mod/journal/report.php @@ -5,7 +5,7 @@ $id = required_param('id', PARAM_INT); // course module - if (! $cm = get_record("course_modules", "id", $id)) { + if (! $cm = get_coursemodule_from_id('journal', $id)) { error("Course Module ID was incorrect"); } diff --git a/mod/journal/version.php b/mod/journal/version.php index 7921b829243..1e54d56e09a 100644 --- a/mod/journal/version.php +++ b/mod/journal/version.php @@ -5,8 +5,8 @@ // This fragment is called by /admin/index.php //////////////////////////////////////////////////////////////////////////////// -$module->version = 2006080800; -$module->requires = 2005031000; // Requires this Moodle version +$module->version = 2006080900; +$module->requires = 2006080900; // Requires this Moodle version $module->cron = 60; ?> diff --git a/mod/journal/view.php b/mod/journal/view.php index 5202c67634e..43cccf8b7dd 100644 --- a/mod/journal/view.php +++ b/mod/journal/view.php @@ -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('journal', $id)) { error("Course Module ID was incorrect"); } diff --git a/mod/label/version.php b/mod/label/version.php index c5ea0af38e5..f2373372f7b 100644 --- a/mod/label/version.php +++ b/mod/label/version.php @@ -5,8 +5,8 @@ /// This fragment is called by moodle_needs_upgrading() and /admin/index.php ///////////////////////////////////////////////////////////////////////////////// -$module->version = 2006080800; // The current module version (Date: YYYYMMDDXX) -$module->requires = 2004052505; // Requires this Moodle version +$module->version = 2006080900; // The current module version (Date: YYYYMMDDXX) +$module->requires = 2006080900; // Requires this Moodle version $module->cron = 0; // Period for cron to check this module (secs) ?> diff --git a/mod/label/view.php b/mod/label/view.php index 95c6e5dd65e..20575ece2b8 100644 --- a/mod/label/view.php +++ b/mod/label/view.php @@ -6,7 +6,7 @@ $l = optional_param('l',0,PARAM_INT); // 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"); } diff --git a/mod/lams/version.php b/mod/lams/version.php index 8d13175a8c6..92dad72db96 100644 --- a/mod/lams/version.php +++ b/mod/lams/version.php @@ -5,7 +5,8 @@ /// This fragment is called by moodle_needs_upgrading() and /admin/index.php ///////////////////////////////////////////////////////////////////////////////// -$module->version = 2006080800; // The current module version (Date: YYYYMMDDXX) +$module->version = 2006080900; // The current module version (Date: YYYYMMDDXX) +$module->requires = 2006080900; // Requires this Moodle version $module->cron = 0; // Period for cron to check this module (secs) ?> diff --git a/mod/lams/view.php b/mod/lams/view.php index d47dd54ceb7..1abfc786975 100644 --- a/mod/lams/view.php +++ b/mod/lams/view.php @@ -9,7 +9,7 @@ require_once("constants.php"); $id = optional_param('id', 0, PARAM_INT); // Course Module ID, or -if (! $cm = get_record("course_modules", "id", $id)) { +if (! $cm = get_coursemodule_from_id('lams', $id)) { error("Course Module ID was incorrect"); } diff --git a/mod/lesson/import.php b/mod/lesson/import.php index 96eb0a3ff73..5a22e7443e9 100644 --- a/mod/lesson/import.php +++ b/mod/lesson/import.php @@ -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"); } diff --git a/mod/lesson/importppt.php b/mod/lesson/importppt.php index 6c0f2e2159a..f13b083a305 100644 --- a/mod/lesson/importppt.php +++ b/mod/lesson/importppt.php @@ -14,7 +14,7 @@ $pageid = optional_param('pageid', '', PARAM_INT); // Page ID global $matches; - if (! $cm = get_record("course_modules", "id", $id)) { + if (! $cm = get_coursemodule_from_id('lesson', $id)) { error("Course Module ID was incorrect"); } diff --git a/mod/lesson/lesson.php b/mod/lesson/lesson.php index dac80ef47af..c5bd8fae5e7 100644 --- a/mod/lesson/lesson.php +++ b/mod/lesson/lesson.php @@ -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"); } diff --git a/mod/lesson/mediafile.php b/mod/lesson/mediafile.php index 484d5e2f6aa..a7bcbf28d42 100644 --- a/mod/lesson/mediafile.php +++ b/mod/lesson/mediafile.php @@ -10,7 +10,7 @@ $id = required_param('id', PARAM_INT); // Course Module ID $printclose = optional_param('printclose', 0, PARAM_INT); - if (! $cm = get_record('course_modules', 'id', $id)) { + if (! $cm = get_coursemodule_from_id('lesson', $id)) { error('Course Module ID was incorrect'); } @@ -91,7 +91,7 @@ echo "
"; echo '