Minor - format function "Database ::" to "Database::"

pull/2487/head
jmontoyaa 9 years ago
parent e23d0a50f7
commit 4af8524c05
  1. 8
      main/admin/access_url_add_courses_to_url.php
  2. 6
      main/admin/access_url_add_usergroup_to_url.php
  3. 4
      main/admin/access_url_add_users_to_url.php
  4. 2
      main/admin/access_url_edit_courses_to_url.php
  5. 16
      main/admin/course_information.php
  6. 4
      main/admin/sub_language_add.php
  7. 6
      main/admin/user_export.php
  8. 10
      main/admin/user_information.php
  9. 8
      main/course_info/infocours.php
  10. 2
      main/document/create_audio.php
  11. 8
      main/exercise/exercise.php
  12. 2
      main/exercise/exercise_report.php
  13. 2
      main/exercise/exercise_result.class.php
  14. 4
      main/exercise/hotpotatoes_exercise_report.php
  15. 2
      main/exercise/question_create.php
  16. 18
      main/forum/forumconfig.inc.php
  17. 118
      main/forum/forumfunction.inc.php
  18. 2
      main/gradebook/gradebook_add_link.php
  19. 4
      main/gradebook/gradebook_edit_all.php
  20. 4
      main/gradebook/gradebook_edit_link.php
  21. 4
      main/gradebook/gradebook_showlog_link.php
  22. 4
      main/gradebook/index.php
  23. 10
      main/gradebook/lib/GradebookUtils.php
  24. 4
      main/gradebook/lib/be/abstractlink.class.php
  25. 2
      main/gradebook/lib/be/attendancelink.class.php
  26. 4
      main/gradebook/lib/be/learnpathlink.class.php
  27. 2
      main/group/group_category.php
  28. 8
      main/group/group_space.php
  29. 2
      main/inc/ajax/course.ajax.php
  30. 2
      main/inc/ajax/lp.ajax.php
  31. 2
      main/inc/ajax/work.ajax.php
  32. 4
      main/inc/lib/add_course.lib.inc.php
  33. 12
      main/inc/lib/agenda.lib.php
  34. 4
      main/inc/lib/api.lib.php
  35. 6
      main/inc/lib/attendance.lib.php
  36. 38
      main/inc/lib/course.lib.php
  37. 26
      main/inc/lib/exercise.lib.php
  38. 20
      main/inc/lib/groupmanager.lib.php
  39. 38
      main/inc/lib/link.lib.php
  40. 18
      main/inc/lib/specific_fields_manager.lib.php
  41. 6
      main/inc/lib/statistics.lib.php
  42. 2
      main/inc/lib/system_announcements.lib.php
  43. 2
      main/inc/lib/thematic.lib.php
  44. 12
      main/inc/lib/tracking.lib.php
  45. 6
      main/inc/lib/usermanager.lib.php
  46. 4
      main/inc/lib/userportal.lib.php
  47. 2
      main/inc/local.inc.php
  48. 10
      main/lp/learnpath.class.php
  49. 2
      main/lp/lp_edit_item.php
  50. 6
      main/mySpace/current_courses.php
  51. 4
      main/mySpace/myStudents.php
  52. 4
      main/mySpace/user_edit.php
  53. 2
      main/search/search_suggestions.php
  54. 2
      main/session/add_many_session_to_category.php
  55. 2
      main/survey/create_new_survey.php
  56. 10
      main/survey/fillsurvey.php
  57. 12
      main/survey/preview.php
  58. 12
      main/survey/question.php
  59. 4
      main/survey/reporting.php
  60. 8
      main/survey/survey.download.inc.php
  61. 6
      main/survey/survey.lib.php
  62. 12
      main/survey/survey.php
  63. 28
      main/survey/surveyUtil.class.php
  64. 12
      main/survey/survey_invitation.php
  65. 12
      main/survey/survey_invite.php
  66. 8
      main/survey/survey_list.php
  67. 6
      main/user/user_export.php
  68. 44
      src/Chamilo/CourseBundle/Component/CourseCopy/CourseBuilder.php
  69. 6
      src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php

@ -25,10 +25,10 @@ $courses = array ();
$url_list = array(); $url_list = array();
$users = array(); $users = array();
$tbl_access_url_rel_course = Database:: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); $tbl_access_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$tbl_access_url = Database:: get_main_table(TABLE_MAIN_ACCESS_URL); $tbl_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL);
$tbl_user = Database:: get_main_table(TABLE_MAIN_USER); $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_course = Database:: get_main_table(TABLE_MAIN_COURSE); $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
/* Header */ /* Header */
$tool_name = get_lang('AddCoursesToURL'); $tool_name = get_lang('AddCoursesToURL');

@ -24,9 +24,9 @@ $courses = array();
$url_list = array(); $url_list = array();
$tbl_access_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); $tbl_access_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$tbl_access_url = Database:: get_main_table(TABLE_MAIN_ACCESS_URL); $tbl_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL);
$tbl_user = Database:: get_main_table(TABLE_MAIN_USER); $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_course = Database:: get_main_table(TABLE_MAIN_COURSE); $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$tool_name = get_lang('AddUserGroupToURL'); $tool_name = get_lang('AddUserGroupToURL');
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));

@ -25,8 +25,8 @@ $url_list = array();
$users = array(); $users = array();
$tbl_access_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); $tbl_access_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$tbl_access_url = Database:: get_main_table(TABLE_MAIN_ACCESS_URL); $tbl_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL);
$tbl_user = Database:: get_main_table(TABLE_MAIN_USER); $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
/* Header */ /* Header */
$tool_name = get_lang('AddUsersToURL'); $tool_name = get_lang('AddUsersToURL');

@ -127,7 +127,7 @@ if ($ajax_search) {
} }
} }
$tbl_course = Database:: get_main_table(TABLE_MAIN_COURSE); $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$sql = "SELECT id, code, title $sql = "SELECT id, code, title
FROM $tbl_course u FROM $tbl_course u
ORDER BY title, code"; ORDER BY title, code";

@ -26,34 +26,34 @@ function get_course_usage($course, $session_id = 0)
{ {
$courseId = $course['real_id']; $courseId = $course['real_id'];
// Learnpaths // Learnpaths
$table = Database :: get_course_table(TABLE_LP_MAIN); $table = Database::get_course_table(TABLE_LP_MAIN);
$usage[] = array( $usage[] = array(
get_lang(ucfirst(TOOL_LEARNPATH)), get_lang(ucfirst(TOOL_LEARNPATH)),
CourseManager::count_rows_course_table($table, $session_id, $courseId) CourseManager::count_rows_course_table($table, $session_id, $courseId)
); );
// Forums // Forums
$table = Database :: get_course_table(TABLE_FORUM); $table = Database::get_course_table(TABLE_FORUM);
$usage[] = array(get_lang('Forums'), CourseManager::count_rows_course_table($table, $session_id, $courseId)); $usage[] = array(get_lang('Forums'), CourseManager::count_rows_course_table($table, $session_id, $courseId));
// Quizzes // Quizzes
$table = Database :: get_course_table(TABLE_QUIZ_TEST); $table = Database::get_course_table(TABLE_QUIZ_TEST);
$usage[] = array( $usage[] = array(
get_lang(ucfirst(TOOL_QUIZ)), get_lang(ucfirst(TOOL_QUIZ)),
CourseManager::count_rows_course_table($table, $session_id, $courseId) CourseManager::count_rows_course_table($table, $session_id, $courseId)
); );
// Documents // Documents
$table = Database :: get_course_table(TABLE_DOCUMENT); $table = Database::get_course_table(TABLE_DOCUMENT);
$usage[] = array( $usage[] = array(
get_lang(ucfirst(TOOL_DOCUMENT)), get_lang(ucfirst(TOOL_DOCUMENT)),
CourseManager::count_rows_course_table($table, $session_id, $courseId) CourseManager::count_rows_course_table($table, $session_id, $courseId)
); );
// Groups // Groups
$table = Database :: get_course_table(TABLE_GROUP); $table = Database::get_course_table(TABLE_GROUP);
$usage[] = array( $usage[] = array(
get_lang(ucfirst(TOOL_GROUP)), get_lang(ucfirst(TOOL_GROUP)),
CourseManager::count_rows_course_table($table, $session_id, $courseId) CourseManager::count_rows_course_table($table, $session_id, $courseId)
); );
// Calendar // Calendar
$table = Database :: get_course_table(TABLE_AGENDA); $table = Database::get_course_table(TABLE_AGENDA);
$usage[] = array( $usage[] = array(
get_lang(ucfirst(TOOL_CALENDAR_EVENT)), get_lang(ucfirst(TOOL_CALENDAR_EVENT)),
CourseManager::count_rows_course_table($table, $session_id, $courseId) CourseManager::count_rows_course_table($table, $session_id, $courseId)
@ -100,8 +100,8 @@ $table->display();
*/ */
echo Display::page_header(get_lang('Users')); echo Display::page_header(get_lang('Users'));
$table_course_user = Database:: get_main_table(TABLE_MAIN_COURSE_USER); $table_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$table_user = Database:: get_main_table(TABLE_MAIN_USER); $table_user = Database::get_main_table(TABLE_MAIN_USER);
$sql = "SELECT *, cu.status as course_status $sql = "SELECT *, cu.status as course_status
FROM $table_course_user cu, $table_user u"; FROM $table_course_user cu, $table_user u";
if (api_is_multiple_url_enabled()) { if (api_is_multiple_url_enabled()) {

@ -32,7 +32,7 @@ $interbreadcrumb[] = array('url' => 'languages.php', 'name' => get_lang('Platfor
*/ */
function add_sub_language($original_name, $english_name, $isocode, $sublanguage_available, $parent_id) function add_sub_language($original_name, $english_name, $isocode, $sublanguage_available, $parent_id)
{ {
$tbl_admin_languages = Database:: get_main_table(TABLE_MAIN_LANGUAGE); $tbl_admin_languages = Database::get_main_table(TABLE_MAIN_LANGUAGE);
$original_name = Database::escape_string($original_name); $original_name = Database::escape_string($original_name);
$english_name = Database::escape_string($english_name); $english_name = Database::escape_string($english_name);
$isocode = Database::escape_string($isocode); $isocode = Database::escape_string($isocode);
@ -64,7 +64,7 @@ function add_sub_language($original_name, $english_name, $isocode, $sublanguage_
*/ */
function check_if_language_exist($original_name, $english_name, $isocode, $sublanguage_available) function check_if_language_exist($original_name, $english_name, $isocode, $sublanguage_available)
{ {
$tbl_admin_languages = Database:: get_main_table(TABLE_MAIN_LANGUAGE); $tbl_admin_languages = Database::get_main_table(TABLE_MAIN_LANGUAGE);
$sql_original_name = 'SELECT count(*) AS count_original_name FROM ' . $tbl_admin_languages . ' WHERE original_name="' . Database::escape_string($original_name) . '" '; $sql_original_name = 'SELECT count(*) AS count_original_name FROM ' . $tbl_admin_languages . ' WHERE original_name="' . Database::escape_string($original_name) . '" ';
$sql_english_name = 'SELECT count(*) AS count_english_name FROM ' . $tbl_admin_languages . ' WHERE english_name="' . Database::escape_string($english_name) . '" '; $sql_english_name = 'SELECT count(*) AS count_english_name FROM ' . $tbl_admin_languages . ' WHERE english_name="' . Database::escape_string($english_name) . '" ';
//$sql_isocode='SELECT count(*) AS count_isocode FROM '.$tbl_admin_languages.' WHERE isocode="'.Database::escape_string($isocode).'" '; //$sql_isocode='SELECT count(*) AS count_isocode FROM '.$tbl_admin_languages.' WHERE isocode="'.Database::escape_string($isocode).'" ';

@ -12,9 +12,9 @@ $this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script(); api_protect_admin_script();
// Database table definitions // Database table definitions
$course_table = Database:: get_main_table(TABLE_MAIN_COURSE); $course_table = Database::get_main_table(TABLE_MAIN_COURSE);
$user_table = Database:: get_main_table(TABLE_MAIN_USER); $user_table = Database::get_main_table(TABLE_MAIN_USER);
$course_user_table = Database:: get_main_table(TABLE_MAIN_COURSE_USER); $course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$session_course_user_table = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); $session_course_user_table = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tool_name = get_lang('ExportUserListXMLCSV'); $tool_name = get_lang('ExportUserListXMLCSV');

@ -249,11 +249,11 @@ foreach ($data as $label => $item) {
} }
$trackingInformation = $table->toHtml(); $trackingInformation = $table->toHtml();
$tbl_session_course = Database:: get_main_table(TABLE_MAIN_SESSION_COURSE); $tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_session_course_user = Database:: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); $tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_session = Database:: get_main_table(TABLE_MAIN_SESSION); $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_course = Database:: get_main_table(TABLE_MAIN_COURSE); $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$tbl_user = Database:: get_main_table(TABLE_MAIN_USER); $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$socialInformation = ''; $socialInformation = '';

@ -53,10 +53,10 @@ if (api_get_setting('pdf_export_watermark_by_course') == 'true') {
$show_delete_watermark_text_message = true; $show_delete_watermark_text_message = true;
} }
} }
$tbl_user = Database:: get_main_table(TABLE_MAIN_USER); $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_admin = Database:: get_main_table(TABLE_MAIN_ADMIN); $tbl_admin = Database::get_main_table(TABLE_MAIN_ADMIN);
$tbl_course_user = Database:: get_main_table(TABLE_MAIN_COURSE_USER); $tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$tbl_course = Database:: get_main_table(TABLE_MAIN_COURSE); $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$sql = "SELECT tutor_name FROM $tbl_course WHERE id = $courseId"; $sql = "SELECT tutor_name FROM $tbl_course WHERE id = $courseId";
$q_tutor = Database::query($sql); $q_tutor = Database::query($sql);

@ -207,7 +207,7 @@ if (isset($_POST['text2voice_mode']) && $_POST['text2voice_mode'] == 'google') {
downloadMP3_pediaphon($filepath, $dir); downloadMP3_pediaphon($filepath, $dir);
} }
$tbl_admin_languages = Database:: get_main_table(TABLE_MAIN_LANGUAGE); $tbl_admin_languages = Database::get_main_table(TABLE_MAIN_LANGUAGE);
$sql_select = "SELECT * FROM $tbl_admin_languages"; $sql_select = "SELECT * FROM $tbl_admin_languages";
$result_select = Database::query($sql_select); $result_select = Database::query($sql_select);

@ -41,10 +41,10 @@ $isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh(
$courseInfo $courseInfo
); );
$TBL_DOCUMENT = Database :: get_course_table(TABLE_DOCUMENT); $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
$TBL_ITEM_PROPERTY = Database :: get_course_table(TABLE_ITEM_PROPERTY); $TBL_ITEM_PROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
$TBL_EXERCISE_QUESTION = Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION); $TBL_EXERCISE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);
$TBL_EXERCISES = Database :: get_course_table(TABLE_QUIZ_TEST); $TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST);
$TBL_TRACK_EXERCISES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); $TBL_TRACK_EXERCISES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
// document path // document path

@ -39,7 +39,7 @@ $is_tutor = api_is_allowed_to_edit(true);
$TBL_TRACK_EXERCISES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); $TBL_TRACK_EXERCISES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
$TBL_TRACK_ATTEMPT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $TBL_TRACK_ATTEMPT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$TBL_TRACK_ATTEMPT_RECORDING = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING); $TBL_TRACK_ATTEMPT_RECORDING = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
$TBL_LP_ITEM_VIEW = Database :: get_course_table(TABLE_LP_ITEM_VIEW); $TBL_LP_ITEM_VIEW = Database::get_course_table(TABLE_LP_ITEM_VIEW);
$allowCoachFeedbackExercises = api_get_setting('allow_coach_feedback_exercises') === 'true'; $allowCoachFeedbackExercises = api_get_setting('allow_coach_feedback_exercises') === 'true';

