Skip to content

Commit

Permalink
Add link for teacher for access to closed course - refs BT#12493
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelFQC committed Mar 21, 2017
1 parent dba5aa7 commit 88de339
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
11 changes: 11 additions & 0 deletions main/inc/lib/course.lib.php
Expand Up @@ -3784,6 +3784,17 @@ public static function returnCoursesCategories($user_category_id, $load_dirs = f
$params['code_course'] = '(' . $course_info['visual_code'] . ') ';
}

$params['current_user_is_teacher'] = false;

/** @var array $teacher */
foreach ($teachers as $teacher) {
if ($teacher['id'] != $user_id) {
continue;
}

$params['current_user_is_teacher'] = true;
}

$params['visibility'] = $course_info['visibility'];
$params['link'] = $courseUrl;
$params['thumbnails'] = $thumbnails;
Expand Down
Expand Up @@ -9,7 +9,7 @@
{% for item in category.courses %}
<div class="row">
<div class="col-md-2">
{% if item.visibility == constant('COURSE_VISIBILITY_CLOSED') %}
{% if item.visibility == constant('COURSE_VISIBILITY_CLOSED') and not item.current_user_is_teacher %}
<span class="thumbnail">
{% if item.thumbnails != '' %}
<img src="{{ item.thumbnails }}" title="{{ item.title }}"
Expand Down Expand Up @@ -47,7 +47,7 @@
</div>
{% endif %}
<h4 class="course-items-title">
{% if item.visibility == constant('COURSE_VISIBILITY_CLOSED') %}
{% if item.visibility == constant('COURSE_VISIBILITY_CLOSED') and not item.current_user_is_teacher %}
{{ item.title }} {{ item.code_course }}
{% else %}
<a href="{{ item.link }}">
Expand Down
Expand Up @@ -5,7 +5,7 @@
<div class="panel-body">
<div class="row">
<div class="col-md-2">
{% if item.visibility == constant('COURSE_VISIBILITY_CLOSED') %}
{% if item.visibility == constant('COURSE_VISIBILITY_CLOSED') and not item.current_user_is_teacher %}
<span class="thumbnail">
{% if item.thumbnails != '' %}
<img src="{{ item.thumbnails }}" title="{{ item.title }}"
Expand Down Expand Up @@ -43,7 +43,7 @@
</div>
{% endif %}
<h4 class="course-items-title">
{% if item.visibility == constant('COURSE_VISIBILITY_CLOSED') %}
{% if item.visibility == constant('COURSE_VISIBILITY_CLOSED') and not item.current_user_is_teacher %}
{{ item.title }} {{ item.code_course }}
{% else %}
<a href="{{ item.link }}">
Expand Down
Expand Up @@ -57,7 +57,7 @@
</div>
<div class="description">
<h4 class="title">
{% if item.visibility == constant('COURSE_VISIBILITY_CLOSED') %}
{% if item.visibility == constant('COURSE_VISIBILITY_CLOSED') and not item.current_user_is_teacher %}
{{ item.title }} {{ item.code_course }}
{% else %}
<a href="{{ item.link }}">{{ item.title }} {{ item.code_course }}</a>
Expand Down
Expand Up @@ -54,7 +54,7 @@
</div>
<div class="description">
<h4 class="title">
{% if item.visibility == constant('COURSE_VISIBILITY_CLOSED') %}
{% if item.visibility == constant('COURSE_VISIBILITY_CLOSED') and not item.current_user_is_teacher %}
{{ item.title }} {{ item.code_course }}
{% else %}
<a href="{{ item.link }}">{{ item.title }} {{ item.code_course }}</a>
Expand Down

0 comments on commit 88de339

Please sign in to comment.