Permalink
Browse files

MDL-40515: report_log: List activities in optgroups

  • Loading branch information...
1 parent 7bc37de commit 227d3fcbd33e292104852afcefcb8413987c93b3 @aolley aolley committed Jul 5, 2013
Showing with 22 additions and 4 deletions.
  1. +22 −4 report/log/locallib.php
View
@@ -226,12 +226,14 @@ function report_log_print_mnet_selector_form($hostid, $course, $selecteduser=0,
/// Casting $course->modinfo to string prevents one notice when the field is null
if ($modinfo = unserialize((string)$course->modinfo)) {
$section = 0;
+ $thissection = array();
foreach ($modinfo as $mod) {
if ($mod->mod == "label") {
continue;
}
if ($mod->section > 0 and $section <> $mod->section) {
- $activities["section/$mod->section"] = '--- '.get_section_name($course, $mod->section).' ---';
+ $activities[] = $thissection;
+ $thissection = array();
}
$section = $mod->section;
$mod->name = strip_tags(format_string($mod->name, true));
@@ -241,12 +243,19 @@ function report_log_print_mnet_selector_form($hostid, $course, $selecteduser=0,
if (!$mod->visible) {
$mod->name = "(".$mod->name.")";
}
- $activities["$mod->cm"] = $mod->name;
+ $key = get_section_name($course, $mod->section);
+ if (!isset($thissection[$key])) {
+ $thissection[$key] = array();
+ }
+ $thissection[$key][$mod->cm] = $mod->name;
if ($mod->cm == $modid) {
$selectedactivity = "$mod->cm";
}
}
+ if (!empty($thissection)) {
+ $activities[] = $thissection;
+ }
}
if (has_capability('report/log:view', $sitecontext) && !$course->category) {
@@ -479,12 +488,14 @@ function report_log_print_selector_form($course, $selecteduser=0, $selecteddate=
/// Casting $course->modinfo to string prevents one notice when the field is null
if ($modinfo = unserialize((string)$course->modinfo)) {
$section = 0;
+ $thissection = array();
foreach ($modinfo as $mod) {
if ($mod->mod == "label") {
continue;
}
if ($mod->section > 0 and $section <> $mod->section) {
- $activities["section/$mod->section"] = '--- '.get_section_name($course, $mod->section).' ---';
+ $activities[] = $thissection;
+ $thissection = array();
}
$section = $mod->section;
$mod->name = strip_tags(format_string($mod->name, true));
@@ -494,12 +505,19 @@ function report_log_print_selector_form($course, $selecteduser=0, $selecteddate=
if (!$mod->visible) {
$mod->name = "(".$mod->name.")";
}
- $activities["$mod->cm"] = $mod->name;
+ $key = get_section_name($course, $mod->section);
+ if (!isset($thissection[$key])) {
+ $thissection[$key] = array();
+ }
+ $thissection[$key][$mod->cm] = $mod->name;
if ($mod->cm == $modid) {
$selectedactivity = "$mod->cm";
}
}
+ if (!empty($thissection)) {
+ $activities[] = $thissection;
+ }
}
if (has_capability('report/log:view', $sitecontext) && ($course->id == SITEID)) {

0 comments on commit 227d3fc

Please sign in to comment.