@ -50,7 +50,7 @@ class ExerciseResult
$TBL_TABLE_LP_MAIN = Database::get_course_table(TABLE_LP_MAIN); $TBL_TABLE_LP_MAIN = Database::get_course_table(TABLE_LP_MAIN);
$TBL_USER = Database::get_main_table(TABLE_MAIN_USER); $TBL_USER = Database::get_main_table(TABLE_MAIN_USER);
$TBL_TRACK_EXERCISES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); $TBL_TRACK_EXERCISES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
$TBL_TRACK_ATTEMPT_RECORDING = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING); $TBL_TRACK_ATTEMPT_RECORDING = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
$cid = api_get_course_id(); $cid = api_get_course_id();
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();

@ -30,10 +30,10 @@ $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path']."/document";
$is_allowedToEdit = api_is_allowed_to_edit(null, true) || api_is_drh(); $is_allowedToEdit = api_is_allowed_to_edit(null, true) || api_is_drh();
$is_tutor = api_is_allowed_to_edit(true); $is_tutor = api_is_allowed_to_edit(true);
$TBL_QUESTIONS = Database :: get_course_table(TABLE_QUIZ_QUESTION); $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION);
$TBL_TRACK_EXERCISES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); $TBL_TRACK_EXERCISES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
$TBL_TRACK_HOTPOTATOES_EXERCISES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES); $TBL_TRACK_HOTPOTATOES_EXERCISES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES);
$TBL_LP_ITEM_VIEW = Database :: get_course_table(TABLE_LP_ITEM_VIEW); $TBL_LP_ITEM_VIEW = Database::get_course_table(TABLE_LP_ITEM_VIEW);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$hotpotatoes_path = isset($_REQUEST['path']) ? Security::remove_XSS($_REQUEST['path']) : null; $hotpotatoes_path = isset($_REQUEST['path']) ? Security::remove_XSS($_REQUEST['path']) : null;

