mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-36482 activities block: Allow mod display without intro's
This commit is contained in:
parent
95190fda69
commit
48cb2c824d
1 changed files with 13 additions and 5 deletions
|
@ -84,7 +84,11 @@ foreach ($modinfo->cms as $cm) {
|
|||
|
||||
// preload instances
|
||||
foreach ($resources as $modname=>$instances) {
|
||||
$resources[$modname] = $DB->get_records_list($modname, 'id', $instances, 'id', 'id,name,intro,introformat,timemodified');
|
||||
$additionalfields = '';
|
||||
if (plugin_supports('mod', $modname, FEATURE_MOD_INTRO)) {
|
||||
$additionalfields = ',intro,introformat';
|
||||
}
|
||||
$resources[$modname] = $DB->get_records_list($modname, 'id', $instances, 'id', 'id,name'.$additionalfields);
|
||||
}
|
||||
|
||||
if (!$cms) {
|
||||
|
@ -109,8 +113,8 @@ foreach ($cms as $cm) {
|
|||
continue;
|
||||
}
|
||||
$resource = $resources[$cm->modname][$cm->instance];
|
||||
$printsection = '';
|
||||
if ($usesections) {
|
||||
$printsection = '';
|
||||
if ($cm->sectionnum !== $currentsection) {
|
||||
if ($cm->sectionnum) {
|
||||
$printsection = get_section_name($course, $cm->sectionnum);
|
||||
|
@ -120,8 +124,6 @@ foreach ($cms as $cm) {
|
|||
}
|
||||
$currentsection = $cm->sectionnum;
|
||||
}
|
||||
} else {
|
||||
$printsection = '<span class="smallinfo">'.userdate($resource->timemodified)."</span>";
|
||||
}
|
||||
|
||||
$extra = empty($cm->extra) ? '' : $cm->extra;
|
||||
|
@ -131,11 +133,17 @@ foreach ($cms as $cm) {
|
|||
$icon = '<img src="'.$OUTPUT->pix_url('icon', $cm->modname).'" class="activityicon" alt="'.get_string('modulename', $cm->modname).'" /> ';
|
||||
}
|
||||
|
||||
if (isset($cm->intro) && isset($cm->introformat)) {
|
||||
$intro = format_module_intro('resource', $resource, $cm->id);
|
||||
} else {
|
||||
$intro = '';
|
||||
}
|
||||
|
||||
$class = $cm->visible ? '' : 'class="dimmed"'; // hidden modules are dimmed
|
||||
$table->data[] = array (
|
||||
$printsection,
|
||||
"<a $class $extra href=\"$CFG->wwwroot/mod/$cm->modname/view.php?id=$cm->id\">".$icon.format_string($resource->name)."</a>",
|
||||
format_module_intro('resource', $resource, $cm->id));
|
||||
$intro);
|
||||
}
|
||||
|
||||
echo html_writer::table($table);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue