parent
990fdf1a97
commit
41380c91c3
@ -0,0 +1,82 @@ |
|||||||
|
<?php |
||||||
|
/* For licensing terms, see /license.txt */ |
||||||
|
/** |
||||||
|
* Skills reporting |
||||||
|
* @package chamilo.reporting |
||||||
|
*/ |
||||||
|
require_once '../inc/global.inc.php'; |
||||||
|
|
||||||
|
$this_section = SECTION_TRACKING; |
||||||
|
|
||||||
|
$interbreadcrumb[] = array("url" => "index.php", "name" => get_lang('MySpace')); |
||||||
|
|
||||||
|
$toolName = get_lang('Skills'); |
||||||
|
|
||||||
|
$selectedCourse = isset($_REQUEST['course']) ? intval($_REQUEST['course']) : null; |
||||||
|
$selectedSkill = isset($_REQUEST['skill']) ? intval($_REQUEST['skill']) : 0; |
||||||
|
|
||||||
|
$action = null; |
||||||
|
|
||||||
|
if (!empty($selectedCourse)) { |
||||||
|
$action = 'filterByCourse'; |
||||||
|
} else if (!empty($selectedSkill)) { |
||||||
|
$action = 'filterBySkill'; |
||||||
|
} |
||||||
|
|
||||||
|
$userId = api_get_user_id(); |
||||||
|
|
||||||
|
$courses = CourseManager::getCoursesFollowedByUser( |
||||||
|
$userId, DRH, null, null, null, null, false |
||||||
|
); |
||||||
|
|
||||||
|
$tableRows = array(); |
||||||
|
$reportTitle = null; |
||||||
|
|
||||||
|
$objSkill = new Skill(); |
||||||
|
$skills = $objSkill->get_all(); |
||||||
|
|
||||||
|
switch ($action) { |
||||||
|
case 'filterByCourse': |
||||||
|
$course = api_get_course_info_by_id($selectedCourse); |
||||||
|
|
||||||
|
$reportTitle = sprintf(get_lang('AchievedSkillByCourseX'), $course['name']); |
||||||
|
|
||||||
|
$tableRows = $objSkill->listAchievedByCourse($selectedCourse); |
||||||
|
break; |
||||||
|
case 'filterBySkill': |
||||||
|
$skill = $objSkill->get($selectedSkill); |
||||||
|
|
||||||
|
$reportTitle = sprintf(get_lang('StudentsWhoAchievedTheSkillX'), $skill['name']); |
||||||
|
|
||||||
|
$students = UserManager::getUsersFollowedByUser($userId, STUDENT, false, false, false, null, null, null, null, |
||||||
|
null, null, DRH); |
||||||
|
|
||||||
|
foreach ($students as $student) { |
||||||
|
$tableRows = $objSkill->listUsersWhoAchieved($selectedSkill, $student['user_id']); |
||||||
|
} |
||||||
|
|
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
foreach ($tableRows as &$row) { |
||||||
|
$row['completeName'] = api_get_person_name($row['firstname'], $row['lastname']); |
||||||
|
$row['achievedAt'] = api_format_date($row['acquired_skill_at'], DATE_FORMAT_NUMBER); |
||||||
|
} |
||||||
|
|
||||||
|
/* |
||||||
|
* View |
||||||
|
*/ |
||||||
|
$tpl = new Template($toolName); |
||||||
|
|
||||||
|
$tpl->assign('courses', $courses); |
||||||
|
$tpl->assign('skills', $skills); |
||||||
|
|
||||||
|
$tpl->assign('selectedCourse', $selectedCourse); |
||||||
|
$tpl->assign('selectedSkill', $selectedSkill); |
||||||
|
|
||||||
|
$tpl->assign('reportTitle', $reportTitle); |
||||||
|
$tpl->assign('rows', $tableRows); |
||||||
|
|
||||||
|
$contentTemplate = $tpl->get_template('my_space/skills.tpl'); |
||||||
|
|
||||||
|
$tpl->display($contentTemplate); |
||||||
@ -0,0 +1,84 @@ |
|||||||
|
{% 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="Ver mis estadísticas" title="Ver mis estadísticas"> |
||||||
|
</a> |
||||||
|
<a href="{{ _p.web_main }}mySpace/student.php"> |
||||||
|
<img src="{{ _p.web_img }}icons/32/user.png" alt="Estudiantes" title="Estudiantes"> |
||||||
|
</a> |
||||||
|
<a href="{{ _p.web_main }}mySpace/teachers.php"> |
||||||
|
<img src="{{ _p.web_img }}icons/32/teacher.png" alt="Profesores" title="Profesores"> |
||||||
|
</a> |
||||||
|
<a href="{{ _p.web_main }}mySpace/course.php"> |
||||||
|
<img src="{{ _p.web_img }}icons/32/course.png" alt="Cursos" title="Cursos"> |
||||||
|
</a> |
||||||
|
<a href="{{ _p.web_main }}mySpace/session.php"> |
||||||
|
<img src="{{ _p.web_img }}icons/32/session.png" alt="Sesiones de formación" title="Sesiones de formación"> |
||||||
|
</a> |
||||||
|
<a href="{{ _p.web_main }}mySpace/skills.php"> |
||||||
|
<img src="{{ _p.web_img }}icons/32/skills.png" alt="Competencias" title="Competencias"> |
||||||
|
</a> |
||||||
|
</div> |
||||||
|
|
||||||
|
<h1 class="page-header">{{ 'Skills' | get_lang }}</h1> |
||||||
|
|
||||||
|
<div class="row"> |
||||||
|
<div class="span6"> |
||||||
|
<form class="form-inline" method="post" action="{{ _p.web_self }}"> |
||||||
|
<label for="course">{{ 'Courses' | get_lang }}</label> |
||||||
|
<select name="course" id="course"> |
||||||
|
<option value="0">{{ 'Select' | get_lang }}</option> |
||||||
|
{% for course in courses %} |
||||||
|
<option value="{{ course.id }}" {{ (course.id == selectedCourse) ? 'selected' : '' }}>{{ course.title }}</option> |
||||||
|
{% endfor %} |
||||||
|
</select> |
||||||
|
<button type="submit" class="btn">{{ 'Filter' | get_lang }}</button> |
||||||
|
</form> |
||||||
|
</div> |
||||||
|
<div class="span6"> |
||||||
|
<form class="form-inline" method="post" action="{{ _p.web_self }}"> |
||||||
|
<label for="skill">{{ 'Skills' | get_lang }}</label> |
||||||
|
<select name="skill" id="skill"> |
||||||
|
<option value="0">{{ 'Select' | get_lang }}</option> |
||||||
|
{% for skill in skills %} |
||||||
|
<option value="{{ skill.id }}" {{ (skill.id == selectedSkill) ? 'selected' : '' }}>{{ skill.name }}</option> |
||||||
|
{% endfor %} |
||||||
|
</select> |
||||||
|
<button type="submit" class="btn">{{ 'Filter' | get_lang }}</button> |
||||||
|
</form> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
<h2 class="page-header">{{ reportTitle }} <small>{{ reportSubTitle }}</small></h2> |
||||||
|
|
||||||
|
{% if rows %} |
||||||
|
<table class="table"> |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<th>{{ 'Course' | get_lang }}</th> |
||||||
|
<th>{{ 'Skill' | get_lang }}</th> |
||||||
|
<th>{{ 'Student' | get_lang }}</th> |
||||||
|
<th>{{ 'Date' | get_lang }}</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
{% for row in rows %} |
||||||
|
<tr> |
||||||
|
<td>{{ row.c_name }}</td> |
||||||
|
<td>{{ row.skill_name }}</td> |
||||||
|
<td>{{ row.completeName }}</td> |
||||||
|
<td>{{ row.achievedAt }}</td> |
||||||
|
</tr> |
||||||
|
{% endfor %} |
||||||
|
</tbody> |
||||||
|
</table> |
||||||
|
{% else %} |
||||||
|
<div class="alert alert-info"> |
||||||
|
{{ 'NoResults' | get_lang }} |
||||||
|
</div> |
||||||
|
{% endif %} |
||||||
|
</div> |
||||||
|
{% endblock %} |
||||||
Loading…
Reference in new issue