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 d5fe71617f3..55cb0d57ca8 100644 --- a/mod/assign/locallib.php +++ b/mod/assign/locallib.php @@ -2003,11 +2003,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 2bc451eef50..990d6856fca 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 db47dd62569..44673916866 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'); @@ -66,6 +65,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 e0a237e61ef..9b8b855bfc3 100644 --- a/mod/chat/index.php +++ b/mod/chat/index.php @@ -22,7 +22,6 @@ $event->trigger(); /// Get all required strings -$strsectionname = get_string('sectionname', 'format_'.$course->format); $strchats = get_string('modulenameplural', 'chat'); $strchat = get_string('modulename', 'chat'); @@ -51,6 +50,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 c232a44d253..471ff2253db 100644 --- a/mod/choice/index.php +++ b/mod/choice/index.php @@ -20,7 +20,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); @@ -51,6 +50,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 ae7aa688ee2..de7c74bb1af 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'); @@ -67,6 +66,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 cfbf423fd79..fc2b7d0264f 100644 --- a/mod/feedback/index.php +++ b/mod/feedback/index.php @@ -68,12 +68,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 dc987df9bfb..2684b452d2f 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'); @@ -60,6 +59,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 47ec16ecc8e..1ed91a99bcb 100644 --- a/mod/glossary/index.php +++ b/mod/glossary/index.php @@ -49,13 +49,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 db50669e84c..469ce71347f 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'); @@ -60,6 +59,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 1f5093f6f14..1f95c538829 100644 --- a/mod/lesson/index.php +++ b/mod/lesson/index.php @@ -67,7 +67,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"); @@ -75,6 +74,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 { 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 eeb5cf78f47..e42ff0dc1bb 100644 --- a/mod/page/index.php +++ b/mod/page/index.php @@ -39,7 +39,6 @@ $event->trigger(); $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'); @@ -61,6 +60,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 206bd9a8d15..4ef737e9b7c 100644 --- a/mod/quiz/index.php +++ b/mod/quiz/index.php @@ -88,7 +88,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 571886174f8..0b99c4da19e 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'); @@ -64,6 +63,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 3101c96622f..b7536598023 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"); @@ -39,6 +38,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 4612f8be2a5..abec7ceb1c3 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'); @@ -60,6 +59,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 ed82d3fd6de..a5f5ca38087 100644 --- a/mod/wiki/index.php +++ b/mod/wiki/index.php @@ -69,11 +69,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 d0aefac4805..9fac4019a64 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 {