Change table to show total result see BT#13099

pull/2487/head
jmontoyaa 8 years ago
parent 26e53437c2
commit 07b0dc8dcd
  1. 19
      main/admin/gradebook_dependency.php
  2. 57
      main/template/default/admin/gradebook_dependency.tpl

@ -57,7 +57,8 @@ $courseList = [];
/*$mandatoryList = api_get_configuration_value('gradebook_dependency_mandatory_courses');
$mandatoryList = isset($mandatoryList['courses']) ? $mandatoryList['courses'] : [];*/
$userResult = [];
$totalDependencies = count($dependencies);
foreach ($dependencies as $courseId) {
$courseInfo = api_get_course_info_by_id($courseId);
$courseCode = $courseInfo['code'];
@ -70,16 +71,23 @@ foreach ($dependencies as $courseId) {
$userList = CourseManager::get_student_list_from_course_code($courseCode);
$users = [];
foreach ($userList as $user) {
$userInfo = api_get_user_info($user['user_id']);
$userId = $user['user_id'];
$userInfo = api_get_user_info($userId);
$result = Category::userFinishedCourse(
$user['user_id'],
$userId,
$subCategory,
true
);
$userInfo['result'] = $result;
$users[] = $userInfo;
//$users[] = $userInfo;
$userResult[$userId]['result'][$courseCode] = $result;
$userResult[$userId]['user_info'] = $userInfo;
}
foreach ($userResult as $userId => &$userData) {
$userData['final_result'] = count(array_filter($userData['result'])) == $totalDependencies;
}
$courseInfo['users'] = $users;
//$courseInfo['users'] = $users;
//$courseInfo['is_mandatory'] = in_array($courseCode, $mandatoryList);
$courseList[] = $courseInfo;
}
@ -96,5 +104,6 @@ $tpl->assign(
$tpl->assign('gradebook_category', $category);
$tpl->assign('courses', $courseList);
$tpl->assign('users', $userResult);
$layout = $tpl->get_template('admin/gradebook_dependency.tpl');
$tpl->display($layout);

@ -2,37 +2,44 @@
{% block content %}
<h3>
{{ gradebook_category.name }}
{{ gradebook_category.name }}
{% if gradebook_category.courseCode is not empty %}
({{ gradebook_category.courseCode }})
{% endif %}
</h3>
<hr>
{% for course in courses %}
<h4>
{{ course.title }} ({{ course.code }})
</h4>
<table class="table">
<thead class="title">
<tr>
<th>{{ 'Users' | get_lang }}</th>
{% for course in courses %}
<th>
{{ course.title }} ({{ course.code }})
</th>
{% endfor %}
<th>{{ 'Total' | get_lang }}</th>
</tr>
</thead>
{% for user in users %}
<tr>
<td>{{ user.user_info.complete_name }}</td>
{% if course.users %}
<table class="table">
<thead class="title">
<tr>
<th>{{ 'Users' | get_lang }}</th>
<th>{{ 'Result' | get_lang }}</th>
</tr>
</thead>
{% for user in course.users %}
<tr>
<td>{{ user.complete_name }}</td>
<td>
{% if user.result %}
<img src="{{ 'check-circle.png'|icon(22) }}" />
{% else %}
{% endif %}
</td>
</tr>
{% for course in courses %}
<td>
{% if user.result[course.code] %}
<img src="{{ 'check-circle.png'|icon(22) }}" />
{% endif %}
</td>
{% endfor %}
</table>
{% endif %}
<td>
{% if user.final_result %}
<img src="{{ 'check-circle.png'|icon(22) }}" />
{% else %}
<img src="{{ 'warning.png'|icon(22) }}" />
{% endif %}
</td>
</tr>
{% endfor %}
</table>
{% endblock %}

Loading…
Cancel
Save