0) { $my_temp = []; foreach ($idChecked as $id) { $my_temp[] = Database::escape_string($id); // forcing the escape_string } $idChecked = $my_temp; $idChecked = "'".implode("','", $idChecked)."'"; $result = Database::query("DELETE FROM $tbl_session_rel_course WHERE session_id='$id_session' AND c_id IN($idChecked)"); $nbr_affected_rows = Database::affected_rows($result); Database::query("DELETE FROM $tbl_session_rel_course_rel_user WHERE session_id='$id_session' AND c_id IN($idChecked)"); Database::query("UPDATE $tbl_session SET nbr_courses=nbr_courses-$nbr_affected_rows WHERE id='$id_session'"); } header('Location: '.api_get_self().'?id_session='.$id_session.'&sort='.$sort); exit(); } $limit = 20; $from = $page * $limit; $sql = "SELECT c.id, c.code, c.title, nbr_users FROM $tbl_session_rel_course, $tbl_course c WHERE c_id = c.id AND session_id='$id_session' ORDER BY `$sort` LIMIT $from,".($limit + 1); $result = Database::query($sql); $Courses = Database::store_result($result); $tool_name = api_htmlentities($session_name, ENT_QUOTES).' : '.get_lang('Courses in this session'); $interbreadcrumb[] = ['url' => "session_list.php", "name" => get_lang('Session list')]; $interbreadcrumb[] = ['url' => "resume_session.php?id_session=".Security::remove_XSS($_REQUEST['id_session']), "name" => get_lang('Session overview')]; Display::display_header($tool_name); echo Display::page_header($tool_name); ?>
$enreg) { $course = []; $course[] = ''; $course[] = api_htmlentities($enreg['title'], ENT_QUOTES); $course[] = ''.$enreg['nbr_users'].' '.get_lang('Users').''; $course[] = ''. Display::getMdiIcon(ObjectIcon::HOME, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Course')).' '. Display::getMdiIcon(ActionIcon::EDIT, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Edit')).' '. Display::getMdiIcon(ActionIcon::DELETE, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Delete')).''; $tableCourses[] = $course; } echo ''; Display :: display_sortable_table($tableHeader, $tableCourses, [], []); echo '
'; Display::display_footer();