Permalink
Browse files

MDL-36482 activities block: Allow mod display without intro's

  • Loading branch information...
1 parent ab6a0ac commit 0bc310eb5a9523f9a47ff6940499dfb533fb9e56 Russell Smith committed with stronk7 May 2, 2013
Showing with 13 additions and 5 deletions.
  1. +13 −5 course/resources.php
View
@@ -84,7 +84,11 @@
// 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 @@
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 @@
}
$currentsection = $cm->sectionnum;
}
- } else {
- $printsection = '<span class="smallinfo">'.userdate($resource->timemodified)."</span>";
}
$extra = empty($cm->extra) ? '' : $cm->extra;
@@ -131,11 +133,17 @@
$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);

0 comments on commit 0bc310e

Please sign in to comment.