Skip to content

Commit

Permalink
Reporting: Add detailed report link to each user - refs BT#17648 #3461
Browse files Browse the repository at this point in the history
* Report: Added detailed report link to user BT#17648 - refs #3461

* Minor: Report: Flici fix BT#17648 - refs #3461

* Report: Change SELECT to INNER JOIN BT#17648 - refs #3461
  • Loading branch information
carlangas159 committed Nov 17, 2020
1 parent f6b80af commit 200ce2e
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions main/inc/lib/myspace.lib.php
Expand Up @@ -1175,21 +1175,23 @@ public static function displayResumeLP(
$lp_id = (int) $row['lp_id'];
$registeredUsers = self::getCompanyLearnpathSubscription($startDate, $endDate, $lp_id);
if (!empty($registeredUsers)) {
$lp_info = [];
$lpInfo = [];
$teacherList = [];
$teachersId = explode(',', trim($row['users_id'], ","));
$lp_table = Database::get_course_table(TABLE_LP_MAIN);
$query = "
SELECT *,
(select title from $tblCourse where course.id = c_lp.c_id) as courseTitle
SELECT $lp_table.*,
$tblCourse.title as courseTitle,
$tblCourse.code as courseCode
FROM
$lp_table
INNER JOIN $tblCourse ON $tblCourse.id = $lp_table.c_id
WHERE
id = $lp_id
$lp_table.iid = $lp_id
";
$res = Database::query($query);
if (Database::num_rows($res)) {
$lp_info = Database::fetch_array($res);
$lpInfo = Database::fetch_array($res);
}
$studentUsers = [];
for ($i = 0; $i < count($registeredUsers); $i++) {
Expand All @@ -1199,9 +1201,10 @@ public static function displayResumeLP(
for ($i = 0; $i < count($teachersId); $i++) {
$teacherId = $teachersId[$i];
$teacher = api_get_user_info($teacherId);
$data[$teacher['complete_name']][$lp_info['name']] = [
$data[$teacher['complete_name']][$lpInfo['name']] = [
'students' => count($studentUsers),
'studentList' => $studentUsers,
'lpInfo' => $lpInfo,
];
$teacherList[] = $teacher;
}
Expand Down Expand Up @@ -1231,6 +1234,7 @@ public static function displayResumeLP(
$hiddenField = 'student_show_'.$index;
$hiddenFieldLink = 'student_show_'.$index.'_';
$printTeacherName = ($teacherName == $teacherNameTemp) ? '' : $teacherName;
$lpInfo = $row['lpInfo'];
$teacherNameTemp = $teacherName;
$table .=
"<tr>".
Expand All @@ -1244,7 +1248,14 @@ public static function displayResumeLP(
"</a>".
"<div id='$hiddenField' class='hidden'>";
foreach ($row['studentList'] as $student) {
$table .= $student['complete_name']."<br>";
$reportLink = Display::url(
Display::return_icon('statistics.png', get_lang('Stats')),
api_get_path(WEB_CODE_PATH).'mySpace/myStudents.php?details=true&student='.
$student['id']
.'&id_session='.$lpInfo['session_id']
.'&course='.$lpInfo['courseCode']
);
$table .= "$reportLink ".$student['complete_name']."<br>";
$totalStudent++;
}
$index++;
Expand Down

0 comments on commit 200ce2e

Please sign in to comment.