parent
9d98f83a95
commit
eaec0034a9
@ -0,0 +1,72 @@ |
|||||||
|
<?php |
||||||
|
/* For licensing terms, see /license.txt */ |
||||||
|
/** |
||||||
|
* Skills reporting |
||||||
|
* @package chamilo.reporting |
||||||
|
*/ |
||||||
|
require_once '../inc/global.inc.php'; |
||||||
|
|
||||||
|
if (!api_is_student_boss()) { |
||||||
|
api_not_allowed(); |
||||||
|
} |
||||||
|
|
||||||
|
$this_section = SECTION_TRACKING; |
||||||
|
|
||||||
|
$interbreadcrumb[] = array("url" => "index.php", "name" => get_lang('MySpace')); |
||||||
|
|
||||||
|
$toolName = get_lang('Skills'); |
||||||
|
|
||||||
|
$userId = api_get_user_id(); |
||||||
|
$selectedStudent = isset($_REQUEST['student']) ? intval($_REQUEST['student']) : 0; |
||||||
|
|
||||||
|
$tableRows = array(); |
||||||
|
|
||||||
|
$followedStudents = UserManager::getUsersFollowedByStudentBoss($userId); |
||||||
|
|
||||||
|
$skillTable = Database::get_main_table(TABLE_MAIN_SKILL); |
||||||
|
$skillRelUserTable = Database::get_main_table(TABLE_MAIN_SKILL_REL_USER); |
||||||
|
$userTable = Database::get_main_table(TABLE_MAIN_USER); |
||||||
|
$courseTable = Database::get_main_table(TABLE_MAIN_COURSE); |
||||||
|
|
||||||
|
foreach ($followedStudents as &$student) { |
||||||
|
$student['completeName'] = api_get_person_name($student['firstname'], $student['lastname']); |
||||||
|
} |
||||||
|
|
||||||
|
if ($selectedStudent > 0) { |
||||||
|
$sql = "SELECT s.name, sru.acquired_skill_at, c.title c_name, c.directory c_directory " |
||||||
|
. "FROM $skillTable s " |
||||||
|
. "INNER JOIN $skillRelUserTable sru ON s.id = sru.skill_id " |
||||||
|
. "INNER JOIN $courseTable c ON sru.course_id = c.id " |
||||||
|
. "WHERE sru.user_id = $selectedStudent"; |
||||||
|
|
||||||
|
$result = Database::query($sql); |
||||||
|
|
||||||
|
while ($resultData = Database::fetch_assoc($result)) { |
||||||
|
$row = array( |
||||||
|
'completeName' => $followedStudents[$selectedStudent]['completeName'], |
||||||
|
'achievedAt' => api_format_date($resultData['acquired_skill_at'], DATE_FORMAT_NUMBER) |
||||||
|
); |
||||||
|
|
||||||
|
if (file_exists(api_get_path(SYS_COURSE_PATH) . "{$resultData['c_directory']}/course-pic85x85.png")) { |
||||||
|
$row['courseImage'] = api_get_path(WEB_COURSE_PATH) . "{$resultData['c_directory']}/course-pic85x85.png"; |
||||||
|
} else { |
||||||
|
$row['courseImage'] = Display::return_icon('course.png', null, null, ICON_SIZE_BIG, null, true); |
||||||
|
} |
||||||
|
|
||||||
|
$tableRows[] = array_merge($resultData, $row); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/* |
||||||
|
* View |
||||||
|
*/ |
||||||
|
$tpl = new Template($toolName); |
||||||
|
|
||||||
|
$tpl->assign('followedStudents', $followedStudents); |
||||||
|
$tpl->assign('selectedStudent', $selectedStudent); |
||||||
|
|
||||||
|
$tpl->assign('rows', $tableRows); |
||||||
|
|
||||||
|
$contentTemplate = $tpl->get_template('my_space/team_skills.tpl'); |
||||||
|
|
||||||
|
$tpl->display($contentTemplate); |
||||||
@ -0,0 +1,57 @@ |
|||||||
|
{% extends "default/layout/main.tpl" %} |
||||||
|
|
||||||
|
{% block body %} |
||||||
|
<div class="span12"> |
||||||
|
<div class="actions"> |
||||||
|
<a href="{{ _p.web_main }}auth/my_progress.php"> |
||||||
|
<img src="{{ _p.web_img }}icons/32/stats.png" alt="{{ 'MyStats' | get_lang }}" title="{{ 'MyStats' | get_lang }}"> |
||||||
|
</a> |
||||||
|
<a href="{{ _p.web_main }}mySpace/student.php"> |
||||||
|
<img src="{{ _p.web_img }}icons/32/user.png" alt="{{ 'Students' | get_lang }}" title="{{ 'Students' | get_lang }}"> |
||||||
|
</a> |
||||||
|
<a href="#"> |
||||||
|
<img src="{{ _p.web_img }}icons/32/skills.png" alt="Competencias" title="Competencias"> |
||||||
|
</a> |
||||||
|
</div> |
||||||
|
|
||||||
|
<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 followedStudents %} |
||||||
|
<option value="{{ student.user_id }}" {{ (student.user_id == selectedStudent) ? 'selected' : '' }}>{{ student.completeName }}</option> |
||||||
|
{% endfor %} |
||||||
|
</select> |
||||||
|
<button type="submit" class="btn btn-primary">{{ 'Search' | get_lang }}</button> |
||||||
|
</form> |
||||||
|
|
||||||
|
{% if rows %} |
||||||
|
<table class="table"> |
||||||
|
<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.completeName }}</td> |
||||||
|
<td>{{ row.name }}</td> |
||||||
|
<td>{{ row.achievedAt }}</td> |
||||||
|
<td><img src="{{ row.courseImage }}" alt="{{ row.c_name }}" width="64"> {{ row.c_name }}</td> |
||||||
|
</tr> |
||||||
|
{% endfor %} |
||||||
|
</tbody> |
||||||
|
</table> |
||||||
|
{% else %} |
||||||
|
<div class="alert alert-info"> |
||||||
|
{{ 'NoResults' | get_lang }} |
||||||
|
</div> |
||||||
|
{% endif %} |
||||||
|
</div> |
||||||
|
{% endblock %} |
||||||
Loading…
Reference in new issue