mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
"MDL-14129, fix print_error call under course/, see tracker"
This commit is contained in:
parent
211c6890c5
commit
ba6018a902
17 changed files with 146 additions and 117 deletions
|
@ -24,19 +24,19 @@
|
|||
}
|
||||
|
||||
if (!$site = get_site()) {
|
||||
print_error("Site isn't defined!");
|
||||
print_error("siteisnotdefined", 'debug');
|
||||
}
|
||||
|
||||
if (empty($id)) {
|
||||
print_error("Category not known!");
|
||||
print_error("unknowcategory");
|
||||
}
|
||||
|
||||
if (!$context = get_context_instance(CONTEXT_COURSECAT, $id)) {
|
||||
print_error("Category not known!");
|
||||
print_error("unknowcategory");
|
||||
}
|
||||
|
||||
if (!$category = get_record("course_categories", "id", $id)) {
|
||||
print_error("Category not known!");
|
||||
print_error("unknowcategory");
|
||||
}
|
||||
|
||||
if (has_capability('moodle/course:create', $context)) {
|
||||
|
@ -170,7 +170,7 @@
|
|||
require_capability('moodle/category:update', get_context_instance(CONTEXT_COURSECAT, $moveto));
|
||||
|
||||
if (! $destcategory = get_record("course_categories", "id", $data->moveto)) {
|
||||
print_error("Error finding the category");
|
||||
print_error("cannotfindcategory", '', '', $data->moveto);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -9,11 +9,11 @@
|
|||
require_login();
|
||||
|
||||
if (!can_delete_course($id)) {
|
||||
print_error('You do not have the permission to delete this course.');
|
||||
print_error('cannotdeletecourse');
|
||||
}
|
||||
|
||||
if (!$site = get_site()) {
|
||||
print_error("Site not found!");
|
||||
print_error("siteisnotdefined", 'debug');
|
||||
}
|
||||
|
||||
$strdeletecourse = get_string("deletecourse");
|
||||
|
@ -21,7 +21,7 @@
|
|||
$strcategories = get_string("categories");
|
||||
|
||||
if (! $course = get_record("course", "id", $id)) {
|
||||
print_error("Course ID was incorrect (can't find it)");
|
||||
print_error("invalidcourseid");
|
||||
}
|
||||
|
||||
$category = get_record("course_categories", "id", $course->category);
|
||||
|
@ -49,7 +49,7 @@
|
|||
}
|
||||
|
||||
if ($delete != md5($course->timemodified)) {
|
||||
print_error("The check variable was wrong - try again");
|
||||
print_error("invalidmd5");
|
||||
}
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
|
||||
if($id == SITEID){
|
||||
// don't allow editing of 'site course' using this from
|
||||
print_error('You cannot edit the site course using this form');
|
||||
print_error('cannoteditsiteform');
|
||||
}
|
||||
|
||||
if (!$course = get_record('course', 'id', $id)) {
|
||||
print_error('Course ID was incorrect');
|
||||
print_error('invalidcourseid');
|
||||
}
|
||||
require_login($course->id);
|
||||
$category = get_record('course_categories', 'id', $course->category);
|
||||
|
@ -30,12 +30,12 @@
|
|||
$course = null;
|
||||
require_login();
|
||||
if (!$category = get_record('course_categories', 'id', $categoryid)) {
|
||||
print_error('Category ID was incorrect');
|
||||
print_error('unknowcategory');
|
||||
}
|
||||
require_capability('moodle/course:create', get_context_instance(CONTEXT_COURSECAT, $category->id));
|
||||
} else {
|
||||
require_login();
|
||||
print_error('Either course id or category must be specified');
|
||||
print_error('needcoursecategroyid');
|
||||
}
|
||||
|
||||
/// prepare course
|
||||
|
|
|
@ -22,7 +22,7 @@ $categoryupdate = optional_param('categoryupdate', 0, PARAM_BOOL); // Enables th
|
|||
$resort = optional_param('resort', 0, PARAM_BOOL);
|
||||
|
||||
if (!$site = get_site()) {
|
||||
print_error("Site isn't defined!");
|
||||
print_error("siteisnotdefined");
|
||||
}
|
||||
|
||||
if ($categoryadd) { // Show Add category form: if $id is given, it is used as the parent category
|
||||
|
@ -33,7 +33,7 @@ if ($categoryadd) { // Show Add category form: if $id is given, it is used as th
|
|||
$strtitle = get_string("editcategorysettings");
|
||||
$context = get_context_instance(CONTEXT_COURSECAT, $id);
|
||||
if (!$category = get_record("course_categories", "id", $id)) {
|
||||
print_error("Category not known!");
|
||||
print_error("unknowcategory");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ if ($mform->is_cancelled()){
|
|||
}
|
||||
|
||||
if (!update_record('course_categories', $newcategory)) {
|
||||
print_error( "Could not update the category '$newcategory->name' ");
|
||||
print_error( "cannotupdatecategory", '', '', $newcategory->name);
|
||||
} else {
|
||||
if ($newcategory->parent == 0) {
|
||||
$redirect_link = 'index.php?categoryedit=on';
|
||||
|
@ -210,7 +210,7 @@ if ($id && !$categoryadd && !$categoryupdate && false) {
|
|||
require_capability('moodle/category:update', get_context_instance(CONTEXT_COURSECAT, $moveto));
|
||||
|
||||
if (!$destcategory = get_record("course_categories", "id", $data->moveto)) {
|
||||
print_error("Error finding the destination category");
|
||||
pritn_error("unknowcategory");
|
||||
}
|
||||
// TODO function to move the category
|
||||
}
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
$id = required_param('id',PARAM_INT); // Week ID
|
||||
|
||||
if (! $section = get_record("course_sections", "id", $id)) {
|
||||
print_error("Course section is incorrect");
|
||||
print_error("sectionnotexist");
|
||||
}
|
||||
|
||||
if (! $course = get_record("course", "id", $section->course)) {
|
||||
print_error("Could not find the course!");
|
||||
print_error("invalidcourseid");
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
|
@ -25,7 +25,7 @@
|
|||
$timenow = time();
|
||||
|
||||
if (! set_field("course_sections", "summary", $form->summary, "id", $section->id)) {
|
||||
print_error("Could not update the summary!");
|
||||
print_error("cannotupdatesummary");
|
||||
}
|
||||
|
||||
add_to_log($course->id, "course", "editsection", "editsection.php?id=$section->id", "$section->section");
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
}
|
||||
|
||||
if (! $course = get_record("course", "id", $id)) {
|
||||
print_error("Course ID was incorrect (can't find it)");
|
||||
print_error("invalidcourseid");
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
|
@ -65,7 +65,7 @@
|
|||
$addcourse = clean_param($addcourse, PARAM_INT);
|
||||
set_time_limit(180);
|
||||
if (!add_to_metacourse($course->id,$addcourse)) {
|
||||
print_error("Could not add the selected course to this meta course!");
|
||||
print_error("cannotmetacourse");
|
||||
}
|
||||
}
|
||||
} else if ($remove and !empty($frm->removeselect) and confirm_sesskey()) {
|
||||
|
@ -73,7 +73,7 @@
|
|||
set_time_limit(180);
|
||||
$removecourse = clean_param($removecourse, PARAM_INT);
|
||||
if (! remove_from_metacourse($course->id,$removecourse)) {
|
||||
print_error("Could not remove the selected course from this meta course!");
|
||||
print_error("cannotremovefrommeta");
|
||||
}
|
||||
}
|
||||
} else if ($showall and confirm_sesskey()) {
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
$context = $sysctx;
|
||||
|
||||
if (!$site = get_site()) {
|
||||
print_error('Site isn\'t defined!');
|
||||
print_error('siteisnotdefined', 'debug');
|
||||
}
|
||||
|
||||
if ($CFG->forcelogin) {
|
||||
|
@ -120,7 +120,7 @@
|
|||
if ($childcats = get_records('course_categories', 'parent', $deletecat->id)) {
|
||||
foreach ($childcats as $childcat) {
|
||||
if (! set_field('course_categories', 'parent', $deletecat->parent, 'id', $childcat->id)) {
|
||||
print_error('Could not update a child category!', 'index.php');
|
||||
print_error('cannotupdatesubcate', '', 'index.php');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -131,7 +131,7 @@
|
|||
if ($childcourses = get_records('course', 'category', $deletecat->id)) {
|
||||
foreach ($childcourses as $childcourse) {
|
||||
if (! set_field('course', 'category', $deletecat->parent, 'id', $childcourse->id)) {
|
||||
print_error('Could not update a child course!', 'index.php');
|
||||
print_error('cannotupdatesubcourse', '', 'index.php');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -163,7 +163,7 @@
|
|||
unset($tempcat);
|
||||
$tempcat->name = get_string('miscellaneous');
|
||||
if (!$tempcat->id = insert_record('course_categories', $tempcat)) {
|
||||
print_error('Serious error: Could not create a default category!');
|
||||
print_error('cannotsetupcategory');
|
||||
}
|
||||
$tempcat->context = get_context_instance(CONTEXT_COURSECAT, $tempcat->id);
|
||||
mark_context_dirty('/'.SYSCONTEXTID);
|
||||
|
|
|
@ -9,16 +9,16 @@
|
|||
$name = optional_param('name', false, PARAM_RAW); // Course short name
|
||||
|
||||
if (!$id and !$name) {
|
||||
print_error("Must specify course id or short name");
|
||||
print_error("unspecifycourseid");
|
||||
}
|
||||
|
||||
if ($name) {
|
||||
if (! $course = get_record("course", "shortname", $name) ) {
|
||||
print_error("That's an invalid short course name");
|
||||
print_error("invalidshortname");
|
||||
}
|
||||
} else {
|
||||
if (! $course = get_record("course", "id", $id) ) {
|
||||
print_error("That's an invalid course id");
|
||||
print_error("invalidcourseid");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1184,7 +1184,7 @@ function get_all_mods($courseid, &$mods, &$modnames, &$modnamesplural, &$modname
|
|||
}
|
||||
asort($modnames, SORT_LOCALE_STRING);
|
||||
} else {
|
||||
print_error("No modules are installed!");
|
||||
print_error("nomodules", 'debug');
|
||||
}
|
||||
|
||||
if ($rawmods = get_course_mods($courseid)) {
|
||||
|
@ -1948,7 +1948,7 @@ function print_my_moodle() {
|
|||
global $USER, $CFG;
|
||||
|
||||
if (empty($USER->id)) {
|
||||
print_error("It shouldn't be possible to see My Moodle without being logged in.");
|
||||
print_error('nopermissions', '', '', 'See My Moodle');
|
||||
}
|
||||
|
||||
$courses = get_my_courses($USER->id, 'visible DESC,sortorder ASC', array('summary'));
|
||||
|
@ -2539,7 +2539,7 @@ function course_in_meta ($course) {
|
|||
*/
|
||||
function print_standard_coursemodule_settings($form, $features=null) {
|
||||
if (! $course = get_record('course', 'id', $form->course)) {
|
||||
print_error("This course doesn't exist");
|
||||
print_error("invalidcourseid");
|
||||
}
|
||||
print_groupmode_setting($form, $course);
|
||||
if (!empty($features->groupings)) {
|
||||
|
@ -2555,12 +2555,12 @@ function print_groupmode_setting($form, $course=NULL) {
|
|||
|
||||
if (empty($course)) {
|
||||
if (! $course = get_record('course', 'id', $form->course)) {
|
||||
print_error("This course doesn't exist");
|
||||
print_error("invalidcourseid");
|
||||
}
|
||||
}
|
||||
if ($form->coursemodule) {
|
||||
if (! $cm = get_record('course_modules', 'id', $form->coursemodule)) {
|
||||
print_error("This course module doesn't exist");
|
||||
print_error("cmunknown");
|
||||
}
|
||||
$groupmode = groups_get_activity_groupmode($cm);
|
||||
} else {
|
||||
|
@ -2588,12 +2588,12 @@ function print_grouping_settings($form, $course=NULL) {
|
|||
|
||||
if (empty($course)) {
|
||||
if (! $course = get_record('course', 'id', $form->course)) {
|
||||
print_error("This course doesn't exist");
|
||||
print_error("invalidcourseid");
|
||||
}
|
||||
}
|
||||
if ($form->coursemodule) {
|
||||
if (! $cm = get_record('course_modules', 'id', $form->coursemodule)) {
|
||||
print_error("This course module doesn't exist");
|
||||
print_error("cmunknown");
|
||||
}
|
||||
} else {
|
||||
$cm = null;
|
||||
|
@ -2627,7 +2627,7 @@ function print_grouping_settings($form, $course=NULL) {
|
|||
function print_visible_setting($form, $course=NULL) {
|
||||
if (empty($course)) {
|
||||
if (! $course = get_record('course', 'id', $form->course)) {
|
||||
print_error("This course doesn't exist");
|
||||
print_error("invalidcourseid");
|
||||
}
|
||||
}
|
||||
if ($form->coursemodule) {
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
}
|
||||
|
||||
if (! $course = get_record('course', 'id', $id)) {
|
||||
print_error("Course ID was incorrect");
|
||||
print_error("invalidcourseid");
|
||||
}
|
||||
|
||||
/// User must be logged in
|
||||
|
@ -65,7 +65,7 @@
|
|||
require_login($course);
|
||||
require_capability('moodle/user:loginas', $coursecontext);
|
||||
if (!has_capability('moodle/course:view', $coursecontext, $userid, false)) {
|
||||
print_error('This user is not in this course!');
|
||||
print_error('usernotincourse');
|
||||
}
|
||||
if (has_capability('moodle/site:doanything', $coursecontext, $userid, false)) {
|
||||
print_error('nologinas');
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
{$CFG->prefix}modules md
|
||||
WHERE cm.id = '$update' AND
|
||||
md.id = cm.module")){
|
||||
print_error('Invalid course module id!');
|
||||
print_error('invalidcourseid');
|
||||
}
|
||||
$returntomod = optional_param('return', 0, PARAM_BOOL);
|
||||
if (file_exists("../mod/$modname/mod_form.php")) {
|
||||
|
@ -72,17 +72,17 @@
|
|||
|
||||
if (empty($mod->coursemodule)) { //add
|
||||
if (! $course = get_record("course", "id", $mod->course)) {
|
||||
print_error("This course doesn't exist");
|
||||
print_error("invalidcourse");
|
||||
}
|
||||
$mod->instance = '';
|
||||
$mod->coursemodule = '';
|
||||
} else { //delete and update
|
||||
if (! $cm = get_record("course_modules", "id", $mod->coursemodule)) {
|
||||
print_error("This course module doesn't exist");
|
||||
print_error("cmunknown");
|
||||
}
|
||||
|
||||
if (! $course = get_record("course", "id", $cm->course)) {
|
||||
print_error("This course doesn't exist");
|
||||
print_error("invalidcourseid");
|
||||
}
|
||||
$mod->instance = $cm->instance;
|
||||
$mod->coursemodule = $cm->id;
|
||||
|
@ -99,7 +99,7 @@
|
|||
if (file_exists($modlib)) {
|
||||
include_once($modlib);
|
||||
} else {
|
||||
print_error("This module is missing important code! ($modlib)");
|
||||
print_error('modulemissingcode', '', '', $modlib);
|
||||
}
|
||||
$addinstancefunction = $mod->modulename."_add_instance";
|
||||
$updateinstancefunction = $mod->modulename."_update_instance";
|
||||
|
@ -122,7 +122,7 @@
|
|||
include_once($moderr);
|
||||
die;
|
||||
}
|
||||
print_error("Could not update the $mod->modulename", '', "view.php?id=$course->id");
|
||||
print_error('cannotupdatemod', '', 'view.php?id=$course->id', $mod->modulename);
|
||||
}
|
||||
if (is_string($return)) {
|
||||
print_error($return, '', "view.php?id=$course->id");
|
||||
|
@ -161,7 +161,7 @@
|
|||
case "add":
|
||||
|
||||
if (!course_allowed_module($course,$mod->modulename)) {
|
||||
print_error("This module ($mod->modulename) has been disabled for this particular course");
|
||||
print_error('moduledisable', '', '', $mod->modulename);
|
||||
}
|
||||
|
||||
if (!isset($mod->name) || trim($mod->name) == '') {
|
||||
|
@ -175,7 +175,7 @@
|
|||
include_once($moderr);
|
||||
die;
|
||||
}
|
||||
print_error("Could not add a new instance of $mod->modulename", '', "view.php?id=$course->id");
|
||||
print_error('cannotaddnewmodule', '', "view.php?id=$course->id", $mod->modulename);
|
||||
}
|
||||
if (is_string($return)) {
|
||||
print_error($return, '', "view.php?id=$course->id");
|
||||
|
@ -198,14 +198,14 @@
|
|||
// to each other, so we have to update one of them twice.
|
||||
|
||||
if (! $mod->coursemodule = add_course_module($mod) ) {
|
||||
print_error("Could not add a new course module");
|
||||
print_error("cannotaddcoursemodule");
|
||||
}
|
||||
if (! $sectionid = add_mod_to_section($mod) ) {
|
||||
print_error("Could not add the new course module to that section");
|
||||
print_error("cannotaddcmtosection");
|
||||
}
|
||||
|
||||
if (! set_field("course_modules", "section", $sectionid, "id", $mod->coursemodule)) {
|
||||
print_error("Could not update the course module with the correct section");
|
||||
print_error("cannotupdatecm");
|
||||
}
|
||||
|
||||
if (!isset($mod->visible)) { // We get the section's visible field status
|
||||
|
@ -250,7 +250,7 @@
|
|||
"$mod->modulename $mod->instance", $mod->coursemodule);
|
||||
break;
|
||||
default:
|
||||
print_error("No mode defined");
|
||||
print_error('unknowaction');
|
||||
|
||||
}
|
||||
|
||||
|
@ -269,21 +269,21 @@
|
|||
if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
|
||||
|
||||
if (! $cm = get_record("course_modules", "id", $USER->activitycopy)) {
|
||||
print_error("The copied course module doesn't exist!");
|
||||
print_error('copiedcmnotexist');
|
||||
}
|
||||
|
||||
if (!empty($movetosection)) {
|
||||
if (! $section = get_record("course_sections", "id", $movetosection)) {
|
||||
print_error("This section doesn't exist");
|
||||
print_error("sectionnotexist");
|
||||
}
|
||||
$beforecm = NULL;
|
||||
|
||||
} else { // normal moveto
|
||||
if (! $beforecm = get_record("course_modules", "id", $moveto)) {
|
||||
print_error("The destination course module doesn't exist");
|
||||
print_error("destinationcmnotexit");
|
||||
}
|
||||
if (! $section = get_record("course_sections", "id", $beforecm->section)) {
|
||||
print_error("This section doesn't exist");
|
||||
print_error("sectionnotexist");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -292,7 +292,7 @@
|
|||
require_capability('moodle/course:manageactivities', $context);
|
||||
|
||||
if (!ismoving($section->course)) {
|
||||
print_error("You need to copy something first!");
|
||||
print_error("needcopy");
|
||||
}
|
||||
|
||||
moveto_module($cm, $section, $beforecm);
|
||||
|
@ -314,7 +314,7 @@
|
|||
$id = required_param('id',PARAM_INT);
|
||||
|
||||
if (! $cm = get_record("course_modules", "id", $id)) {
|
||||
print_error("This course module doesn't exist");
|
||||
print_error("cmunknown");
|
||||
}
|
||||
|
||||
require_login($cm->course); // needed to setup proper $COURSE
|
||||
|
@ -328,7 +328,7 @@
|
|||
}
|
||||
|
||||
if (!set_field("course_modules", "indent", $cm->indent, "id", $cm->id)) {
|
||||
print_error("Could not update the indent level on that course module");
|
||||
print_error("cannotupdatelevel");
|
||||
}
|
||||
|
||||
if (SITEID == $cm->course) {
|
||||
|
@ -341,7 +341,7 @@
|
|||
} else if (!empty($hide) and confirm_sesskey()) {
|
||||
|
||||
if (! $cm = get_record("course_modules", "id", $hide)) {
|
||||
print_error("This course module doesn't exist");
|
||||
print_error("cmunknown");
|
||||
}
|
||||
|
||||
require_login($cm->course); // needed to setup proper $COURSE
|
||||
|
@ -362,7 +362,7 @@
|
|||
} else if (!empty($show) and confirm_sesskey()) {
|
||||
|
||||
if (! $cm = get_record("course_modules", "id", $show)) {
|
||||
print_error("This course module doesn't exist");
|
||||
print_error("cmunknown");
|
||||
}
|
||||
|
||||
require_login($cm->course); // needed to setup proper $COURSE
|
||||
|
@ -370,11 +370,11 @@
|
|||
require_capability('moodle/course:activityvisibility', $context);
|
||||
|
||||
if (! $section = get_record("course_sections", "id", $cm->section)) {
|
||||
print_error("This module doesn't exist");
|
||||
print_error("sectionnotexist");
|
||||
}
|
||||
|
||||
if (! $module = get_record("modules", "id", $cm->module)) {
|
||||
print_error("This module doesn't exist");
|
||||
print_error("moduledoesnotexist");
|
||||
}
|
||||
|
||||
if ($module->visible and ($section->visible or (SITEID == $cm->course))) {
|
||||
|
@ -394,7 +394,7 @@
|
|||
$id = required_param( 'id', PARAM_INT );
|
||||
|
||||
if (! $cm = get_record("course_modules", "id", $id)) {
|
||||
print_error("This course module doesn't exist");
|
||||
print_error("cmunknown");
|
||||
}
|
||||
|
||||
require_login($cm->course); // needed to setup proper $COURSE
|
||||
|
@ -415,7 +415,7 @@
|
|||
} else if (!empty($copy) and confirm_sesskey()) { // value = course module
|
||||
|
||||
if (! $cm = get_record("course_modules", "id", $copy)) {
|
||||
print_error("This course module doesn't exist");
|
||||
print_error("cmunknown");
|
||||
}
|
||||
|
||||
require_login($cm->course); // needed to setup proper $COURSE
|
||||
|
@ -423,15 +423,15 @@
|
|||
require_capability('moodle/course:manageactivities', $context);
|
||||
|
||||
if (! $section = get_record("course_sections", "id", $cm->section)) {
|
||||
print_error("This module doesn't exist");
|
||||
print_error("sectionnotexist");
|
||||
}
|
||||
|
||||
if (! $module = get_record("modules", "id", $cm->module)) {
|
||||
print_error("This module doesn't exist");
|
||||
print_error("moduledoesnotexist");
|
||||
}
|
||||
|
||||
if (! $instance = get_record($module->name, "id", $cm->instance)) {
|
||||
print_error("Could not find the instance of this module");
|
||||
print_error("moduleinstancedoesnotexist");
|
||||
}
|
||||
|
||||
$USER->activitycopy = $copy;
|
||||
|
@ -453,11 +453,11 @@
|
|||
} else if (!empty($delete) and confirm_sesskey()) { // value = course module
|
||||
|
||||
if (! $cm = get_record("course_modules", "id", $delete)) {
|
||||
print_error("This course module doesn't exist");
|
||||
print_error('cmunknown');
|
||||
}
|
||||
|
||||
if (! $course = get_record("course", "id", $cm->course)) {
|
||||
print_error("This course doesn't exist");
|
||||
print_error("invalidcourseid");
|
||||
}
|
||||
|
||||
require_login($cm->course); // needed to setup proper $COURSE
|
||||
|
@ -465,7 +465,7 @@
|
|||
require_capability('moodle/course:manageactivities', $context);
|
||||
|
||||
if (! $module = get_record("modules", "id", $cm->module)) {
|
||||
print_error("This module doesn't exist");
|
||||
print_error("moduledoesnotexist");
|
||||
}
|
||||
|
||||
if (! $instance = get_record($module->name, "id", $cm->instance)) {
|
||||
|
@ -476,8 +476,8 @@
|
|||
if (! delete_course_module($cm->id)) {
|
||||
notify("Could not delete the $module->name (coursemodule)");
|
||||
}
|
||||
print_error("The required instance of this module didn't exist. Module deleted.",
|
||||
"$CFG->wwwroot/course/view.php?id=$course->id");
|
||||
print_error("moduleinstancedoesnotexist",'',
|
||||
"$CFG->wwwroot/course/view.php?id=$course->id");
|
||||
}
|
||||
|
||||
$fullmodulename = get_string("modulename", $module->name);
|
||||
|
@ -510,11 +510,11 @@
|
|||
} else if (!empty($update) and confirm_sesskey()) { // value = course module
|
||||
|
||||
if (! $cm = get_record("course_modules", "id", $update)) {
|
||||
print_error("This course module doesn't exist");
|
||||
print_error("cmunknown");
|
||||
}
|
||||
|
||||
if (! $course = get_record("course", "id", $cm->course)) {
|
||||
print_error("This course doesn't exist");
|
||||
print_error("invalidcourseid");
|
||||
}
|
||||
|
||||
require_login($course->id); // needed to setup proper $COURSE
|
||||
|
@ -522,15 +522,15 @@
|
|||
require_capability('moodle/course:manageactivities', $context);
|
||||
|
||||
if (! $module = get_record("modules", "id", $cm->module)) {
|
||||
print_error("This module doesn't exist");
|
||||
print_error("moduledoesnotexist");
|
||||
}
|
||||
|
||||
if (! $form = get_record($module->name, "id", $cm->instance)) {
|
||||
print_error("The required instance of this module doesn't exist");
|
||||
print_error("moduleinstancedoesnotexist");
|
||||
}
|
||||
|
||||
if (! $cw = get_record("course_sections", "id", $cm->section)) {
|
||||
print_error("This course section doesn't exist");
|
||||
print_error("sectionnotexist");
|
||||
}
|
||||
|
||||
if (isset($return)) {
|
||||
|
@ -568,11 +568,11 @@
|
|||
|
||||
|
||||
if (! $cm = get_record("course_modules", "id", $duplicate)) {
|
||||
print_error("This course module doesn't exist");
|
||||
print_error("cmunknown");
|
||||
}
|
||||
|
||||
if (! $course = get_record("course", "id", $cm->course)) {
|
||||
print_error("This course doesn't exist");
|
||||
print_error("invalidcourseid");
|
||||
}
|
||||
|
||||
require_login($course->id); // needed to setup proper $COURSE
|
||||
|
@ -580,15 +580,15 @@
|
|||
require_capability('moodle/course:manageactivities', $context);
|
||||
|
||||
if (! $module = get_record("modules", "id", $cm->module)) {
|
||||
print_error("This module doesn't exist");
|
||||
print_error("moduledoesnotexist");
|
||||
}
|
||||
|
||||
if (! $form = get_record($module->name, "id", $cm->instance)) {
|
||||
print_error("The required instance of this module doesn't exist");
|
||||
print_error("moduleinstancedoesnotexist");
|
||||
}
|
||||
|
||||
if (! $cw = get_record("course_sections", "id", $cm->section)) {
|
||||
print_error("This course section doesn't exist");
|
||||
print_error("sectionnotexist");
|
||||
}
|
||||
|
||||
if (isset($return)) {
|
||||
|
@ -627,18 +627,18 @@
|
|||
$section = required_param('section',PARAM_INT);
|
||||
|
||||
if (! $course = get_record("course", "id", $id)) {
|
||||
print_error("This course doesn't exist");
|
||||
print_error("invalidcourseid");
|
||||
}
|
||||
|
||||
if (! $module = get_record("modules", "name", $add)) {
|
||||
print_error("This module type doesn't exist");
|
||||
print_error("moduledoesnotexist");
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
require_capability('moodle/course:manageactivities', $context);
|
||||
|
||||
if (!course_allowed_module($course,$module->id)) {
|
||||
print_error("This module has been disabled for this particular course");
|
||||
print_error("moduledisable");
|
||||
}
|
||||
|
||||
require_login($course->id); // needed to setup proper $COURSE
|
||||
|
@ -675,7 +675,7 @@
|
|||
}
|
||||
|
||||
} else {
|
||||
print_error("No action was specified");
|
||||
print_error("unknowaction");
|
||||
}
|
||||
|
||||
require_login($course->id); // needed to setup proper $COURSE
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
$course = required_param('course', PARAM_INT);
|
||||
|
||||
if (! $course = get_record("course", "id", $course)) {
|
||||
print_error("This course doesn't exist");
|
||||
print_error("invalidcourseid");
|
||||
}
|
||||
|
||||
require_login($course);
|
||||
|
@ -26,13 +26,13 @@
|
|||
require_capability('moodle/course:manageactivities', $context);
|
||||
|
||||
if (! $module = get_record("modules", "name", $add)) {
|
||||
print_error("This module type doesn't exist");
|
||||
print_error("moduledoesnotexist");
|
||||
}
|
||||
|
||||
$cw = get_course_section($section, $course->id);
|
||||
|
||||
if (!course_allowed_module($course, $module->id)) {
|
||||
print_error("This module has been disabled for this particular course");
|
||||
print_error("moduledisable");
|
||||
}
|
||||
|
||||
$cm = null;
|
||||
|
@ -75,11 +75,11 @@
|
|||
$navlinksinstancename = '';
|
||||
} else if (!empty($update)) {
|
||||
if (! $cm = get_record("course_modules", "id", $update)) {
|
||||
print_error("This course module doesn't exist");
|
||||
print_error("cmunknown");
|
||||
}
|
||||
|
||||
if (! $course = get_record("course", "id", $cm->course)) {
|
||||
print_error("This course doesn't exist");
|
||||
print_error("invalidcourseid");
|
||||
}
|
||||
|
||||
require_login($course); // needed to setup proper $COURSE
|
||||
|
@ -87,15 +87,15 @@
|
|||
require_capability('moodle/course:manageactivities', $context);
|
||||
|
||||
if (! $module = get_record("modules", "id", $cm->module)) {
|
||||
print_error("This module doesn't exist");
|
||||
print_error("moduledoesnotexist");
|
||||
}
|
||||
|
||||
if (! $form = get_record($module->name, "id", $cm->instance)) {
|
||||
print_error("The required instance of this module doesn't exist");
|
||||
print_error("moduleinstancedoesnotexist");
|
||||
}
|
||||
|
||||
if (! $cw = get_record("course_sections", "id", $cm->section)) {
|
||||
print_error("This course section doesn't exist");
|
||||
print_error("sectionnotexist");
|
||||
}
|
||||
|
||||
$form->coursemodule = $cm->id;
|
||||
|
@ -160,7 +160,7 @@
|
|||
$CFG->pagepath .= '/mod';
|
||||
}
|
||||
} else {
|
||||
print_error('Invalid operation.');
|
||||
print_error('invalidaction');
|
||||
}
|
||||
|
||||
$modmoodleform = "$CFG->dirroot/mod/$module->name/mod_form.php";
|
||||
|
@ -168,14 +168,14 @@
|
|||
require_once($modmoodleform);
|
||||
|
||||
} else {
|
||||
print_error('No formslib form description file found for this activity.');
|
||||
print_error('noformdesc');
|
||||
}
|
||||
|
||||
$modlib = "$CFG->dirroot/mod/$module->name/lib.php";
|
||||
if (file_exists($modlib)) {
|
||||
include_once($modlib);
|
||||
} else {
|
||||
print_error("This module is missing important code! ($modlib)");
|
||||
print_error("modulemissingcode", '', '', $modlib);
|
||||
}
|
||||
|
||||
$mformclassname = 'mod_'.$module->name.'_mod_form';
|
||||
|
@ -192,17 +192,17 @@
|
|||
if (empty($fromform->coursemodule)) { //add
|
||||
$cm = null;
|
||||
if (! $course = get_record("course", "id", $fromform->course)) {
|
||||
print_error("This course doesn't exist");
|
||||
print_error("invalidcourseid");
|
||||
}
|
||||
$fromform->instance = '';
|
||||
$fromform->coursemodule = '';
|
||||
} else { //update
|
||||
if (! $cm = get_record("course_modules", "id", $fromform->coursemodule)) {
|
||||
print_error("This course module doesn't exist");
|
||||
print_error("cmunknown");
|
||||
}
|
||||
|
||||
if (! $course = get_record("course", "id", $cm->course)) {
|
||||
print_error("This course doesn't exist");
|
||||
print_error("invalidcourseid");
|
||||
}
|
||||
$fromform->instance = $cm->instance;
|
||||
$fromform->coursemodule = $cm->id;
|
||||
|
@ -243,7 +243,7 @@
|
|||
|
||||
$returnfromfunc = $updateinstancefunction($fromform);
|
||||
if (!$returnfromfunc) {
|
||||
print_error("Could not update the $fromform->modulename", '', "view.php?id=$course->id");
|
||||
print_error('cannotupdatemod', '', 'view.php?id=$course->id', $fromform->modulename);
|
||||
}
|
||||
if (is_string($returnfromfunc)) {
|
||||
print_error($returnfromfunc, '', "view.php?id=$course->id");
|
||||
|
@ -273,12 +273,12 @@
|
|||
}
|
||||
|
||||
if (!course_allowed_module($course,$fromform->modulename)) {
|
||||
print_error("This module ($fromform->modulename) has been disabled for this particular course");
|
||||
print_error('moduledisable', '', '', $fromform->modulename);
|
||||
}
|
||||
|
||||
$returnfromfunc = $addinstancefunction($fromform);
|
||||
if (!$returnfromfunc) {
|
||||
print_error("Could not add a new instance of $fromform->modulename", '', "view.php?id=$course->id");
|
||||
print_error("cannotaddnewmodule", '', "view.php?id=$course->id", $fromform->modulename);
|
||||
}
|
||||
if (is_string($returnfromfunc)) {
|
||||
print_error($returnfromfunc, '', "view.php?id=$course->id");
|
||||
|
@ -290,14 +290,14 @@
|
|||
// to each other, so we have to update one of them twice.
|
||||
|
||||
if (! $fromform->coursemodule = add_course_module($fromform) ) {
|
||||
print_error("Could not add a new course module");
|
||||
print_error("cannotaddcoursemodule");
|
||||
}
|
||||
if (! $sectionid = add_mod_to_section($fromform) ) {
|
||||
print_error("Could not add the new course module to that section");
|
||||
print_error("cannotaddcmtosection");
|
||||
}
|
||||
|
||||
if (! set_field("course_modules", "section", $sectionid, "id", $fromform->coursemodule)) {
|
||||
print_error("Could not update the course module with the correct section");
|
||||
print_error("cannotupdatecm");
|
||||
}
|
||||
|
||||
// make sure visibility is set correctly (in particular in calendar)
|
||||
|
@ -315,7 +315,7 @@
|
|||
"view.php?id=$fromform->coursemodule",
|
||||
"$fromform->instance", $fromform->coursemodule);
|
||||
} else {
|
||||
print_error("Data submitted is invalid.");
|
||||
print_error("invaliddata");
|
||||
}
|
||||
|
||||
// sync idnumber with grade_item
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
require_login();
|
||||
|
||||
if (isguest()) {
|
||||
print_error("No guests here!");
|
||||
print_error("noguest");
|
||||
}
|
||||
|
||||
if (empty($CFG->enablecourserequests)) {
|
||||
|
|
|
@ -14,7 +14,7 @@ require_once('reset_form.php');
|
|||
$id = required_param('id', PARAM_INT);
|
||||
|
||||
if (!$course = get_record('course', 'id', $id)) {
|
||||
print_error("Course is misconfigured");
|
||||
print_error("invalidcourseid");
|
||||
}
|
||||
|
||||
require_login($course);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
$id = required_param('id', PARAM_INT); // course id
|
||||
|
||||
if (! $course = get_record("course", "id", $id)) {
|
||||
print_error("Course ID was incorrect");
|
||||
print_error("invalidcourseid");
|
||||
}
|
||||
|
||||
require_login($course);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue