Skip to content
Permalink
Browse files

MDL-39876 Change get_record('course') calls to get_course

  • Loading branch information...
sammarshallou committed Jun 18, 2013
1 parent 838d78a commit ab7632b74c331540c90229bf03d13aa2e6bdd9be
Showing with 231 additions and 233 deletions.
  1. +1 −1 admin/roles/assign.php
  2. +1 −1 admin/roles/check.php
  3. +1 −1 admin/roles/override.php
  4. +1 −1 admin/roles/permissions.php
  5. +1 −1 admin/roles/usersroles.php
  6. +1 −1 backup/backup.php
  7. +2 −2 backup/import.php
  8. +1 −1 backup/moodle2/backup_section_task.class.php
  9. +2 −2 backup/moodle2/restore_stepslib.php
  10. +1 −1 backup/util/checks/backup_check.class.php
  11. +1 −1 blocks/community/communitycourse.php
  12. +1 −1 blocks/completionstatus/details.php
  13. +1 −1 blocks/rss_client/editfeed.php
  14. +1 −1 blocks/rss_client/managefeeds.php
  15. +1 −1 blocks/rss_client/viewfeed.php
  16. +1 −1 calendar/event.php
  17. +1 −1 calendar/lib.php
  18. +1 −1 calendar/preferences.php
  19. +1 −1 course/changenumsections.php
  20. +1 −1 course/dnduploadlib.php
  21. +1 −1 course/editsection.php
  22. +4 −4 course/externallib.php
  23. +4 −4 course/lib.php
  24. +1 −1 course/loginas.php
  25. +2 −2 course/manage.php
  26. +9 −9 course/mod.php
  27. +1 −1 course/modduplicate.php
  28. +2 −2 course/modedit.php
  29. +1 −1 course/publish/backup.php
  30. +1 −1 course/publish/hubselector.php
  31. +1 −1 course/publish/index.php
  32. +1 −1 course/publish/metadata.php
  33. +1 −1 course/report.php
  34. +1 −1 course/resources.php
  35. +1 −1 course/rest.php
  36. +2 −2 course/togglecompletion.php
  37. +1 −1 course/user.php
  38. +1 −1 enrol/ajax.php
  39. +1 −1 enrol/bulkchange.php
  40. +1 −1 enrol/cohort/ajax.php
  41. +1 −1 enrol/cohort/edit.php
  42. +1 −1 enrol/editenrolment.php
  43. +2 −2 enrol/externallib.php
  44. +1 −1 enrol/guest/addinstance.php
  45. +1 −1 enrol/index.php
  46. +1 −1 enrol/instances.php
  47. +1 −1 enrol/manual/ajax.php
  48. +1 −1 enrol/manual/edit.php
  49. +1 −1 enrol/manual/locallib.php
  50. +1 −1 enrol/manual/manage.php
  51. +1 −1 enrol/manual/unenrolself.php
  52. +1 −1 enrol/meta/addinstance.php
  53. +1 −1 enrol/mnet/addinstance.php
  54. +1 −1 enrol/otherusers.php
  55. +1 −1 enrol/paypal/edit.php
  56. +1 −1 enrol/paypal/unenrolself.php
  57. +1 −1 enrol/self/edit.php
  58. +1 −1 enrol/self/lib.php
  59. +1 −1 enrol/self/unenrolself.php
  60. +1 −1 enrol/unenroluser.php
  61. +1 −1 enrol/users.php
  62. +1 −1 file.php
  63. +1 −1 grade/edit/outcome/course.php
  64. +1 −1 grade/edit/outcome/edit.php
  65. +1 −1 grade/edit/outcome/index.php
  66. +1 −1 group/import.php
  67. +1 −1 group/index.php
  68. +1 −1 group/lib.php
  69. +1 −1 group/members.php
  70. +4 −6 lib/accesslib.php
  71. +1 −1 lib/db/install.php
  72. +1 −1 lib/modinfolib.php
  73. +2 −2 lib/moodlelib.php
  74. +1 −1 lib/navigationlib.php
  75. +1 −1 lib/pagelib.php
  76. +2 −2 lib/tests/accesslib_test.php
  77. +1 −1 mod/assign/index.php
  78. +1 −1 mod/assign/lib.php
  79. +1 −1 mod/assign/locallib.php
  80. +2 −2 mod/assign/mod_form.php
  81. +1 −1 mod/assign/view.php
  82. +1 −1 mod/book/delete.php
  83. +1 −1 mod/book/edit.php
  84. +1 −1 mod/book/index.php
  85. +1 −1 mod/book/move.php
  86. +1 −1 mod/book/show.php
  87. +1 −1 mod/book/tool/exportimscp/index.php
  88. +1 −1 mod/book/tool/importhtml/index.php
  89. +1 −1 mod/book/tool/print/index.php
  90. +2 −2 mod/book/view.php
  91. +1 −1 mod/chat/gui_ajax/index.php
  92. +2 −2 mod/data/import.php
  93. +1 −1 mod/data/lib.php
  94. +2 −2 mod/data/preset.php
  95. +1 −1 mod/feedback/ajax.php
  96. +1 −1 mod/folder/edit.php
  97. +1 −1 mod/folder/index.php
  98. +1 −1 mod/folder/view.php
  99. +1 −1 mod/forum/discuss.php
  100. +1 −1 mod/forum/lib.php
  101. +1 −1 mod/forum/subscribe.php
  102. +1 −1 mod/forum/subscribers.php
  103. +1 −1 mod/forum/user.php
  104. +1 −1 mod/glossary/approve.php
  105. +1 −1 mod/glossary/rsslib.php
  106. +3 −3 mod/glossary/showentry.php
  107. +3 −3 mod/glossary/showentry_ajax.php
  108. +1 −1 mod/imscp/index.php
  109. +1 −1 mod/imscp/view.php
  110. +1 −1 mod/lesson/continue.php
  111. +1 −1 mod/lesson/edit.php
  112. +1 −1 mod/lesson/editpage.php
  113. +1 −1 mod/lesson/essay.php
  114. +1 −1 mod/lesson/grade.php
  115. +1 −1 mod/lesson/highscores.php
  116. +1 −1 mod/lesson/import.php
  117. +1 −1 mod/lesson/lesson.php
  118. +1 −1 mod/lesson/mediafile.php
  119. +1 −1 mod/lesson/report.php
  120. +1 −1 mod/lesson/view.php
  121. +1 −1 mod/lti/grade.php
  122. +1 −1 mod/lti/index.php
  123. +1 −1 mod/lti/launch.php
  124. +1 −1 mod/lti/view.php
  125. +1 −1 mod/page/index.php
  126. +1 −1 mod/page/view.php
  127. +2 −2 mod/quiz/attemptlib.php
  128. +1 −1 mod/quiz/cronlib.php
  129. +1 −1 mod/quiz/grade.php
  130. +1 −1 mod/quiz/overridedelete.php
  131. +1 −1 mod/quiz/overrideedit.php
  132. +1 −1 mod/quiz/overrides.php
  133. +1 −1 mod/resource/index.php
  134. +1 −1 mod/resource/view.php
  135. +2 −2 mod/scorm/datamodels/sequencinghandler.php
  136. +2 −2 mod/scorm/loaddatamodel.php
  137. +1 −1 mod/scorm/report.php
  138. +1 −1 mod/scorm/report/graphs/graph.php
  139. +2 −2 mod/scorm/userreport.php
  140. +1 −1 mod/url/index.php
  141. +1 −1 mod/url/lib.php
  142. +1 −1 mod/url/view.php
  143. +1 −1 mod/wiki/admin.php
  144. +1 −1 mod/wiki/comments.php
  145. +1 −1 mod/wiki/create.php
  146. +1 −1 mod/wiki/diff.php
  147. +1 −1 mod/wiki/edit.php
  148. +1 −1 mod/wiki/editcomments.php
  149. +1 −1 mod/wiki/files.php
  150. +1 −1 mod/wiki/filesedit.php
  151. +1 −1 mod/wiki/history.php
  152. +1 −1 mod/wiki/instancecomments.php
  153. +1 −1 mod/wiki/lock.php
  154. +1 −1 mod/wiki/map.php
  155. +1 −1 mod/wiki/overridelocks.php
  156. +1 −1 mod/wiki/prettyview.php
  157. +1 −1 mod/wiki/restoreversion.php
  158. +4 −4 mod/wiki/view.php
  159. +1 −1 mod/wiki/viewversion.php
  160. +1 −1 mod/workshop/aggregate.php
  161. +1 −1 mod/workshop/allocation.php
  162. +1 −1 mod/workshop/allocation/scheduled/lib.php
  163. +1 −1 mod/workshop/assessment.php
  164. +1 −1 mod/workshop/editform.php
  165. +1 −1 mod/workshop/editformpreview.php
  166. +1 −1 mod/workshop/exassessment.php
  167. +1 −1 mod/workshop/excompare.php
  168. +1 −1 mod/workshop/exsubmission.php
  169. +1 −1 mod/workshop/index.php
  170. +1 −1 mod/workshop/lib.php
  171. +1 −1 mod/workshop/submission.php
  172. +1 −1 mod/workshop/switchphase.php
  173. +1 −1 mod/workshop/toolbox.php
  174. +2 −2 mod/workshop/view.php
  175. +1 −1 notes/index.php
  176. +1 −1 report/completion/index.php
  177. +1 −1 report/completion/user.php
  178. +1 −1 report/log/graph.php
  179. +1 −1 report/log/index.php
  180. +1 −1 report/log/user.php
  181. +1 −1 report/loglive/index.php
  182. +1 −1 report/outline/index.php
  183. +1 −1 report/outline/user.php
  184. +1 −1 report/stats/graph.php
  185. +1 −1 report/stats/user.php
  186. +1 −1 user/editadvanced.php
  187. +2 −2 user/index.php
  188. +1 −1 user/repository.php
  189. +1 −1 user/view.php
@@ -39,7 +39,7 @@
} else {
$isfrontpage = false;
if ($context->contextlevel == CONTEXT_USER) {
$course = $DB->get_record('course', array('id'=>optional_param('courseid', SITEID, PARAM_INT)), '*', MUST_EXIST);
$course = get_course(optional_param('courseid', SITEID, PARAM_INT));
$user = $DB->get_record('user', array('id'=>$context->instanceid), '*', MUST_EXIST);
$url->param('courseid', $course->id);
$url->param('userid', $user->id);
@@ -35,7 +35,7 @@
} else {
$isfrontpage = false;
if ($context->contextlevel == CONTEXT_USER) {
$course = $DB->get_record('course', array('id'=>optional_param('courseid', SITEID, PARAM_INT)), '*', MUST_EXIST);
$course = get_course(optional_param('courseid', SITEID, PARAM_INT));
$user = $DB->get_record('user', array('id'=>$context->instanceid), '*', MUST_EXIST);
$url->param('courseid', $course->id);
$url->param('userid', $user->id);
@@ -36,7 +36,7 @@
} else {
$isfrontpage = false;
if ($context->contextlevel == CONTEXT_USER) {
$course = $DB->get_record('course', array('id'=>optional_param('courseid', SITEID, PARAM_INT)), '*', MUST_EXIST);
$course = get_course(optional_param('courseid', SITEID, PARAM_INT));
$user = $DB->get_record('user', array('id'=>$context->instanceid), '*', MUST_EXIST);
$url->param('courseid', $course->id);
$url->param('userid', $user->id);
@@ -43,7 +43,7 @@
} else {
$isfrontpage = false;
if ($context->contextlevel == CONTEXT_USER) {
$course = $DB->get_record('course', array('id'=>optional_param('courseid', SITEID, PARAM_INT)), '*', MUST_EXIST);
$course = get_course(optional_param('courseid', SITEID, PARAM_INT));
$user = $DB->get_record('user', array('id'=>$context->instanceid), '*', MUST_EXIST);
$url->param('courseid', $course->id);
$url->param('userid', $user->id);
@@ -32,7 +32,7 @@
// Validate them and get the corresponding objects.
$user = $DB->get_record('user', array('id' => $userid), '*', MUST_EXIST);
$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
$course = get_course($courseid);
$usercontext = context_user::instance($user->id);
$coursecontext = context_course::instance($course->id);
@@ -40,7 +40,7 @@
$id = $courseid;
$cm = null;
$course = $DB->get_record('course', array('id'=>$courseid), '*', MUST_EXIST);
$course = get_course($courseid);
$type = backup::TYPE_1COURSE;
if (!is_null($sectionid)) {
$section = $DB->get_record('course_sections', array('course'=>$course->id, 'id'=>$sectionid), '*', MUST_EXIST);
@@ -17,7 +17,7 @@
$restoretarget = optional_param('target', backup::TARGET_CURRENT_ADDING, PARAM_INT);
// Load the course and context
$course = $DB->get_record('course', array('id'=>$courseid), '*', MUST_EXIST);
$course = get_course($courseid);
$context = context_course::instance($courseid);
// Must pass login
@@ -51,7 +51,7 @@
}
// Load the course +context to import from
$importcourse = $DB->get_record('course', array('id'=>$importcourseid), '*', MUST_EXIST);
$importcourse = get_course($importcourseid);
$importcontext = context_course::instance($importcourseid);
// Make sure the user can backup from that course
@@ -148,7 +148,7 @@ protected function define_settings() {
// All these are common settings to be shared by all sections
$section = $DB->get_record('course_sections', array('id' => $this->sectionid), '*', MUST_EXIST);
$course = $DB->get_record('course', array('id' => $section->course), '*', MUST_EXIST);
$course = get_course($section->course);
// Define section_included (to decide if the whole task must be really executed)
$settingname = $settingprefix . 'included';
@@ -1632,7 +1632,7 @@ class restore_default_enrolments_step extends restore_execution_step {
public function define_execution() {
global $DB;
$course = $DB->get_record('course', array('id'=>$this->get_courseid()), '*', MUST_EXIST);
$course = get_course($this->get_courseid());
if ($DB->record_exists('enrol', array('courseid'=>$this->get_courseid(), 'enrol'=>'manual'))) {
// Something already added instances, do not add default instances.
@@ -1849,7 +1849,7 @@ protected function define_execution() {
return;
}
if (!$DB->record_exists('enrol', array('enrol'=>'manual', 'courseid'=>$courseid))) {
$course = $DB->get_record('course', array('id'=>$courseid), '*', MUST_EXIST);
$course = get_course($courseid);
$fields = array('status'=>ENROL_INSTANCE_ENABLED, 'enrolperiod'=>$enrol->get_config('enrolperiod', 0), 'roleid'=>$enrol->get_config('roleid', 0));
$enrol->add_instance($course, $fields);
}
@@ -109,7 +109,7 @@ public static function check_security($backup_controller, $apply) {
$typecapstocheck = array();
switch ($type) {
case backup::TYPE_1COURSE :
$DB->get_record('course', array('id' => $id), '*', MUST_EXIST); // course exists
get_course($id); // course exists
$typecapstocheck['moodle/backup:backupcourse'] = $coursectx;
break;
case backup::TYPE_1SECTION :
@@ -34,7 +34,7 @@
require_login();
$courseid = required_param('courseid', PARAM_INT); //if no courseid is given
$parentcourse = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
$parentcourse = get_course($courseid);
$context = context_course::instance($courseid);
$PAGE->set_course($parentcourse);
@@ -32,7 +32,7 @@
$userid = optional_param('user', 0, PARAM_INT);
// Load course.
$course = $DB->get_record('course', array('id' => $id), '*', MUST_EXIST);
$course = get_course($id);
// Load user.
if ($userid) {
@@ -154,7 +154,7 @@ public static function autodiscover_feed_url($url){
$courseid = 0;
}
if ($courseid) {
$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
$course = get_course($courseid);
$PAGE->set_course($course);
$context = $PAGE->context;
} else {
@@ -36,7 +36,7 @@
$courseid = 0;
}
if ($courseid) {
$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
$course = get_course($courseid);
$PAGE->set_course($course);
$context = $PAGE->context;
} else {
@@ -39,7 +39,7 @@
$courseid = 0;
}
if ($courseid) {
$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
$course = get_course($courseid);
$PAGE->set_course($course);
$context = $PAGE->context;
} else {
@@ -81,7 +81,7 @@
$PAGE->set_pagelayout('standard');
if ($courseid != SITEID && !empty($courseid)) {
$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
$course = get_course($courseid);
$courses = array($course->id => $course);
$issite = false;
} else {
@@ -1817,7 +1817,7 @@ function calendar_get_allowed_types(&$allowed, $course = null) {
if (!empty($course)) {
if (!is_object($course)) {
$course = $DB->get_record('course', array('id' => $course), '*', MUST_EXIST);
$course = get_course($course);
}
if ($course->id != SITEID) {
$coursecontext = context_course::instance($course->id);
@@ -7,7 +7,7 @@
require_once($CFG->dirroot.'/calendar/preferences_form.php');
$courseid = required_param('course', PARAM_INT);
$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
$course = get_course($courseid);
$PAGE->set_url(new moodle_url('/calendar/preferences.php', array('course' => $courseid)));
$PAGE->set_pagelayout('standard');
@@ -30,7 +30,7 @@
$courseid = required_param('courseid', PARAM_INT);
$increase = optional_param('increase', true, PARAM_BOOL);
$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
$course = get_course($courseid);
$courseformatoptions = course_get_format($course)->get_format_options();
$PAGE->set_url('/course/changenumsections.php', array('courseid' => $courseid));
@@ -460,7 +460,7 @@ public function __construct($courseid, $section, $type, $modulename) {
throw new coding_exception('dndupload_ajax_processor should only be used within AJAX requests');
}
$this->course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
$this->course = get_course($courseid);
require_login($this->course, false);
$this->context = context_course::instance($this->course->id);
@@ -33,7 +33,7 @@
$PAGE->set_url('/course/editsection.php', array('id'=>$id, 'sr'=> $sectionreturn));
$section = $DB->get_record('course_sections', array('id' => $id), '*', MUST_EXIST);
$course = $DB->get_record('course', array('id' => $section->course), '*', MUST_EXIST);
$course = get_course($section->course);
$sectionnum = $section->section;
require_login($course);
@@ -67,15 +67,15 @@ public static function get_course_contents_parameters() {
* @since Moodle 2.2
*/
public static function get_course_contents($courseid, $options = array()) {
global $CFG, $DB;
global $CFG;
require_once($CFG->dirroot . "/course/lib.php");
//validate parameter
$params = self::validate_parameters(self::get_course_contents_parameters(),
array('courseid' => $courseid, 'options' => $options));
//retrieve the course
$course = $DB->get_record('course', array('id' => $params['courseid']), '*', MUST_EXIST);
$course = get_course($params['courseid']);
//check course format exist
if (!file_exists($CFG->dirroot . '/course/format/' . $course->format . '/lib.php')) {
@@ -848,7 +848,7 @@ public static function delete_courses($courseids) {
$transaction = $DB->start_delegated_transaction();
foreach ($params['courseids'] as $courseid) {
$course = $DB->get_record('course', array('id'=>$courseid), '*', MUST_EXIST);
$course = get_course($courseid);
// Check if the context is valid.
$coursecontext = context_course::instance($course->id);
@@ -1077,7 +1077,7 @@ public static function duplicate_course($courseid, $fullname, $shortname, $categ
$rc->execute_plan();
$rc->destroy();
$course = $DB->get_record('course', array('id' => $newcourseid), '*', MUST_EXIST);
$course = get_course($newcourseid);
$course->fullname = $params['fullname'];
$course->shortname = $params['shortname'];
$course->visible = $params['visible'];
@@ -3053,7 +3053,7 @@ function course_get_url($courseorid, $section = null, $options = array()) {
* @return object the created module info
*/
function create_module($moduleinfo) {
global $DB, $CFG;
global $CFG;
require_once($CFG->dirroot . '/course/modlib.php');
@@ -3069,7 +3069,7 @@ function create_module($moduleinfo) {
}
// Some additional checks (capability / existing instances).
$course = $DB->get_record('course', array('id'=>$moduleinfo->course), '*', MUST_EXIST);
$course = get_course($moduleinfo->course);
list($module, $context, $cw) = can_add_moduleinfo($course, $moduleinfo->modulename, $moduleinfo->section);
// Load module library.
@@ -3093,15 +3093,15 @@ function create_module($moduleinfo) {
* @return object the updated module info
*/
function update_module($moduleinfo) {
global $DB, $CFG;
global $CFG;
require_once($CFG->dirroot . '/course/modlib.php');
// Check the course module exists.
$cm = get_coursemodule_from_id('', $moduleinfo->coursemodule, 0, false, MUST_EXIST);
// Check the course exists.
$course = $DB->get_record('course', array('id'=>$cm->course), '*', MUST_EXIST);
$course = get_course($cm->course);
// Some checks (capaibility / existing instances).
list($cm, $context, $module, $data, $cw) = can_update_moduleinfo($cm);
@@ -35,7 +35,7 @@
$userid = required_param('user', PARAM_INT); // login as this user
require_sesskey();
$course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST);
$course = get_course($id);
/// User must be logged in
@@ -237,10 +237,10 @@
if ((!empty($hide) or !empty($show)) && confirm_sesskey()) {
// Hide or show a course.
if (!empty($hide)) {
$course = $DB->get_record('course', array('id' => $hide), '*', MUST_EXIST);
$course = get_course($hide);
$visible = 0;
} else {
$course = $DB->get_record('course', array('id' => $show), '*', MUST_EXIST);
$course = get_course($show);
$visible = 1;
}
$coursecontext = context_course::instance($course->id);
@@ -80,7 +80,7 @@
} else if (!empty($duplicate)) {
$cm = get_coursemodule_from_id('', $duplicate, 0, true, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
$course = get_course($cm->course);
require_login($course, false, $cm);
$coursecontext = context_course::instance($course->id);
@@ -117,7 +117,7 @@
} else if (!empty($delete)) {
$cm = get_coursemodule_from_id('', $delete, 0, true, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
$course = get_course($cm->course);
require_login($course, false, $cm);
$modcontext = context_module::instance($cm->id);
@@ -158,7 +158,7 @@
if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
$cm = get_coursemodule_from_id('', $USER->activitycopy, 0, true, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
$course = get_course($cm->course);
require_login($course, false, $cm);
$coursecontext = context_course::instance($course->id);
@@ -198,7 +198,7 @@
$id = required_param('id', PARAM_INT);
$cm = get_coursemodule_from_id('', $id, 0, true, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
$course = get_course($cm->course);
require_login($course, false, $cm);
$coursecontext = context_course::instance($course->id);
@@ -219,7 +219,7 @@
} else if (!empty($hide) and confirm_sesskey()) {
$cm = get_coursemodule_from_id('', $hide, 0, true, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
$course = get_course($cm->course);
require_login($course, false, $cm);
$coursecontext = context_course::instance($course->id);
@@ -232,7 +232,7 @@
} else if (!empty($show) and confirm_sesskey()) {
$cm = get_coursemodule_from_id('', $show, 0, true, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
$course = get_course($cm->course);
require_login($course, false, $cm);
$coursecontext = context_course::instance($course->id);
@@ -253,7 +253,7 @@
$id = required_param('id', PARAM_INT);
$cm = get_coursemodule_from_id('', $id, 0, true, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
$course = get_course($cm->course);
require_login($course, false, $cm);
$coursecontext = context_course::instance($course->id);
@@ -266,7 +266,7 @@
} else if (!empty($copy) and confirm_sesskey()) { // value = course module
$cm = get_coursemodule_from_id('', $copy, 0, true, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
$course = get_course($cm->course);
require_login($course, false, $cm);
$coursecontext = context_course::instance($course->id);
@@ -285,7 +285,7 @@
} else if (!empty($cancelcopy) and confirm_sesskey()) { // value = course module
$courseid = $USER->activitycopycourse;
$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
$course = get_course($courseid);
$cm = get_coursemodule_from_id('', $USER->activitycopy, 0, true, IGNORE_MISSING);
$sectionreturn = $USER->activitycopysectionreturn;
@@ -36,7 +36,7 @@
$courseid = required_param('course', PARAM_INT);
$sectionreturn = optional_param('sr', null, PARAM_INT);
$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
$course = get_course($courseid);
$cm = get_coursemodule_from_id('', $cmid, $course->id, true, MUST_EXIST);
$cmcontext = context_module::instance($cm->id);
$context = context_course::instance($courseid);

0 comments on commit ab7632b

Please sign in to comment.
You can’t perform that action at this time.