mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
MDL-65621 block_myoverview: tag courses as "hidden from students"
This is intended to visually separate hidden course from open courses in the course overview block by applying a "Hidden from students" tag to the various views in this block. To achive this, the course summary exporter's output must be augmented with a "visiblity" attribute, carrying the given course's corresponding visibility setting. Since the exporter now expects this data point as part of its input, the output of the course_get_recent_courses() function had to also be augmented with the course visibility setting to provide this value.
This commit is contained in:
parent
fac49f8f72
commit
1606fb6812
6 changed files with 27 additions and 5 deletions
|
@ -29,7 +29,8 @@
|
|||
"fullname": "course 3",
|
||||
"hasprogress": true,
|
||||
"progress": 10,
|
||||
"coursecategory": "Miscellaneous"
|
||||
"coursecategory": "Miscellaneous",
|
||||
"visible": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
"fullname": "course 3",
|
||||
"hasprogress": true,
|
||||
"progress": 10,
|
||||
"coursecategory": "Miscellaneous"
|
||||
"coursecategory": "Miscellaneous",
|
||||
"visible": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -65,6 +66,11 @@
|
|||
</span>
|
||||
{{{fullname}}}
|
||||
</a>
|
||||
{{^visible}}
|
||||
<div class="d-flex flex-wrap">
|
||||
<span class="tag tag-info">{{#str}} hiddenfromstudents {{/str}}</span>
|
||||
</div>
|
||||
{{/visible}}
|
||||
</div>
|
||||
</div>
|
||||
{{#hasprogress}}
|
||||
|
|
|
@ -30,7 +30,8 @@
|
|||
"summary": "This course is about assignments",
|
||||
"hasprogress": true,
|
||||
"progress": 10,
|
||||
"coursecategory": "Miscellaneous"
|
||||
"coursecategory": "Miscellaneous",
|
||||
"visible": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -75,6 +76,11 @@
|
|||
</a>
|
||||
{{> block_myoverview/course-action-menu }}
|
||||
</div>
|
||||
{{^visible}}
|
||||
<div class="d-flex flex-wrap">
|
||||
<span class="tag tag-info">{{#str}} hiddenfromstudents {{/str}}</span>
|
||||
</div>
|
||||
{{/visible}}
|
||||
<div class="summary">
|
||||
<span class="sr-only">{{#str}}aria:coursesummary, block_myoverview{{/str}}</span>
|
||||
{{{summary}}}
|
||||
|
|
|
@ -105,6 +105,9 @@ class course_summary_exporter extends \core\external\exporter {
|
|||
),
|
||||
'enddate' => array(
|
||||
'type' => PARAM_INT,
|
||||
),
|
||||
'visible' => array(
|
||||
'type' => PARAM_BOOL,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -4593,7 +4593,7 @@ function course_get_recent_courses(int $userid = null, int $limit = 0, int $offs
|
|||
}
|
||||
|
||||
$basefields = array('id', 'idnumber', 'summary', 'summaryformat', 'startdate', 'enddate', 'category',
|
||||
'shortname', 'fullname', 'timeaccess', 'component');
|
||||
'shortname', 'fullname', 'timeaccess', 'component', 'visible');
|
||||
|
||||
$sort = trim($sort);
|
||||
if (empty($sort)) {
|
||||
|
|
|
@ -28,7 +28,8 @@
|
|||
"courseimage": "https://moodlesite/pluginfile/123/course/overviewfiles/123.jpg",
|
||||
"fullname": "course 3",
|
||||
"hasprogress": true,
|
||||
"progress": 10
|
||||
"progress": 10,
|
||||
"visible": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -63,6 +64,11 @@
|
|||
</span>
|
||||
{{$coursename}}{{/coursename}}
|
||||
</a>
|
||||
{{^visible}}
|
||||
<div class="d-flex flex-wrap">
|
||||
<span class="tag tag-info">{{#str}} hiddenfromstudents {{/str}}</span>
|
||||
</div>
|
||||
{{/visible}}
|
||||
</div>
|
||||
{{$menu}}{{/menu}}
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue