/** * Gets group data for a course. * * This returns an object with the following properties: * - groups : An array of all the groups in the course. * - groupings : An array of all the groupings within the course. * - mappings : An array of group to grouping mappings. * * @param int $courseid The course id to get data for. * @param cache $cache The cache if it has already been initialised. If not a new one will be created. * @return stdClass */ function groups_get_course_data($courseid, cache $cache = null) { if ($cache === null) { // Initialise a cache if we wern't given one. $cache = cache::make('core', 'groupdata'); } // Try to retrieve it from the cache. $data = $cache->get($courseid); if ($data === false) { $data = groups_cache_groupdata($courseid, $cache); } return $data; }
$PAGE->set_url($pageurl); $PAGE->set_title(format_string($activityrecord->name)); $PAGE->set_heading(format_string($course->fullname)); $PAGE->requires->yui_module('moodle-mod_dialogue-clickredirector', 'M.mod_dialogue.clickredirector.init', array($cm->id)); $dialogue = new \mod_dialogue\dialogue($cm, $course, $activityrecord); $total = 0; $rs = dialogue_get_bulk_open_rule_listing($dialogue, $total); $pagination = new \paging_bar($total, $page, \mod_dialogue\dialogue::PAGINATION_PAGE_SIZE, $pageurl); // get the dialogue module render $renderer = $PAGE->get_renderer('mod_dialogue'); echo $OUTPUT->header(); if (!empty($dialogue->activityrecord->intro)) { echo $OUTPUT->box(format_module_intro('dialogue', $dialogue->activityrecord, $cm->id), 'generalbox', 'intro'); } echo $renderer->tab_navigation($dialogue); $groupcache = groups_cache_groupdata($course->id); $html = ''; if (!$rs) { $html .= $OUTPUT->notification(get_string('nobulkrulesfound', 'dialogue'), 'notifyproblem'); } else { $html .= html_writer::start_div('listing-meta'); $html .= html_writer::tag('h6', get_string('displaying', 'dialogue')); $a = new stdClass(); $a->start = $page ? $page * \mod_dialogue\dialogue::PAGINATION_PAGE_SIZE : 1; $a->end = $page * \mod_dialogue\dialogue::PAGINATION_PAGE_SIZE + count($rs); $a->total = $total; $html .= html_writer::tag('h6', get_string('listpaginationheader', 'dialogue', $a), array('class' => 'pull-right')); $html .= html_writer::end_div(); $html .= html_writer::start_tag('table', array('class' => 'conversation-list table table-hover table-condensed')); $html .= html_writer::start_tag('tbody'); foreach ($rs as $record) {