diff --git a/course/resources.php b/course/resources.php index d0235f54960..4691d959185 100644 --- a/course/resources.php +++ b/course/resources.php @@ -52,7 +52,6 @@ foreach ($allmodules as $key=>$module) { } $strresources = get_string('resources'); -$strsectionname = get_string('sectionname', 'format_'.$course->format); $strname = get_string('name'); $strintro = get_string('moduleintro'); $strlastmodified = get_string('lastmodified'); @@ -100,6 +99,7 @@ $table = new html_table(); $table->attributes['class'] = 'generaltable mod_index'; if ($usesections) { + $strsectionname = get_string('sectionname', 'format_'.$course->format); $table->head = array ($strsectionname, $strname, $strintro); $table->align = array ('center', 'left', 'left'); } else { diff --git a/mod/assign/locallib.php b/mod/assign/locallib.php index 233bfcefbe5..ab356ada5a5 100644 --- a/mod/assign/locallib.php +++ b/mod/assign/locallib.php @@ -1935,11 +1935,12 @@ class assign { return $o; } - $strsectionname = get_string('sectionname', 'format_'.$course->format); + $strsectionname = ''; $usesections = course_format_uses_sections($course->format); $modinfo = get_fast_modinfo($course); if ($usesections) { + $strsectionname = get_string('sectionname', 'format_'.$course->format); $sections = $modinfo->get_section_info_all(); } $courseindexsummary = new assign_course_index_summary($usesections, $strsectionname); diff --git a/mod/assignment/index.php b/mod/assignment/index.php index 5adcbf2b91c..bad9d6b162f 100644 --- a/mod/assignment/index.php +++ b/mod/assignment/index.php @@ -18,7 +18,6 @@ add_to_log($course->id, "assignment", "view all", "index.php?id=$course->id", "" $strassignments = get_string("modulenameplural", "assignment"); $strassignment = get_string("modulename", "assignment"); $strassignmenttype = get_string("assignmenttype", "assignment"); -$strsectionname = get_string('sectionname', 'format_'.$course->format); $strname = get_string("name"); $strduedate = get_string("duedate", "assignment"); $strsubmitted = get_string("submitted", "assignment"); @@ -43,6 +42,7 @@ $timenow = time(); $table = new html_table(); if ($usesections) { + $strsectionname = get_string('sectionname', 'format_'.$course->format); $table->head = array ($strsectionname, $strname, $strassignmenttype, $strduedate, $strsubmitted, $strgrade); } else { $table->head = array ($strname, $strassignmenttype, $strduedate, $strsubmitted, $strgrade); diff --git a/mod/book/index.php b/mod/book/index.php index 75461889413..6f6d7115e3d 100644 --- a/mod/book/index.php +++ b/mod/book/index.php @@ -37,7 +37,6 @@ $PAGE->set_pagelayout('incourse'); // Get all required strings $strbooks = get_string('modulenameplural', 'mod_book'); $strbook = get_string('modulename', 'mod_book'); -$strsectionname = get_string('sectionname', 'format_'.$course->format); $strname = get_string('name'); $strintro = get_string('moduleintro'); $strlastmodified = get_string('lastmodified'); @@ -62,6 +61,7 @@ $table = new html_table(); $table->attributes['class'] = 'generaltable mod_index'; if ($usesections) { + $strsectionname = get_string('sectionname', 'format_'.$course->format); $table->head = array ($strsectionname, $strname, $strintro); $table->align = array ('center', 'left', 'left'); } else { diff --git a/mod/chat/index.php b/mod/chat/index.php index a56e489e971..22582dafbdc 100644 --- a/mod/chat/index.php +++ b/mod/chat/index.php @@ -19,7 +19,6 @@ add_to_log($course->id, 'chat', 'view all', "index.php?id=$course->id", ''); /// Get all required strings -$strsectionname = get_string('sectionname', 'format_'.$course->format); $strchats = get_string('modulenameplural', 'chat'); $strchat = get_string('modulename', 'chat'); @@ -47,6 +46,7 @@ $strname = get_string('name'); $table = new html_table(); if ($usesections) { + $strsectionname = get_string('sectionname', 'format_'.$course->format); $table->head = array ($strsectionname, $strname); $table->align = array ('center', 'left'); } else { diff --git a/mod/choice/index.php b/mod/choice/index.php index 1d0ca001cf0..d82c14677ac 100644 --- a/mod/choice/index.php +++ b/mod/choice/index.php @@ -18,7 +18,6 @@ $strchoice = get_string("modulename", "choice"); $strchoices = get_string("modulenameplural", "choice"); - $strsectionname = get_string('sectionname', 'format_'.$course->format); $PAGE->set_title($strchoices); $PAGE->set_heading($course->fullname); $PAGE->navbar->add($strchoices); @@ -49,6 +48,7 @@ $table = new html_table(); if ($usesections) { + $strsectionname = get_string('sectionname', 'format_'.$course->format); $table->head = array ($strsectionname, get_string("question"), get_string("answer")); $table->align = array ("center", "left", "left"); } else { diff --git a/mod/data/index.php b/mod/data/index.php index 94a7323f394..7d5ffe0af46 100644 --- a/mod/data/index.php +++ b/mod/data/index.php @@ -41,7 +41,6 @@ $context = context_course::instance($course->id); add_to_log($course->id, "data", "view all", "index.php?id=$course->id", ""); -$strsectionname = get_string('sectionname', 'format_'.$course->format); $strname = get_string('name'); $strdata = get_string('modulename','data'); $strdataplural = get_string('modulenameplural','data'); @@ -66,6 +65,7 @@ $strnumnotapproved = get_string('numnotapproved', 'data'); $table = new html_table(); if ($usesections) { + $strsectionname = get_string('sectionname', 'format_'.$course->format); $table->head = array ($strsectionname, $strname, $strdescription, $strentries, $strnumnotapproved); $table->align = array ('center', 'center', 'center', 'center', 'center'); } else { diff --git a/mod/feedback/index.php b/mod/feedback/index.php index a1a42ff9cbb..c8eca6c86e9 100644 --- a/mod/feedback/index.php +++ b/mod/feedback/index.php @@ -66,12 +66,12 @@ $usesections = course_format_uses_sections($course->format); $timenow = time(); $strname = get_string("name"); -$strsectionname = get_string('sectionname', 'format_'.$course->format); $strresponses = get_string('responses', 'feedback'); $table = new html_table(); if ($usesections) { + $strsectionname = get_string('sectionname', 'format_'.$course->format); if (has_capability('mod/feedback:viewreports', $context)) { $table->head = array ($strsectionname, $strname, $strresponses); $table->align = array ("center", "left", 'center'); diff --git a/mod/folder/index.php b/mod/folder/index.php index 9cbe696bdc7..7f1b8d02fc2 100644 --- a/mod/folder/index.php +++ b/mod/folder/index.php @@ -37,7 +37,6 @@ add_to_log($course->id, 'folder', 'view all', "index.php?id=$course->id", ''); $strfolder = get_string('modulename', 'folder'); $strfolders = get_string('modulenameplural', 'folder'); -$strsectionname = get_string('sectionname', 'format_'.$course->format); $strname = get_string('name'); $strintro = get_string('moduleintro'); $strlastmodified = get_string('lastmodified'); @@ -59,6 +58,7 @@ $table = new html_table(); $table->attributes['class'] = 'generaltable mod_index'; if ($usesections) { + $strsectionname = get_string('sectionname', 'format_'.$course->format); $table->head = array ($strsectionname, $strname, $strintro); $table->align = array ('center', 'left', 'left'); } else { diff --git a/mod/glossary/index.php b/mod/glossary/index.php index b20829d1315..a2976d17a0a 100644 --- a/mod/glossary/index.php +++ b/mod/glossary/index.php @@ -48,13 +48,13 @@ $usesections = course_format_uses_sections($course->format); /// Print the list of instances (your module will probably extend this) $timenow = time(); -$strsectionname = get_string('sectionname', 'format_'.$course->format); $strname = get_string("name"); $strentries = get_string("entries", "glossary"); $table = new html_table(); if ($usesections) { + $strsectionname = get_string('sectionname', 'format_'.$course->format); $table->head = array ($strsectionname, $strname, $strentries); $table->align = array ("CENTER", "LEFT", "CENTER"); } else { diff --git a/mod/imscp/index.php b/mod/imscp/index.php index 53505da6c4d..c09fdd94232 100644 --- a/mod/imscp/index.php +++ b/mod/imscp/index.php @@ -37,7 +37,6 @@ add_to_log($course->id, 'imscp', 'view all', "index.php?id=$course->id", ''); $strimscp = get_string('modulename', 'imscp'); $strimscps = get_string('modulenameplural', 'imscp'); -$strsectionname = get_string('sectionname', 'format_'.$course->format); $strname = get_string('name'); $strintro = get_string('moduleintro'); $strlastmodified = get_string('lastmodified'); @@ -59,6 +58,7 @@ $table = new html_table(); $table->attributes['class'] = 'generaltable mod_index'; if ($usesections) { + $strsectionname = get_string('sectionname', 'format_'.$course->format); $table->head = array ($strsectionname, $strname, $strintro); $table->align = array ('center', 'left', 'left'); } else { diff --git a/mod/lesson/index.php b/mod/lesson/index.php index 67b717a80ad..5a1026568d7 100644 --- a/mod/lesson/index.php +++ b/mod/lesson/index.php @@ -66,7 +66,6 @@ $usesections = course_format_uses_sections($course->format); /// Print the list of instances (your module will probably extend this) $timenow = time(); -$strsectionname = get_string('sectionname', 'format_'.$course->format); $strname = get_string("name"); $strgrade = get_string("grade"); $strdeadline = get_string("deadline", "lesson"); @@ -74,6 +73,7 @@ $strnodeadline = get_string("nodeadline", "lesson"); $table = new html_table(); if ($usesections) { + $strsectionname = get_string('sectionname', 'format_'.$course->format); $table->head = array ($strsectionname, $strname, $strgrade, $strdeadline); $table->align = array ("center", "left", "center", "center"); } else { @@ -116,4 +116,4 @@ foreach ($lessons as $lesson) { } } echo html_writer::table($table); -echo $OUTPUT->footer(); \ No newline at end of file +echo $OUTPUT->footer(); diff --git a/mod/lti/index.php b/mod/lti/index.php index 346f6e1c3b8..dc564468483 100644 --- a/mod/lti/index.php +++ b/mod/lti/index.php @@ -77,13 +77,13 @@ if (! $basicltis = get_all_instances_in_course("lti", $course)) { // Print the list of instances (your module will probably extend this) $timenow = time(); $strname = get_string("name"); -$strsectionname = get_string('sectionname', 'format_'.$course->format); $usesections = course_format_uses_sections($course->format); $table = new html_table(); $table->attributes['class'] = 'generaltable mod_index'; if ($usesections) { + $strsectionname = get_string('sectionname', 'format_'.$course->format); $table->head = array ($strsectionname, $strname); $table->align = array ("center", "left"); } else { diff --git a/mod/page/index.php b/mod/page/index.php index 9843372b9f6..ec5d3817bce 100644 --- a/mod/page/index.php +++ b/mod/page/index.php @@ -37,7 +37,6 @@ add_to_log($course->id, 'page', 'view all', "index.php?id=$course->id", ''); $strpage = get_string('modulename', 'page'); $strpages = get_string('modulenameplural', 'page'); -$strsectionname = get_string('sectionname', 'format_'.$course->format); $strname = get_string('name'); $strintro = get_string('moduleintro'); $strlastmodified = get_string('lastmodified'); @@ -59,6 +58,7 @@ $table = new html_table(); $table->attributes['class'] = 'generaltable mod_index'; if ($usesections) { + $strsectionname = get_string('sectionname', 'format_'.$course->format); $table->head = array ($strsectionname, $strname, $strintro); $table->align = array ('center', 'left', 'left'); } else { diff --git a/mod/quiz/index.php b/mod/quiz/index.php index 1d3063906cc..4c3650ca830 100644 --- a/mod/quiz/index.php +++ b/mod/quiz/index.php @@ -87,7 +87,11 @@ if ($showclosingheader) { array_push($align, 'left'); } -array_unshift($headings, get_string('sectionname', 'format_'.$course->format)); +if (course_format_uses_sections($course->format)) { + array_unshift($headings, get_string('sectionname', 'format_'.$course->format)); +} else { + array_unshift($headings, ''); +} array_unshift($align, 'center'); $showing = ''; diff --git a/mod/scorm/index.php b/mod/scorm/index.php index 4daa0b45cb4..ba2b5b73e71 100644 --- a/mod/scorm/index.php +++ b/mod/scorm/index.php @@ -36,7 +36,6 @@ add_to_log($course->id, "scorm", "view all", "index.php?id=$course->id", ""); $strscorm = get_string("modulename", "scorm"); $strscorms = get_string("modulenameplural", "scorm"); -$strsectionname = get_string('sectionname', 'format_'.$course->format); $strname = get_string("name"); $strsummary = get_string("summary"); $strreport = get_string("report", 'scorm'); @@ -63,6 +62,7 @@ if (! $scorms = get_all_instances_in_course("scorm", $course)) { $table = new html_table(); if ($usesections) { + $strsectionname = get_string('sectionname', 'format_'.$course->format); $table->head = array ($strsectionname, $strname, $strsummary, $strreport); $table->align = array ("center", "left", "left", "left"); } else { diff --git a/mod/survey/index.php b/mod/survey/index.php index e9f2f3f5b39..d7cbebc424b 100644 --- a/mod/survey/index.php +++ b/mod/survey/index.php @@ -17,7 +17,6 @@ add_to_log($course->id, "survey", "view all", "index.php?id=$course->id", ""); $strsurveys = get_string("modulenameplural", "survey"); - $strsectionname = get_string('sectionname', 'format_'.$course->format); $strname = get_string("name"); $strstatus = get_string("status"); $strdone = get_string("done", "survey"); @@ -38,6 +37,7 @@ $table->width = '100%'; if ($usesections) { + $strsectionname = get_string('sectionname', 'format_'.$course->format); $table->head = array ($strsectionname, $strname, $strstatus); } else { $table->head = array ($strname, $strstatus); diff --git a/mod/url/index.php b/mod/url/index.php index e5d096dd42c..4941e11fc64 100644 --- a/mod/url/index.php +++ b/mod/url/index.php @@ -37,7 +37,6 @@ add_to_log($course->id, 'url', 'view all', "index.php?id=$course->id", ''); $strurl = get_string('modulename', 'url'); $strurls = get_string('modulenameplural', 'url'); -$strsectionname = get_string('sectionname', 'format_'.$course->format); $strname = get_string('name'); $strintro = get_string('moduleintro'); $strlastmodified = get_string('lastmodified'); @@ -59,6 +58,7 @@ $table = new html_table(); $table->attributes['class'] = 'generaltable mod_index'; if ($usesections) { + $strsectionname = get_string('sectionname', 'format_'.$course->format); $table->head = array ($strsectionname, $strname, $strintro); $table->align = array ('center', 'left', 'left'); } else { diff --git a/mod/wiki/index.php b/mod/wiki/index.php index c2e3c6e328b..831d68ab93a 100644 --- a/mod/wiki/index.php +++ b/mod/wiki/index.php @@ -68,11 +68,11 @@ $usesections = course_format_uses_sections($course->format); /// Print the list of instances (your module will probably extend this) $timenow = time(); -$strsectionname = get_string('sectionname', 'format_' . $course->format); $strname = get_string("name"); $table = new html_table(); if ($usesections) { + $strsectionname = get_string('sectionname', 'format_' . $course->format); $table->head = array($strsectionname, $strname); } else { $table->head = array($strname); diff --git a/mod/workshop/index.php b/mod/workshop/index.php index 263807a87aa..da36295ef47 100644 --- a/mod/workshop/index.php +++ b/mod/workshop/index.php @@ -57,11 +57,11 @@ if (! $workshops = get_all_instances_in_course('workshop', $course)) { $usesections = course_format_uses_sections($course->format); $timenow = time(); -$strsectionname = get_string('sectionname', 'format_'.$course->format); $strname = get_string('name'); $table = new html_table(); if ($usesections) { + $strsectionname = get_string('sectionname', 'format_'.$course->format); $table->head = array ($strsectionname, $strname); $table->align = array ('center', 'left'); } else {