@ -41,7 +41,7 @@ $form->addElement(
$session_id = api_get_session_id(); $session_id = api_get_session_id();
// the exercises // the exercises
$tbl_exercises = Database :: get_course_table(TABLE_QUIZ_TEST); $tbl_exercises = Database::get_course_table(TABLE_QUIZ_TEST);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$sql = "SELECT id,title,type,description, results_disabled $sql = "SELECT id,title,type,description, results_disabled

@ -13,20 +13,20 @@
/* /*
Database Variables Database Variables
*/ */
$table_categories = Database :: get_course_table(TABLE_FORUM_CATEGORY); $table_categories = Database::get_course_table(TABLE_FORUM_CATEGORY);
$table_forums = Database :: get_course_table(TABLE_FORUM); $table_forums = Database::get_course_table(TABLE_FORUM);
$table_threads = Database :: get_course_table(TABLE_FORUM_THREAD); $table_threads = Database::get_course_table(TABLE_FORUM_THREAD);
$table_posts = Database :: get_course_table(TABLE_FORUM_POST); $table_posts = Database::get_course_table(TABLE_FORUM_POST);
$table_mailcue = Database :: get_course_table(TABLE_FORUM_MAIL_QUEUE); $table_mailcue = Database::get_course_table(TABLE_FORUM_MAIL_QUEUE);
$table_threads_qualify = Database :: get_course_table( $table_threads_qualify = Database::get_course_table(
TABLE_FORUM_THREAD_QUALIFY TABLE_FORUM_THREAD_QUALIFY
); );
$table_threads_qualify_historical = Database :: get_course_table( $table_threads_qualify_historical = Database::get_course_table(
TABLE_FORUM_THREAD_QUALIFY_LOG TABLE_FORUM_THREAD_QUALIFY_LOG
); );
$forum_table_attachment = Database :: get_course_table(TABLE_FORUM_ATTACHMENT); $forum_table_attachment = Database::get_course_table(TABLE_FORUM_ATTACHMENT);
$table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); $table_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY);
$table_users = Database::get_main_table(TABLE_MAIN_USER); $table_users = Database::get_main_table(TABLE_MAIN_USER);
/* /*

@ -912,7 +912,7 @@ function deleteForumCategoryThread($content, $id)
*/ */
function delete_post($post_id) function delete_post($post_id)
{ {
$table_threads = Database :: get_course_table(TABLE_FORUM_THREAD); $table_threads = Database::get_course_table(TABLE_FORUM_THREAD);
$post_id = intval($post_id); $post_id = intval($post_id);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$em = Database::getManager(); $em = Database::getManager();
@ -984,7 +984,7 @@ function delete_post($post_id)
*/ */
function check_if_last_post_of_thread($thread_id) function check_if_last_post_of_thread($thread_id)
{ {
$table_posts = Database :: get_course_table(TABLE_FORUM_POST); $table_posts = Database::get_course_table(TABLE_FORUM_POST);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$sql = "SELECT * FROM $table_posts $sql = "SELECT * FROM $table_posts
WHERE c_id = $course_id AND thread_id = ".intval($thread_id)." WHERE c_id = $course_id AND thread_id = ".intval($thread_id)."
@ -1174,9 +1174,9 @@ function change_visibility($content, $id, $target_visibility)
*/ */
function change_lock_status($content, $id, $action) function change_lock_status($content, $id, $action)
{ {
$table_categories = Database :: get_course_table(TABLE_FORUM_CATEGORY); $table_categories = Database::get_course_table(TABLE_FORUM_CATEGORY);
$table_forums = Database :: get_course_table(TABLE_FORUM); $table_forums = Database::get_course_table(TABLE_FORUM);
$table_threads = Database :: get_course_table(TABLE_FORUM_THREAD); $table_threads = Database::get_course_table(TABLE_FORUM_THREAD);
// Determine the relevant table. // Determine the relevant table.
if ($content == 'forumcategory') { if ($content == 'forumcategory') {
@ -1231,9 +1231,9 @@ function change_lock_status($content, $id, $action)
*/ */
function move_up_down($content, $direction, $id) function move_up_down($content, $direction, $id)
{ {
$table_categories = Database:: get_course_table(TABLE_FORUM_CATEGORY); $table_categories = Database::get_course_table(TABLE_FORUM_CATEGORY);
$table_forums = Database:: get_course_table(TABLE_FORUM); $table_forums = Database::get_course_table(TABLE_FORUM);
$table_item_property = Database:: get_course_table(TABLE_ITEM_PROPERTY); $table_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$id = intval($id); $id = intval($id);
@ -1334,8 +1334,8 @@ function move_up_down($content, $direction, $id)
*/ */
function get_forum_categories($id = '', $courseId = 0, $sessionId = 0) function get_forum_categories($id = '', $courseId = 0, $sessionId = 0)
{ {
$table_categories = Database :: get_course_table(TABLE_FORUM_CATEGORY); $table_categories = Database::get_course_table(TABLE_FORUM_CATEGORY);
$table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); $table_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY);
// Condition for the session // Condition for the session
$session_id = $sessionId ?: api_get_session_id(); $session_id = $sessionId ?: api_get_session_id();
@ -1670,7 +1670,7 @@ function get_last_post_by_thread($course_id, $thread_id, $forum_id, $show_visibl
$forum_id = intval($forum_id); $forum_id = intval($forum_id);
$course_id = intval($course_id); $course_id = intval($course_id);
$table_posts = Database :: get_course_table(TABLE_FORUM_POST); $table_posts = Database::get_course_table(TABLE_FORUM_POST);
$sql = "SELECT * FROM $table_posts $sql = "SELECT * FROM $table_posts
WHERE WHERE
c_id = $course_id AND c_id = $course_id AND
@ -1711,10 +1711,10 @@ function get_last_post_information($forum_id, $show_invisibles = false, $course_
} }
$sessionId = api_get_session_id(); $sessionId = api_get_session_id();
$table_posts = Database :: get_course_table(TABLE_FORUM_POST); $table_posts = Database::get_course_table(TABLE_FORUM_POST);
$table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); $table_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY);
$table_users = Database::get_main_table(TABLE_MAIN_USER); $table_users = Database::get_main_table(TABLE_MAIN_USER);
$table_threads = Database :: get_course_table(TABLE_FORUM_THREAD); $table_threads = Database::get_course_table(TABLE_FORUM_THREAD);
$forum_id = intval($forum_id); $forum_id = intval($forum_id);
$return_array = array(); $return_array = array();
@ -1810,8 +1810,8 @@ function get_threads($forum_id, $courseId = null, $sessionId = null)
{ {
$groupId = api_get_group_id(); $groupId = api_get_group_id();
$sessionId = $sessionId !== null ? intval($sessionId) : api_get_session_id(); $sessionId = $sessionId !== null ? intval($sessionId) : api_get_session_id();
$table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); $table_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY);
$table_threads = Database :: get_course_table(TABLE_FORUM_THREAD); $table_threads = Database::get_course_table(TABLE_FORUM_THREAD);
$table_users = Database::get_main_table(TABLE_MAIN_USER); $table_users = Database::get_main_table(TABLE_MAIN_USER);
$courseId = $courseId !== null ? intval($courseId) : api_get_course_int_id(); $courseId = $courseId !== null ? intval($courseId) : api_get_course_int_id();
@ -2068,7 +2068,7 @@ function getPosts(
*/ */
function get_post_information($post_id) function get_post_information($post_id)
{ {
$table_posts = Database :: get_course_table(TABLE_FORUM_POST); $table_posts = Database::get_course_table(TABLE_FORUM_POST);
$table_users = Database::get_main_table(TABLE_MAIN_USER); $table_users = Database::get_main_table(TABLE_MAIN_USER);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
@ -2096,8 +2096,8 @@ function get_post_information($post_id)
*/ */
function get_thread_information($forumId, $thread_id, $sessionId = null) function get_thread_information($forumId, $thread_id, $sessionId = null)
{ {
$table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); $table_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY);
$table_threads = Database :: get_course_table(TABLE_FORUM_THREAD); $table_threads = Database::get_course_table(TABLE_FORUM_THREAD);
$thread_id = intval($thread_id); $thread_id = intval($thread_id);
$sessionId = $sessionId !== null ? intval($sessionId) : api_get_session_id(); $sessionId = $sessionId !== null ? intval($sessionId) : api_get_session_id();
$sessionCondition = api_get_session_condition($sessionId, true, false, 'threads.session_id'); $sessionCondition = api_get_session_condition($sessionId, true, false, 'threads.session_id');
@ -2134,7 +2134,7 @@ function get_thread_information($forumId, $thread_id, $sessionId = null)
*/ */
function get_thread_users_details($thread_id) function get_thread_users_details($thread_id)
{ {
$t_posts = Database :: get_course_table(TABLE_FORUM_POST); $t_posts = Database::get_course_table(TABLE_FORUM_POST);
$t_users = Database::get_main_table(TABLE_MAIN_USER); $t_users = Database::get_main_table(TABLE_MAIN_USER);
$t_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER); $t_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$t_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); $t_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
@ -2188,8 +2188,8 @@ function get_thread_users_details($thread_id)
*/ */
function get_thread_users_qualify($thread_id) function get_thread_users_qualify($thread_id)
{ {
$t_posts = Database :: get_course_table(TABLE_FORUM_POST); $t_posts = Database::get_course_table(TABLE_FORUM_POST);
$t_qualify = Database :: get_course_table(TABLE_FORUM_THREAD_QUALIFY); $t_qualify = Database::get_course_table(TABLE_FORUM_THREAD_QUALIFY);
$t_users = Database::get_main_table(TABLE_MAIN_USER); $t_users = Database::get_main_table(TABLE_MAIN_USER);
$t_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER); $t_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$t_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); $t_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
@ -2256,8 +2256,8 @@ function get_thread_users_qualify($thread_id)
*/ */
function get_thread_users_not_qualify($thread_id) function get_thread_users_not_qualify($thread_id)
{ {
$t_posts = Database :: get_course_table(TABLE_FORUM_POST); $t_posts = Database::get_course_table(TABLE_FORUM_POST);
$t_qualify = Database :: get_course_table(TABLE_FORUM_THREAD_QUALIFY); $t_qualify = Database::get_course_table(TABLE_FORUM_THREAD_QUALIFY);
$t_users = Database::get_main_table(TABLE_MAIN_USER); $t_users = Database::get_main_table(TABLE_MAIN_USER);
$t_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER); $t_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$t_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); $t_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
@ -2327,8 +2327,8 @@ function get_thread_users_not_qualify($thread_id)
*/ */
function get_forum_information($forum_id, $courseId = 0) function get_forum_information($forum_id, $courseId = 0)
{ {
$table_forums = Database :: get_course_table(TABLE_FORUM); $table_forums = Database::get_course_table(TABLE_FORUM);
$table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); $table_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY);
$courseId = empty($courseId) ? api_get_course_int_id(): intval($courseId); $courseId = empty($courseId) ? api_get_course_int_id(): intval($courseId);
$forum_id = intval($forum_id); $forum_id = intval($forum_id);
@ -2362,8 +2362,8 @@ function get_forum_information($forum_id, $courseId = 0)
*/ */
function get_forumcategory_information($cat_id) function get_forumcategory_information($cat_id)
{ {
$table_categories = Database :: get_course_table(TABLE_FORUM_CATEGORY); $table_categories = Database::get_course_table(TABLE_FORUM_CATEGORY);
$table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); $table_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$sql = "SELECT * $sql = "SELECT *
@ -2393,7 +2393,7 @@ function get_forumcategory_information($cat_id)
*/ */
function count_number_of_forums_in_category($cat_id) function count_number_of_forums_in_category($cat_id)
{ {
$table_forums = Database :: get_course_table(TABLE_FORUM); $table_forums = Database::get_course_table(TABLE_FORUM);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$sql = "SELECT count(*) AS number_of_forums $sql = "SELECT count(*) AS number_of_forums
FROM ".$table_forums." FROM ".$table_forums."
@ -2413,7 +2413,7 @@ function count_number_of_forums_in_category($cat_id)
*/ */
function updateThread($values) function updateThread($values)
{ {
$threadTable = Database :: get_course_table(TABLE_FORUM_THREAD); $threadTable = Database::get_course_table(TABLE_FORUM_THREAD);
$courseId = api_get_course_int_id(); $courseId = api_get_course_int_id();
$params = [ $params = [
@ -2502,7 +2502,7 @@ function store_thread($current_forum, $values, $courseInfo = array(), $showMessa
$sessionId = $sessionId ?: api_get_session_id(); $sessionId = $sessionId ?: api_get_session_id();
$em = Database::getManager(); $em = Database::getManager();
$table_threads = Database :: get_course_table(TABLE_FORUM_THREAD); $table_threads = Database::get_course_table(TABLE_FORUM_THREAD);
$gradebook = isset($_GET['gradebook']) ? Security::remove_XSS($_GET['gradebook']) : ''; $gradebook = isset($_GET['gradebook']) ? Security::remove_XSS($_GET['gradebook']) : '';
$upload_ok = 1; $upload_ok = 1;
@ -3313,7 +3313,7 @@ function store_reply($current_forum, $values, $courseId = 0, $userId = 0)
{ {
$courseId = !empty($courseId) ? $courseId : api_get_course_int_id(); $courseId = !empty($courseId) ? $courseId : api_get_course_int_id();
$_course = api_get_course_info_by_id($courseId); $_course = api_get_course_info_by_id($courseId);
$table_posts = Database :: get_course_table(TABLE_FORUM_POST); $table_posts = Database::get_course_table(TABLE_FORUM_POST);
$post_date = api_get_utc_datetime(); $post_date = api_get_utc_datetime();
$userId = $userId ?: api_get_user_id(); $userId = $userId ?: api_get_user_id();
@ -3657,8 +3657,8 @@ function show_edit_post_form(
*/ */
function store_edit_post($forumInfo, $values) function store_edit_post($forumInfo, $values)
{ {
$threadTable = Database :: get_course_table(TABLE_FORUM_THREAD); $threadTable = Database::get_course_table(TABLE_FORUM_THREAD);
$table_posts = Database :: get_course_table(TABLE_FORUM_POST); $table_posts = Database::get_course_table(TABLE_FORUM_POST);
$gradebook = Security::remove_XSS($_GET['gradebook']); $gradebook = Security::remove_XSS($_GET['gradebook']);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
@ -3806,7 +3806,7 @@ function display_user_image($user_id, $name, $origin = '')
*/ */
function increase_thread_view($thread_id) function increase_thread_view($thread_id)
{ {
$table_threads = Database :: get_course_table(TABLE_FORUM_THREAD); $table_threads = Database::get_course_table(TABLE_FORUM_THREAD);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$sql = "UPDATE $table_threads SET thread_views=thread_views+1 $sql = "UPDATE $table_threads SET thread_views=thread_views+1
@ -3826,7 +3826,7 @@ function increase_thread_view($thread_id)
*/ */
function updateThreadInfo($thread_id, $last_post_id, $post_date) function updateThreadInfo($thread_id, $last_post_id, $post_date)
{ {
$table_threads = Database :: get_course_table(TABLE_FORUM_THREAD); $table_threads = Database::get_course_table(TABLE_FORUM_THREAD);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$sql = "UPDATE $table_threads SET $sql = "UPDATE $table_threads SET
thread_replies = thread_replies+1, thread_replies = thread_replies+1,
@ -3871,7 +3871,7 @@ function get_whats_new()
return false; return false;
} }
$table_posts = Database :: get_course_table(TABLE_FORUM_POST); $table_posts = Database::get_course_table(TABLE_FORUM_POST);
$tracking_last_tool_access = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LASTACCESS); $tracking_last_tool_access = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LASTACCESS);
$tool = TOOL_FORUM; $tool = TOOL_FORUM;
@ -3920,7 +3920,7 @@ function get_whats_new()
*/ */
function approve_post($post_id, $action) function approve_post($post_id, $action)
{ {
$table_posts = Database :: get_course_table(TABLE_FORUM_POST); $table_posts = Database::get_course_table(TABLE_FORUM_POST);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
if ($action == 'invisible') { if ($action == 'invisible') {
@ -3954,7 +3954,7 @@ function approve_post($post_id, $action)
*/ */
function get_unaproved_messages($forum_id) function get_unaproved_messages($forum_id)
{ {
$table_posts = Database :: get_course_table(TABLE_FORUM_POST); $table_posts = Database::get_course_table(TABLE_FORUM_POST);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$return_array = array(); $return_array = array();
@ -4052,10 +4052,10 @@ function send_notification_mails($forumId, $thread_id, $reply_info)
*/ */
function handle_mail_cue($content, $id) function handle_mail_cue($content, $id)
{ {
$table_mailcue = Database :: get_course_table(TABLE_FORUM_MAIL_QUEUE); $table_mailcue = Database::get_course_table(TABLE_FORUM_MAIL_QUEUE);
$table_forums = Database :: get_course_table(TABLE_FORUM); $table_forums = Database::get_course_table(TABLE_FORUM);
$table_threads = Database :: get_course_table(TABLE_FORUM_THREAD); $table_threads = Database::get_course_table(TABLE_FORUM_THREAD);
$table_posts = Database :: get_course_table(TABLE_FORUM_POST); $table_posts = Database::get_course_table(TABLE_FORUM_POST);
$table_users = Database::get_main_table(TABLE_MAIN_USER); $table_users = Database::get_main_table(TABLE_MAIN_USER);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
@ -4270,9 +4270,9 @@ function store_move_post($values)
$_course = api_get_course_info(); $_course = api_get_course_info();
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$table_forums = Database :: get_course_table(TABLE_FORUM); $table_forums = Database::get_course_table(TABLE_FORUM);
$table_threads = Database :: get_course_table(TABLE_FORUM_THREAD); $table_threads = Database::get_course_table(TABLE_FORUM_THREAD);
$table_posts = Database :: get_course_table(TABLE_FORUM_POST); $table_posts = Database::get_course_table(TABLE_FORUM_POST);
if ($values['thread'] == '0') { if ($values['thread'] == '0') {
$current_post = get_post_information($values['post_id']); $current_post = get_post_information($values['post_id']);
@ -4389,8 +4389,8 @@ function store_move_post($values)
*/ */
function store_move_thread($values) function store_move_thread($values)
{ {
$table_threads = Database :: get_course_table(TABLE_FORUM_THREAD); $table_threads = Database::get_course_table(TABLE_FORUM_THREAD);
$table_posts = Database :: get_course_table(TABLE_FORUM_POST); $table_posts = Database::get_course_table(TABLE_FORUM_POST);
$courseId = api_get_course_int_id(); $courseId = api_get_course_int_id();
$sessionId = api_get_session_id(); $sessionId = api_get_session_id();
@ -4412,7 +4412,7 @@ function store_move_thread($values)
if (!empty($forumInfo['to_group_id'])) { if (!empty($forumInfo['to_group_id'])) {
$groupId = $forumInfo['to_group_id']; $groupId = $forumInfo['to_group_id'];
$item = api_get_item_property_info($courseId, TABLE_FORUM_THREAD, $threadId, $sessionId, $groupId); $item = api_get_item_property_info($courseId, TABLE_FORUM_THREAD, $threadId, $sessionId, $groupId);
$table = Database:: get_course_table(TABLE_ITEM_PROPERTY); $table = Database::get_course_table(TABLE_ITEM_PROPERTY);
$sessionCondition = api_get_session_condition($sessionId); $sessionCondition = api_get_session_condition($sessionId);
if (!empty($item)) { if (!empty($item)) {
@ -4528,9 +4528,9 @@ function forum_search()
*/ */
function display_forum_search_results($search_term) function display_forum_search_results($search_term)
{ {
$table_threads = Database :: get_course_table(TABLE_FORUM_THREAD); $table_threads = Database::get_course_table(TABLE_FORUM_THREAD);
$table_posts = Database :: get_course_table(TABLE_FORUM_POST); $table_posts = Database::get_course_table(TABLE_FORUM_POST);
$table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); $table_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY);
$session_id = api_get_session_id(); $session_id = api_get_session_id();
$gradebook = Security::remove_XSS($_GET['gradebook']); $gradebook = Security::remove_XSS($_GET['gradebook']);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
@ -4830,7 +4830,7 @@ function edit_forum_attachment_file($file_comment, $post_id, $id_attach)
*/ */
function get_attachment($post_id) function get_attachment($post_id)
{ {
$forum_table_attachment = Database :: get_course_table(TABLE_FORUM_ATTACHMENT); $forum_table_attachment = Database::get_course_table(TABLE_FORUM_ATTACHMENT);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$row = array(); $row = array();
$post_id = intval($post_id); $post_id = intval($post_id);
@ -4852,7 +4852,7 @@ function get_attachment($post_id)
*/ */
function getAllAttachment($postId) function getAllAttachment($postId)
{ {
$forumAttachmentTable = Database :: get_course_table(TABLE_FORUM_ATTACHMENT); $forumAttachmentTable = Database::get_course_table(TABLE_FORUM_ATTACHMENT);
$courseId = api_get_course_int_id(); $courseId = api_get_course_int_id();
$postId = intval($postId); $postId = intval($postId);
$columns = array('iid', 'path', 'filename', 'comment'); $columns = array('iid', 'path', 'filename', 'comment');
@ -4932,10 +4932,10 @@ function delete_attachment($post_id, $id_attach = 0, $display = true)
*/ */
function get_forums_of_group($groupInfo) function get_forums_of_group($groupInfo)
{ {
$table_forums = Database :: get_course_table(TABLE_FORUM); $table_forums = Database::get_course_table(TABLE_FORUM);
$table_threads = Database :: get_course_table(TABLE_FORUM_THREAD); $table_threads = Database::get_course_table(TABLE_FORUM_THREAD);
$table_posts = Database :: get_course_table(TABLE_FORUM_POST); $table_posts = Database::get_course_table(TABLE_FORUM_POST);
$table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); $table_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$groupId = (int) $groupInfo['id']; $groupId = (int) $groupInfo['id'];
@ -5275,7 +5275,7 @@ function get_notifications_of_user($user_id = 0, $force = false)
*/ */
function count_number_of_post_in_thread($thread_id) function count_number_of_post_in_thread($thread_id)
{ {
$table_posts = Database :: get_course_table(TABLE_FORUM_POST); $table_posts = Database::get_course_table(TABLE_FORUM_POST);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
if (empty($course_id)) { if (empty($course_id)) {
return 0; return 0;

@ -17,7 +17,7 @@ $courseCode = isset($_GET['course_code']) ? Security::remove_XSS($_GET['course_c
$selectCat = isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : 0; $selectCat = isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : 0;
$course_info = api_get_course_info($courseCode); $course_info = api_get_course_info($courseCode);
$tbl_forum_thread = Database :: get_course_table(TABLE_FORUM_THREAD); $tbl_forum_thread = Database::get_course_table(TABLE_FORUM_THREAD);
$tbl_link = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK); $tbl_link = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$session_id = api_get_session_id(); $session_id = api_get_session_id();

@ -30,8 +30,8 @@ $course_id = GradebookUtils::get_course_id_by_link_id($my_selectcat);
$table_link = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK); $table_link = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$table_evaluation = Database::get_main_table(TABLE_MAIN_GRADEBOOK_EVALUATION); $table_evaluation = Database::get_main_table(TABLE_MAIN_GRADEBOOK_EVALUATION);
$tbl_forum_thread = Database:: get_course_table(TABLE_FORUM_THREAD); $tbl_forum_thread = Database::get_course_table(TABLE_FORUM_THREAD);
$tbl_attendance = Database:: get_course_table(TABLE_ATTENDANCE); $tbl_attendance = Database::get_course_table(TABLE_ATTENDANCE);
$table_evaluated[LINK_EXERCISE] = array( $table_evaluated[LINK_EXERCISE] = array(
TABLE_QUIZ_TEST, TABLE_QUIZ_TEST,

@ -12,8 +12,8 @@ GradebookUtils::block_students();
$tbl_grade_links = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK); $tbl_grade_links = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
//selected name of database //selected name of database
$course_id = GradebookUtils::get_course_id_by_link_id($_GET['editlink']); $course_id = GradebookUtils::get_course_id_by_link_id($_GET['editlink']);
$tbl_forum_thread = Database:: get_course_table(TABLE_FORUM_THREAD); $tbl_forum_thread = Database::get_course_table(TABLE_FORUM_THREAD);
$tbl_attendance = Database:: get_course_table(TABLE_ATTENDANCE); $tbl_attendance = Database::get_course_table(TABLE_ATTENDANCE);
$em = Database::getManager(); $em = Database::getManager();
$linkarray = LinkFactory :: load($_GET['editlink']); $linkarray = LinkFactory :: load($_GET['editlink']);

@ -31,8 +31,8 @@ echo '<div class="actions">';
api_display_tool_title(get_lang('GradebookQualifyLog')); api_display_tool_title(get_lang('GradebookQualifyLog'));
echo '</div>'; echo '</div>';
$t_user = Database:: get_main_table(TABLE_MAIN_USER); $t_user = Database::get_main_table(TABLE_MAIN_USER);
$t_link_log = Database:: get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG); $t_link_log = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG);
$visible_link = Security::remove_XSS($_GET['visiblelink']); $visible_link = Security::remove_XSS($_GET['visiblelink']);
$evaledit = EvalLink:: load($visible_link); $evaledit = EvalLink:: load($visible_link);
$sql = "SELECT lk.name,lk.description,lk.weight,lk.visible,lk.type,lk.created_at,us.username $sql = "SELECT lk.name,lk.description,lk.weight,lk.visible,lk.type,lk.created_at,us.username

@ -85,8 +85,8 @@ function confirmation() {
} }
</script>'; </script>';
$tbl_forum_thread = Database :: get_course_table(TABLE_FORUM_THREAD); $tbl_forum_thread = Database::get_course_table(TABLE_FORUM_THREAD);
$tbl_attendance = Database :: get_course_table(TABLE_ATTENDANCE); $tbl_attendance = Database::get_course_table(TABLE_ATTENDANCE);
$tbl_grade_links = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK); $tbl_grade_links = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$filter_confirm_msg = true; $filter_confirm_msg = true;
$filter_warning_msg = true; $filter_warning_msg = true;

@ -996,9 +996,9 @@ class GradebookUtils
*/ */
public static function get_users_in_course($courseCode) public static function get_users_in_course($courseCode)
{ {
$tbl_course_user = Database:: get_main_table(TABLE_MAIN_COURSE_USER); $tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$tbl_session_course_user = Database:: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); $tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_user = Database:: get_main_table(TABLE_MAIN_USER); $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname ASC' : ' ORDER BY lastname, firstname ASC'; $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname ASC' : ' ORDER BY lastname, firstname ASC';
$current_session = api_get_session_id(); $current_session = api_get_session_id();
@ -1167,8 +1167,8 @@ class GradebookUtils
$table_link = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK); $table_link = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$em = Database::getManager(); $em = Database::getManager();
$tbl_forum_thread = Database:: get_course_table(TABLE_FORUM_THREAD); $tbl_forum_thread = Database::get_course_table(TABLE_FORUM_THREAD);
$tbl_attendance = Database:: get_course_table(TABLE_ATTENDANCE); $tbl_attendance = Database::get_course_table(TABLE_ATTENDANCE);
$sql = 'UPDATE '.$table_link.' SET weight = '."'".Database::escape_string($weight)."'".' $sql = 'UPDATE '.$table_link.' SET weight = '."'".Database::escape_string($weight)."'".'
WHERE id = '.$linkId; WHERE id = '.$linkId;

@ -348,7 +348,7 @@ abstract class AbstractLink implements GradebookItem
isset($this->weight) && isset($this->weight) &&
isset($this->visible) isset($this->visible)
) { ) {
$tbl_grade_links = Database:: get_main_table(TABLE_MAIN_GRADEBOOK_LINK); $tbl_grade_links = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$sql = "SELECT count(*) FROM ".$tbl_grade_links." $sql = "SELECT count(*) FROM ".$tbl_grade_links."
WHERE WHERE
ref_id=".$this->get_ref_id()." AND ref_id=".$this->get_ref_id()." AND
@ -416,7 +416,7 @@ abstract class AbstractLink implements GradebookItem
*/ */
public static function add_link_log($idevaluation, $nameLog = null) public static function add_link_log($idevaluation, $nameLog = null)
{ {
$table = Database:: get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG); $table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG);
$dateobject = self::load($idevaluation, null, null, null, null); $dateobject = self::load($idevaluation, null, null, null, null);
$current_date_server = api_get_utc_datetime(); $current_date_server = api_get_utc_datetime();
$arreval = get_object_vars($dateobject[0]); $arreval = get_object_vars($dateobject[0]);

@ -111,7 +111,7 @@ class AttendanceLink extends AbstractLink
*/ */
public function has_results() public function has_results()
{ {
$tbl_attendance_result = Database :: get_course_table(TABLE_ATTENDANCE_RESULT); $tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT);
$session_id = api_get_session_id(); $session_id = api_get_session_id();
$sql = 'SELECT count(*) AS number FROM '.$tbl_attendance_result." $sql = 'SELECT count(*) AS number FROM '.$tbl_attendance_result."
WHERE WHERE

@ -33,7 +33,7 @@ class LearnpathLink extends AbstractLink
die('Error in get_not_created_links() : course code not set'); die('Error in get_not_created_links() : course code not set');
} }
$tbl_grade_links = Database:: get_main_table(TABLE_MAIN_GRADEBOOK_LINK); $tbl_grade_links = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$sql = 'SELECT id, name FROM ' . $this->get_learnpath_table() . ' lp $sql = 'SELECT id, name FROM ' . $this->get_learnpath_table() . ' lp
WHERE c_id = ' . $this->course_id . ' AND id NOT IN ' WHERE c_id = ' . $this->course_id . ' AND id NOT IN '
@ -250,7 +250,7 @@ class LearnpathLink extends AbstractLink
*/ */
private function get_learnpath_table() private function get_learnpath_table()
{ {
$this->learnpath_table = Database:: get_course_table(TABLE_LP_MAIN); $this->learnpath_table = Database::get_course_table(TABLE_LP_MAIN);
return $this->learnpath_table; return $this->learnpath_table;
} }

@ -96,7 +96,7 @@ if (isset($_GET['id'])) {
$form->addElement('hidden', 'id'); $form->addElement('hidden', 'id');
} else { } else {
// Checks if the field was created in the table Category. It creates it if is neccesary // Checks if the field was created in the table Category. It creates it if is neccesary
$table_category = Database :: get_course_table(TABLE_GROUP_CATEGORY); $table_category = Database::get_course_table(TABLE_GROUP_CATEGORY);
if (!Database::query("SELECT wiki_state FROM $table_category WHERE c_id = $course_id")) { if (!Database::query("SELECT wiki_state FROM $table_category WHERE c_id = $course_id")) {
Database::query("ALTER TABLE $table_category ADD wiki_state tinyint(3) UNSIGNED NOT NULL default '1' WHERE c_id = $course_id"); Database::query("ALTER TABLE $table_category ADD wiki_state tinyint(3) UNSIGNED NOT NULL default '1' WHERE c_id = $course_id");
} }

@ -388,7 +388,7 @@ function get_number_of_group_users()
} }
// Database table definition // Database table definition
$table = Database :: get_course_table(TABLE_GROUP_USER); $table = Database::get_course_table(TABLE_GROUP_USER);
// Query // Query
$sql = "SELECT count(iid) AS number_of_users $sql = "SELECT count(iid) AS number_of_users
@ -424,9 +424,9 @@ function get_group_user_data($from, $number_of_items, $column, $direction)
} }
// Database table definition // Database table definition
$table_group_user = Database:: get_course_table(TABLE_GROUP_USER); $table_group_user = Database::get_course_table(TABLE_GROUP_USER);
$table_user = Database:: get_main_table(TABLE_MAIN_USER); $table_user = Database::get_main_table(TABLE_MAIN_USER);
$tableGroup = Database:: get_course_table(TABLE_GROUP); $tableGroup = Database::get_course_table(TABLE_GROUP);
// Query // Query
if (api_get_setting('show_email_addresses') === 'true') { if (api_get_setting('show_email_addresses') === 'true') {

@ -231,7 +231,7 @@ switch ($action) {
break; break;
case 'search_survey_by_course': case 'search_survey_by_course':
if (api_is_platform_admin()) { if (api_is_platform_admin()) {
$survey = Database :: get_course_table(TABLE_SURVEY); $survey = Database::get_course_table(TABLE_SURVEY);
$sql = "SELECT survey_id as id, title, anonymous $sql = "SELECT survey_id as id, title, anonymous
FROM $survey FROM $survey

@ -12,7 +12,7 @@ api_protect_course_script(true);
$action = $_REQUEST['a']; $action = $_REQUEST['a'];
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
$sessionId = api_get_session_id(); $sessionId = api_get_session_id();
switch ($action) { switch ($action) {

@ -111,7 +111,7 @@ switch ($action) {
echo 'false'; echo 'false';
break; break;
} }
$work_table = Database:: get_course_table( $work_table = Database::get_course_table(
TABLE_STUDENT_PUBLICATION TABLE_STUDENT_PUBLICATION
); );

@ -1206,8 +1206,8 @@ class AddCourse
$teachers = isset($params['teachers']) ? $params['teachers'] : null; $teachers = isset($params['teachers']) ? $params['teachers'] : null;
$status = isset($params['status']) ? $params['status'] : null; $status = isset($params['status']) ? $params['status'] : null;
$TABLECOURSE = Database:: get_main_table(TABLE_MAIN_COURSE); $TABLECOURSE = Database::get_main_table(TABLE_MAIN_COURSE);
$TABLECOURSUSER = Database:: get_main_table(TABLE_MAIN_COURSE_USER); $TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$ok_to_register_course = true; $ok_to_register_course = true;

@ -3273,8 +3273,8 @@ class Agenda
// get agenda-items for every course // get agenda-items for every course
foreach ($courses_dbs as $key => $array_course_info) { foreach ($courses_dbs as $key => $array_course_info) {
//databases of the courses //databases of the courses
$TABLEAGENDA = Database:: get_course_table(TABLE_AGENDA); $TABLEAGENDA = Database::get_course_table(TABLE_AGENDA);
$TABLE_ITEMPROPERTY = Database:: get_course_table( $TABLE_ITEMPROPERTY = Database::get_course_table(
TABLE_ITEM_PROPERTY TABLE_ITEM_PROPERTY
); );
@ -3536,7 +3536,7 @@ class Agenda
$week = "", $week = "",
$type $type
) { ) {
$tbl_personal_agenda = Database:: get_main_table(TABLE_PERSONAL_AGENDA); $tbl_personal_agenda = Database::get_main_table(TABLE_PERSONAL_AGENDA);
$user_id = intval($user_id); $user_id = intval($user_id);
// 1. creating the SQL statement for getting the personal agenda items in MONTH view // 1. creating the SQL statement for getting the personal agenda items in MONTH view
@ -3949,8 +3949,8 @@ class Agenda
foreach ($courses as $id => $course) { foreach ($courses as $id => $course) {
$c = api_get_course_info_by_id($course['real_id']); $c = api_get_course_info_by_id($course['real_id']);
//databases of the courses //databases of the courses
$t_a = Database:: get_course_table(TABLE_AGENDA, $course['db']); $t_a = Database::get_course_table(TABLE_AGENDA, $course['db']);
$t_ip = Database:: get_course_table( $t_ip = Database::get_course_table(
TABLE_ITEM_PROPERTY, TABLE_ITEM_PROPERTY,
$course['db'] $course['db']
); );
@ -4049,7 +4049,7 @@ class Agenda
*/ */
public static function get_personal_agenda_item($id) public static function get_personal_agenda_item($id)
{ {
$tbl_personal_agenda = Database:: get_main_table(TABLE_PERSONAL_AGENDA); $tbl_personal_agenda = Database::get_main_table(TABLE_PERSONAL_AGENDA);
$id = intval($id); $id = intval($id);
// make sure events of the personal agenda can only be seen by the user himself // make sure events of the personal agenda can only be seen by the user himself
$user = api_get_user_id(); $user = api_get_user_id();

@ -1502,7 +1502,7 @@ function api_get_user_info(
} }
} }
$sql = "SELECT * FROM " . Database:: get_main_table(TABLE_MAIN_USER) . " $sql = "SELECT * FROM " . Database::get_main_table(TABLE_MAIN_USER) . "
WHERE id = $user_id"; WHERE id = $user_id";
$result = Database::query($sql); $result = Database::query($sql);
if (Database::num_rows($result) > 0) { if (Database::num_rows($result) > 0) {
@ -4715,7 +4715,7 @@ function copy_folder_course_session(
$document, $document,
$source_course_id $source_course_id
) { ) {
$table = Database :: get_course_table(TABLE_DOCUMENT); $table = Database::get_course_table(TABLE_DOCUMENT);
$session_id = intval($session_id); $session_id = intval($session_id);
$source_course_id = intval($source_course_id); $source_course_id = intval($source_course_id);

@ -283,7 +283,7 @@ class Attendance
{ {
$_course = api_get_course_info(); $_course = api_get_course_info();
$tbl_attendance = Database::get_course_table(TABLE_ATTENDANCE); $tbl_attendance = Database::get_course_table(TABLE_ATTENDANCE);
$table_link = Database:: get_main_table(TABLE_MAIN_GRADEBOOK_LINK); $table_link = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$session_id = api_get_session_id(); $session_id = api_get_session_id();
$user_id = api_get_user_id(); $user_id = api_get_user_id();
$course_code = $_course['code']; $course_code = $_course['code'];
@ -359,8 +359,8 @@ class Attendance
public function attendance_edit($attendance_id, $link_to_gradebook = false) public function attendance_edit($attendance_id, $link_to_gradebook = false)
{ {
$_course = api_get_course_info(); $_course = api_get_course_info();
$tbl_attendance = Database:: get_course_table(TABLE_ATTENDANCE); $tbl_attendance = Database::get_course_table(TABLE_ATTENDANCE);
$table_link = Database:: get_main_table(TABLE_MAIN_GRADEBOOK_LINK); $table_link = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$session_id = api_get_session_id(); $session_id = api_get_session_id();
$user_id = api_get_user_id(); $user_id = api_get_user_id();

@ -2021,8 +2021,8 @@ class CourseManager
$courseId = api_get_course_int_id(); $courseId = api_get_course_int_id();
} }
$tbl_user = Database:: get_main_table(TABLE_MAIN_USER); $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_session_course_user = Database:: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); $tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$sql = "SELECT DISTINCT $sql = "SELECT DISTINCT
u.user_id, u.user_id,
@ -2580,16 +2580,16 @@ class CourseManager
*/ */
public static function get_special_course_list() public static function get_special_course_list()
{ {
$courseTable = Database:: get_main_table(TABLE_MAIN_COURSE); $courseTable = Database::get_main_table(TABLE_MAIN_COURSE);
$tbl_course_field = Database:: get_main_table(TABLE_EXTRA_FIELD); $tbl_course_field = Database::get_main_table(TABLE_EXTRA_FIELD);
$tbl_course_field_value = Database:: get_main_table(TABLE_EXTRA_FIELD_VALUES); $tbl_course_field_value = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES);
//we filter the courses from the URL //we filter the courses from the URL
$join_access_url = $where_access_url = ''; $join_access_url = $where_access_url = '';
if (api_get_multiple_access_url()) { if (api_get_multiple_access_url()) {
$access_url_id = api_get_current_access_url_id(); $access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) { if ($access_url_id != -1) {
$tbl_url_course = Database:: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); $tbl_url_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$join_access_url = "LEFT JOIN $tbl_url_course url_rel_course $join_access_url = "LEFT JOIN $tbl_url_course url_rel_course
ON url_rel_course.c_id = tcfv.item_id "; ON url_rel_course.c_id = tcfv.item_id ";
$where_access_url = " AND access_url_id = $access_url_id "; $where_access_url = " AND access_url_id = $access_url_id ";
@ -2632,8 +2632,8 @@ class CourseManager
*/ */
public static function getCatalogueCourseList($allowed = true, $byUserId = -1) public static function getCatalogueCourseList($allowed = true, $byUserId = -1)
{ {
$courseTable = Database:: get_main_table(TABLE_MAIN_COURSE); $courseTable = Database::get_main_table(TABLE_MAIN_COURSE);
$tblCourseRelUserCatalogue = Database:: get_main_table(TABLE_MAIN_COURSE_CATALOGUE_USER); $tblCourseRelUserCatalogue = Database::get_main_table(TABLE_MAIN_COURSE_CATALOGUE_USER);
$visibility = $allowed ? 1 : 0; $visibility = $allowed ? 1 : 0;
// Restriction by user id // Restriction by user id
@ -2649,7 +2649,7 @@ class CourseManager
if (api_get_multiple_access_url()) { if (api_get_multiple_access_url()) {
$accessUrlId = api_get_current_access_url_id(); $accessUrlId = api_get_current_access_url_id();
if ($accessUrlId != -1) { if ($accessUrlId != -1) {
$tblUrlCourse = Database:: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); $tblUrlCourse = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$joinAccessUrl = "LEFT JOIN $tblUrlCourse url_rel_course $joinAccessUrl = "LEFT JOIN $tblUrlCourse url_rel_course
ON url_rel_course.c_id = c.id "; ON url_rel_course.c_id = c.id ";
$whereAccessUrl = " AND access_url_id = $accessUrlId "; $whereAccessUrl = " AND access_url_id = $accessUrlId ";
@ -3689,9 +3689,9 @@ class CourseManager
$user_category_id = (int) $user_category_id; $user_category_id = (int) $user_category_id;
// Table definitions // Table definitions
$TABLECOURS = Database:: get_main_table(TABLE_MAIN_COURSE); $TABLECOURS = Database::get_main_table(TABLE_MAIN_COURSE);
$TABLECOURSUSER = Database:: get_main_table(TABLE_MAIN_COURSE_USER); $TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$TABLE_ACCESS_URL_REL_COURSE = Database:: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); $TABLE_ACCESS_URL_REL_COURSE = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$current_url_id = api_get_current_access_url_id(); $current_url_id = api_get_current_access_url_id();
// Get course list auto-register // Get course list auto-register
@ -3843,9 +3843,9 @@ class CourseManager
{ {
$user_id = api_get_user_id(); $user_id = api_get_user_id();
// Table definitions // Table definitions
$TABLECOURS = Database:: get_main_table(TABLE_MAIN_COURSE); $TABLECOURS = Database::get_main_table(TABLE_MAIN_COURSE);
$TABLECOURSUSER = Database:: get_main_table(TABLE_MAIN_COURSE_USER); $TABLECOURSUSER = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$TABLE_ACCESS_URL_REL_COURSE = Database:: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); $TABLE_ACCESS_URL_REL_COURSE = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$current_url_id = api_get_current_access_url_id(); $current_url_id = api_get_current_access_url_id();
$courseList = []; $courseList = [];
@ -5443,7 +5443,7 @@ class CourseManager
*/ */
public static function getCourseAccessPerSessionAndUser($sessionId, $userId, $limit = null) public static function getCourseAccessPerSessionAndUser($sessionId, $userId, $limit = null)
{ {
$table = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$sessionId = intval($sessionId); $sessionId = intval($sessionId);
$userId = intval($userId); $userId = intval($userId);
@ -5474,7 +5474,7 @@ class CourseManager
$startDate, $startDate,
$endDate $endDate
) { ) {
$table = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$courseId = intval($courseId); $courseId = intval($courseId);
$sessionId = intval($sessionId); $sessionId = intval($sessionId);
$startDate = Database::escape_string($startDate); $startDate = Database::escape_string($startDate);
@ -5504,7 +5504,7 @@ class CourseManager
$sessionId = intval($sessionId); $sessionId = intval($sessionId);
$userId = intval($userId); $userId = intval($userId);
$table = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$sql = "SELECT * FROM $table $sql = "SELECT * FROM $table
WHERE session_id = $sessionId AND user_id = $userId WHERE session_id = $sessionId AND user_id = $userId
ORDER BY login_course_date ASC ORDER BY login_course_date ASC
@ -5617,7 +5617,7 @@ class CourseManager
*/ */
public static function getCourseNameFromCode($code) public static function getCourseNameFromCode($code)
{ {
$tbl_main_categories = Database:: get_main_table(TABLE_MAIN_COURSE); $tbl_main_categories = Database::get_main_table(TABLE_MAIN_COURSE);
$sql = 'SELECT title $sql = 'SELECT title
FROM ' . $tbl_main_categories . ' FROM ' . $tbl_main_categories . '
WHERE code = "' . Database::escape_string($code) . '"'; WHERE code = "' . Database::escape_string($code) . '"';

@ -1523,10 +1523,10 @@ HOTSPOT;
$in_number_of_items = intval($in_number_of_items); $in_number_of_items = intval($in_number_of_items);
$in_from = intval($in_from); $in_from = intval($in_from);
$TBL_TRACK_HOTPOTATOES = Database:: get_main_table( $TBL_TRACK_HOTPOTATOES = Database::get_main_table(
TABLE_STATISTIC_TRACK_E_HOTPOTATOES TABLE_STATISTIC_TRACK_E_HOTPOTATOES
); );
$TBL_USER = Database:: get_main_table(TABLE_MAIN_USER); $TBL_USER = Database::get_main_table(TABLE_MAIN_USER);
$sql = "SELECT * FROM $TBL_TRACK_HOTPOTATOES thp $sql = "SELECT * FROM $TBL_TRACK_HOTPOTATOES thp
JOIN $TBL_USER u ON thp.exe_user_id = u.user_id JOIN $TBL_USER u ON thp.exe_user_id = u.user_id
@ -1590,7 +1590,7 @@ HOTSPOT;
$courseId, $courseId,
$sessionId $sessionId
) { ) {
$table = Database:: get_main_table( $table = Database::get_main_table(
TABLE_STATISTIC_TRACK_E_HOTPOTATOES TABLE_STATISTIC_TRACK_E_HOTPOTATOES
); );
$exercisePath = Database::escape_string($exercisePath); $exercisePath = Database::escape_string($exercisePath);
@ -1643,13 +1643,13 @@ HOTSPOT;
$sessionId = api_get_session_id(); $sessionId = api_get_session_id();
$is_allowedToEdit = api_is_allowed_to_edit(null, true) || api_is_allowed_to_edit(true) || api_is_drh() || api_is_student_boss(); $is_allowedToEdit = api_is_allowed_to_edit(null, true) || api_is_allowed_to_edit(true) || api_is_drh() || api_is_student_boss();
$TBL_USER = Database:: get_main_table(TABLE_MAIN_USER); $TBL_USER = Database::get_main_table(TABLE_MAIN_USER);
$TBL_EXERCICES = Database:: get_course_table(TABLE_QUIZ_TEST); $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
$TBL_GROUP_REL_USER = Database:: get_course_table(TABLE_GROUP_USER); $TBL_GROUP_REL_USER = Database::get_course_table(TABLE_GROUP_USER);
$TBL_GROUP = Database:: get_course_table(TABLE_GROUP); $TBL_GROUP = Database::get_course_table(TABLE_GROUP);
$TBL_TRACK_EXERCICES = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); $TBL_TRACK_EXERCICES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
$TBL_TRACK_HOTPOTATOES = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES); $TBL_TRACK_HOTPOTATOES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES);
$TBL_TRACK_ATTEMPT_RECORDING = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING); $TBL_TRACK_ATTEMPT_RECORDING = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
$session_id_and = ' AND te.session_id = ' . $sessionId . ' '; $session_id_and = ' AND te.session_id = ' . $sessionId . ' ';
$exercise_id = intval($exercise_id); $exercise_id = intval($exercise_id);
@ -2503,7 +2503,7 @@ HOTSPOT;
} }
} }
$table = Database:: get_course_table(TABLE_QUIZ_TEST); $table = Database::get_course_table(TABLE_QUIZ_TEST);
return Database::select('*', $table, $conditions); return Database::select('*', $table, $conditions);
} }
@ -2516,7 +2516,7 @@ HOTSPOT;
*/ */
public static function get_exercise_by_id($exerciseId = 0, $courseId = null) public static function get_exercise_by_id($exerciseId = 0, $courseId = null)
{ {
$TBL_EXERCICES = Database:: get_course_table(TABLE_QUIZ_TEST); $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
if (empty($courseId)) { if (empty($courseId)) {
$courseId = api_get_course_int_id(); $courseId = api_get_course_int_id();
} else { } else {
@ -2550,7 +2550,7 @@ HOTSPOT;
$course_id = 0, $course_id = 0,
$only_active_exercises = true $only_active_exercises = true
) { ) {
$TBL_EXERCISES = Database:: get_course_table(TABLE_QUIZ_TEST); $TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST);
if ($only_active_exercises) { if ($only_active_exercises) {
// Only active exercises. // Only active exercises.

@ -387,8 +387,8 @@ class GroupManager
$course_id = $course_info['real_id']; $course_id = $course_info['real_id'];
// Database table definitions // Database table definitions
$group_table = Database:: get_course_table(TABLE_GROUP); $group_table = Database::get_course_table(TABLE_GROUP);
$forum_table = Database:: get_course_table(TABLE_FORUM); $forum_table = Database::get_course_table(TABLE_FORUM);
$groupInfo = self::get_group_properties($groupInfo['iid'], true); $groupInfo = self::get_group_properties($groupInfo['iid'], true);
if ($groupInfo) { if ($groupInfo) {
$groupIid = $groupInfo['iid']; $groupIid = $groupInfo['iid'];
@ -729,8 +729,8 @@ class GroupManager
*/ */
public static function get_category_from_group($group_id, $course_code = null) public static function get_category_from_group($group_id, $course_code = null)
{ {
$table_group = Database:: get_course_table(TABLE_GROUP); $table_group = Database::get_course_table(TABLE_GROUP);
$table_group_cat = Database:: get_course_table(TABLE_GROUP_CATEGORY); $table_group_cat = Database::get_course_table(TABLE_GROUP_CATEGORY);
$group_id = intval($group_id); $group_id = intval($group_id);
@ -771,8 +771,8 @@ class GroupManager
$course_info = api_get_course_info($course_code); $course_info = api_get_course_info($course_code);
$course_id = $course_info['real_id']; $course_id = $course_info['real_id'];
$table_group = Database:: get_course_table(TABLE_GROUP); $table_group = Database::get_course_table(TABLE_GROUP);
$table_group_cat = Database:: get_course_table(TABLE_GROUP_CATEGORY); $table_group_cat = Database::get_course_table(TABLE_GROUP_CATEGORY);
$cat_id = intval($cat_id); $cat_id = intval($cat_id);
$sql = "SELECT iid FROM $table_group $sql = "SELECT iid FROM $table_group
WHERE c_id = $course_id AND category_id='".$cat_id."'"; WHERE c_id = $course_id AND category_id='".$cat_id."'";
@ -1227,8 +1227,8 @@ class GroupManager
$category = self::get_category_from_group($groupIid); $category = self::get_category_from_group($groupIid);
$groups_per_user = isset($category['groups_per_user']) ? $category['groups_per_user'] : self::GROUP_PER_MEMBER_NO_LIMIT; $groups_per_user = isset($category['groups_per_user']) ? $category['groups_per_user'] : self::GROUP_PER_MEMBER_NO_LIMIT;
$group_table = Database:: get_course_table(TABLE_GROUP); $group_table = Database::get_course_table(TABLE_GROUP);
$group_user_table = Database:: get_course_table(TABLE_GROUP_USER); $group_user_table = Database::get_course_table(TABLE_GROUP_USER);
$session_id = api_get_session_id(); $session_id = api_get_session_id();
$complete_user_list = CourseManager::get_real_and_linked_user_list( $complete_user_list = CourseManager::get_real_and_linked_user_list(
@ -1365,8 +1365,8 @@ class GroupManager
*/ */
public static function user_in_number_of_groups($user_id, $cat_id = null) public static function user_in_number_of_groups($user_id, $cat_id = null)
{ {
$table_group_user = Database:: get_course_table(TABLE_GROUP_USER); $table_group_user = Database::get_course_table(TABLE_GROUP_USER);
$table_group = Database:: get_course_table(TABLE_GROUP); $table_group = Database::get_course_table(TABLE_GROUP);
$user_id = intval($user_id); $user_id = intval($user_id);
$cat_id = intval($cat_id); $cat_id = intval($cat_id);

@ -124,7 +124,7 @@ class Link extends Model
$courseId = null, $courseId = null,
$sessionId = null $sessionId = null
) { ) {
$tblLink = Database:: get_course_table(TABLE_LINK); $tblLink = Database::get_course_table(TABLE_LINK);
$linkUrl = Database::escape_string($linkUrl); $linkUrl = Database::escape_string($linkUrl);
$linkId = intval($linkId); $linkId = intval($linkId);
if (is_null($courseId)) { if (is_null($courseId)) {
@ -270,7 +270,7 @@ class Link extends Model
// Add category name if set. // Add category name if set.
if (isset($selectcategory) && $selectcategory > 0) { if (isset($selectcategory) && $selectcategory > 0) {
$table_link_category = Database:: get_course_table( $table_link_category = Database::get_course_table(
TABLE_LINK_CATEGORY TABLE_LINK_CATEGORY
); );
$sql_cat = 'SELECT * FROM %s WHERE id=%d AND c_id = %d LIMIT 1'; $sql_cat = 'SELECT * FROM %s WHERE id=%d AND c_id = %d LIMIT 1';
@ -301,7 +301,7 @@ class Link extends Model
$did = $di->index(); $did = $di->index();
if ($did) { if ($did) {
// Save it to db. // Save it to db.
$tbl_se_ref = Database:: get_main_table( $tbl_se_ref = Database::get_main_table(
TABLE_MAIN_SEARCH_ENGINE_REF TABLE_MAIN_SEARCH_ENGINE_REF
); );
$sql = 'INSERT INTO %s (id, course_code, tool_id, ref_id_high_level, search_did) $sql = 'INSERT INTO %s (id, course_code, tool_id, ref_id_high_level, search_did)
@ -321,7 +321,7 @@ class Link extends Model
Display::addFlash(Display::return_message(get_lang('LinkAdded'))); Display::addFlash(Display::return_message(get_lang('LinkAdded')));
} }
} elseif ($type == 'category') { } elseif ($type == 'category') {
$tbl_categories = Database:: get_course_table(TABLE_LINK_CATEGORY); $tbl_categories = Database::get_course_table(TABLE_LINK_CATEGORY);
$category_title = trim($_POST['category_title']); $category_title = trim($_POST['category_title']);
$description = trim($_POST['description']); $description = trim($_POST['description']);
@ -376,8 +376,8 @@ class Link extends Model
public static function deletelinkcategory($id, $type) public static function deletelinkcategory($id, $type)
{ {
$courseInfo = api_get_course_info(); $courseInfo = api_get_course_info();
$tbl_link = Database:: get_course_table(TABLE_LINK); $tbl_link = Database::get_course_table(TABLE_LINK);
$tbl_categories = Database:: get_course_table(TABLE_LINK_CATEGORY); $tbl_categories = Database::get_course_table(TABLE_LINK_CATEGORY);
$course_id = $courseInfo['real_id']; $course_id = $courseInfo['real_id'];
$id = intval($id); $id = intval($id);
@ -444,7 +444,7 @@ class Link extends Model
{ {
// Remove from search engine if enabled. // Remove from search engine if enabled.
if (api_get_setting('search_enabled') === 'true') { if (api_get_setting('search_enabled') === 'true') {
$tbl_se_ref = Database:: get_main_table( $tbl_se_ref = Database::get_main_table(
TABLE_MAIN_SEARCH_ENGINE_REF TABLE_MAIN_SEARCH_ENGINE_REF
); );
$sql = 'SELECT * FROM %s WHERE course_code=\'%s\' AND tool_id=\'%s\' AND ref_id_high_level=%s LIMIT 1'; $sql = 'SELECT * FROM %s WHERE course_code=\'%s\' AND tool_id=\'%s\' AND ref_id_high_level=%s LIMIT 1';
@ -476,7 +476,7 @@ class Link extends Model
**/ **/
public static function get_link_info($id) public static function get_link_info($id)
{ {
$tbl_link = Database:: get_course_table(TABLE_LINK); $tbl_link = Database::get_course_table(TABLE_LINK);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
if (empty($id) || empty($course_id)) { if (empty($id) || empty($course_id)) {
@ -499,7 +499,7 @@ class Link extends Model
*/ */
public static function editLink($id, $values = array()) public static function editLink($id, $values = array())
{ {
$tbl_link = Database:: get_course_table(TABLE_LINK); $tbl_link = Database::get_course_table(TABLE_LINK);
$_course = api_get_course_info(); $_course = api_get_course_info();
$course_id = $_course['real_id']; $course_id = $_course['real_id'];
$id = intval($id); $id = intval($id);
@ -581,7 +581,7 @@ class Link extends Model
// Actually, it consists on delete terms from db, // Actually, it consists on delete terms from db,
// insert new ones, create a new search engine document, and remove the old one. // insert new ones, create a new search engine document, and remove the old one.
// Get search_did. // Get search_did.
$tbl_se_ref = Database:: get_main_table( $tbl_se_ref = Database::get_main_table(
TABLE_MAIN_SEARCH_ENGINE_REF TABLE_MAIN_SEARCH_ENGINE_REF
); );
$sql = 'SELECT * FROM %s WHERE course_code=\'%s\' AND tool_id=\'%s\' AND ref_id_high_level=%s LIMIT 1'; $sql = 'SELECT * FROM %s WHERE course_code=\'%s\' AND tool_id=\'%s\' AND ref_id_high_level=%s LIMIT 1';
@ -654,7 +654,7 @@ class Link extends Model
// Add category name if set. // Add category name if set.
if (isset($categoryId) && $categoryId > 0) { if (isset($categoryId) && $categoryId > 0) {
$table_link_category = Database:: get_course_table( $table_link_category = Database::get_course_table(
TABLE_LINK_CATEGORY TABLE_LINK_CATEGORY
); );
$sql_cat = 'SELECT * FROM %s WHERE id=%d and c_id = %d LIMIT 1'; $sql_cat = 'SELECT * FROM %s WHERE id=%d and c_id = %d LIMIT 1';
@ -729,7 +729,7 @@ class Link extends Model
*/ */
public static function editCategory($id, $values) public static function editCategory($id, $values)
{ {
$tbl_categories = Database:: get_course_table(TABLE_LINK_CATEGORY); $tbl_categories = Database::get_course_table(TABLE_LINK_CATEGORY);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$id = intval($id); $id = intval($id);
@ -789,8 +789,8 @@ class Link extends Model
*/ */
public static function getLinkCategories($courseId, $sessionId, $withBaseContent = true) public static function getLinkCategories($courseId, $sessionId, $withBaseContent = true)
{ {
$tblLinkCategory = Database:: get_course_table(TABLE_LINK_CATEGORY); $tblLinkCategory = Database::get_course_table(TABLE_LINK_CATEGORY);
$tblItemProperty = Database:: get_course_table(TABLE_ITEM_PROPERTY); $tblItemProperty = Database::get_course_table(TABLE_ITEM_PROPERTY);
$courseId = intval($courseId); $courseId = intval($courseId);
// Condition for the session. // Condition for the session.
@ -868,8 +868,8 @@ class Link extends Model
$sessionId, $sessionId,
$withBaseContent = true $withBaseContent = true
) { ) {
$tbl_link = Database:: get_course_table(TABLE_LINK); $tbl_link = Database::get_course_table(TABLE_LINK);
$TABLE_ITEM_PROPERTY = Database:: get_course_table(TABLE_ITEM_PROPERTY); $TABLE_ITEM_PROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
$courseId = (int) $courseId; $courseId = (int) $courseId;
$sessionId = (int) $sessionId; $sessionId = (int) $sessionId;
$categoryId = (int) $categoryId; $categoryId = (int) $categoryId;
@ -1227,7 +1227,7 @@ class Link extends Model
*/ */
public static function movecatlink($action, $catlinkid, $courseId = null, $sessionId = null) public static function movecatlink($action, $catlinkid, $courseId = null, $sessionId = null)
{ {
$tbl_categories = Database:: get_course_table(TABLE_LINK_CATEGORY); $tbl_categories = Database::get_course_table(TABLE_LINK_CATEGORY);
if (is_null($courseId)) { if (is_null($courseId)) {
$courseId = api_get_course_int_id(); $courseId = api_get_course_int_id();
@ -1298,7 +1298,7 @@ class Link extends Model
public static function get_cat($catname) public static function get_cat($catname)
{ {
// Get category id (existing or make new). // Get category id (existing or make new).
$tbl_categories = Database:: get_course_table(TABLE_LINK_CATEGORY); $tbl_categories = Database::get_course_table(TABLE_LINK_CATEGORY);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$result = Database:: query( $result = Database:: query(
@ -1339,7 +1339,7 @@ class Link extends Model
$_course = api_get_course_info(); $_course = api_get_course_info();
$_user = api_get_user_info(); $_user = api_get_user_info();
$tbl_link = Database:: get_course_table(TABLE_LINK); $tbl_link = Database::get_course_table(TABLE_LINK);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$urleq = "url='" . Database:: escape_string($url) . "'"; $urleq = "url='" . Database:: escape_string($url) . "'";

@ -14,7 +14,7 @@ $table_sf_val = Database::get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES);
*/ */
function add_specific_field($name) function add_specific_field($name)
{ {
$table_sf = Database:: get_main_table(TABLE_MAIN_SPECIFIC_FIELD); $table_sf = Database::get_main_table(TABLE_MAIN_SPECIFIC_FIELD);
$name = trim($name); $name = trim($name);
if (empty($name)) { if (empty($name)) {
return false; return false;
@ -41,7 +41,7 @@ function add_specific_field($name)
*/ */
function delete_specific_field($id) function delete_specific_field($id)
{ {
$table_sf = Database:: get_main_table(TABLE_MAIN_SPECIFIC_FIELD); $table_sf = Database::get_main_table(TABLE_MAIN_SPECIFIC_FIELD);
$id = (int)$id; $id = (int)$id;
if (!is_numeric($id)) { if (!is_numeric($id)) {
return false; return false;
@ -59,7 +59,7 @@ function delete_specific_field($id)
*/ */
function edit_specific_field($id, $name) function edit_specific_field($id, $name)
{ {
$table_sf = Database:: get_main_table(TABLE_MAIN_SPECIFIC_FIELD); $table_sf = Database::get_main_table(TABLE_MAIN_SPECIFIC_FIELD);
$id = (int)$id; $id = (int)$id;
if (!is_numeric($id)) { if (!is_numeric($id)) {
return false; return false;
@ -76,7 +76,7 @@ function edit_specific_field($id, $name)
*/ */
function get_specific_field_list($conditions = array(), $order_by = array()) function get_specific_field_list($conditions = array(), $order_by = array())
{ {
$table_sf = Database:: get_main_table(TABLE_MAIN_SPECIFIC_FIELD); $table_sf = Database::get_main_table(TABLE_MAIN_SPECIFIC_FIELD);
$return_array = array(); $return_array = array();
$sql = "SELECT * FROM $table_sf"; $sql = "SELECT * FROM $table_sf";
if (count($conditions) > 0) { if (count($conditions) > 0) {
@ -107,7 +107,7 @@ function get_specific_field_values_list(
$conditions = array(), $conditions = array(),
$order_by = array() $order_by = array()
) { ) {
$table_sfv = Database:: get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES); $table_sfv = Database::get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES);
$return_array = array(); $return_array = array();
$sql = "SELECT * FROM $table_sfv"; $sql = "SELECT * FROM $table_sfv";
if (count($conditions) > 0) { if (count($conditions) > 0) {
@ -154,8 +154,8 @@ function get_specific_field_values_list_by_prefix(
$tool_id, $tool_id,
$ref_id $ref_id
) { ) {
$table_sf = Database:: get_main_table(TABLE_MAIN_SPECIFIC_FIELD); $table_sf = Database::get_main_table(TABLE_MAIN_SPECIFIC_FIELD);
$table_sfv = Database:: get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES); $table_sfv = Database::get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES);
$sql = 'SELECT sfv.value FROM %s sf LEFT JOIN %s sfv ON sf.id = sfv.field_id'. $sql = 'SELECT sfv.value FROM %s sf LEFT JOIN %s sfv ON sf.id = sfv.field_id'.
' WHERE sf.code = \'%s\' AND sfv.c_id = \'%s\' AND tool_id = \'%s\' AND sfv.ref_id = %s'; ' WHERE sf.code = \'%s\' AND sfv.c_id = \'%s\' AND tool_id = \'%s\' AND sfv.ref_id = %s';
$sql = sprintf( $sql = sprintf(
@ -190,7 +190,7 @@ function add_specific_field_value(
$ref_id, $ref_id,
$value $value
) { ) {
$table_sf_values = Database:: get_main_table( $table_sf_values = Database::get_main_table(
TABLE_MAIN_SPECIFIC_FIELD_VALUES TABLE_MAIN_SPECIFIC_FIELD_VALUES
); );
$value = trim($value); $value = trim($value);
@ -278,7 +278,7 @@ function get_specific_field_code_from_name($name) {
'X', 'X',
'Y', 'Y',
); );
$table_sf = Database:: get_main_table(TABLE_MAIN_SPECIFIC_FIELD); $table_sf = Database::get_main_table(TABLE_MAIN_SPECIFIC_FIELD);
$sql = "SELECT code FROM $table_sf ORDER BY code"; $sql = "SELECT code FROM $table_sf ORDER BY code";
$res = Database::query($sql); $res = Database::query($sql);
$code = strtoupper(substr($name, 0, 1)); $code = strtoupper(substr($name, 0, 1));

@ -101,9 +101,9 @@ class Statistics
public static function countUsers($status = null, $categoryCode = null, $countInvisibleCourses = true, $onlyActive = false) public static function countUsers($status = null, $categoryCode = null, $countInvisibleCourses = true, $onlyActive = false)
{ {
// Database table definitions // Database table definitions
$course_user_table = Database:: get_main_table(TABLE_MAIN_COURSE_USER); $course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$course_table = Database:: get_main_table(TABLE_MAIN_COURSE); $course_table = Database::get_main_table(TABLE_MAIN_COURSE);
$user_table = Database:: get_main_table(TABLE_MAIN_USER); $user_table = Database::get_main_table(TABLE_MAIN_USER);
$access_url_rel_user_table= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); $access_url_rel_user_table= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$current_url_id = api_get_current_access_url_id(); $current_url_id = api_get_current_access_url_id();
$active_filter = $onlyActive?' AND active=1':''; $active_filter = $onlyActive?' AND active=1':'';

@ -432,7 +432,7 @@ class SystemAnnouncementManager
**/ **/
public static function announcement_for_groups($announcement_id, $group_array) public static function announcement_for_groups($announcement_id, $group_array)
{ {
$tbl_announcement_group = Database:: get_main_table( $tbl_announcement_group = Database::get_main_table(
TABLE_MAIN_SYSTEM_ANNOUNCEMENTS_GROUPS TABLE_MAIN_SYSTEM_ANNOUNCEMENTS_GROUPS
); );
//first delete all group associations for this announcement //first delete all group associations for this announcement

@ -253,7 +253,7 @@ class Thematic
$session_id = null $session_id = null
) { ) {
// set current course and session // set current course and session
$tbl_thematic = Database:: get_course_table(TABLE_THEMATIC); $tbl_thematic = Database::get_course_table(TABLE_THEMATIC);
$course_info = api_get_course_info($course_code); $course_info = api_get_course_info($course_code);
$course_id = $course_info['real_id']; $course_id = $course_info['real_id'];

@ -2488,9 +2488,9 @@ class Tracking
if (!empty($course)) { if (!empty($course)) {
// Get course tables names // Get course tables names
$tbl_quiz_questions = Database::get_course_table(TABLE_QUIZ_QUESTION); $tbl_quiz_questions = Database::get_course_table(TABLE_QUIZ_QUESTION);
$lp_table = Database:: get_course_table(TABLE_LP_MAIN); $lp_table = Database::get_course_table(TABLE_LP_MAIN);
$lp_item_table = Database:: get_course_table(TABLE_LP_ITEM); $lp_item_table = Database::get_course_table(TABLE_LP_ITEM);
$lp_view_table = Database:: get_course_table(TABLE_LP_VIEW); $lp_view_table = Database::get_course_table(TABLE_LP_VIEW);
$lp_item_view_table = Database::get_course_table(TABLE_LP_ITEM_VIEW); $lp_item_view_table = Database::get_course_table(TABLE_LP_ITEM_VIEW);
$course_id = $course['real_id']; $course_id = $course['real_id'];
@ -3010,9 +3010,9 @@ class Tracking
if (!empty($course)) { if (!empty($course)) {
$course_id = $course['real_id']; $course_id = $course['real_id'];
$lp_table = Database:: get_course_table(TABLE_LP_MAIN); $lp_table = Database::get_course_table(TABLE_LP_MAIN);
$t_lpv = Database:: get_course_table(TABLE_LP_VIEW); $t_lpv = Database::get_course_table(TABLE_LP_VIEW);
$t_lpiv = Database:: get_course_table(TABLE_LP_ITEM_VIEW); $t_lpiv = Database::get_course_table(TABLE_LP_ITEM_VIEW);
// Check the real number of LPs corresponding to the filter in the // Check the real number of LPs corresponding to the filter in the
// database (and if no list was given, get them all) // database (and if no list was given, get them all)

@ -879,7 +879,7 @@ class UserManager
*/ */
public static function update_openid($user_id, $openid) public static function update_openid($user_id, $openid)
{ {
$table_user = Database:: get_main_table(TABLE_MAIN_USER); $table_user = Database::get_main_table(TABLE_MAIN_USER);
if ($user_id != strval(intval($user_id))) { if ($user_id != strval(intval($user_id))) {
return false; return false;
} }
@ -1564,7 +1564,7 @@ class UserManager
$id = intval($id); $id = intval($id);
if (empty($userInfo)) { if (empty($userInfo)) {
$user_table = Database:: get_main_table(TABLE_MAIN_USER); $user_table = Database::get_main_table(TABLE_MAIN_USER);
$sql = "SELECT email, picture_uri FROM $user_table $sql = "SELECT email, picture_uri FROM $user_table
WHERE id=".$id; WHERE id=".$id;
$res = Database::query($sql); $res = Database::query($sql);
@ -1631,7 +1631,7 @@ class UserManager
$id = intval($id); $id = intval($id);
if (empty($userInfo)) { if (empty($userInfo)) {
$user_table = Database:: get_main_table(TABLE_MAIN_USER); $user_table = Database::get_main_table(TABLE_MAIN_USER);
$sql = "SELECT email, picture_uri FROM $user_table WHERE id=$id"; $sql = "SELECT email, picture_uri FROM $user_table WHERE id=$id";
$res = Database::query($sql); $res = Database::query($sql);

@ -472,8 +472,8 @@ class IndexManager
$setting_show_also_closed_courses = api_get_setting('show_closed_courses') == 'true'; $setting_show_also_closed_courses = api_get_setting('show_closed_courses') == 'true';
// Database table definitions. // Database table definitions.
$main_course_table = Database:: get_main_table(TABLE_MAIN_COURSE); $main_course_table = Database::get_main_table(TABLE_MAIN_COURSE);
$main_category_table = Database:: get_main_table(TABLE_MAIN_CATEGORY); $main_category_table = Database::get_main_table(TABLE_MAIN_CATEGORY);
// Get list of courses in category $category. // Get list of courses in category $category.
$sql = "SELECT * FROM $main_course_table cours $sql = "SELECT * FROM $main_course_table cours

@ -885,7 +885,7 @@ if (!isset($_SESSION['login_as'])) {
} }
if ($save_course_access) { if ($save_course_access) {
$course_tracking_table = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); $course_tracking_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
/* /*
* When $_configuration['session_lifetime'] is too big 100 hours (in order to let users take exercises with no problems) * When $_configuration['session_lifetime'] is too big 100 hours (in order to let users take exercises with no problems)
* the function Tracking::get_time_spent_on_the_course() returns big values (200h) due the condition: * the function Tracking::get_time_spent_on_the_course() returns big values (200h) due the condition:

@ -322,7 +322,7 @@ class learnpath
$lp_item_id_list_to_string = implode("','", $lp_item_id_list); $lp_item_id_list_to_string = implode("','", $lp_item_id_list);
if (!empty($lp_item_id_list_to_string)) { if (!empty($lp_item_id_list_to_string)) {
// Get last viewing vars. // Get last viewing vars.
$itemViewTable = Database:: get_course_table(TABLE_LP_ITEM_VIEW); $itemViewTable = Database::get_course_table(TABLE_LP_ITEM_VIEW);
// This query should only return one or zero result. // This query should only return one or zero result.
$sql = "SELECT lp_item_id, status $sql = "SELECT lp_item_id, status
FROM $itemViewTable FROM $itemViewTable
@ -1042,10 +1042,10 @@ class learnpath
return false; return false;
} }
$lp = Database:: get_course_table(TABLE_LP_MAIN); $lp = Database::get_course_table(TABLE_LP_MAIN);
$lp_item = Database:: get_course_table(TABLE_LP_ITEM); $lp_item = Database::get_course_table(TABLE_LP_ITEM);
$lp_view = Database:: get_course_table(TABLE_LP_VIEW); $lp_view = Database::get_course_table(TABLE_LP_VIEW);
$lp_item_view = Database:: get_course_table(TABLE_LP_ITEM_VIEW); $lp_item_view = Database::get_course_table(TABLE_LP_ITEM_VIEW);
// Delete lp item id. // Delete lp item id.
foreach ($this->items as $id => $dummy) { foreach ($this->items as $id => $dummy) {

@ -166,7 +166,7 @@ echo '<div class="row">';
echo '<div id="lp_sidebar" class="col-md-4">'; echo '<div id="lp_sidebar" class="col-md-4">';
$path_item = isset($_GET['path_item']) ? $_GET['path_item'] : 0; $path_item = isset($_GET['path_item']) ? $_GET['path_item'] : 0;
$path_item = Database::escape_string($path_item); $path_item = Database::escape_string($path_item);
$tbl_doc = Database :: get_course_table(TABLE_DOCUMENT); $tbl_doc = Database::get_course_table(TABLE_DOCUMENT);
$sql_doc = "SELECT path FROM ".$tbl_doc." $sql_doc = "SELECT path FROM ".$tbl_doc."
WHERE c_id = $course_id AND id = '".$path_item."' "; WHERE c_id = $course_id AND id = '".$path_item."' ";

@ -54,12 +54,12 @@ if (!empty($my_courses)) {
$students[] = $student['user_id']; $students[] = $student['user_id'];
} }
$t_lp = Database :: get_course_table(TABLE_LP_MAIN); $t_lp = Database::get_course_table(TABLE_LP_MAIN);
$sql_lp = "SELECT lp.name, lp.id FROM $t_lp lp $sql_lp = "SELECT lp.name, lp.id FROM $t_lp lp
WHERE c_id = $course_id AND lp.session_id = 0"; WHERE c_id = $course_id AND lp.session_id = 0";
$rs_lp = Database::query($sql_lp); $rs_lp = Database::query($sql_lp);
$t_lpi = Database :: get_course_table(TABLE_LP_ITEM); $t_lpi = Database::get_course_table(TABLE_LP_ITEM);
$t_news = Database :: get_course_table(TABLE_ANNOUNCEMENT); $t_news = Database::get_course_table(TABLE_ANNOUNCEMENT);
$total_tools_list = Tracking::get_tools_most_used_by_course( $total_tools_list = Tracking::get_tools_most_used_by_course(
$course_id, $course_id,

@ -861,7 +861,7 @@ if (!empty($student_id)) {
if ($user_info['status'] != INVITEE) { if ($user_info['status'] != INVITEE) {
$csv_content[] = array(); $csv_content[] = array();
$csv_content[] = array(str_replace('&nbsp;', '', $table_title)); $csv_content[] = array(str_replace('&nbsp;', '', $table_title));
$t_lp = Database :: get_course_table(TABLE_LP_MAIN); $t_lp = Database::get_course_table(TABLE_LP_MAIN);
// csv export headers // csv export headers
$csv_content[] = array(); $csv_content[] = array();
@ -1160,7 +1160,7 @@ if (!empty($student_id)) {
get_lang('Attempts') get_lang('Attempts')
); );
$t_quiz = Database :: get_course_table(TABLE_QUIZ_TEST); $t_quiz = Database::get_course_table(TABLE_QUIZ_TEST);
$sessionCondition = api_get_session_condition( $sessionCondition = api_get_session_condition(
$sessionId, $sessionId,
true, true,

@ -18,8 +18,8 @@ if (!api_is_platform_admin()) {
} }
// Database table definitions // Database table definitions
$table_admin = Database:: get_main_table(TABLE_MAIN_ADMIN); $table_admin = Database::get_main_table(TABLE_MAIN_ADMIN);
$table_user = Database:: get_main_table(TABLE_MAIN_USER); $table_user = Database::get_main_table(TABLE_MAIN_USER);
$database = Database::get_main_database(); $database = Database::get_main_database();
$userId = isset($_REQUEST['user_id']) ? intval($_REQUEST['user_id']) : ''; $userId = isset($_REQUEST['user_id']) ? intval($_REQUEST['user_id']) : '';

@ -13,7 +13,7 @@ function get_suggestions_from_search_engine($q)
global $charset; global $charset;
$json = []; $json = [];
$table_sfv = Database:: get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES); $table_sfv = Database::get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES);
$q = Database::escape_string($q); $q = Database::escape_string($q);
$cid = api_get_course_id(); $cid = api_get_course_id();
$sql_add = ''; $sql_add = '';

@ -38,7 +38,7 @@ if (isset($_GET['add_type']) && $_GET['add_type'] != '') {
} }
if (!api_is_platform_admin() && !api_is_session_admin()) { if (!api_is_platform_admin() && !api_is_session_admin()) {
$sql = 'SELECT session_admin_id FROM ' . Database:: get_main_table(TABLE_MAIN_SESSION) . ' WHERE id=' . $id_session; $sql = 'SELECT session_admin_id FROM ' . Database::get_main_table(TABLE_MAIN_SESSION) . ' WHERE id=' . $id_session;
$rs = Database::query($sql); $rs = Database::query($sql);
if (Database::result($rs, 0, 0) != $_user['user_id']) { if (Database::result($rs, 0, 0) != $_user['user_id']) {
api_not_allowed(true); api_not_allowed(true);

@ -18,7 +18,7 @@ require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_COURSES; $this_section = SECTION_COURSES;
// Database table definitions // Database table definitions
$table_survey = Database :: get_course_table(TABLE_SURVEY); $table_survey = Database::get_course_table(TABLE_SURVEY);
$table_user = Database::get_main_table(TABLE_MAIN_USER); $table_user = Database::get_main_table(TABLE_MAIN_USER);
$table_course = Database::get_main_table(TABLE_MAIN_COURSE); $table_course = Database::get_main_table(TABLE_MAIN_COURSE);
$table_gradebook_link = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK); $table_gradebook_link = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);

@ -29,11 +29,11 @@ if (!empty($_user)) {
} }
// Database table definitions // Database table definitions
$table_survey = Database :: get_course_table(TABLE_SURVEY); $table_survey = Database::get_course_table(TABLE_SURVEY);
$table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER); $table_survey_answer = Database::get_course_table(TABLE_SURVEY_ANSWER);
$table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION); $table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
$table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION); $table_survey_question_option = Database::get_course_table(TABLE_SURVEY_QUESTION_OPTION);
$table_survey_invitation = Database :: get_course_table(TABLE_SURVEY_INVITATION); $table_survey_invitation = Database::get_course_table(TABLE_SURVEY_INVITATION);
$table_user = Database::get_main_table(TABLE_MAIN_USER); $table_user = Database::get_main_table(TABLE_MAIN_USER);
// Check if user is anonymous or not // Check if user is anonymous or not

@ -14,12 +14,12 @@ require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_COURSES; $this_section = SECTION_COURSES;
// Database table definitions // Database table definitions
$table_survey = Database:: get_course_table(TABLE_SURVEY); $table_survey = Database::get_course_table(TABLE_SURVEY);
$table_survey_question = Database:: get_course_table(TABLE_SURVEY_QUESTION); $table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
$table_survey_question_option = Database:: get_course_table(TABLE_SURVEY_QUESTION_OPTION); $table_survey_question_option = Database::get_course_table(TABLE_SURVEY_QUESTION_OPTION);
$table_course = Database:: get_main_table(TABLE_MAIN_COURSE); $table_course = Database::get_main_table(TABLE_MAIN_COURSE);
$table_user = Database:: get_main_table(TABLE_MAIN_USER); $table_user = Database::get_main_table(TABLE_MAIN_USER);
$table_survey_invitation = Database:: get_course_table(TABLE_SURVEY_INVITATION); $table_survey_invitation = Database::get_course_table(TABLE_SURVEY_INVITATION);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$userId = api_get_user_id(); $userId = api_get_user_id();

@ -32,11 +32,11 @@ if (empty($surveyData)) {
$is_valid_request = isset($_REQUEST['is_executable']) ? $_REQUEST['is_executable'] : null; $is_valid_request = isset($_REQUEST['is_executable']) ? $_REQUEST['is_executable'] : null;
// Database table definitions // Database table definitions
$table_survey = Database:: get_course_table(TABLE_SURVEY); $table_survey = Database::get_course_table(TABLE_SURVEY);
$table_survey_question = Database:: get_course_table(TABLE_SURVEY_QUESTION); $table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
$table_survey_question_option = Database:: get_course_table(TABLE_SURVEY_QUESTION_OPTION); $table_survey_question_option = Database::get_course_table(TABLE_SURVEY_QUESTION_OPTION);
$table_course = Database:: get_main_table(TABLE_MAIN_COURSE); $table_course = Database::get_main_table(TABLE_MAIN_COURSE);
$table_user = Database:: get_main_table(TABLE_MAIN_USER); $table_user = Database::get_main_table(TABLE_MAIN_USER);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$urlname = api_substr(api_html_entity_decode($surveyData['title'], ENT_QUOTES), 0, 40); $urlname = api_substr(api_html_entity_decode($surveyData['title'], ENT_QUOTES), 0, 40);
if (api_strlen(strip_tags($surveyData['title'])) > 40) { if (api_strlen(strip_tags($surveyData['title'])) > 40) {
@ -44,7 +44,7 @@ if (api_strlen(strip_tags($surveyData['title'])) > 40) {
} }
if ($surveyData['survey_type'] == 1) { if ($surveyData['survey_type'] == 1) {
$sql = 'SELECT id FROM '.Database :: get_course_table(TABLE_SURVEY_QUESTION_GROUP).' $sql = 'SELECT id FROM '.Database::get_course_table(TABLE_SURVEY_QUESTION_GROUP).'
WHERE WHERE
c_id = '.$course_id.' AND c_id = '.$course_id.' AND
survey_id = '.(int)$_GET['survey_id'].' LIMIT 1'; survey_id = '.(int)$_GET['survey_id'].' LIMIT 1';

@ -101,8 +101,8 @@ if (!api_is_allowed_to_edit(false, true) || $isDrhOfCourse) {
} }
// Database table definitions // Database table definitions
$table_course = Database:: get_main_table(TABLE_MAIN_COURSE); $table_course = Database::get_main_table(TABLE_MAIN_COURSE);
$table_user = Database:: get_main_table(TABLE_MAIN_USER); $table_user = Database::get_main_table(TABLE_MAIN_USER);
$urlname = strip_tags(api_substr(api_html_entity_decode($survey_data['title'], ENT_QUOTES), 0, 40)); $urlname = strip_tags(api_substr(api_html_entity_decode($survey_data['title'], ENT_QUOTES), 0, 40));
if (api_strlen(strip_tags($survey_data['title'])) > 40) { if (api_strlen(strip_tags($survey_data['title'])) > 40) {
$urlname .= '...'; $urlname .= '...';

@ -18,10 +18,10 @@ function check_download_survey($course, $invitation, $doc_url)
$course_id = $_course['real_id']; $course_id = $_course['real_id'];
// Database table definitions // Database table definitions
$table_survey = Database:: get_course_table(TABLE_SURVEY); $table_survey = Database::get_course_table(TABLE_SURVEY);
$table_survey_question = Database:: get_course_table(TABLE_SURVEY_QUESTION); $table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
$table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION); $table_survey_question_option = Database::get_course_table(TABLE_SURVEY_QUESTION_OPTION);
$table_survey_invitation = Database :: get_course_table(TABLE_SURVEY_INVITATION); $table_survey_invitation = Database::get_course_table(TABLE_SURVEY_INVITATION);
// Now we check if the invitationcode is valid // Now we check if the invitationcode is valid
$sql = "SELECT * FROM $table_survey_invitation $sql = "SELECT * FROM $table_survey_invitation

@ -188,7 +188,7 @@ class SurveyManager
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$session_id = api_get_session_id(); $session_id = api_get_session_id();
$courseCode = api_get_course_id(); $courseCode = api_get_course_id();
$table_survey = Database:: get_course_table(TABLE_SURVEY); $table_survey = Database::get_course_table(TABLE_SURVEY);
$shared_survey_id = 0; $shared_survey_id = 0;
if (!isset($values['survey_id'])) { if (!isset($values['survey_id'])) {
@ -1615,8 +1615,8 @@ class SurveyManager
public static function get_people_who_filled_survey($survey_id, $all_user_info = false, $course_id = null) public static function get_people_who_filled_survey($survey_id, $all_user_info = false, $course_id = null)
{ {
// Database table definition // Database table definition
$table_survey_answer = Database:: get_course_table(TABLE_SURVEY_ANSWER); $table_survey_answer = Database::get_course_table(TABLE_SURVEY_ANSWER);
$table_user = Database:: get_main_table(TABLE_MAIN_USER); $table_user = Database::get_main_table(TABLE_MAIN_USER);
// Variable initialisation // Variable initialisation
$return = array(); $return = array();

@ -36,12 +36,12 @@ if (!api_is_allowed_to_edit(false, true) ||
} }
// Database table definitions // Database table definitions
$table_survey = Database:: get_course_table(TABLE_SURVEY); $table_survey = Database::get_course_table(TABLE_SURVEY);
$table_survey_question = Database:: get_course_table(TABLE_SURVEY_QUESTION); $table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
$table_survey_question_option = Database:: get_course_table(TABLE_SURVEY_QUESTION_OPTION); $table_survey_question_option = Database::get_course_table(TABLE_SURVEY_QUESTION_OPTION);
$table_survey_question_group = Database:: get_course_table(TABLE_SURVEY_QUESTION_GROUP); $table_survey_question_group = Database::get_course_table(TABLE_SURVEY_QUESTION_GROUP);
$table_course = Database:: get_main_table(TABLE_MAIN_COURSE); $table_course = Database::get_main_table(TABLE_MAIN_COURSE);
$table_user = Database:: get_main_table(TABLE_MAIN_USER); $table_user = Database::get_main_table(TABLE_MAIN_USER);
$survey_id = intval($_GET['survey_id']); $survey_id = intval($_GET['survey_id']);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();

@ -250,9 +250,9 @@ class SurveyUtil
*/ */
public static function delete_user_report($survey_id, $user_id) public static function delete_user_report($survey_id, $user_id)
{ {
$table_survey_answer = Database:: get_course_table(TABLE_SURVEY_ANSWER); $table_survey_answer = Database::get_course_table(TABLE_SURVEY_ANSWER);
$table_survey_invitation = Database:: get_course_table(TABLE_SURVEY_INVITATION); $table_survey_invitation = Database::get_course_table(TABLE_SURVEY_INVITATION);
$table_survey = Database:: get_course_table(TABLE_SURVEY); $table_survey = Database::get_course_table(TABLE_SURVEY);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$survey_id = (int) $survey_id; $survey_id = (int) $survey_id;
@ -480,9 +480,9 @@ class SurveyUtil
$singlePage = isset($_GET['single_page']) ? intval($_GET['single_page']) : 0; $singlePage = isset($_GET['single_page']) ? intval($_GET['single_page']) : 0;
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
// Database table definitions // Database table definitions
$table_survey_question = Database:: get_course_table(TABLE_SURVEY_QUESTION); $table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
$table_survey_question_option = Database:: get_course_table(TABLE_SURVEY_QUESTION_OPTION); $table_survey_question_option = Database::get_course_table(TABLE_SURVEY_QUESTION_OPTION);
$table_survey_answer = Database:: get_course_table(TABLE_SURVEY_ANSWER); $table_survey_answer = Database::get_course_table(TABLE_SURVEY_ANSWER);
// Determining the offset of the sql statement (the n-th question of the survey) // Determining the offset of the sql statement (the n-th question of the survey)
$offset = !isset($_GET['question']) ? 0 : intval($_GET['question']); $offset = !isset($_GET['question']) ? 0 : intval($_GET['question']);
@ -2868,9 +2868,9 @@ class SurveyUtil
$direction = 'asc'; $direction = 'asc';
} }
$table_survey = Database:: get_course_table(TABLE_SURVEY); $table_survey = Database::get_course_table(TABLE_SURVEY);
$table_survey_question = Database:: get_course_table(TABLE_SURVEY_QUESTION); $table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
$table_user = Database:: get_main_table(TABLE_MAIN_USER); $table_user = Database::get_main_table(TABLE_MAIN_USER);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
@ -2921,7 +2921,7 @@ class SurveyUtil
// Database table definitions // Database table definitions
$table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION); $table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
$table_survey_invitation = Database::get_course_table(TABLE_SURVEY_INVITATION); $table_survey_invitation = Database::get_course_table(TABLE_SURVEY_INVITATION);
$table_survey = Database:: get_course_table(TABLE_SURVEY); $table_survey = Database::get_course_table(TABLE_SURVEY);
$sql = "SELECT question_id $sql = "SELECT question_id
FROM $table_survey_question FROM $table_survey_question
@ -3151,10 +3151,10 @@ class SurveyUtil
*/ */
public static function show_link_available($user_id, $survey_code, $user_answer) public static function show_link_available($user_id, $survey_code, $user_answer)
{ {
$table_survey = Database:: get_course_table(TABLE_SURVEY); $table_survey = Database::get_course_table(TABLE_SURVEY);
$table_survey_invitation = Database:: get_course_table(TABLE_SURVEY_INVITATION); $table_survey_invitation = Database::get_course_table(TABLE_SURVEY_INVITATION);
$table_survey_answer = Database:: get_course_table(TABLE_SURVEY_ANSWER); $table_survey_answer = Database::get_course_table(TABLE_SURVEY_ANSWER);
$table_survey_question = Database:: get_course_table(TABLE_SURVEY_QUESTION); $table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
$survey_code = Database::escape_string($survey_code); $survey_code = Database::escape_string($survey_code);
$user_id = intval($user_id); $user_id = intval($user_id);

@ -16,12 +16,12 @@ if (!api_is_allowed_to_edit(false, true)) {
} }
// Database table definitions // Database table definitions
$table_survey = Database:: get_course_table(TABLE_SURVEY); $table_survey = Database::get_course_table(TABLE_SURVEY);
$table_survey_question = Database:: get_course_table(TABLE_SURVEY_QUESTION); $table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
$table_survey_question_option = Database:: get_course_table(TABLE_SURVEY_QUESTION_OPTION); $table_survey_question_option = Database::get_course_table(TABLE_SURVEY_QUESTION_OPTION);
$table_course = Database:: get_main_table(TABLE_MAIN_COURSE); $table_course = Database::get_main_table(TABLE_MAIN_COURSE);
$table_user = Database:: get_main_table(TABLE_MAIN_USER); $table_user = Database::get_main_table(TABLE_MAIN_USER);
$table_survey_invitation = Database:: get_course_table(TABLE_SURVEY_INVITATION); $table_survey_invitation = Database::get_course_table(TABLE_SURVEY_INVITATION);
$tool_name = get_lang('SurveyInvitations'); $tool_name = get_lang('SurveyInvitations');
// Getting the survey information // Getting the survey information

@ -31,11 +31,11 @@ if (empty($survey_data)) {
} }
// Database table definitions // Database table definitions
$table_survey = Database:: get_course_table(TABLE_SURVEY); $table_survey = Database::get_course_table(TABLE_SURVEY);
$table_survey_question = Database:: get_course_table(TABLE_SURVEY_QUESTION); $table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
$table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION); $table_survey_question_option = Database::get_course_table(TABLE_SURVEY_QUESTION_OPTION);
$table_course = Database:: get_main_table(TABLE_MAIN_COURSE); $table_course = Database::get_main_table(TABLE_MAIN_COURSE);
$table_user = Database:: get_main_table(TABLE_MAIN_USER); $table_user = Database::get_main_table(TABLE_MAIN_USER);
$urlname = strip_tags(api_substr(api_html_entity_decode($survey_data['title'], ENT_QUOTES), 0, 40)); $urlname = strip_tags(api_substr(api_html_entity_decode($survey_data['title'], ENT_QUOTES), 0, 40));
if (api_strlen(strip_tags($survey_data['title'])) > 40) { if (api_strlen(strip_tags($survey_data['title'])) > 40) {
@ -231,7 +231,7 @@ if ($form->validate()) {
// Updating the invited field in the survey table // Updating the invited field in the survey table
SurveyUtil::update_count_invited($survey_data['code']); SurveyUtil::update_count_invited($survey_data['code']);
$total_count = $count_course_users + $counter_additional_users; $total_count = $count_course_users + $counter_additional_users;
$table_survey = Database :: get_course_table(TABLE_SURVEY); $table_survey = Database::get_course_table(TABLE_SURVEY);
// Counting the number of people that are invited // Counting the number of people that are invited
$sql = "SELECT * FROM $table_survey $sql = "SELECT * FROM $table_survey
WHERE WHERE

@ -53,10 +53,10 @@ if (!api_is_allowed_to_edit(false, true)) {
$extend_rights_for_coachs = api_get_setting('extend_rights_for_coach_on_survey'); $extend_rights_for_coachs = api_get_setting('extend_rights_for_coach_on_survey');
// Database table definitions // Database table definitions
$table_survey = Database:: get_course_table(TABLE_SURVEY); $table_survey = Database::get_course_table(TABLE_SURVEY);
$table_survey_question = Database:: get_course_table(TABLE_SURVEY_QUESTION); $table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
$table_course = Database:: get_main_table(TABLE_MAIN_COURSE); $table_course = Database::get_main_table(TABLE_MAIN_COURSE);
$table_user = Database:: get_main_table(TABLE_MAIN_USER); $table_user = Database::get_main_table(TABLE_MAIN_USER);
// Language variables // Language variables
if (isset($_GET['search']) && $_GET['search'] == 'advanced') { if (isset($_GET['search']) && $_GET['search'] == 'advanced') {

@ -15,9 +15,9 @@ $export['addcsvheader'] = isset($_REQUEST['addcsvheader']) ? $_REQUEST['addcsvhe
$export['session'] = isset($_REQUEST['session']) ? $_REQUEST['session'] : null; $export['session'] = isset($_REQUEST['session']) ? $_REQUEST['session'] : null;
// Database table definitions // Database table definitions
$course_table = Database:: get_main_table(TABLE_MAIN_COURSE); $course_table = Database::get_main_table(TABLE_MAIN_COURSE);
$user_table = Database:: get_main_table(TABLE_MAIN_USER); $user_table = Database::get_main_table(TABLE_MAIN_USER);
$course_user_table = Database:: get_main_table(TABLE_MAIN_COURSE_USER); $course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$session_course_user_table = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); $session_course_user_table = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$session_user_table = Database::get_main_table(TABLE_MAIN_SESSION_USER); $session_user_table = Database::get_main_table(TABLE_MAIN_SESSION_USER);

@ -139,7 +139,7 @@ class CourseBuilder
$courseCode = '', $courseCode = '',
$with_base_content = false $with_base_content = false
) { ) {
$table_properties = Database:: get_course_table(TABLE_ITEM_PROPERTY); $table_properties = Database::get_course_table(TABLE_ITEM_PROPERTY);
$course = api_get_course_info($courseCode); $course = api_get_course_info($courseCode);
$courseId = $course['real_id']; $courseId = $course['real_id'];
@ -334,7 +334,7 @@ class CourseBuilder
$with_base_content = false, $with_base_content = false,
$id_list = array() $id_list = array()
) { ) {
$table = Database:: get_course_table(TABLE_FORUM); $table = Database::get_course_table(TABLE_FORUM);
$sessionCondition = api_get_session_condition( $sessionCondition = api_get_session_condition(
$session_id, $session_id,
@ -365,7 +365,7 @@ class CourseBuilder
$with_base_content = false, $with_base_content = false,
$id_list = array() $id_list = array()
) { ) {
$table = Database:: get_course_table(TABLE_FORUM_CATEGORY); $table = Database::get_course_table(TABLE_FORUM_CATEGORY);
$sessionCondition = api_get_session_condition( $sessionCondition = api_get_session_condition(
$session_id, $session_id,
@ -398,7 +398,7 @@ class CourseBuilder
$with_base_content = false, $with_base_content = false,
$id_list = array() $id_list = array()
) { ) {
$table = Database:: get_course_table(TABLE_FORUM_THREAD); $table = Database::get_course_table(TABLE_FORUM_THREAD);
$sessionCondition = api_get_session_condition( $sessionCondition = api_get_session_condition(
$session_id, $session_id,
@ -510,7 +510,7 @@ class CourseBuilder
$with_base_content = false, $with_base_content = false,
$id_list = array() $id_list = array()
) { ) {
$table = Database:: get_course_table(TABLE_TOOL_INTRO); $table = Database::get_course_table(TABLE_TOOL_INTRO);
$sessionCondition = api_get_session_condition( $sessionCondition = api_get_session_condition(
$session_id, $session_id,
@ -564,9 +564,9 @@ class CourseBuilder
$with_base_content = false, $with_base_content = false,
$idList = array() $idList = array()
) { ) {
$table_qui = Database:: get_course_table(TABLE_QUIZ_TEST); $table_qui = Database::get_course_table(TABLE_QUIZ_TEST);
$table_rel = Database:: get_course_table(TABLE_QUIZ_TEST_QUESTION); $table_rel = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);
$table_doc = Database:: get_course_table(TABLE_DOCUMENT); $table_doc = Database::get_course_table(TABLE_DOCUMENT);
if (!empty($courseId) && !empty($session_id)) { if (!empty($courseId) && !empty($session_id)) {
$session_id = intval($session_id); $session_id = intval($session_id);
@ -795,10 +795,10 @@ class CourseBuilder
*/ */
public function build_quiz_orphan_questions() public function build_quiz_orphan_questions()
{ {
$table_qui = Database:: get_course_table(TABLE_QUIZ_TEST); $table_qui = Database::get_course_table(TABLE_QUIZ_TEST);
$table_rel = Database:: get_course_table(TABLE_QUIZ_TEST_QUESTION); $table_rel = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);
$table_que = Database:: get_course_table(TABLE_QUIZ_QUESTION); $table_que = Database::get_course_table(TABLE_QUIZ_QUESTION);
$table_ans = Database:: get_course_table(TABLE_QUIZ_ANSWER); $table_ans = Database::get_course_table(TABLE_QUIZ_ANSWER);
$courseId = api_get_course_int_id(); $courseId = api_get_course_int_id();
@ -901,8 +901,8 @@ class CourseBuilder
$with_base_content = false, $with_base_content = false,
$id_list = array() $id_list = array()
) { ) {
$table_survey = Database:: get_course_table(TABLE_SURVEY); $table_survey = Database::get_course_table(TABLE_SURVEY);
$table_question = Database:: get_course_table(TABLE_SURVEY_QUESTION); $table_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
$sessionCondition = api_get_session_condition( $sessionCondition = api_get_session_condition(
$session_id, $session_id,
@ -979,7 +979,7 @@ class CourseBuilder
$with_base_content = false, $with_base_content = false,
$id_list = array() $id_list = array()
) { ) {
$table = Database:: get_course_table(TABLE_ANNOUNCEMENT); $table = Database::get_course_table(TABLE_ANNOUNCEMENT);
$sessionCondition = api_get_session_condition( $sessionCondition = api_get_session_condition(
$session_id, $session_id,
@ -990,7 +990,7 @@ class CourseBuilder
$sql = 'SELECT * FROM '.$table.' $sql = 'SELECT * FROM '.$table.'
WHERE c_id = '.$courseId.' '.$sessionCondition; WHERE c_id = '.$courseId.' '.$sessionCondition;
$db_result = Database::query($sql); $db_result = Database::query($sql);
$table_attachment = Database:: get_course_table( $table_attachment = Database::get_course_table(
TABLE_ANNOUNCEMENT_ATTACHMENT TABLE_ANNOUNCEMENT_ATTACHMENT
); );
while ($obj = Database::fetch_object($db_result)) { while ($obj = Database::fetch_object($db_result)) {
@ -1040,7 +1040,7 @@ class CourseBuilder
$with_base_content = false, $with_base_content = false,
$id_list = array() $id_list = array()
) { ) {
$table = Database:: get_course_table(TABLE_AGENDA); $table = Database::get_course_table(TABLE_AGENDA);
$sessionCondition = api_get_session_condition( $sessionCondition = api_get_session_condition(
$session_id, $session_id,
@ -1052,7 +1052,7 @@ class CourseBuilder
WHERE c_id = '.$courseId.' '.$sessionCondition; WHERE c_id = '.$courseId.' '.$sessionCondition;
$db_result = Database::query($sql); $db_result = Database::query($sql);
while ($obj = Database::fetch_object($db_result)) { while ($obj = Database::fetch_object($db_result)) {
$table_attachment = Database:: get_course_table( $table_attachment = Database::get_course_table(
TABLE_AGENDA_ATTACHMENT TABLE_AGENDA_ATTACHMENT
); );
$sql = 'SELECT path, comment, filename, size $sql = 'SELECT path, comment, filename, size
@ -1097,7 +1097,7 @@ class CourseBuilder
$with_base_content = false, $with_base_content = false,
$id_list = array() $id_list = array()
) { ) {
$table = Database:: get_course_table(TABLE_COURSE_DESCRIPTION); $table = Database::get_course_table(TABLE_COURSE_DESCRIPTION);
if (!empty($session_id) && !empty($courseId)) { if (!empty($session_id) && !empty($courseId)) {
$session_id = intval($session_id); $session_id = intval($session_id);
@ -1116,7 +1116,7 @@ class CourseBuilder
$sql = 'SELECT * FROM '.$table.' $sql = 'SELECT * FROM '.$table.'
WHERE c_id = '.$courseId.' '.$session_condition; WHERE c_id = '.$courseId.' '.$session_condition;
} else { } else {
$table = Database:: get_course_table(TABLE_COURSE_DESCRIPTION); $table = Database::get_course_table(TABLE_COURSE_DESCRIPTION);
$sql = 'SELECT * FROM '.$table.' $sql = 'SELECT * FROM '.$table.'
WHERE c_id = '.$courseId.' AND session_id = 0'; WHERE c_id = '.$courseId.' AND session_id = 0';
} }
@ -1303,7 +1303,7 @@ class CourseBuilder
WHERE g.c_id = '.$courseId.' '.$session_condition; WHERE g.c_id = '.$courseId.' '.$session_condition;
} }
} else { } else {
$table_glossary = Database:: get_course_table(TABLE_GLOSSARY); $table_glossary = Database::get_course_table(TABLE_GLOSSARY);
//@todo check this queries are the same ... ayayay //@todo check this queries are the same ... ayayay
if (!empty($this->course->type) && $this->course->type == 'partial') { if (!empty($this->course->type) && $this->course->type == 'partial') {
$sql = 'SELECT * FROM '.$table_glossary.' g $sql = 'SELECT * FROM '.$table_glossary.' g
@ -1535,7 +1535,7 @@ class CourseBuilder
$with_base_content = false, $with_base_content = false,
$id_list = array() $id_list = array()
) { ) {
$table_work = Database:: get_course_table(TABLE_STUDENT_PUBLICATION); $table_work = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
$sessionCondition = api_get_session_condition( $sessionCondition = api_get_session_condition(
$session_id, $session_id,
true, true,

@ -2764,9 +2764,9 @@ class CourseRestorer
public function restore_student_publication($sessionId = 0) public function restore_student_publication($sessionId = 0)
{ {
$sessionId = intval($sessionId); $sessionId = intval($sessionId);
$work_assignment_table = Database:: get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT); $work_assignment_table = Database::get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT);
$work_table = Database:: get_course_table(TABLE_STUDENT_PUBLICATION); $work_table = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
$item_property_table = Database:: get_course_table(TABLE_ITEM_PROPERTY); $item_property_table = Database::get_course_table(TABLE_ITEM_PROPERTY);
// Query in student publication // Query in student publication
$sql = 'SELECT * FROM '.$work_table.' $sql = 'SELECT * FROM '.$work_table.'

Loading…
Cancel
Save