public function get_activities_and_resources() {
        global $DB, $OUTPUT, $CFG;
        require_once($CFG->dirroot.'/course/lib.php');

        // Get enabled activities and resources.
        $modules = $DB->get_records('modules', ['visible' => 1], 'name ASC');
        $data = new stdClass();
        $data->courseid = $this->courseid;
        $data->sesskey = sesskey();
        $data->helpicon = $OUTPUT->help_icon('bulkcompletiontracking', 'core_completion');
        // Add icon information.
        $data->modules = array_values($modules);
        $coursecontext = context_course::instance($this->courseid);
        $canmanage = has_capability('moodle/course:manageactivities', $coursecontext);
        $course = get_course($this->courseid);
        foreach ($data->modules as $module) {
            $module->icon = $OUTPUT->image_url('icon', $module->name)->out();
            $module->formattedname = format_string(get_string('modulenameplural', 'mod_' . $module->name),
                true, ['context' => $coursecontext]);
            $module->canmanage = $canmanage && course_allowed_module($course, $module->name);
            $defaults = self::get_default_completion($course, $module, false);
            $defaults->modname = $module->name;
            $module->completionstatus = $this->get_completion_detail($defaults);
        }

        return $data;
    }