From 28463ab582dadc58e1c5674464aea0d3192a1fff Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Thu, 18 Jul 2024 16:59:00 -0500 Subject: [PATCH] Multi url disabled (#5678) * Display: Fix styles for toast * Internal: Remove api_is_multiple_url_enabled --- .env.dist | 2 - assets/css/scss/atoms/_toast.scss | 10 +- public/main/admin/course_edit.php | 21 +- public/main/admin/course_information.php | 20 +- public/main/admin/course_list.php | 8 +- public/main/admin/course_list_admin.php | 13 +- .../admin/dashboard_add_courses_to_user.php | 45 +-- .../admin/dashboard_add_sessions_to_user.php | 37 +- .../admin/dashboard_add_users_to_user.php | 66 +--- public/main/admin/settings.php | 20 +- public/main/admin/subscribe_user2course.php | 79 ++-- public/main/admin/user_export.php | 43 +- public/main/admin/user_information.php | 48 ++- public/main/inc/ajax/admin.ajax.php | 15 +- .../lib/CoursesAndSessionsCatalog.class.php | 211 ++++------ public/main/inc/lib/api.lib.php | 37 +- public/main/inc/lib/course.lib.php | 65 +-- public/main/inc/lib/login.lib.php | 23 +- public/main/inc/lib/myspace.lib.php | 88 ++--- public/main/inc/lib/online.inc.php | 36 +- public/main/inc/lib/redirect.class.php | 17 +- public/main/inc/lib/sessionmanager.lib.php | 370 ++++++------------ public/main/inc/lib/statistics.lib.php | 345 ++++++---------- public/main/inc/lib/tracking.lib.php | 217 ++++------ public/main/inc/lib/usermanager.lib.php | 87 ++-- public/main/inc/lib/userportal.lib.php | 101 ++--- public/main/inc/lib/webservices/Rest.php | 40 +- .../inc/lib/zombie/zombie_manager.class.php | 33 +- public/main/my_space/session_filter.php | 25 +- public/main/my_space/user_edit.php | 11 +- .../session/add_edit_users_to_session.php | 213 ++++------ .../session/add_users_to_session_course.php | 238 +++++------ public/main/session/resume_session.php | 18 +- public/main/session/session_add.php | 41 +- public/main/session/session_course_edit.php | 31 +- public/main/session/session_export.php | 66 ++-- public/main/session/session_import.php | 9 +- public/main/user/add_users_to_session.php | 196 +++------- public/main/user/subscribe_user.php | 240 +++--------- public/main/user/user.php | 28 +- public/main/user/user_export.php | 36 +- .../src/export_pdf_all_in_one.php | 26 +- .../EventListener/LegacyListener.php | 18 +- .../Repository/Node/UsergroupRepository.php | 61 +-- .../ServiceHelper/AccessUrlHelper.php | 17 +- .../synchronize_user_base_from_ldap.php | 13 +- 46 files changed, 1119 insertions(+), 2265 deletions(-) diff --git a/.env.dist b/.env.dist index ba83d89b7d..7cdb85c292 100644 --- a/.env.dist +++ b/.env.dist @@ -33,8 +33,6 @@ APP_LOCALE='en_US' APP_CUSTOM_VUE_TEMPLATE='0' -APP_MULTIPLE_ACCESS_URL='' - GOOGLE_MAPS_API_KEY='' #APP_API_PLATFORM_URL='http://localhost/api/' #deprecated diff --git a/assets/css/scss/atoms/_toast.scss b/assets/css/scss/atoms/_toast.scss index 6d3dc34620..23198e65e9 100644 --- a/assets/css/scss/atoms/_toast.scss +++ b/assets/css/scss/atoms/_toast.scss @@ -1,5 +1,5 @@ .p-toast { - @apply whitespace-pre-line break-words opacity-90 w-96; + @apply whitespace-pre-line break-words opacity-90 min-w-96; &.p-toast-top-center, &.p-toast-bottom-center { @apply -translate-x-1/2; @@ -52,7 +52,7 @@ @apply bg-warning text-gray-90 border-0; .p-toast-message-icon, .p-toast-icon-close { - @apply bg-gray-90; + @apply text-gray-90; } } @@ -65,14 +65,14 @@ } .p-toast-message-content { - @apply flex items-center p-4 border-0; + @apply flex items-start p-4 border-0; .p-toast-message-text { - @apply flex-auto m-0 ml-4; + @apply flex-auto m-0 ml-4 self-center; } .p-toast-message-icon { - @apply shrink-0 text-body-1; + @apply shrink-0 text-2xl; &.p-icon { @apply w-8 h-8; diff --git a/public/main/admin/course_edit.php b/public/main/admin/course_edit.php index 0ec8c7aede..14b6baa03e 100644 --- a/public/main/admin/course_edit.php +++ b/public/main/admin/course_edit.php @@ -59,19 +59,14 @@ while ($obj = Database::fetch_object($res)) { } // Get all possible teachers without the course teachers -if (api_is_multiple_url_enabled()) { - $access_url_rel_user_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); - $sql = "SELECT u.id as user_id,lastname,firstname - FROM $table_user as u - INNER JOIN $access_url_rel_user_table url_rel_user - ON (u.id=url_rel_user.user_id) - WHERE - url_rel_user.access_url_id = $urlId AND - status = 1".$order_clause; -} else { - $sql = "SELECT id as user_id, lastname, firstname - FROM $table_user WHERE status='1'".$order_clause; -} +$access_url_rel_user_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); +$sql = "SELECT u.id as user_id,lastname,firstname + FROM $table_user as u + INNER JOIN $access_url_rel_user_table url_rel_user + ON (u.id=url_rel_user.user_id) + WHERE + url_rel_user.access_url_id = $urlId AND + status = 1".$order_clause; $courseInfo['tutor_name'] = null; $res = Database::query($sql); diff --git a/public/main/admin/course_information.php b/public/main/admin/course_information.php index 40b74704e1..0a26fc89d4 100644 --- a/public/main/admin/course_information.php +++ b/public/main/admin/course_information.php @@ -138,17 +138,15 @@ echo Display::page_header(get_lang('Users')); $table_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER); $table_user = Database::get_main_table(TABLE_MAIN_USER); $sql = "SELECT *, cu.status as course_status - FROM $table_course_user cu, $table_user u"; -if (api_is_multiple_url_enabled()) { - $sql .= " INNER JOIN ".Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER)." url_rel_user - ON - u.id = url_rel_user.user_id AND - url_rel_user.access_url_id = ".api_get_current_access_url_id(); -} -$sql .= " WHERE - cu.user_id = u.id AND - cu.c_id = '".$courseId."' AND - cu.relation_type <> ".COURSE_RELATION_TYPE_RRHH; + FROM $table_course_user cu, $table_user u + INNER JOIN ".Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER)." url_rel_user + ON + u.id = url_rel_user.user_id AND + url_rel_user.access_url_id = ".api_get_current_access_url_id()." + WHERE + cu.user_id = u.id AND + cu.c_id = '".$courseId."' AND + cu.relation_type <> ".COURSE_RELATION_TYPE_RRHH; $res = Database::query($sql); $is_western_name_order = api_is_western_name_order(); if (Database::num_rows($res) > 0) { diff --git a/public/main/admin/course_list.php b/public/main/admin/course_list.php index 28dad9c0d1..2e3da2dcd9 100644 --- a/public/main/admin/course_list.php +++ b/public/main/admin/course_list.php @@ -80,9 +80,7 @@ function get_course_data($from, $number_of_items, $column, $direction, $dataFunc INNER JOIN $tblCourseCategory category ON course_rel_category.course_category_id = category.id "; } - if ((api_is_platform_admin() || api_is_session_admin()) && - api_is_multiple_url_enabled() && -1 != api_get_current_access_url_id() - ) { + if ((api_is_platform_admin() || api_is_session_admin())) { $access_url_rel_course_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); $sql .= " INNER JOIN $access_url_rel_course_table url_rel_course ON (course.id = url_rel_course.c_id)"; @@ -121,9 +119,7 @@ function get_course_data($from, $number_of_items, $column, $direction, $dataFunc } // Adding the filter to see the user's only of the current access_url. - if ((api_is_platform_admin() || api_is_session_admin()) && - api_is_multiple_url_enabled() && -1 != api_get_current_access_url_id() - ) { + if ((api_is_platform_admin() || api_is_session_admin())) { $sql .= ' AND url_rel_course.access_url_id='.api_get_current_access_url_id(); } diff --git a/public/main/admin/course_list_admin.php b/public/main/admin/course_list_admin.php index c2d6cc142d..14cf4df4c0 100644 --- a/public/main/admin/course_list_admin.php +++ b/public/main/admin/course_list_admin.php @@ -73,11 +73,10 @@ function get_course_data($from, $number_of_items, $column, $direction, $dataFunc } $sql = "$select FROM $table course"; - if (api_is_multiple_url_enabled()) { - $access_url_rel_course_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); - $sql .= " INNER JOIN $access_url_rel_course_table url_rel_course - ON (course.id = url_rel_course.c_id)"; - } + + $access_url_rel_course_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); + $sql .= " INNER JOIN $access_url_rel_course_table url_rel_course + ON (course.id = url_rel_course.c_id)"; $tableCourseRelUser = Database::get_main_table(TABLE_MAIN_COURSE_USER); $sql .= " @@ -119,9 +118,7 @@ function get_course_data($from, $number_of_items, $column, $direction, $dataFunc } // Adding the filter to see the user's only of the current access_url. - if (api_is_multiple_url_enabled()) { - $sql .= " AND url_rel_course.access_url_id = ".api_get_current_access_url_id(); - } + $sql .= " AND url_rel_course.access_url_id = ".api_get_current_access_url_id(); if ($addTeacherColumn) { $teachers = isset($_GET['course_teachers']) ? $_GET['course_teachers'] : []; diff --git a/public/main/admin/dashboard_add_courses_to_user.php b/public/main/admin/dashboard_add_courses_to_user.php index 57ece1d46f..5a938ebca9 100644 --- a/public/main/admin/dashboard_add_courses_to_user.php +++ b/public/main/admin/dashboard_add_courses_to_user.php @@ -76,21 +76,13 @@ function search_courses($needle, $type) $without_assigned_courses = ' AND c.code NOT IN('.implode(',', $assigned_courses_code).')'; } - if (api_is_multiple_url_enabled()) { - $sql = "SELECT c.code, c.title - FROM $tbl_course c - LEFT JOIN $tbl_course_rel_access_url a - ON (a.c_id = c.id) - WHERE - c.code LIKE '$needle%' $without_assigned_courses AND - access_url_id = ".api_get_current_access_url_id(); - } else { - $sql = "SELECT c.code, c.title - FROM $tbl_course c - WHERE - c.code LIKE '$needle%' - $without_assigned_courses "; - } + $sql = "SELECT c.code, c.title + FROM $tbl_course c + LEFT JOIN $tbl_course_rel_access_url a + ON (a.c_id = c.id) + WHERE + c.code LIKE '$needle%' $without_assigned_courses AND + access_url_id = ".api_get_current_access_url_id(); $rs = Database::query($sql); @@ -205,21 +197,14 @@ if (isset($_POST['firstLetterCourse'])) { $needle = Database::escape_string($firstLetter.'%'); } -if (api_is_multiple_url_enabled()) { - $sql = " SELECT c.code, c.title - FROM $tbl_course c - LEFT JOIN $tbl_course_rel_access_url a - ON (a.c_id = c.id) - WHERE - c.code LIKE '$needle' $without_assigned_courses AND - access_url_id = ".api_get_current_access_url_id().' - ORDER BY c.title'; -} else { - $sql = " SELECT c.code, c.title - FROM $tbl_course c - WHERE c.code LIKE '$needle' $without_assigned_courses - ORDER BY c.title"; -} +$sql = " SELECT c.code, c.title + FROM $tbl_course c + LEFT JOIN $tbl_course_rel_access_url a + ON (a.c_id = c.id) + WHERE + c.code LIKE '$needle' $without_assigned_courses AND + access_url_id = ".api_get_current_access_url_id().' + ORDER BY c.title'; $result = Database::query($sql); diff --git a/public/main/admin/dashboard_add_sessions_to_user.php b/public/main/admin/dashboard_add_sessions_to_user.php index f3c47eeaf9..6170bfe950 100644 --- a/public/main/admin/dashboard_add_sessions_to_user.php +++ b/public/main/admin/dashboard_add_sessions_to_user.php @@ -74,17 +74,12 @@ function search_sessions($needle, $type) $without_assigned_sessions = ' AND s.id NOT IN('.implode(',', $assigned_sessions_id).')'; } - if (api_is_multiple_url_enabled()) { - $sql = " SELECT s.id, s.title FROM $tbl_session s - LEFT JOIN $tbl_session_rel_access_url a - ON (s.id = a.session_id) - WHERE - s.title LIKE '$needle%' $without_assigned_sessions AND - access_url_id = ".api_get_current_access_url_id(); - } else { - $sql = "SELECT s.id, s.title FROM $tbl_session s - WHERE s.title LIKE '$needle%' $without_assigned_sessions "; - } + $sql = " SELECT s.id, s.title FROM $tbl_session s + LEFT JOIN $tbl_session_rel_access_url a + ON (s.id = a.session_id) + WHERE + s.title LIKE '$needle%' $without_assigned_sessions AND + access_url_id = ".api_get_current_access_url_id(); $rs = Database::query($sql); $return .= '