|
|
|
@ -25,6 +25,7 @@ $skillTable = Database::get_main_table(TABLE_MAIN_SKILL); |
|
|
|
|
$skillRelUserTable = Database::get_main_table(TABLE_MAIN_SKILL_REL_USER); |
|
|
|
|
$courseTable = Database::get_main_table(TABLE_MAIN_COURSE); |
|
|
|
|
$tableRows = array(); |
|
|
|
|
$objSkill = new Skill(); |
|
|
|
|
$tpl = new Template(get_lang('Skills')); |
|
|
|
|
$tplPath = null; |
|
|
|
|
|
|
|
|
@ -32,41 +33,31 @@ $tpl->assign('allow_skill_tool', api_get_setting('allow_skills_tool') === 'true' |
|
|
|
|
$tpl->assign('allow_drh_skills_management', api_get_setting('allow_hr_skills_management') === 'true'); |
|
|
|
|
|
|
|
|
|
if ($isStudent) { |
|
|
|
|
$sql = "SELECT s.name, sru.acquired_skill_at, c.title, c.directory |
|
|
|
|
FROM $skillTable s |
|
|
|
|
INNER JOIN $skillRelUserTable sru |
|
|
|
|
ON s.id = sru.skill_id |
|
|
|
|
LEFT JOIN $courseTable c |
|
|
|
|
ON sru.course_id = c.id |
|
|
|
|
WHERE sru.user_id = $userId"; |
|
|
|
|
$result = Database::query($sql); |
|
|
|
|
while ($resultData = Database::fetch_assoc($result)) { |
|
|
|
|
$skills = $objSkill->getUserSkills($userId, true); |
|
|
|
|
$courseTempList = []; |
|
|
|
|
foreach ($skills as $resultData) { |
|
|
|
|
$courseId = $resultData['course_id']; |
|
|
|
|
|
|
|
|
|
if (!empty($courseId)) { |
|
|
|
|
if (isset($courseTempList[$courseId])) { |
|
|
|
|
$courseInfo = $courseTempList[$courseId]; |
|
|
|
|
} else { |
|
|
|
|
$courseInfo = api_get_course_info_by_id($courseId); |
|
|
|
|
$courseTempList[$courseId] = $courseInfo; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$tableRow = array( |
|
|
|
|
'skillName' => $resultData['name'], |
|
|
|
|
'achievedAt' => api_format_date($resultData['acquired_skill_at'], DATE_FORMAT_NUMBER), |
|
|
|
|
'courseImage' => Display::return_icon( |
|
|
|
|
'course.png', |
|
|
|
|
null, |
|
|
|
|
null, |
|
|
|
|
ICON_SIZE_MEDIUM, |
|
|
|
|
null, |
|
|
|
|
true |
|
|
|
|
), |
|
|
|
|
'courseName' => $resultData['title'] |
|
|
|
|
'skill_badge' => $resultData['icon_image'], |
|
|
|
|
'skill_name' => $resultData['name'], |
|
|
|
|
'achieved_at' => api_format_date($resultData['acquired_skill_at'], DATE_FORMAT_NUMBER), |
|
|
|
|
'course_image' => '', |
|
|
|
|
'course_name' => '' |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$imageSysPath = sprintf("%s%s/course-pic.png", api_get_path(SYS_COURSE_PATH), $resultData['directory']); |
|
|
|
|
|
|
|
|
|
if (file_exists($imageSysPath)) { |
|
|
|
|
$thumbSysPath = sprintf("%s%s/course-pic32.png", api_get_path(SYS_COURSE_PATH), $resultData['directory']); |
|
|
|
|
$thumbWebPath = sprintf("%s%s/course-pic32.png", api_get_path(WEB_COURSE_PATH), $resultData['directory']); |
|
|
|
|
|
|
|
|
|
if (!file_exists($thumbSysPath)) { |
|
|
|
|
$courseImageThumb = new Image($imageSysPath); |
|
|
|
|
$courseImageThumb->resize(32); |
|
|
|
|
$courseImageThumb->send_image($thumbSysPath); |
|
|
|
|
} |
|
|
|
|
$tableRow['courseImage'] = $thumbWebPath; |
|
|
|
|
if (!empty($courseInfo)) { |
|
|
|
|
$tableRow['course_image'] = $courseInfo['course_image_source']; |
|
|
|
|
$tableRow['course_name'] = $courseInfo['title']; |
|
|
|
|
} |
|
|
|
|
$tableRows[] = $tableRow; |
|
|
|
|
} |
|
|
|
@ -143,8 +134,6 @@ if ($isStudent) { |
|
|
|
|
|
|
|
|
|
$tableRows = array(); |
|
|
|
|
$reportTitle = null; |
|
|
|
|
|
|
|
|
|
$objSkill = new Skill(); |
|
|
|
|
$skills = $objSkill->get_all(); |
|
|
|
|
|
|
|
|
|
switch ($action) { |
|
|
|
|