Skip to content

Commit

Permalink
MDL-67751 course: include inline folders in list of resources.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulholden committed Apr 15, 2020
1 parent 1d4fdb0 commit 2c469d3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions blocks/activity_modules/block_activity_modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ function get_content() {
$archetypes = array();

foreach($modinfo->cms as $cm) {
// Exclude activities which are not visible or have no link (=label)
if (!$cm->uservisible or !$cm->has_view()) {
// Exclude activities that aren't visible or have no view link (e.g. label). Account for folder being displayed inline.
if (!$cm->uservisible || (!$cm->has_view() && strcmp($cm->modname, 'folder') !== 0)) {
continue;
}
if (array_key_exists($cm->modname, $modfullnames)) {
Expand Down
11 changes: 5 additions & 6 deletions course/resources.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,8 @@
if (!in_array($cm->modname, $availableresources)) {
continue;
}
if (!$cm->uservisible) {
continue;
}
if (!$cm->has_view()) {
// Exclude label and similar
// Exclude activities that aren't visible or have no view link (e.g. label). Account for folder being displayed inline.
if (!$cm->uservisible || (!$cm->has_view() && strcmp($cm->modname, 'folder') !== 0)) {
continue;
}
$cms[$cm->id] = $cm;
Expand Down Expand Up @@ -140,9 +137,11 @@
}

$class = $cm->visible ? '' : 'class="dimmed"'; // hidden modules are dimmed
$url = $cm->url ?: new moodle_url("/mod/{$cm->modname}/view.php", ['id' => $cm->id]);

$table->data[] = array (
$printsection,
"<a $class $extra href=\"".$cm->url."\">".$icon.$cm->get_formatted_name()."</a>",
"<a $class $extra href=\"" . $url ."\">" . $icon . $cm->get_formatted_name() . "</a>",
$intro);
}

Expand Down
3 changes: 2 additions & 1 deletion report/log/classes/renderable.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ public function get_activities_list() {
$section = 0;
$thissection = array();
foreach ($modinfo->cms as $cm) {
if (!$cm->uservisible || !$cm->has_view()) {
// Exclude activities that aren't visible or have no view link (e.g. label). Account for folders displayed inline.
if (!$cm->uservisible || (!$cm->has_view() && strcmp($cm->modname, 'folder') !== 0)) {
continue;
}
if ($cm->sectionnum > 0 and $section <> $cm->sectionnum) {
Expand Down
3 changes: 2 additions & 1 deletion report/log/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,8 @@ function report_log_print_mnet_selector_form($hostid, $course, $selecteduser=0,
$section = 0;
$thissection = array();
foreach ($modinfo->cms as $cm) {
if (!$cm->uservisible || !$cm->has_view()) {
// Exclude activities that aren't visible or have no view link (e.g. label). Account for folder being displayed inline.
if (!$cm->uservisible || (!$cm->has_view() && strcmp($cm->modname, 'folder') !== 0)) {
continue;
}
if ($cm->sectionnum > 0 and $section <> $cm->sectionnum) {
Expand Down

0 comments on commit 2c469d3

Please sign in to comment.