private function aggregateData() { $meta = new MoodleMetaData(); $this->data = array(); $this->data['Course ID'] = $this->course->id; $this->data["No of contexts"] = count($this->contexts); $this->data["Context by level"] = array(); foreach ($this->contextbylevel as $level => $count) { $this->data["Context by level"][] = context_level_to_name($level) . " ({$level}):\t{$count}"; } $this->data["Context by module"] = array(); foreach ($this->contextbymodule as $module => $count) { $this->data["Context by module"][] = $meta->moduleName($module) . " ({$module}):\t{$count}"; } $this->data["Number of role capability overwrites"] = count($this->capabilityoverwrites); $this->data["Role capability overwrites by context"] = array(); foreach ($this->capabilityoverwrites as $contextid => $count) { $this->data["Role capability overwrites by context"][] = $this->contexts[$contextid]->get_context_name() . " ({$contextid}):\t{$count}"; } $this->data["Number of local role assignments"] = count($this->rolesassigned); $this->data["Locally assigned roles by context"] = array(); foreach ($this->rolesassigned as $contextid => $count) { $this->data["Locally assigned roles by context"][] = $this->contexts[$contextid]->get_context_name() . " ({$contextid}):\t{$count}"; } $this->data["Number of enrolled users"] = $this->enrolledtotal; $this->data["Users enrolled by role"] = array(); foreach ($this->usersbyrole as $roleid => $count) { $this->data["Users enrolled by role"][] = $meta->roleName($roleid) . " ({$roleid}):\t{$count}"; } $this->data["Number of groups"] = $this->groupsnumber; $this->data["Group statistics"] = array(); $this->data["Group statistics"]["Min number of members in a group"] = $this->groupsmin; $this->data["Group statistics"]["Max number of members in a group"] = $this->groupsmax; $this->data["Group statistics"]["Avg number of members in a group"] = $this->groupsavg; $this->data["Course modinfo size"] = $this->modinfosize; $this->data["Number of sections"] = $this->sectionsnumber; $this->data["Section statistics"] = array(); $this->data["Section statistics"]['Sections visible'] = $this->sectionsvisible; $this->data["Section statistics"]['Sections hidden'] = $this->sectionshidden; $this->data["Section statistics"]["Min number of modules in a section"] = $this->sectionsmin; $this->data["Section statistics"]["Max number of modules in a section"] = $this->sectionsmax; $this->data["Section statistics"]["Avg number of modules in a section"] = $this->sectionsavg; $this->data["Number of grades"] = $this->gradesnumber; $this->data["Number of log entries"] = $this->logsnumber; $this->data["Number of files"] = $this->filesnumber; $this->data["Total file size"] = $this->filesize; }