1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* For licensing terms, see /license.txt */ |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Class MyStudents. |
7
|
|
|
*/ |
8
|
|
|
class MyStudents |
9
|
|
|
{ |
10
|
|
|
public static function getBlockForCareers(int $studentId): ?string |
11
|
|
|
{ |
12
|
|
|
if (!api_get_configuration_value('allow_career_users')) { |
13
|
|
|
return null; |
14
|
|
|
} |
15
|
|
|
|
16
|
|
|
$careers = UserManager::getUserCareers($studentId); |
17
|
|
|
|
18
|
|
|
if (empty($careers)) { |
19
|
|
|
return null; |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
$webCodePath = api_get_path(WEB_CODE_PATH); |
23
|
|
|
$langDiagram = get_lang('Diagram'); |
24
|
|
|
|
25
|
|
|
$headers = [ |
26
|
|
|
get_lang('Career'), |
27
|
|
|
get_lang('Diagram'), |
28
|
|
|
]; |
29
|
|
|
|
30
|
|
|
$data = array_map( |
31
|
|
|
function (array $careerData) use ($webCodePath, $langDiagram) { |
32
|
|
|
$url = $webCodePath.'user/career_diagram.php?career_id='.$careerData['id']; |
33
|
|
|
|
34
|
|
|
return [ |
35
|
|
|
$careerData['name'], |
36
|
|
|
Display::url($langDiagram, $url), |
37
|
|
|
]; |
38
|
|
|
}, |
39
|
|
|
$careers |
40
|
|
|
); |
41
|
|
|
|
42
|
|
|
$table = new HTML_Table(['class' => 'table table-hover table-striped data_table']); |
43
|
|
|
$table->setHeaders($headers); |
44
|
|
|
$table->setData($data); |
45
|
|
|
|
46
|
|
|
return Display::page_subheader(get_lang('Careers'), null, 'h3', ['class' => 'section-title']) |
47
|
|
|
.$table->toHtml(); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
public static function getBlockForSkills(int $studentId, int $courseId, int $sessionId): string |
51
|
|
|
{ |
52
|
|
|
$allowAll = api_get_configuration_value('allow_teacher_access_student_skills'); |
53
|
|
|
|
54
|
|
|
if ($allowAll) { |
55
|
|
|
// Show all skills |
56
|
|
|
return Tracking::displayUserSkills($studentId, 0, 0, true); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
// Default behaviour - Show all skills depending the course and session id |
60
|
|
|
return Tracking::displayUserSkills($studentId, $courseId, $sessionId); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
public static function getBlockForClasses($student_id): ?string |
64
|
|
|
{ |
65
|
|
|
$userGroupManager = new UserGroup(); |
66
|
|
|
$userGroups = $userGroupManager->getNameListByUser( |
67
|
|
|
$student_id, |
68
|
|
|
UserGroup::NORMAL_CLASS |
69
|
|
|
); |
70
|
|
|
|
71
|
|
|
if (empty($userGroups)) { |
72
|
|
|
return null; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
$headers = [get_lang('Classes')]; |
76
|
|
|
$data = array_map( |
77
|
|
|
function ($class) { |
78
|
|
|
return [$class]; |
79
|
|
|
}, |
80
|
|
|
$userGroups |
81
|
|
|
); |
82
|
|
|
|
83
|
|
|
$table = new HTML_Table(['class' => 'table table-hover table-striped data_table']); |
84
|
|
|
$table->setHeaders($headers); |
85
|
|
|
$table->setData($data); |
86
|
|
|
|
87
|
|
|
return $table->toHtml(); |
88
|
|
|
} |
89
|
|
|
} |
90
|
|
|
|