";
- echo "id\">";
+
+ // this is ok since this will get inherited from course category context
+ // if it is set
+ if (has_capability('moodle/category:update', $coursecontext)) {
+ echo "id\">";
+ } else {
+ echo "id\" disabled=\"disabled\">";
+ }
+
echo "
";
echo "
";
if (empty($THEME->custompix)) {
@@ -179,30 +190,47 @@
$pixpath = "$CFG->themedir/$CFG->theme/pix";
}
- echo "wwwroot/course/edit.php?id=$course->id\"> ";
-
- $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
+ // checks whether user can update course settings
+ if (has_capability('moodle/course:update', $coursecontext)) {
+ echo "wwwroot/course/edit.php?id=$course->id\"> ";
+ }
+
+ // checks whether user can do role assignment
if (has_capability('moodle/role:assign', $coursecontext)) {
echo'';
echo '';
}
-
- echo "id\"> ";
- if (!empty($course->visible)) {
- echo "id&sesskey=$USER->sesskey\"> ";
- } else {
- echo "id&sesskey=$USER->sesskey\"> ";
+
+ // checks whether user can delete course
+ if (has_capability('moodle/course:delete', $coursecontext)) {
+ echo "id\"> ";
+ }
+
+ // checks whether user can change visibility
+ if (has_capability('moodle/course:visibility', $coursecontext)) {
+ if (!empty($course->visible)) {
+ echo "id&sesskey=$USER->sesskey\"> ";
+ } else {
+ echo "id&sesskey=$USER->sesskey\"> ";
+ }
+ }
+
+ // checks whether user can do site backup
+ if (has_capability('moodle/site:backup', $coursecontext)) {
+ echo "id\"> ";
}
- echo "id\"> ";
-
- echo "id&wdir=/backupdata\"> ";
+ // checks whether user can do restore
+ if (has_capability('moodle/site:restore', $coursecontext)) {
+ echo "id&wdir=/backupdata\"> ";
+ }
+
echo "