$returnurl = new moodle_url('/local/modules/assigncourse.php', array('id' => $id)); if (!empty($moveto) and $data = data_submitted()) { ; if (!$destcategory = $DB->get_record('local_module', array('id' => $data->moveto))) { print_error('cannotfindmodules', '', '', $data->moveto); } $courses = array(); foreach ($data as $key => $value) { if (preg_match('/^c\d+$/', $key)) { $courseid = substr($key, 1); array_push($courses, $courseid); } } $instance->add_courses($courses, $data->moveto); } // Prepare the standard URL params for this page. We'll need them later. $urlparams = array('id' => $id); if ($page) { $urlparams['page'] = $page; } if ($perpage) { $urlparams['perpage'] = $perpage; } echo $OUTPUT->heading(get_string('assigncourses', 'local_modules')); $tools = $DB->get_records('local_module_course', array('moduleid' => $moduleids)); $data = array(); $modulelist = $DB->get_record('local_module', array('id' => $moduleids)); $prgname = $DB->get_field('local_program', 'fullname', array('id' => $modulelist->programid));