diff --git a/public/main/admin/dashboard_add_users_to_user.php b/public/main/admin/dashboard_add_users_to_user.php
index 1fd3f453c1..6703a4591c 100644
--- a/public/main/admin/dashboard_add_users_to_user.php
+++ b/public/main/admin/dashboard_add_users_to_user.php
@@ -109,12 +109,12 @@ function search_users($needle, $type = 'multiple')
$order_clause
";
} else {
- $sql = "SELECT user_id, username, lastname, firstname
+ $sql = "SELECT id as user_id, username, lastname, firstname
FROM $tbl_user user
WHERE
".(api_sort_by_first_name() ? 'firstname' : 'lastname')." LIKE '$needle%' AND
status NOT IN(".DRH.', '.SESSIONADMIN.', '.STUDENT_BOSS.") AND
- user_id NOT IN ($user_anonymous, $current_user_id, $user_id)
+ id NOT IN ($user_anonymous, $current_user_id, $user_id)
$without_assigned_users
$order_clause
";
@@ -397,20 +397,20 @@ if (api_is_multiple_url_enabled()) {
$sql = "SELECT user.id as user_id, username, lastname, firstname
FROM $tbl_user user
LEFT JOIN $tbl_access_url_rel_user au
- ON (au.user_id = user.user_id)
+ ON (au.user_id = user.id)
WHERE
$without_assigned_users
- user.user_id NOT IN ($user_anonymous, $current_user_id, $user_id) AND
+ user.id NOT IN ($user_anonymous, $current_user_id, $user_id) AND
status NOT IN(".DRH.', '.SESSIONADMIN.', '.ANONYMOUS.") $search_user AND
access_url_id = ".api_get_current_access_url_id()."
$sqlConditions
ORDER BY firstname";
} else {
- $sql = "SELECT user_id, username, lastname, firstname
+ $sql = "SELECT id as user_id, username, lastname, firstname
FROM $tbl_user user
WHERE
$without_assigned_users
- user_id NOT IN ($user_anonymous, $current_user_id, $user_id) AND
+ id NOT IN ($user_anonymous, $current_user_id, $user_id) AND
status NOT IN(".DRH.', '.SESSIONADMIN.', '.ANONYMOUS.")
$search_user
$sqlConditions
diff --git a/public/main/admin/user_list.php b/public/main/admin/user_list.php
index 97500935e9..2d5733f07c 100644
--- a/public/main/admin/user_list.php
+++ b/public/main/admin/user_list.php
@@ -597,9 +597,9 @@ function modify_filter($user_id, $url_params, $row)
if (api_is_platform_admin()) {
if (!$user_is_anonymous) {
$result .= ''.
- Display::return_icon('info2.png', get_lang('Informationrmation')).' ';
+ Display::return_icon('info2.png', get_lang('Information')).' ';
} else {
- $result .= Display::return_icon('info2_na.png', get_lang('Informationrmation')).' ';
+ $result .= Display::return_icon('info2_na.png', get_lang('Information')).' ';
}
}
diff --git a/public/main/admin/user_list_consent.php b/public/main/admin/user_list_consent.php
index d31daa49ab..8be9cb37f8 100644
--- a/public/main/admin/user_list_consent.php
+++ b/public/main/admin/user_list_consent.php
@@ -644,7 +644,7 @@ $toolbarActions = Display::toolbarAction(
);
$noticeMessage = sprintf(
- get_lang('InformationrmationRightToBeForgottenLinkX'),
+ get_lang("You can find more information about the user's right to be forgotten through the following page: %s"),
'https://gdpr-info.eu/art-17-gdpr/'
);
$notice = Display::return_message($noticeMessage, 'normal', false);
diff --git a/public/main/inc/lib/api.lib.php b/public/main/inc/lib/api.lib.php
index a0b36b78d9..e315c2c5e8 100644
--- a/public/main/inc/lib/api.lib.php
+++ b/public/main/inc/lib/api.lib.php
@@ -2081,10 +2081,10 @@ function api_get_anonymous_id()
if ($max >= 2) {
$sql = "SELECT * FROM $table as TEL
JOIN $tableU as U
- ON U.user_id = TEL.login_user_id
+ ON U.id = TEL.login_user_id
WHERE TEL.user_ip = '$ip'
AND U.status = ".ANONYMOUS."
- AND U.user_id != 2 ";
+ AND U.id != 2 ";
$result = Database::query($sql);
if (empty(Database::num_rows($result))) {
@@ -2108,19 +2108,19 @@ function api_get_anonymous_id()
} else {
$row = Database::fetch_array($result, 'ASSOC');
- return $row['user_id'];
+ return $row['id'];
}
}
$table = Database::get_main_table(TABLE_MAIN_USER);
- $sql = "SELECT user_id
+ $sql = "SELECT id
FROM $table
WHERE status = ".ANONYMOUS." ";
$res = Database::query($sql);
if (Database::num_rows($res) > 0) {
$row = Database::fetch_array($res, 'ASSOC');
- return $row['user_id'];
+ return $row['id'];
}
// No anonymous user was found.
@@ -3088,7 +3088,7 @@ function api_get_user_status($user_id = null)
$user_id = api_get_user_id();
}
$table = Database::get_main_table(TABLE_MAIN_USER);
- $sql = "SELECT status FROM $table WHERE user_id = $user_id ";
+ $sql = "SELECT status FROM $table WHERE id = $user_id ";
$result = Database::query($sql);
$status = null;
if (Database::num_rows($result)) {
@@ -5705,7 +5705,7 @@ function api_is_course_visible_for_user($userid = null, $cid = null)
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$sql = "SELECT status FROM $tbl_user
- WHERE user_id = $userid
+ WHERE id = $userid
LIMIT 1";
$result = Database::query($sql);
diff --git a/public/main/inc/lib/attendance.lib.php b/public/main/inc/lib/attendance.lib.php
index e7d0ec430a..d975a14fcb 100644
--- a/public/main/inc/lib/attendance.lib.php
+++ b/public/main/inc/lib/attendance.lib.php
@@ -25,13 +25,24 @@ class Attendance
/**
* Get attendance list only the id, name and attendance_qualify_max fields.
*
- * @param int $course_id course db name (optional)
- * @param int $session_id session id (optional)
+ * @param int $courseId
+ * @param int $sessionId
*
* @return array attendances list
*/
- public function get_attendances_list($course_id = 0, $session_id = 0)
+ public function get_attendances_list($courseId = 0, $sessionId = 0)
{
+ $repo = Container::getAttendanceRepository();
+
+ $course = api_get_course_entity($courseId);
+ $session = api_get_session_entity($sessionId);
+
+ $qb = $repo->getResourcesByCourse($course, $session, null);
+ //$qb->select('resource');
+ $qb->andWhere('resource.active = 1');
+
+ return $qb->getQuery()->getResult();
+
$table = Database::get_course_table(TABLE_ATTENDANCE);
$course_id = (int) $course_id;
if (empty($course_id)) {
diff --git a/public/main/inc/lib/course.lib.php b/public/main/inc/lib/course.lib.php
index 07c35c6407..49db543187 100644
--- a/public/main/inc/lib/course.lib.php
+++ b/public/main/inc/lib/course.lib.php
@@ -6,6 +6,7 @@ use Chamilo\CoreBundle\Entity\AccessUrlRelSession;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\ExtraField as EntityExtraField;
use Chamilo\CoreBundle\Entity\SequenceResource;
+use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CoreBundle\Repository\CourseRepository;
use Chamilo\CoreBundle\Repository\SequenceResourceRepository;
@@ -1075,9 +1076,8 @@ class CourseManager
'c_id' => $courseId,
'visible' => $visible,
];
- $insertId = Database::insert($courseUserTable, $params);
- return $insertId;
+ return Database::insert($courseUserTable, $params);
}
/**
@@ -1145,24 +1145,38 @@ class CourseManager
}
/**
- * @param int $user_id
- * @param string $startsWith Optional
+ * @param int $userId
+ * @param string $keyword
*
* @return array an array with the course info of all the courses (real and virtual)
* of which the current user is course admin
*/
- public static function get_course_list_of_user_as_course_admin($user_id, $startsWith = '')
+ public static function get_course_list_of_user_as_course_admin($userId, $keyword = '')
{
- if ($user_id != strval(intval($user_id))) {
+ $user = api_get_user_entity($userId);
+
+ if (null === $user) {
return [];
}
+ $url = api_get_url_entity();
+ $user = api_get_user_entity($userId);
+
+ $repo = Container::getUserRepository();
+
+ return $repo->getCourses($user, $url, COURSEMANAGER, $keyword);
+
+
// Definitions database tables and variables
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$tblCourseCategory = Database::get_main_table(TABLE_MAIN_CATEGORY);
- $user_id = intval($user_id);
- $data = [];
+ $userId = (int) $userId;
+
+
+ if (empty($userId)) {
+ return [];
+ }
$sql = "SELECT
course.code,
@@ -1173,9 +1187,10 @@ class CourseManager
FROM $tbl_course_user as course_rel_user
INNER JOIN $tbl_course as course
ON course.id = course_rel_user.c_id
- LEFT JOIN $tblCourseCategory ON course.category_id = $tblCourseCategory.id
+ LEFT JOIN $tblCourseCategory
+ ON course.category_id = $tblCourseCategory.id
WHERE
- course_rel_user.user_id = $user_id AND
+ course_rel_user.user_id = $userId AND
course_rel_user.status = 1
";
@@ -1196,23 +1211,23 @@ class CourseManager
ON (course_rel_url.c_id = course.id)
WHERE
access_url_id = $access_url_id AND
- course_rel_user.user_id = $user_id AND
+ course_rel_user.user_id = $userId AND
course_rel_user.status = 1
";
}
}
- if (!empty($startsWith)) {
- $startsWith = Database::escape_string($startsWith);
-
- $sql .= " AND (course.title LIKE '$startsWith%' OR course.code LIKE '$startsWith%')";
+ if (!empty($keyword)) {
+ $keyword = Database::escape_string($keyword);
+ $sql .= " AND (course.title LIKE '$keyword%' OR course.code LIKE '$keyword%')";
}
$sql .= ' ORDER BY course.title';
- $result_nb_cours = Database::query($sql);
- if (Database::num_rows($result_nb_cours) > 0) {
- while ($row = Database::fetch_array($result_nb_cours, 'ASSOC')) {
+ $query = Database::query($sql);
+ $data = [];
+ if (Database::num_rows($query) > 0) {
+ while ($row = Database::fetch_array($query, 'ASSOC')) {
$data[$row['id']] = $row;
}
}
@@ -1258,7 +1273,7 @@ class CourseManager
/**
* Check if user is subscribed inside a course.
*
- * @param int $user_id
+ * @param int $userId
* @param string $course_code , if this parameter is null, it'll check for all courses
* @param bool $in_a_session True for checking inside sessions too, by default is not checked
* @param int $session_id
@@ -1266,12 +1281,12 @@ class CourseManager
* @return bool $session_id true if the user is registered in the course, false otherwise
*/
public static function is_user_subscribed_in_course(
- $user_id,
+ $userId,
$course_code = null,
$in_a_session = false,
$session_id = 0
) {
- $user_id = (int) $user_id;
+ $userId = (int) $userId;
$session_id = (int) $session_id;
if (api_get_configuration_value('catalog_course_subscription_in_user_s_session')) {
@@ -1283,7 +1298,7 @@ class CourseManager
return false;
}
- $user = api_get_user_entity($user_id);
+ $user = api_get_user_entity($userId);
if (is_null($user)) {
return false;
}
@@ -1312,7 +1327,7 @@ class CourseManager
$sql = "SELECT * FROM ".Database::get_main_table(TABLE_MAIN_COURSE_USER)."
WHERE
- user_id = $user_id AND
+ user_id = $userId AND
relation_type<>".COURSE_RELATION_TYPE_RRHH."
$condition_course ";
@@ -1330,21 +1345,21 @@ class CourseManager
$tableSessionCourseUser = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$sql = "SELECT 1 FROM $tableSessionCourseUser
- WHERE user_id = $user_id AND session_id = $session_id $condition_course";
+ WHERE user_id = $userId AND session_id = $session_id $condition_course";
if (Database::num_rows(Database::query($sql)) > 0) {
return true;
}
$sql = "SELECT 1 FROM $tableSessionCourseUser
- WHERE user_id = $user_id AND session_id = $session_id AND status = 2 $condition_course";
+ WHERE user_id = $userId AND session_id = $session_id AND status = 2 $condition_course";
if (Database::num_rows(Database::query($sql)) > 0) {
return true;
}
$sql = 'SELECT 1 FROM '.Database::get_main_table(TABLE_MAIN_SESSION).
- " WHERE id = $session_id AND id_coach = $user_id";
+ " WHERE id = $session_id AND id_coach = $userId";
if (Database::num_rows(Database::query($sql)) > 0) {
return true;
@@ -1356,14 +1371,14 @@ class CourseManager
/**
* Is the user a teacher in the given course?
*
- * @param int $user_id , the id (int) of the user
+ * @param int $userId , the id (int) of the user
* @param string $course_code , the course code
*
* @return bool if the user is a teacher in the course, false otherwise
*/
- public static function is_course_teacher($user_id, $course_code)
+ public static function is_course_teacher($userId, $course_code)
{
- if ($user_id != strval(intval($user_id))) {
+ if ($userId != strval(intval($userId))) {
return false;
}
@@ -1373,7 +1388,7 @@ class CourseManager
}
$courseId = $courseInfo['real_id'];
$sql = "SELECT status FROM ".Database::get_main_table(TABLE_MAIN_COURSE_USER)."
- WHERE c_id = $courseId AND user_id = $user_id ";
+ WHERE c_id = $courseId AND user_id = $userId ";
$result = Database::query($sql);
if (Database::num_rows($result) > 0) {
diff --git a/public/main/inc/lib/tracking.lib.php b/public/main/inc/lib/tracking.lib.php
index 14f1a91379..621786af5e 100644
--- a/public/main/inc/lib/tracking.lib.php
+++ b/public/main/inc/lib/tracking.lib.php
@@ -2605,7 +2605,7 @@ class Tracking
}
$resultLP = Database::select(
- 'id',
+ 'iid',
$lPTable,
['where' => $lpConditions]
);
@@ -2773,13 +2773,13 @@ class Tracking
// Check the real number of LPs corresponding to the filter in the
// database (and if no list was given, get them all)
if (empty($session_id)) {
- $sql = "SELECT DISTINCT(id), use_max_score
+ $sql = "SELECT DISTINCT(iid), use_max_score
FROM $lp_table
WHERE
c_id = $course_id AND
(session_id = 0 OR session_id IS NULL) $condition_lp ";
} else {
- $sql = "SELECT DISTINCT(id), use_max_score
+ $sql = "SELECT DISTINCT(iid), use_max_score
FROM $lp_table
WHERE c_id = $course_id $condition_lp ";
}
@@ -6499,9 +6499,9 @@ class Tracking
}
// Now fill users data
- $sqlUsers = "SELECT user_id, username, lastname, firstname
+ $sqlUsers = "SELECT id as user_id, username, lastname, firstname
FROM $tuser
- WHERE user_id IN (".implode(',', $userIds).")";
+ WHERE id IN (".implode(',', $userIds).")";
$resUsers = Database::query($sqlUsers);
while ($rowUser = Database::fetch_assoc($resUsers)) {
$users[$rowUser['user_id']] = $rowUser;
diff --git a/public/main/mySpace/myStudents.php b/public/main/mySpace/myStudents.php
index c3c9d1147e..1ae8b871fe 100644
--- a/public/main/mySpace/myStudents.php
+++ b/public/main/mySpace/myStudents.php
@@ -25,23 +25,24 @@ $courseCode = '';
if ($courseInfo) {
$courseCode = $courseInfo['code'];
}
-$student_id = isset($_GET['student']) ? (int) $_GET['student'] : 0;
+$studentId = isset($_GET['student']) ? (int) $_GET['student'] : 0;
+
+if (empty($studentId)) {
+ api_not_allowed(true);
+}
+
$coachId = isset($_GET['id_coach']) ? (int) $_GET['id_coach'] : 0;
$details = isset($_GET['details']) ? Security::remove_XSS($_GET['details']) : '';
-$currentUrl = api_get_self().'?student='.$student_id.'&course='.$courseCode.'&id_session='.$sessionId
+$currentUrl = api_get_self().'?student='.$studentId.'&course='.$courseCode.'&id_session='.$sessionId
.'&origin='.$origin.'&details='.$details;
$allowMessages = api_get_configuration_value('private_messages_about_user');
$workingTime = api_get_configuration_value('considered_working_time');
$workingTimeEdit = api_get_configuration_value('allow_working_time_edition');
-if (empty($student_id)) {
- api_not_allowed(true);
-}
-
// user info
-$user_info = api_get_user_info($student_id);
+$userInfo = api_get_user_info($studentId);
-if (empty($user_info)) {
+if (empty($userInfo)) {
api_not_allowed(true);
}
@@ -149,7 +150,7 @@ if (!empty($details)) {
'name' => get_lang('Learners of trainer'),
];
$interbreadcrumb[] = [
- 'url' => 'myStudents.php?student='.$student_id.'&id_coach='.$coachId,
+ 'url' => 'myStudents.php?student='.$studentId.'&id_coach='.$coachId,
'name' => get_lang('Learner details'),
];
} else {
@@ -158,7 +159,7 @@ if (!empty($details)) {
'name' => get_lang('My learners'),
];
$interbreadcrumb[] = [
- 'url' => 'myStudents.php?student='.$student_id,
+ 'url' => 'myStudents.php?student='.$studentId,
'name' => get_lang('Learner details'),
];
}
@@ -182,7 +183,7 @@ if (!empty($details)) {
$this_section = SECTION_TRACKING;
$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('Reporting')];
$interbreadcrumb[] = ['url' => 'teachers.php', 'name' => get_lang('Trainers')];
- $nameTools = $user_info['complete_name'];
+ $nameTools = $userInfo['complete_name'];
} else {
$interbreadcrumb[] = [
'url' => api_is_student_boss() ? '#' : 'index.php',
@@ -221,7 +222,7 @@ switch ($action) {
}
$workingTime = isset($_GET['time']) ? $_GET['time'] : '';
$workId = isset($_GET['work_id']) ? $_GET['work_id'] : '';
- Event::eventAddVirtualCourseTime($courseInfo['real_id'], $student_id, $sessionId, $workingTime, $workId);
+ Event::eventAddVirtualCourseTime($courseInfo['real_id'], $studentId, $sessionId, $workingTime, $workId);
Display::addFlash(Display::return_message(get_lang('Updated')));
header('Location: '.$currentUrl);
@@ -232,7 +233,7 @@ switch ($action) {
}
$workingTime = isset($_GET['time']) ? $_GET['time'] : '';
$workId = isset($_GET['work_id']) ? $_GET['work_id'] : '';
- Event::eventRemoveVirtualCourseTime($courseInfo['real_id'], $student_id, $sessionId, $workingTime, $workId);
+ Event::eventRemoveVirtualCourseTime($courseInfo['real_id'], $studentId, $sessionId, $workingTime, $workId);
Display::addFlash(Display::return_message(get_lang('Updated')));
@@ -254,7 +255,7 @@ switch ($action) {
$progressPerCourse = [];
foreach ($courses as $course) {
$courseId = $course['c_id'];
- $courseTimeSpent = Tracking::get_time_spent_on_the_course($student_id, $courseId, $sessionToExport);
+ $courseTimeSpent = Tracking::get_time_spent_on_the_course($studentId, $courseId, $sessionToExport);
$timeSpentPerCourse[$courseId] = $courseTimeSpent;
$timeSpent += $courseTimeSpent;
$sql = "SELECT DISTINCT count(course_access_id) as count
@@ -262,11 +263,11 @@ switch ($action) {
WHERE
c_id = $courseId AND
session_id = $sessionToExport AND
- user_id = $student_id";
+ user_id = $studentId";
$result = Database::query($sql);
$row = Database::fetch_array($result);
$numberVisits += $row['count'];
- $courseProgress = Tracking::get_avg_student_progress($student_id, $course['code'], [], $sessionToExport);
+ $courseProgress = Tracking::get_avg_student_progress($studentId, $course['code'], [], $sessionToExport);
$progressPerCourse[$courseId] = $courseProgress;
$progress += $courseProgress;
}
@@ -274,8 +275,8 @@ switch ($action) {
$average = round($progress / count($courses), 1);
$average = empty($average) ? '0%' : $average.'%';
- $first = Tracking::get_first_connection_date($student_id);
- $last = Tracking::get_last_connection_date($student_id);
+ $first = Tracking::get_first_connection_date($studentId);
+ $last = Tracking::get_last_connection_date($studentId);
$table = new HTML_Table(['class' => 'data_table']);
$column = 0;
@@ -328,7 +329,7 @@ switch ($action) {
$courseCodeItem = $courseInfoItem['code'];
$isSubscribed = CourseManager::is_user_subscribed_in_course(
- $student_id,
+ $studentId,
$courseCodeItem,
true,
$sId
@@ -342,7 +343,7 @@ switch ($action) {
$totalProgress += $progress;
$bestScore = Tracking::get_avg_student_score(
- $student_id,
+ $studentId,
$courseCodeItem,
[],
$sId,
@@ -391,7 +392,7 @@ switch ($action) {
$tpl = new Template('', false, false, false, true, false, false);
$tpl->assign('title', get_lang('Attestation of attendance'));
$tpl->assign('session_title', $sessionInfo['name']);
- $tpl->assign('student', $user_info['complete_name']);
+ $tpl->assign('student', $userInfo['complete_name']);
$tpl->assign('table_progress', $table->toHtml());
$tpl->assign('subtitle', sprintf(
get_lang('In session %s, you had the following results'),
@@ -405,7 +406,7 @@ switch ($action) {
'session_info' => $sessionInfo,
'course_info' => '',
'pdf_date' => '',
- 'student_info' => $user_info,
+ 'student_info' => $userInfo,
'show_grade_generated_date' => true,
'show_real_course_teachers' => false,
'show_teacher_as_myself' => false,
@@ -444,7 +445,7 @@ switch ($action) {
$title .= '_'.$sessionInfo['name'];
}
- $fileName = 'report'.$title.'_'.$user_info['complete_name'];
+ $fileName = 'report'.$title.'_'.$userInfo['complete_name'];
switch ($export) {
case 'csv':
Export::arrayToCsv($dataToExport, $fileName);
@@ -465,27 +466,27 @@ switch ($action) {
if (!empty($subject) && !empty($message)) {
$currentUserInfo = api_get_user_info();
MessageManager::sendMessageAboutUser(
- $user_info,
+ $userInfo,
$currentUserInfo,
$subject,
$message
);
// Send also message to all student bosses
- $bossList = UserManager::getStudentBossList($student_id);
+ $bossList = UserManager::getStudentBossList($studentId);
if (!empty($bossList)) {
- $url = api_get_path(WEB_CODE_PATH).'mySpace/myStudents.php?student='.$student_id;
+ $url = api_get_path(WEB_CODE_PATH).'mySpace/myStudents.php?student='.$studentId;
$link = Display::url($url, $url);
foreach ($bossList as $boss) {
MessageManager::send_message_simple(
$boss['boss_id'],
- sprintf(get_lang('Follow up message about student %s'), $user_info['complete_name']),
+ sprintf(get_lang('Follow up message about student %s'), $userInfo['complete_name']),
sprintf(
get_lang('Hi,
'),
$currentUserInfo['complete_name'],
- $user_info['complete_name'],
+ $userInfo['complete_name'],
$link
)
);
@@ -505,35 +506,35 @@ switch ($action) {
// Delete old certificate
$myCertificate = GradebookUtils::get_certificate_by_user_id(
0,
- $student_id
+ $studentId
);
if ($myCertificate) {
- $certificate = new Certificate($myCertificate['id'], $student_id);
+ $certificate = new Certificate($myCertificate['id'], $studentId);
$certificate->delete(true);
}
// Create new one
- $certificate = new Certificate(0, $student_id);
+ $certificate = new Certificate(0, $studentId);
$certificate->generatePdfFromCustomCertificate();
exit;
break;
case 'send_legal':
- $isBoss = UserManager::userIsBossOfStudent(api_get_user_id(), $student_id);
+ $isBoss = UserManager::userIsBossOfStudent(api_get_user_id(), $studentId);
if ($isBoss || api_is_platform_admin()) {
$subject = get_lang('Legal conditions');
$content = sprintf(
get_lang('Hello,
Your tutor sent you your terms and conditions. You can sign it following this URL: %s'),
api_get_path(WEB_PATH)
);
- MessageManager::send_message_simple($student_id, $subject, $content);
+ MessageManager::send_message_simple($studentId, $subject, $content);
Display::addFlash(Display::return_message(get_lang('Sent')));
}
break;
case 'delete_legal':
- $isBoss = UserManager::userIsBossOfStudent(api_get_user_id(), $student_id);
+ $isBoss = UserManager::userIsBossOfStudent(api_get_user_id(), $studentId);
if ($isBoss || api_is_platform_admin()) {
$extraFieldValue = new ExtraFieldValue('user');
$value = $extraFieldValue->get_values_by_handler_and_field_variable(
- $student_id,
+ $studentId,
'legal_accept'
);
$result = $extraFieldValue->delete($value['id']);
@@ -547,12 +548,12 @@ switch ($action) {
$check = true;
if (!empty($lp_id) &&
- !empty($student_id) &&
+ !empty($studentId) &&
api_is_allowed_to_edit() &&
Security::check_token('get')
) {
Event::delete_student_lp_events(
- $student_id,
+ $studentId,
$lp_id,
$courseInfo,
$sessionId
@@ -611,7 +612,7 @@ $sql = "SELECT c_id
FROM $tbl_course_user
WHERE
relation_type <> ".COURSE_RELATION_TYPE_RRHH." AND
- user_id = ".$student_id;
+ user_id = ".$studentId;
$rs = Database::query($sql);
while ($row = Database::fetch_array($rs)) {
@@ -627,7 +628,7 @@ while ($row = Database::fetch_array($rs)) {
// Get the list of sessions where the user is subscribed as student
$sql = 'SELECT session_id, c_id
FROM '.Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER).'
- WHERE user_id='.$student_id;
+ WHERE user_id='.$studentId;
$rs = Database::query($sql);
$tmp_sessions = [];
while ($row = Database::fetch_array($rs, 'ASSOC')) {
@@ -651,12 +652,12 @@ $isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh(
);
if (api_is_drh() && !api_is_platform_admin()) {
- if (!empty($student_id)) {
+ if (!empty($studentId)) {
if (api_drh_can_access_all_session_content()) {
} else {
if (!$isDrhOfCourse) {
if (api_is_drh() &&
- !UserManager::is_user_followed_by_drh($student_id, api_get_user_id())
+ !UserManager::is_user_followed_by_drh($studentId, api_get_user_id())
) {
api_not_allowed(true);
}
@@ -691,40 +692,40 @@ echo ''.
+if (!empty($userInfo['email'])) {
+ $send_mail = ''.
Display::return_icon('mail_send.png', get_lang('Send message mail'), '', ICON_SIZE_MEDIUM).'';
} else {
$send_mail = Display::return_icon('mail_send_na.png', get_lang('Send message mail'), '', ICON_SIZE_MEDIUM);
}
echo $send_mail;
-if (!empty($student_id) && !empty($courseCode)) {
+if (!empty($studentId) && !empty($courseCode)) {
// Only show link to connection details if course and student were defined in the URL
- echo ''
.Display::return_icon('statistics.png', get_lang('Access details'), '', ICON_SIZE_MEDIUM)
.'';
}
$notebookTeacherEnable = 'true' === api_get_plugin_setting('notebookteacher', 'enable_plugin_notebookteacher');
-if ($notebookTeacherEnable && !empty($student_id) && !empty($course_code)) {
+if ($notebookTeacherEnable && !empty($studentId) && !empty($course_code)) {
// link notebookteacher
- $optionsLink = 'student_id='.$student_id.'&origin='.$origin.'&cidReq='.$courseCode.'&id_session='.$sessionId;
+ $optionsLink = 'student_id='.$studentId.'&origin='.$origin.'&cidReq='.$courseCode.'&id_session='.$sessionId;
echo ''
.Display::return_icon('notebookteacher.png', get_lang('Notebook'), '', ICON_SIZE_MEDIUM)
.'';
}
-if (api_can_login_as($student_id)) {
- echo ''
.Display::return_icon('login_as.png', get_lang('Login as'), null, ICON_SIZE_MEDIUM).' ';
}
-if (Skill::isAllowed($student_id, false)) {
+if (Skill::isAllowed($studentId, false)) {
echo Display::url(
Display::return_icon(
'skill-badges.png',
@@ -732,11 +733,11 @@ if (Skill::isAllowed($student_id, false)) {
null,
ICON_SIZE_MEDIUM
),
- api_get_path(WEB_CODE_PATH).'badge/assign.php?'.http_build_query(['user' => $student_id])
+ api_get_path(WEB_CODE_PATH).'badge/assign.php?'.http_build_query(['user' => $studentId])
);
}
-if (Skill::isAllowed($student_id, false)) {
+if (Skill::isAllowed($studentId, false)) {
echo Display::url(
Display::return_icon(
'attendance.png',
@@ -744,12 +745,12 @@ if (Skill::isAllowed($student_id, false)) {
null,
ICON_SIZE_MEDIUM
),
- api_get_path(WEB_CODE_PATH).'mySpace/myStudents.php?action=all_attendance&student='.$student_id
+ api_get_path(WEB_CODE_PATH).'mySpace/myStudents.php?action=all_attendance&student='.$studentId
);
}
$permissions = StudentFollowUpPlugin::getPermissions(
- $student_id,
+ $studentId,
api_get_user_id()
);
@@ -762,14 +763,14 @@ if ($isAllow) {
null,
ICON_SIZE_MEDIUM
),
- api_get_path(WEB_PLUGIN_PATH).'studentfollowup/posts.php?student_id='.$student_id
+ api_get_path(WEB_PLUGIN_PATH).'studentfollowup/posts.php?student_id='.$studentId
);
}
echo '';
// is the user online ?
$online = get_lang('No');
-if (user_is_online($student_id)) {
+if (user_is_online($studentId)) {
$online = get_lang('Yes');
}
@@ -777,10 +778,10 @@ if (user_is_online($student_id)) {
$avg_student_progress = $avg_student_score = 0;
if (empty($sessionId)) {
- $isSubscribedToCourse = CourseManager::is_user_subscribed_in_course($user_info['user_id'], $courseCode);
+ $isSubscribedToCourse = CourseManager::is_user_subscribed_in_course($studentId, $courseCode);
} else {
$isSubscribedToCourse = CourseManager::is_user_subscribed_in_course(
- $user_info['user_id'],
+ $studentId,
$courseCode,
true,
$sessionId
@@ -789,7 +790,7 @@ if (empty($sessionId)) {
if ($isSubscribedToCourse) {
$avg_student_progress = Tracking::get_avg_student_progress(
- $user_info['user_id'],
+ $studentId,
$courseCode,
[],
$sessionId
@@ -797,7 +798,7 @@ if ($isSubscribedToCourse) {
// the score inside the Reporting table
$avg_student_score = Tracking::get_avg_student_score(
- $user_info['user_id'],
+ $studentId,
$courseCode,
[],
$sessionId
@@ -809,7 +810,7 @@ $time_spent_on_the_course = 0;
if (!empty($courseInfo)) {
$time_spent_on_the_course = api_time_to_hms(
Tracking::get_time_spent_on_the_course(
- $user_info['user_id'],
+ $studentId,
$courseInfo['real_id'],
$sessionId
)
@@ -817,13 +818,13 @@ if (!empty($courseInfo)) {
}
// get information about connections on the platform by student
-$first_connection_date = Tracking::get_first_connection_date($user_info['user_id']);
+$first_connection_date = Tracking::get_first_connection_date($studentId);
if ('' == $first_connection_date) {
$first_connection_date = get_lang('No connection');
}
$last_connection_date = Tracking::get_last_connection_date(
- $user_info['user_id'],
+ $studentId,
true
);
if ('' == $last_connection_date) {
@@ -840,9 +841,9 @@ $csv_content[] = [
get_lang('Tel'),
];
$csv_content[] = [
- $user_info['complete_name'],
- $user_info['email'],
- $user_info['phone'],
+ $userInfo['complete_name'],
+ $userInfo['email'],
+ $userInfo['phone'],
];
$csv_content[] = [];
@@ -869,30 +870,18 @@ $csv_content[] = [
$coachs_name = '';
$session_name = '';
-$userPicture = UserManager::getUserPicture($user_info['user_id'], USER_IMAGE_SIZE_BIG);
+$userPicture = UserManager::getUserPicture($studentId, USER_IMAGE_SIZE_BIG);
$userGroupManager = new UserGroup();
$userGroups = $userGroupManager->getNameListByUser(
- $user_info['user_id'],
+ $studentId,
UserGroup::NORMAL_CLASS
);
-$userInfo = [
- 'id' => $user_info['user_id'],
- 'complete_name' => $user_info['complete_name'],
- 'complete_name_link' => $user_info['complete_name_with_message_link'],
- 'phone' => $user_info['phone'],
- 'code' => $user_info['official_code'],
- 'username' => $user_info['username'],
- 'registration_date' => $user_info['registration_date'],
- 'email' => $user_info['email'],
- 'has_certificates' => $user_info['has_certificates'],
- 'last_login' => $user_info['last_login'],
- 'profile_url' => $user_info['profile_url'],
- 'groups' => $userGroupManager,
- 'avatar' => $userPicture,
- 'online' => $online,
-];
+$userInfo['complete_name_link'] = $userInfo['complete_name_with_message_link'];
+$userInfo['groups'] = $userGroupManager;
+$userInfo['avatar'] = $userPicture;
+$userInfo['online'] = $online;
if (!empty($courseCode)) {
$userInfo['url_access'] = Display::url(
@@ -900,7 +889,7 @@ if (!empty($courseCode)) {
'access_details.php?'
.http_build_query(
[
- 'student' => $student_id,
+ 'student' => $studentId,
'course' => $courseCode,
'origin' => $origin,
'cidReq' => $courseCode,
@@ -914,7 +903,7 @@ if (!empty($courseCode)) {
// Display timezone if the user selected one and if the admin allows the use of user's timezone
$timezone = null;
$timezone_user = UserManager::get_extra_user_data_by_field(
- $user_info['user_id'],
+ $studentId,
'timezone'
);
$use_users_timezone = api_get_setting('use_users_timezone', 'timezones');
@@ -942,13 +931,13 @@ if ('true' === $details) {
$icon = '';
$timeLegalAccept = '';
$btn = '';
-
+$userInfo['legal'] = '';
if ('true' === api_get_setting('allow_terms_conditions')) {
- $isBoss = UserManager::userIsBossOfStudent(api_get_user_id(), $student_id);
+ $isBoss = UserManager::userIsBossOfStudent(api_get_user_id(), $studentId);
if ($isBoss || api_is_platform_admin()) {
$extraFieldValue = new ExtraFieldValue('user');
$value = $extraFieldValue->get_values_by_handler_and_field_variable(
- $student_id,
+ $studentId,
'legal_accept'
);
$icon = Display::return_icon('accept_na.png');
@@ -959,14 +948,14 @@ if ('true' === api_get_setting('allow_terms_conditions')) {
$icon = Display::return_icon('accept.png');
$btn = Display::url(
get_lang('Delete legal agreement'),
- api_get_self().'?action=delete_legal&student='.$student_id.'&course='.$course_code,
+ api_get_self().'?action=delete_legal&student='.$studentId.'&course='.$course_code,
['class' => 'btn btn-danger']
);
$timeLegalAccept = api_get_local_time($legalTime);
} else {
$btn = Display::url(
get_lang('Send message legal agreement'),
- api_get_self().'?action=send_legal&student='.$student_id.'&course='.$course_code,
+ api_get_self().'?action=send_legal&student='.$studentId.'&course='.$course_code,
['class' => 'btn btn-primary']
);
$timeLegalAccept = get_lang('Not Registered');
@@ -1010,9 +999,9 @@ if (isset($_GET['action']) and 'all_attendance' == $_GET['action']) {
$defaults['startDate'] = $startDateText;
$defaults['endDate'] = $endDateText;
$form = new FormValidator('all_attendance_list', 'GET',
- 'myStudents.php?action=all_attendance&student='.$student_id.'&startDate='.$defaults['startDate'].'&endDate='.$defaults['endDate'].'&&'.api_get_cidreq(),
+ 'myStudents.php?action=all_attendance&student='.$studentId.'&startDate='.$defaults['startDate'].'&endDate='.$defaults['endDate'].'&&'.api_get_cidreq(),
'');
- $form->addElement('html', '');
+ $form->addElement('html', '');
$form->addElement('html', '');
$form->addDateTimePicker('startDate', [
@@ -1031,7 +1020,7 @@ if (isset($_GET['action']) and 'all_attendance' == $_GET['action']) {
$form->display();
/** Display dates */
$attendance = new Attendance();
- $data = $attendance->getCoursesWithAttendance($student_id, $startDate, $endDate);
+ $data = $attendance->getCoursesWithAttendance($studentId, $startDate, $endDate);
// 'attendance from %s to %s'
$title = sprintf(get_lang('AttendanceFromXToY'), $startDateText, $endDateText);
@@ -1072,7 +1061,7 @@ if (isset($_GET['action']) and 'all_attendance' == $_GET['action']) {
| ';
if ($count_attempts > 0) {
$all_attempt_url = "../exercise/exercise_report.php?id=$exercise_id&"
- ."cidReq=$courseCode&filter_by_user=$student_id&id_session=$sessionId";
+ ."cidReq=$courseCode&filter_by_user=$studentId&id_session=$sessionId";
echo Display::url(
Display::return_icon(
'test_results.png',
@@ -2002,7 +1991,7 @@ if (empty($details)) {
[],
ICON_SIZE_SMALL
);
- if (in_array($student_id, $user_list)) {
+ if (in_array($studentId, $user_list)) {
$survey_done = Display::return_icon(
"accept.png",
get_lang('Answered'),
@@ -2040,7 +2029,7 @@ if (empty($details)) {
}
}
- $userWorks = getWorkPerUser($student_id, $courseInfo['real_id'], $sessionId);
+ $userWorks = getWorkPerUser($studentId, $courseInfo['real_id'], $sessionId);
echo '
|