diff --git a/course/lib.php b/course/lib.php
index 951cc0dc54c..4e4416cdf59 100644
--- a/course/lib.php
+++ b/course/lib.php
@@ -62,11 +62,11 @@ function build_mnet_logs_array($hostid, $course, $user=0, $date=0, $order="l.tim
// and so the next 86400 seconds worth of logs are printed.
/// Setup for group handling.
-
- // TODO: I don't understand group/context/etc. enough to be able to do
+
+ // TODO: I don't understand group/context/etc. enough to be able to do
// something interesting with it here
// What is the context of a remote course?
-
+
/// If the group mode is separate, and this user does not have editing privileges,
/// then only the user's group can be viewed.
//if ($course->groupmode == SEPARATEGROUPS and !has_capability('moodle/course:managegroups', get_context_instance(CONTEXT_COURSE, $course->id))) {
@@ -106,7 +106,7 @@ function build_mnet_logs_array($hostid, $course, $user=0, $date=0, $order="l.tim
if ('site_errors' === $modid) {
$where .= " AND ( l.action='error' OR l.action='infected' )";
} else if ($modid) {
- //TODO: This assumes that modids are the same across sites... probably
+ //TODO: This assumes that modids are the same across sites... probably
//not true
$where .= " AND l.cmid = :modid";
$params['modid'] = $modid;
@@ -174,7 +174,7 @@ function build_logs_array($course, $user=0, $date=0, $order="l.time ASC", $limit
if ($modname) {
$joins[] = "l.module = :modname";
- $params['modname'] = $modname;
+ $params['modname'] = $modname;
}
if ('site_errors' === $modid) {
@@ -196,7 +196,7 @@ function build_logs_array($course, $user=0, $date=0, $order="l.time ASC", $limit
}
}
-
+
/// Getting all members of a group.
if ($groupid and !$user) {
if ($gusers = groups_get_members($groupid)) {
@@ -284,7 +284,7 @@ function print_log($course, $user=0, $date=0, $order="l.time ASC", $page=0, $per
if (empty($logs['logs'])) {
$logs['logs'] = array();
}
-
+
$row = 1;
foreach ($logs['logs'] as $log) {
@@ -355,16 +355,16 @@ function print_log($course, $user=0, $date=0, $order="l.time ASC", $page=0, $per
function print_mnet_log($hostid, $course, $user=0, $date=0, $order="l.time ASC", $page=0, $perpage=100,
$url="", $modname="", $modid=0, $modaction="", $groupid=0) {
-
+
global $CFG, $DB;
-
+
if (!$logs = build_mnet_logs_array($hostid, $course, $user, $date, $order, $page*$perpage, $perpage,
$modname, $modid, $modaction, $groupid)) {
notify("No logs found!");
print_footer($course);
exit;
}
-
+
if ($course->id == SITEID) {
$courses[0] = '';
if ($ccc = get_courses('all', 'c.id ASC', 'c.id,c.shortname,c.visible')) {
@@ -373,7 +373,7 @@ function print_mnet_log($hostid, $course, $user=0, $date=0, $order="l.time ASC",
}
}
}
-
+
$totalcount = $logs['totalcount'];
$count=0;
$ldcache = array();
@@ -407,7 +407,7 @@ function print_mnet_log($hostid, $course, $user=0, $date=0, $order="l.time ASC",
$row = 1;
foreach ($logs['logs'] as $log) {
-
+
$log->info = $log->coursename;
$row = ($row + 1) % 2;
@@ -426,7 +426,7 @@ function print_mnet_log($hostid, $course, $user=0, $date=0, $order="l.time ASC",
}
}
- //Filter log->info
+ //Filter log->info
$log->info = format_string($log->info);
$log->url = strip_tags(urldecode($log->url)); // Some XSS protection
@@ -955,7 +955,7 @@ function print_recent_activity($course) {
$content = $print_recent_activity($course, $viewfullnames, $timestart) || $content;
}
} else {
- debugging("Missing lib.php in lib/{$modname} - please reinstall files or uninstall the module");
+ debugging("Missing lib.php in lib/{$modname} - please reinstall files or uninstall the module");
}
}
@@ -1179,7 +1179,7 @@ function &get_fast_modinfo(&$course, $userid=0) {
* Returns a number of useful structures for course displays
*/
function get_all_mods($courseid, &$mods, &$modnames, &$modnamesplural, &$modnamesused) {
- global $DB;
+ global $DB;
$mods = array(); // course modules indexed by id
$modnames = array(); // all course module names (except resource!)
@@ -1236,7 +1236,7 @@ function course_set_display($courseid, $display=0) {
if (empty($USER->id) or $USER->username == 'guest') {
//do not store settings in db for guests
- } else if ($DB->record_exists("course_display", "userid", $USER->id, array("course"=>$courseid))) {
+ } else if ($DB->record_exists("course_display", array("userid" => $USER->id, "course"=>$courseid))) {
$DB->set_field("course_display", "display", $display, array("userid"=>$USER->id, "course"=>$courseid));
} else {
$record = new object();
@@ -1310,7 +1310,7 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
/// Casting $course->modinfo to string prevents one notice when the field is null
$modinfo = get_fast_modinfo($course);
-
+
//Acccessibility: replace table with list
";
}
}
-
+
require_once("$CFG->dirroot/enrol/enrol.class.php");
$enrol = enrolment_factory::factory($course->enrol);
echo $enrol->get_access_icons($course);
@@ -2005,7 +2005,7 @@ function print_my_moodle() {
}
// MNET
- if (!empty($rcourses)) {
+ if (!empty($rcourses)) {
// at the IDP, we know of all the remote courses
foreach ($rcourses as $course) {
print_remote_course($course, "100%");
@@ -2095,8 +2095,8 @@ function print_remote_course($course, $width="100%") {
$linkcss.' href="'.$url.'">'
. format_string($course->fullname) .'
'
. format_string($course->hostname) . ' : '
- . format_string($course->cat_name) . ' : '
- . format_string($course->shortname). '';
+ . format_string($course->cat_name) . ' : '
+ . format_string($course->shortname). '';
echo '';
$options = NULL;
$options->noclean = true;
@@ -2220,7 +2220,7 @@ function set_coursemodule_groupmembersonly($id, $groupmembersonly) {
function set_coursemodule_idnumber($id, $idnumber) {
global $DB;
- return $DB->set_field("course_modules", "idnumber", $idnumber, array("id"=>$id));
+ return $DB->set_field("course_modules", "idnumber", $idnumber, array("id"=>$id));
}
/**
* $prevstateoverrides = true will set the visibility of the course module
@@ -2284,7 +2284,7 @@ function delete_course_module($id) {
foreach ($grade_items as $grade_item) {
$grade_item->delete('moddelete');
}
-
+
}
return $DB->delete_records('course_modules', array('id'=>$cm->id));
}
@@ -2502,7 +2502,7 @@ function make_editing_buttons($mod, $absolute=false, $moveselect=true, $indent=-
' alt="'.$str->movedown.'" />'."\n";
}
} else {
- $move = '';
+ $move = '';
}
$leftright = '';
@@ -2515,7 +2515,7 @@ function make_editing_buttons($mod, $absolute=false, $moveselect=true, $indent=-
$rightarrow = 'right.gif';
$leftarrow = 'left.gif';
}
-
+
if ($indent > 0) {
$leftright .= '
';
echo ''.get_string('grouping', 'group').': | ';
echo '
';
-
+
$groupingid = isset($cm->groupingid) ? $cm->groupingid : 0;
-
+
choose_from_menu($groupings, 'groupingid', $groupingid, get_string('none'), '', 0, false);
echo ' | ';
-
+
$checked = empty($cm->groupmembersonly) ? '':'checked="checked"';
echo '
';
echo '| '.get_string('groupmembersonly', 'group').': | ';
@@ -2725,7 +2725,7 @@ function update_restricted_mods($course, $mods) {
function course_allowed_module($course,$mod) {
global $DB;
-
+
if (empty($course->restrictmodules)) {
return true;
}
@@ -2744,7 +2744,7 @@ function course_allowed_module($course,$mod) {
if (empty($modid)) {
return false;
}
-
+
return $DB->record_exists('course_allowed_modules', array('course'=>$course->id, 'module'=>$modid));
}
@@ -2761,7 +2761,7 @@ function category_delete_full($category, $showfeedback=true) {
if ($children = $DB->get_records('course_categories', array('parent'=>$category->id), 'sortorder ASC')) {
foreach ($children as $childcat) {
if (!category_delete_full($childcat, $showfeedback)) {
- notify("Error deleting category $childcat->name");
+ notify("Error deleting category $childcat->name");
return false;
}
}
@@ -2770,17 +2770,17 @@ function category_delete_full($category, $showfeedback=true) {
if ($courses = $DB->get_records('course', array('category'=>$category->id), 'sortorder ASC')) {
foreach ($courses as $course) {
if (!delete_course($course->id, false)) {
- notify("Error deleting course $course->shortname");
+ notify("Error deleting course $course->shortname");
return false;
}
- notify(get_string('coursedeleted', '', $course->shortname), 'notifysuccess');
+ notify(get_string('coursedeleted', '', $course->shortname), 'notifysuccess');
}
}
// now delete anything that may depend on course category context
grade_course_category_delete($category->id, 0, $showfeedback);
if (!question_delete_course_category($category, 0, $showfeedback)) {
- notify(get_string('errordeletingquestionsfromcategory', 'question', $category), 'notifysuccess');
+ notify(get_string('errordeletingquestionsfromcategory', 'question', $category), 'notifysuccess');
return false;
}
@@ -2790,7 +2790,7 @@ function category_delete_full($category, $showfeedback=true) {
events_trigger('category_deleted', $category);
- notify(get_string('coursecategorydeleted', '', format_string($category->name)), 'notifysuccess');
+ notify(get_string('coursecategorydeleted', '', format_string($category->name)), 'notifysuccess');
return true;
}
@@ -2813,7 +2813,7 @@ function category_delete_move($category, $newparentid, $showfeedback=true) {
if ($children = $DB->get_records('course_categories', array('parent'=>$category->id), 'sortorder ASC')) {
foreach ($children as $childcat) {
if (!move_category($childcat, $newparentcat)) {
- notify("Error moving category $childcat->name");
+ notify("Error moving category $childcat->name");
return false;
}
}
@@ -2821,16 +2821,16 @@ function category_delete_move($category, $newparentid, $showfeedback=true) {
if ($courses = $DB->get_records('course', array('category'=>$category->id), 'sortorder ASC', 'id')) {
if (!move_courses(array_keys($courses), $newparentid)) {
- notify("Error moving courses");
+ notify("Error moving courses");
return false;
}
- notify(get_string('coursesmovedout', '', format_string($category->name)), 'notifysuccess');
+ notify(get_string('coursesmovedout', '', format_string($category->name)), 'notifysuccess');
}
// now delete anything that may depend on course category context
grade_course_category_delete($category->id, $newparentid, $showfeedback);
if (!question_delete_course_category($category, $newparentcat, $showfeedback)) {
- notify(get_string('errordeletingquestionsfromcategory', 'question', $category), 'notifysuccess');
+ notify(get_string('errordeletingquestionsfromcategory', 'question', $category), 'notifysuccess');
return false;
}
@@ -2840,7 +2840,7 @@ function category_delete_move($category, $newparentid, $showfeedback=true) {
events_trigger('category_deleted', $category);
- notify(get_string('coursecategorydeleted', '', format_string($category->name)), 'notifysuccess');
+ notify(get_string('coursecategorydeleted', '', format_string($category->name)), 'notifysuccess');
return true;
}
@@ -2923,10 +2923,10 @@ function move_category ($category, $newparentcat) {
context_moved($context, $newparent);
- // The most effective thing would be to find the common parent,
+ // The most effective thing would be to find the common parent,
// until then, do it sitewide...
fix_course_sortorder();
-
+
return true;
}
@@ -3017,7 +3017,7 @@ function create_course($data) {
add_to_log(SITEID, 'course', 'new', 'view.php?id='.$course->id, $data->fullname.' (ID '.$course->id.')');
return $course;
- }
+ }
return false; // error
}
@@ -3077,37 +3077,37 @@ function update_course($data) {
// put custom role names into db
$context = get_context_instance(CONTEXT_COURSE, $course->id);
-
+
foreach ($data as $dname => $dvalue) {
-
+
// is this the right param?
$dvalue = clean_param($dvalue, PARAM_NOTAGS);
if (!strstr($dname, 'role_')) {
continue;
- }
-
+ }
+
$dt = explode('_', $dname);
$roleid = $dt[1];
// make up our mind whether we want to delete, update or insert
-
+
if (empty($dvalue)) {
-
+
$DB->delete_records('role_names', array('contextid'=>$context->id, 'roleid'=>$roleid));
-
+
} else if ($t = $DB->get_record('role_names', array('contextid'=>$context->id, 'roleid'=>$roleid))) {
-
+
$t->name = $dvalue;
- $DB->update_record('role_names', $t);
-
+ $DB->update_record('role_names', $t);
+
} else {
-
+
$t->contextid = $context->id;
$t->roleid = $roleid;
$t->name = $dvalue;
- $DB->insert_record('role_names', $t);
+ $DB->insert_record('role_names', $t);
}
-
+
}
return true;