Improve template in skills report for student boss #2892

pull/2901/head
Angel Fernando Quiroz Campos 7 years ago
parent 92dcd2507e
commit dcf36bc75a
  1. 18
      main/social/my_skills_report.php
  2. 47
      main/template/default/skill/student_boss_report.tpl

@ -47,15 +47,26 @@ if ($isStudent) {
$tpl->assign('skill_table', $result['table']);
$tplPath = 'skill/student_report.tpl';
} elseif ($isStudentBoss) {
$selectedStudent = isset($_REQUEST['student']) ? (int) $_REQUEST['student'] : 0;
$tableRows = [];
$followedStudents = UserManager::getUsersFollowedByStudentBoss($userId);
$frmStudents = new FormValidator('students', 'get');
$slcStudent = $frmStudents->addSelect(
'student',
get_lang('Student'),
['0' => get_lang('Select')]
);
$frmStudents->addButtonSearch(get_lang('Search'));
foreach ($followedStudents as &$student) {
$student['completeName'] = api_get_person_name($student['firstname'], $student['lastname']);
$slcStudent->addOption($student['completeName'], $student['user_id']);
}
if ($selectedStudent > 0) {
if ($frmStudents->validate()) {
$selectedStudent = (int) $frmStudents->exportValue('student');
$sql = "SELECT s.name, sru.acquired_skill_at, c.title, c.directory
FROM $skillTable s
INNER JOIN $skillRelUserTable sru
@ -109,8 +120,7 @@ if ($isStudent) {
}
$tplPath = 'skill/student_boss_report.tpl';
$tpl->assign('followed_students', $followedStudents);
$tpl->assign('selected_student', $selectedStudent);
$tpl->assign('form', $frmStudents->returnForm());
} elseif ($isDRH) {
$selectedCourse = isset($_REQUEST['course']) ? intval($_REQUEST['course']) : null;
$selectedSkill = isset($_REQUEST['skill']) ? intval($_REQUEST['skill']) : 0;

@ -8,38 +8,33 @@
<h1 class="page-header">{{ 'SkillsAcquired' | get_lang }}</h1>
<form class="form-inline" method="post" action="{{ _p.web_self }}">
<label>{{ 'Students' | get_lang }}</label>
<select name="student" id="student">
<option value="0">{{ 'Select' | get_lang }}</option>
{% for student in followed_students %}
<option value="{{ student.user_id }}" {{ (student.user_id == selected_student) ? 'selected' : '' }}>
{{ student.completeName }}
</option>
{% endfor %}
</select>
<button type="submit" class="btn btn-primary">{{ 'Search' | get_lang }}</button>
</form>
{{ form }}
{% if rows %}
<table class="table">
<thead>
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>{{ 'Student' | get_lang }}</th>
<th>{{ 'SkillsAcquired' | get_lang }}</th>
<th>{{ 'Date' | get_lang }}</th>
<th>{{ 'Course' | get_lang }}</th>
</tr>
</thead>
<tbody>
{% for row in rows %}
<tr>
<td>{{ row.complete_name }}</td>
<td>{{ row.skill_name }}</td>
<td>{{ row.achieved_at }}</td>
<td><img src="{{ row.course_image }}" alt="{{ row.course_name }}"> {{ row.course_name }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</thead>
<tbody>
{% for row in rows %}
<tr>
<td>{{ row.complete_name }}</td>
<td>{{ row.skill_name }}</td>
<td>{{ row.achieved_at }}</td>
<td>
{% if not row.course_name is empty %}
<img src="{{ row.course_image }}" alt="{{ row.course_name }}"> {{ row.course_name }}
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}

Loading…
Cancel
Save