Minor - format code + remove unusedc code.

pull/4014/head^2
Julio 3 years ago
parent 021f4339de
commit c30a4bc460
  1. 1
      public/main/admin/dashboard_add_sessions_to_user.php
  2. 13
      public/main/admin/statistics/index.php
  3. 1
      public/main/coursecopy/copy_course_session.php
  4. 28
      public/main/inc/lib/api.lib.php
  5. 10
      public/main/inc/lib/sessionmanager.lib.php

@ -25,7 +25,6 @@ $interbreadcrumb[] = ['url' => 'user_list.php', 'name' => get_lang('User list')]
// Database Table Definitions
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
$tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
// Initializing variables

@ -406,14 +406,15 @@ switch ($report) {
}
$content .= Display::page_subheader2(get_lang('GeneralStats'));
// Coach
// Coach
$sql = "SELECT COUNT(DISTINCT(sru.user_id)) count FROM $tableSession s
INNER JOIN $tableSessionRelUser sru ON s.id = sru.session_id
// Coach.
$sql = "SELECT COUNT(DISTINCT(sru.user_id)) count
FROM $tableSession s
INNER JOIN $tableSessionRelUser sru
ON s.id = sru.session_id
WHERE
(s.display_start_date BETWEEN '$start' AND '$end' OR
s.display_end_date BETWEEN '$start' AND '$end')
AND sru.relation_type = ".Session::GENERAL_COACH."
s.display_end_date BETWEEN '$start' AND '$end') AND
sru.relation_type = ".Session::GENERAL_COACH."
$statusCondition
";
$result = Database::query($sql);

@ -39,7 +39,6 @@ $interbreadcrumb[] = [
// Database Table Definitions
$tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
$tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);

@ -2961,12 +2961,14 @@ function api_is_coach($session_id = 0, $courseId = null, $check_student_view = t
if (!empty($session_id)) {
$sql = "SELECT DISTINCT s.id
FROM $session_table AS s
INNER JOIN $tblSessionRelUser sru ON s.id = sru.session_id
WHERE sru.user_id = $userId AND
s.id = $session_id AND
sru.relation_type = ".SessionEntity::GENERAL_COACH."
ORDER BY s.access_start_date, s.access_end_date, s.name";
FROM $session_table AS s
INNER JOIN $tblSessionRelUser sru
ON s.id = sru.session_id
WHERE
sru.user_id = $userId AND
s.id = $session_id AND
sru.relation_type = ".SessionEntity::GENERAL_COACH."
ORDER BY s.access_start_date, s.access_end_date, s.name";
$result = Database::query($sql);
if (!empty($sessionIsCoach)) {
$sessionIsCoach = array_merge(
@ -4841,13 +4843,13 @@ function api_is_course_visible_for_user($userid = null, $cid = null)
$tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$sql = "SELECT sru_2.user_id AS session_admin_id, sru_1.user_id AS session_coach_id
FROM $tbl_session AS s
INNER JOIN $tblSessionRelUser sru_1
ON (sru_1.session_id = s.id AND sru_1.relation_type = ".SessionEntity::GENERAL_COACH.")
INNER JOIN $tblSessionRelUser sru_2
ON (sru_2.session_id = s.id AND sru_2.relation_type = ".SessionEntity::SESSION_ADMIN.")
INNER JOIN $tbl_session_course src
ON (src.session_id = s.id AND src.c_id = $courseId)";
FROM $tbl_session AS s
INNER JOIN $tblSessionRelUser sru_1
ON (sru_1.session_id = s.id AND sru_1.relation_type = ".SessionEntity::GENERAL_COACH.")
INNER JOIN $tblSessionRelUser sru_2
ON (sru_2.session_id = s.id AND sru_2.relation_type = ".SessionEntity::SESSION_ADMIN.")
INNER JOIN $tbl_session_course src
ON (src.session_id = s.id AND src.c_id = $courseId)";
$result = Database::query($sql);
$row = Database::store_result($result);

@ -1767,8 +1767,6 @@ class SessionManager
$tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
$tbl_url_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
$tbl_student_publication = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
$tbl_student_publication_assignment = Database::get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT);
$userGroupSessionTable = Database::get_main_table(TABLE_USERGROUP_REL_SESSION);
$trackCourseAccess = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$trackAccess = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
@ -2300,11 +2298,6 @@ class SessionManager
$session_visibility = SESSION_VISIBLE_READ_ONLY,
$removeUsersNotInList = false
) {
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
if (empty($session_id) || empty($course_code)) {
return false;
}
@ -8079,7 +8072,8 @@ class SessionManager
FROM $extraFieldTables $tbl_session s
LEFT JOIN $tbl_session_category sc
ON s.session_category_id = sc.id
INNER JOIN $tblSessionRelUser sru ON s.id = sru.session_id
INNER JOIN $tblSessionRelUser sru
ON s.id = sru.session_id
INNER JOIN $tbl_user u
ON sru.user_id = u.id
INNER JOIN $sessionCourseUserTable scu

Loading…
Cancel
Save