Minor - Code style - Use "self" instead of classname within the class and remove spaces around :: operator

pull/2487/head
Yannick Warnier 9 years ago
parent 9400639437
commit 02f16760bd
  1. 80
      main/inc/lib/document.lib.php
  2. 74
      main/inc/lib/sessionmanager.lib.php
  3. 26
      main/survey/survey.lib.php
  4. 46
      main/survey/surveyUtil.class.php
  5. 82
      plugin/buycourses/src/buy_course_plugin.class.php
  6. 78
      src/Chamilo/CourseBundle/Component/CourseCopy/CourseRecycler.php
  7. 62
      src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php

@ -681,7 +681,7 @@ class DocumentManager
$temp[$row['id']] = $row;
}
//@todo use the DocumentManager::is_visible function
//@todo use the self::is_visible function
// Checking visibility in a session
foreach ($my_repeat_ids as $id) {
foreach ($doc_list as $row) {
@ -717,7 +717,7 @@ class DocumentManager
// Checking parents visibility.
$final_document_data = array();
foreach ($document_data as $row) {
$is_visible = DocumentManager::check_visibility_tree(
$is_visible = self::check_visibility_tree(
$row['id'],
$_course['code'],
$sessionId,
@ -835,7 +835,7 @@ class DocumentManager
if ($result && Database::num_rows($result) != 0) {
while ($row = Database::fetch_array($result, 'ASSOC')) {
if (DocumentManager::is_folder_to_avoid($row['path'])) {
if (self::is_folder_to_avoid($row['path'])) {
continue;
}
@ -1079,7 +1079,7 @@ class DocumentManager
$remove_content_from_db = false
) {
$TABLE_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
$TABLE_ITEMPROPERTY = Database :: get_course_table(TABLE_ITEM_PROPERTY);
$TABLE_ITEMPROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
// Deleting from the DB
$user_id = api_get_user_id();
@ -1376,7 +1376,7 @@ class DocumentManager
*/
public static function get_document_id($courseInfo, $path, $sessionId = null)
{
$table = Database :: get_course_table(TABLE_DOCUMENT);
$table = Database::get_course_table(TABLE_DOCUMENT);
$courseId = $courseInfo['real_id'];
if (!isset($sessionId)) {
@ -1430,7 +1430,7 @@ class DocumentManager
$session_id = empty($session_id) ? api_get_session_id() : intval($session_id);
$www = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/document';
$TABLE_DOCUMENT = Database :: get_course_table(TABLE_DOCUMENT);
$TABLE_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
$id = intval($id);
$sessionCondition = api_get_session_condition($session_id, true, true);
@ -1788,7 +1788,7 @@ class DocumentManager
*/
public static function attach_gradebook_certificate($course_id, $document_id, $session_id = 0)
{
$tbl_category = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
$tbl_category = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
$session_id = intval($session_id);
if (empty($session_id)) {
$session_id = api_get_session_id();
@ -1815,7 +1815,7 @@ class DocumentManager
*/
public static function get_default_certificate_id($course_id, $session_id = 0)
{
$tbl_category = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
$tbl_category = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
$session_id = intval($session_id);
if (empty($session_id)) {
$session_id = api_get_session_id();
@ -2035,7 +2035,7 @@ class DocumentManager
$default_certificate = self::get_default_certificate_id($course_id);
if ((int) $default_certificate == (int) $default_certificate_id) {
$tbl_category = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
$tbl_category = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
$session_id = api_get_session_id();
if ($session_id == 0 || is_null($session_id)) {
$sql_session = 'AND (session_id=' . intval($session_id) . ' OR isnull(session_id)) ';
@ -2555,7 +2555,7 @@ class DocumentManager
return false;
}
$orig_source_html = DocumentManager::get_resources_from_source_html($content_html);
$orig_source_html = self::get_resources_from_source_html($content_html);
$orig_course_info = api_get_course_info($origin_course_code);
// Course does not exist in the current DB probably this came from a zip file?
@ -2778,7 +2778,7 @@ class DocumentManager
$pre_remove .='..\/';
}
$orig_source_html = DocumentManager::get_resources_from_source_html($content_html);
$orig_source_html = self::get_resources_from_source_html($content_html);
foreach ($orig_source_html as $source) {
@ -2942,7 +2942,7 @@ class DocumentManager
}
if ($new_path) {
$documentId = DocumentManager::get_document_id(
$documentId = self::get_document_id(
$course_info,
$new_path,
$sessionId
@ -2953,7 +2953,7 @@ class DocumentManager
$params = array();
/*if ($if_exists == 'rename') {
// Remove prefix
$suffix = DocumentManager::getDocumentSuffix(
$suffix = self::getDocumentSuffix(
$course_info,
$sessionId,
api_get_group_id()
@ -4562,7 +4562,7 @@ class DocumentManager
);
if ($filePath) {
return DocumentManager::get_document_id(
return self::get_document_id(
$courseInfo,
$filePath,
$sessionId
@ -4820,7 +4820,7 @@ class DocumentManager
if (!empty($defaultCertificateId)) {
// We have a certificate from the course base
$documentData = DocumentManager::get_document_data_by_id(
$documentData = self::get_document_data_by_id(
$defaultCertificateId,
$courseData['code'],
false,
@ -5278,7 +5278,7 @@ class DocumentManager
$current_session_id = api_get_session_id();
$courseParams = api_get_cidreq();
$www = api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/document';
$webODFList = DocumentManager::get_web_odf_extension_list();
$webODFList = self::get_web_odf_extension_list();
// Get the title or the basename depending on what we're using
if ($document_data['title'] != '') {
@ -5371,7 +5371,7 @@ class DocumentManager
api_get_setting('students_download_folders') == 'true'
) {
//filter: when I am into a shared folder, I can only show "my shared folder" for donwload
if (DocumentManager::is_shared_folder($curdirpath, $current_session_id)) {
if (self::is_shared_folder($curdirpath, $current_session_id)) {
if (preg_match('/shared_folder\/sf_user_' . api_get_user_id() . '$/', urldecode($forcedownload_link)) ||
preg_match('/shared_folder_session_' . $current_session_id . '\/sf_user_' . api_get_user_id() . '$/', urldecode($forcedownload_link)) ||
$isAllowedToEdit || api_is_platform_admin()
@ -5497,7 +5497,7 @@ class DocumentManager
if (preg_match('/mp3$/i', urldecode($checkExtension)) ||
(preg_match('/wav$/i', urldecode($checkExtension))) ||
preg_match('/ogg$/i', urldecode($checkExtension))) {
$sound_preview = DocumentManager::generate_media_preview($counter);
$sound_preview = self::generate_media_preview($counter);
return $sound_preview;
} elseif (
@ -5512,16 +5512,16 @@ class DocumentManager
) {
$url = 'showinframes.php?' . $courseParams . '&id=' . $document_data['id'];
return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' .
DocumentManager::build_document_icon_tag($filetype, $path, $isAllowedToEdit) .
self::build_document_icon_tag($filetype, $path, $isAllowedToEdit) .
Display::return_icon('shared.png', get_lang('ResourceShared'), array()) . '</a>';
} else {
return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' .
DocumentManager::build_document_icon_tag($filetype, $path, $isAllowedToEdit) .
self::build_document_icon_tag($filetype, $path, $isAllowedToEdit) .
Display::return_icon('shared.png', get_lang('ResourceShared'), array()) . '</a>';
}
} else {
return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" target="' . $target . '"' . $visibility_class . ' style="float:left">' .
DocumentManager::build_document_icon_tag($filetype, $path, $isAllowedToEdit) .
self::build_document_icon_tag($filetype, $path, $isAllowedToEdit) .
Display::return_icon('shared.png', get_lang('ResourceShared'), array()) . '</a>';
}
} else {
@ -5530,7 +5530,7 @@ class DocumentManager
if (preg_match('/mp3$/i', urldecode($checkExtension)) ||
(preg_match('/wav$/i', urldecode($checkExtension))) ||
preg_match('/ogg$/i', urldecode($checkExtension))) {
$sound_preview = DocumentManager::generate_media_preview($counter);
$sound_preview = self::generate_media_preview($counter);
return $sound_preview;
} elseif (
@ -5547,14 +5547,14 @@ class DocumentManager
) {
$url = 'showinframes.php?' . $courseParams . '&id=' . $document_data['id']; //without preview
return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' .
DocumentManager::build_document_icon_tag($filetype, $path, $isAllowedToEdit) . '</a>';
self::build_document_icon_tag($filetype, $path, $isAllowedToEdit) . '</a>';
} else {
return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" ' . $visibility_class . ' style="float:left">' .
DocumentManager::build_document_icon_tag($filetype, $path, $isAllowedToEdit) . '</a>';
self::build_document_icon_tag($filetype, $path, $isAllowedToEdit) . '</a>';
}
} else {
return '<a href="' . $url . '" title="' . $tooltip_title_alt . '" target="' . $target . '"' . $visibility_class . ' style="float:left">' .
DocumentManager::build_document_icon_tag($filetype, $path, $isAllowedToEdit) . '</a>';
self::build_document_icon_tag($filetype, $path, $isAllowedToEdit) . '</a>';
}
}
}
@ -5677,20 +5677,20 @@ class DocumentManager
{
$sessionId = api_get_session_id();
$courseParams = api_get_cidreq();
$web_odf_extension_list = DocumentManager::get_web_odf_extension_list();
$web_odf_extension_list = self::get_web_odf_extension_list();
$document_id = $document_data['id'];
$type = $document_data['filetype'];
$is_read_only = $document_data['readonly'];
$path = $document_data['path'];
$parent_id = DocumentManager::get_document_id(
$parent_id = self::get_document_id(
api_get_course_info(),
dirname($path),
0
);
if (empty($parent_id) && !empty($sessionId)) {
$parent_id = DocumentManager::get_document_id(
$parent_id = self::get_document_id(
api_get_course_info(),
dirname($path),
$sessionId
@ -5698,12 +5698,12 @@ class DocumentManager
}
$curdirpath = dirname($document_data['path']);
$is_certificate_mode = DocumentManager::is_certificate_mode($path);
$is_certificate_mode = self::is_certificate_mode($path);
$curdirpath = urlencode($curdirpath);
$extension = pathinfo($path, PATHINFO_EXTENSION);
//@todo Implement remote support for converter
$usePpt2lp = (api_get_setting('service_ppt2lp', 'active') == 'true' && api_get_setting('service_ppt2lp', 'host') == 'localhost');
$formatTypeList = DocumentManager::getFormatTypeListConvertor('from', $extension);
$formatTypeList = self::getFormatTypeListConvertor('from', $extension);
$formatType = current($formatTypeList);
// Build URL-parameters for table-sorting
@ -5753,7 +5753,7 @@ class DocumentManager
$modify_icons .= '&nbsp;' . Display::return_icon('delete_na.png', get_lang('Delete'), array(), ICON_SIZE_SMALL);
} else {
//Edit button
if (in_array($path, DocumentManager::get_system_folders())) {
if (in_array($path, self::get_system_folders())) {
$modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL);
} elseif ($is_certificate_mode ) {
// gradebook category doesn't seem to be taken into account
@ -5795,7 +5795,7 @@ class DocumentManager
}
// Move button.
if ($is_certificate_mode || in_array($path, DocumentManager::get_system_folders())) {
if ($is_certificate_mode || in_array($path, self::get_system_folders())) {
$modify_icons .= '&nbsp;' . Display::return_icon('move_na.png', get_lang('Move'), array(), ICON_SIZE_SMALL) . '</a>';
} else {
if ($sessionId) {
@ -5827,14 +5827,14 @@ class DocumentManager
}
// Delete button
if (in_array($path, DocumentManager::get_system_folders())) {
if (in_array($path, self::get_system_folders())) {
$modify_icons .= '&nbsp;' . Display::return_icon('delete_na.png', get_lang('ThisFolderCannotBeDeleted'), array(), ICON_SIZE_SMALL);
} else {
$titleToShow = addslashes(basename($document_data['title']));
if (isset($_GET['curdirpath']) &&
$_GET['curdirpath'] == '/certificates' &&
DocumentManager::get_default_certificate_id(api_get_course_id()) == $id
self::get_default_certificate_id(api_get_course_id()) == $id
) {
$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?' . $courseParams . '&amp;curdirpath=' . $curdirpath . '&action=delete_item&id='.$parent_id.'&deleteid='.$document_id.'&amp;' . $sort_params . 'delete_certificate_id=' . $id . '" onclick="return confirmation(\'' . $titleToShow . '\');">' .
Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
@ -5860,7 +5860,7 @@ class DocumentManager
// Add action to covert to PDF, will create a new document whit same filename but .pdf extension
// @TODO: add prompt to select a format target
if (in_array($path, DocumentManager::get_system_folders())) {
if (in_array($path, self::get_system_folders())) {
// nothing to do
} else {
if ($usePpt2lp && $formatType) {
@ -5885,7 +5885,7 @@ class DocumentManager
}
if (isset($_GET['curdirpath']) && $_GET['curdirpath'] == '/certificates') {//allow attach certificate to course
$visibility_icon_certificate = 'nocertificate';
if (DocumentManager::get_default_certificate_id(api_get_course_id()) == $id) {
if (self::get_default_certificate_id(api_get_course_id()) == $id) {
$visibility_icon_certificate = 'certificate';
$certificate = get_lang('DefaultCertificate');
$preview = get_lang('PreviewCertificate');
@ -5985,7 +5985,7 @@ class DocumentManager
) {
$path_displayed = $folder;
// If document title is used, we have to display titles instead of real paths...
$path_displayed = DocumentManager::get_titles_of_path($folder);
$path_displayed = self::get_titles_of_path($folder);
if (empty($path_displayed)) {
$path_displayed = get_lang('Untitled');
@ -6001,7 +6001,7 @@ class DocumentManager
(substr($folder, 0, strlen($move_file) + 1) != $move_file . '/')
) {
// Cannot copy dir into his own subdir
$path_displayed = DocumentManager::get_titles_of_path($folder);
$path_displayed = self::get_titles_of_path($folder);
$display_folder = substr($path_displayed, strlen($group_dir));
$display_folder = ($display_folder == '') ? get_lang('Documents') : $display_folder;
//$form .= '<option value="'.$folder.'">'.$display_folder.'</option>';
@ -6350,7 +6350,7 @@ class DocumentManager
}
if (Security::check_abs_path($tempZipFile, api_get_path(SYS_ARCHIVE_PATH))) {
DocumentManager::file_send_for_download($tempZipFile, true);
self::file_send_for_download($tempZipFile, true);
@unlink($tempZipFile);
exit;
}
@ -6401,7 +6401,7 @@ class DocumentManager
foreach ($documents as $document) {
$documentId = $document['id'];
DocumentManager::delete_document(
self::delete_document(
$courseInfo,
null,
$base_work_dir,

@ -626,8 +626,8 @@ class SessionManager
//escaping vars
$sessionId = $sessionId == 'T' ? 'T' : intval($sessionId);
$courseId = intval($courseId);
$date_from = Database :: escape_string($date_from);
$date_to = Database :: escape_string($date_to);
$date_from = Database::escape_string($date_from);
$date_to = Database::escape_string($date_to);
//tables
$session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
@ -641,10 +641,10 @@ class SessionManager
/* if (empty($sessionId)
{
// Registered students in a course outside session.
$users = CourseManager :: get_student_list_from_course_code($course_code);
$users = CourseManager::get_student_list_from_course_code($course_code);
} else {
// Registered students in session.
$users = CourseManager :: get_student_list_from_course_code($course_code, true, $sessionId);
$users = CourseManager::get_student_list_from_course_code($course_code, true, $sessionId);
} */
$sessionCond = 'and session_id = %s';
@ -1185,7 +1185,7 @@ class SessionManager
*/
public static function get_number_of_tracking_access_overview()
{
$table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$sql = "SELECT COUNT(course_access_id) count FROM $table";
$result = Database::query($sql);
$row = Database::fetch_assoc($result);
@ -1218,11 +1218,11 @@ class SessionManager
$date_to = Database::escape_string($date_to);
// database table definition
$user = Database :: get_main_table(TABLE_MAIN_USER);
$course = Database :: get_main_table(TABLE_MAIN_COURSE);
$track_e_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$track_e_course_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$sessionTable = Database :: get_main_table(TABLE_MAIN_SESSION);
$user = Database::get_main_table(TABLE_MAIN_USER);
$course = Database::get_main_table(TABLE_MAIN_COURSE);
$track_e_login = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$track_e_course_access = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$sessionTable = Database::get_main_table(TABLE_MAIN_SESSION);
global $export_csv;
if ($export_csv) {
@ -1548,7 +1548,7 @@ class SessionManager
$tbl_url_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
$tbl_item_properties = Database::get_course_table(TABLE_ITEM_PROPERTY);
$tbl_student_publication = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
$tbl_student_publication_assignment = Database :: get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT);
$tbl_student_publication_assignment = Database::get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT);
$userGroupSessionTable = Database::get_main_table(TABLE_USERGROUP_REL_SESSION);
$ticket = Database::get_main_table(TABLE_TICKET_TICKET);
@ -1576,7 +1576,7 @@ class SessionManager
$id_checked = intval($id_checked);
}
if (SessionManager::allowed($id_checked) && !$from_ws) {
if (self::allowed($id_checked) && !$from_ws) {
$qb = $em
->createQuery('
SELECT s.sessionAdminId FROM ChamiloCoreBundle:Session s
@ -1592,7 +1592,7 @@ class SessionManager
}
// Delete documents inside a session
$courses = SessionManager::getCoursesInSession($id_checked);
$courses = self::getCoursesInSession($id_checked);
foreach ($courses as $courseId) {
$courseInfo = api_get_course_info_by_id($courseId);
DocumentManager::deleteDocumentsFromSession($courseInfo, $id_checked);
@ -2162,7 +2162,7 @@ class SessionManager
Database::query($sql);
// Get the list of courses related to this session
$course_list = SessionManager::get_course_list_by_session_id($session_id);
$course_list = self::get_course_list_by_session_id($session_id);
if (!empty($course_list)) {
foreach ($course_list as $course) {
@ -2766,9 +2766,9 @@ class SessionManager
$session_id = $rows['id'];
if ($delete_session) {
if ($from_ws) {
SessionManager::delete($session_id, true);
self::delete($session_id, true);
} else {
SessionManager::delete($session_id);
self::delete($session_id);
}
}
}
@ -3488,7 +3488,7 @@ class SessionManager
$orderBy = Database::escape_string($orderBy);
$orderBy = " ORDER BY $orderBy";
} else {
if (SessionManager::orderCourseIsEnabled()) {
if (self::orderCourseIsEnabled()) {
$orderBy .= " ORDER BY position ";
} else {
$orderBy .= " ORDER BY title ";
@ -3537,7 +3537,7 @@ class SessionManager
$keyword = null
) {
if (empty($sessionId)) {
$sessionsSQL = SessionManager::get_sessions_followed_by_drh(
$sessionsSQL = self::get_sessions_followed_by_drh(
$userId,
null,
null,
@ -4562,7 +4562,7 @@ class SessionManager
Database::query($sql);
// We get the last insert id.
$my_session_result = SessionManager::get_session_by_name($enreg['SessionName']);
$my_session_result = self::get_session_by_name($enreg['SessionName']);
$session_id = $my_session_result['id'];
if ($session_id) {
@ -4630,7 +4630,7 @@ class SessionManager
Database::query($sql);
}
} else {
$my_session_result = SessionManager::get_session_by_name($session_name);
$my_session_result = self::get_session_by_name($session_name);
$session_id = $my_session_result['id'];
}
@ -4775,7 +4775,7 @@ class SessionManager
SET c_id = '$courseId', session_id='$session_id'";
Database::query($sql);
SessionManager::installCourse($session_id, $courseInfo['real_id']);
self::installCourse($session_id, $courseInfo['real_id']);
if ($debug) {
$logger->addInfo("Sessions - Adding course '$course_code' to session #$session_id");
@ -4799,7 +4799,7 @@ class SessionManager
// If any user provided for a course, use the users array.
if (empty($course_users)) {
if (!empty($userList)) {
SessionManager::subscribe_users_to_session_course(
self::subscribe_users_to_session_course(
$userList,
$session_id,
$course_code
@ -4838,7 +4838,7 @@ class SessionManager
$coach_id = UserManager::get_user_id_from_username($course_coach);
if ($coach_id !== false) {
// Just insert new coaches
SessionManager::updateCoaches(
self::updateCoaches(
$session_id,
$courseId,
array($coach_id),
@ -4926,7 +4926,7 @@ class SessionManager
}
if (!empty($teacherToAdd)) {
SessionManager::updateCoaches(
self::updateCoaches(
$session_id,
$courseId,
array($teacherToAdd),
@ -5110,7 +5110,7 @@ class SessionManager
// Continue default behaviour.
if ($onlyAddFirstCoachOrTeacher == false) {
// Checking one more time see BT#6449#note-149
$coaches = SessionManager::getCoachesByCourseSession($session_id, $courseId);
$coaches = self::getCoachesByCourseSession($session_id, $courseId);
// Update coaches if only there's 1 course see BT#6449#note-189
if (empty($coaches) || count($courses) == 1) {
foreach ($course_coaches as $course_coach) {
@ -5118,7 +5118,7 @@ class SessionManager
$coach_id = UserManager::get_user_id_from_username($course_coach);
if ($coach_id !== false) {
// Just insert new coaches
SessionManager::updateCoaches(
self::updateCoaches(
$session_id,
$courseId,
array($coach_id),
@ -5145,7 +5145,7 @@ class SessionManager
$user_id = UserManager::get_user_id_from_username($user);
if ($user_id !== false) {
SessionManager::subscribe_users_to_session_course(
self::subscribe_users_to_session_course(
array($user_id),
$session_id,
$course_code
@ -5260,11 +5260,11 @@ class SessionManager
*/
public static function getAllCoursesFromAllSessionFromDrh($userId)
{
$sessions = SessionManager::get_sessions_followed_by_drh($userId);
$sessions = self::get_sessions_followed_by_drh($userId);
$coursesFromSession = array();
if (!empty($sessions)) {
foreach ($sessions as $session) {
$courseList = SessionManager::get_course_list_by_session_id($session['id']);
$courseList = self::get_course_list_by_session_id($session['id']);
foreach ($courseList as $course) {
$coursesFromSession[] = $course['code'];
}
@ -5280,11 +5280,11 @@ class SessionManager
*/
public static function getAllCoursesFromAllSessions()
{
$sessions = SessionManager::get_sessions_list();
$sessions = self::get_sessions_list();
$coursesFromSession = array();
if (!empty($sessions)) {
foreach ($sessions as $session) {
$courseList = SessionManager::get_course_list_by_session_id($session['id']);
$courseList = self::get_course_list_by_session_id($session['id']);
foreach ($courseList as $course) {
$coursesFromSession[$course['code'].':'.$session['id']] = $course['visual_code'] . ' - ' . $course['title'] . ' (' . $session['name'] . ')';
}
@ -5391,7 +5391,7 @@ class SessionManager
case 'drh_all':
// Show all by DRH
if (empty($sessionIdList)) {
$sessionsListSql = SessionManager::get_sessions_followed_by_drh(
$sessionsListSql = self::get_sessions_followed_by_drh(
$userId,
null,
null,
@ -5577,7 +5577,7 @@ class SessionManager
continue;
}
$messages[] = Display::return_message(get_lang('StudentList') . '<br />' . $userToString, 'info', false);
SessionManager::subscribe_users_to_session(
self::subscribe_users_to_session(
$sessionDestinationId,
$newUserList,
SESSION_VISIBLE_READ_ONLY,
@ -5751,7 +5751,7 @@ class SessionManager
// Followed teachers by drh
if (api_drh_can_access_all_session_content()) {
if (empty($sessionIdList)) {
$sessions = SessionManager::get_sessions_followed_by_drh($userId);
$sessions = self::get_sessions_followed_by_drh($userId);
$sessionIdList = array();
foreach ($sessions as $session) {
$sessionIdList[] = $session['id'];
@ -7102,7 +7102,7 @@ class SessionManager
$coachInfo = api_get_user_info($sessionInfo['id_coach']);
};
$categoriesList = SessionManager::get_all_session_category();
$categoriesList = self::get_all_session_category();
$userInfo = api_get_user_info();
$categoriesOptions = array(
@ -8081,7 +8081,7 @@ class SessionManager
foreach ($listSessionId as $i => $sessionId) {
// here we got all session for this course
// lets check there session categories
$sessionInfo = SessionManager::fetch($sessionId);
$sessionInfo = self::fetch($sessionId);
$catId = $sessionInfo['session_category_id'];
if (!isset($listCat[$catId])) {
$listCatInfo = self::get_session_category($catId);
@ -8090,7 +8090,7 @@ class SessionManager
$listCat[$catId]['catSessionName'] = $listCatInfo['name'];
$listCat[$catId]['sessionList'] = array();
}
$listSessionInfo = SessionManager::fetch($sessionId);
$listSessionInfo = self::fetch($sessionId);
$listSessionIdName = array(
"sessionId" => $sessionId,
"sessionName" => $listSessionInfo['name'],

@ -336,7 +336,7 @@ class SurveyManager
}
if ($values['survey_type'] == 1 && !empty($values['parent_id'])) {
SurveyManager::copy_survey($values['parent_id'], $survey_id);
self::copy_survey($values['parent_id'], $survey_id);
}
Display::addFlash(
@ -613,7 +613,7 @@ class SurveyManager
Database::query($sql);
// Deleting the questions of the survey
SurveyManager::delete_all_survey_questions($survey_id, $shared);
self::delete_all_survey_questions($survey_id, $shared);
// Update into item_property (delete)
api_item_property_update(
@ -773,7 +773,7 @@ class SurveyManager
$course_id = $courseId ? $courseId : api_get_course_int_id();
$datas = SurveyManager::get_survey($survey_id);
$datas = self::get_survey($survey_id);
$session_where = '';
if (api_get_session_id() != 0) {
$session_where = ' AND session_id = "'.api_get_session_id().'" ';
@ -816,7 +816,7 @@ class SurveyManager
$session_id = $survey_data['session_id'];
// Getting a list with all the people who have filled the survey
$people_filled = SurveyManager::get_people_who_filled_survey($survey_id, false, $course_id);
$people_filled = self::get_people_who_filled_survey($survey_id, false, $course_id);
$number = intval(count($people_filled));
@ -1061,11 +1061,11 @@ class SurveyManager
$tbl_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
// Getting all the information of the survey
$survey_data = SurveyManager::get_survey($form_content['survey_id']);
$survey_data = self::get_survey($form_content['survey_id']);
// Storing the question in the shared database
if (is_numeric($survey_data['survey_share']) && $survey_data['survey_share'] != 0) {
$shared_question_id = SurveyManager::save_shared_question($form_content, $survey_data);
$shared_question_id = self::save_shared_question($form_content, $survey_data);
$form_content['shared_question_id'] = $shared_question_id;
}
@ -1169,7 +1169,7 @@ class SurveyManager
}
// Storing the options of the question
SurveyManager::save_question_options($form_content, $survey_data);
self::save_question_options($form_content, $survey_data);
} else {
$return_message = 'PleasFillAllAnswer';
}
@ -1321,10 +1321,10 @@ class SurveyManager
Database::query($sql);
// Deleting all the options of the questions of the survey
SurveyManager::delete_all_survey_questions_options($survey_id, $shared);
self::delete_all_survey_questions_options($survey_id, $shared);
// Deleting all the answers on this survey
SurveyManager::delete_all_survey_answers($survey_id);
self::delete_all_survey_answers($survey_id);
}
/**
@ -1345,7 +1345,7 @@ class SurveyManager
// Table definitions
$table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
if ($shared) {
SurveyManager::delete_shared_survey_question($survey_id, $question_id);
self::delete_shared_survey_question($survey_id, $question_id);
}
// Deleting the survey questions
@ -1357,7 +1357,7 @@ class SurveyManager
Database::query($sql);
// Deleting the options of the question of the survey
SurveyManager::delete_survey_question_option($survey_id, $question_id, $shared);
self::delete_survey_question_option($survey_id, $question_id, $shared);
}
/**
@ -1378,7 +1378,7 @@ class SurveyManager
$table_survey_question_option = Database::get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION_OPTION);
// First we have to get the shared_question_id
$question_data = SurveyManager::get_question($question_id);
$question_data = self::get_question($question_id);
// Deleting the survey questions
$sql = "DELETE FROM $table_survey_question
@ -1411,7 +1411,7 @@ class SurveyManager
}
if (is_numeric($survey_data['survey_share']) && $survey_data['survey_share'] != 0) {
SurveyManager::save_shared_question_options($form_content, $survey_data);
self::save_shared_question_options($form_content, $survey_data);
}
// Table definition

@ -214,19 +214,19 @@ class SurveyUtil
$survey_data['number_of_questions'] = count($questions_data);
if ($action == 'questionreport') {
SurveyUtil::display_question_report($survey_data);
self::display_question_report($survey_data);
}
if ($action == 'userreport') {
SurveyUtil::display_user_report($people_filled, $survey_data);
self::display_user_report($people_filled, $survey_data);
}
if ($action == 'comparativereport') {
SurveyUtil::display_comparative_report();
self::display_comparative_report();
}
if ($action == 'completereport') {
SurveyUtil::display_complete_report($survey_data);
self::display_complete_report($survey_data);
}
if ($action == 'deleteuserreport') {
SurveyUtil::delete_user_report($_GET['survey_id'], $_GET['user']);
self::delete_user_report($_GET['survey_id'], $_GET['user']);
}
}
@ -536,7 +536,7 @@ class SurveyUtil
if ($question['type'] == 'score') {
/** @todo This function should return the options as this is needed further in the code */
$options = SurveyUtil::display_question_report_score($survey_data, $question, $offset);
$options = self::display_question_report_score($survey_data, $question, $offset);
} elseif ($question['type'] == 'open') {
/** @todo Also get the user who has answered this */
$sql = "SELECT * FROM $table_survey_answer
@ -970,7 +970,7 @@ class SurveyUtil
$userParam = $i;
$i++;
}
SurveyUtil::display_complete_report_row(
self::display_complete_report_row(
$survey_data,
$possible_answers,
$answers_of_user,
@ -992,7 +992,7 @@ class SurveyUtil
$userParam = $i;
$i++;
}
SurveyUtil::display_complete_report_row(
self::display_complete_report_row(
$survey_data,
$possible_answers,
$answers_of_user,
@ -1219,7 +1219,7 @@ class SurveyUtil
$result = Database::query($sql);
while ($row = Database::fetch_array($result)) {
if ($old_user != $row['user'] && $old_user != '') {
$return .= SurveyUtil::export_complete_report_row(
$return .= self::export_complete_report_row(
$survey_data,
$possible_answers,
$answers_of_user,
@ -1238,7 +1238,7 @@ class SurveyUtil
$old_user = $row['user'];
}
// This is to display the last user
$return .= SurveyUtil::export_complete_report_row(
$return .= self::export_complete_report_row(
$survey_data,
$possible_answers,
$answers_of_user,
@ -1510,7 +1510,7 @@ class SurveyUtil
$result = Database::query($sql);
while ($row = Database::fetch_array($result)) {
if ($old_user != $row['user'] && $old_user != '') {
$return = SurveyUtil::export_complete_report_row_xls(
$return = self::export_complete_report_row_xls(
$survey_data,
$possible_answers,
$answers_of_user,
@ -1535,7 +1535,7 @@ class SurveyUtil
$old_user = $row['user'];
}
$return = SurveyUtil::export_complete_report_row_xls(
$return = self::export_complete_report_row_xls(
$survey_data,
$possible_answers,
$answers_of_user,
@ -1713,8 +1713,8 @@ class SurveyUtil
if (is_numeric($xAxis) && is_numeric($yAxis)) {
// Getting the answers of the two questions
$answers_x = SurveyUtil::get_answers_of_question_by_user($surveyId, $xAxis);
$answers_y = SurveyUtil::get_answers_of_question_by_user($surveyId, $yAxis);
$answers_x = self::get_answers_of_question_by_user($surveyId, $xAxis);
$answers_y = self::get_answers_of_question_by_user($surveyId, $yAxis);
// Displaying the table
$tableHtml = '<table border="1" class="data_table">';
@ -1757,7 +1757,7 @@ class SurveyUtil
break;
} else {
$tableHtml .= '<td align="center">';
$votes = SurveyUtil::comparative_check(
$votes = self::comparative_check(
$answers_x,
$answers_y,
$question_x['answersid'][($ii - 1)],
@ -1782,7 +1782,7 @@ class SurveyUtil
$tableHtml .= '<th>'.$question_y['answers'][$ij].' '.$y.'</th>';
} else {
$tableHtml .= '<td align="center">';
$votes = SurveyUtil::comparative_check(
$votes = self::comparative_check(
$answers_x,
$answers_y,
$question_x['answersid'][($ii - 1)],
@ -1817,7 +1817,7 @@ class SurveyUtil
break;
} else {
$tableHtml .= '<td align="center">';
$votes = SurveyUtil::comparative_check(
$votes = self::comparative_check(
$answers_x,
$answers_y,
$question_x['answersid'][($ii-1)],
@ -1842,7 +1842,7 @@ class SurveyUtil
$tableHtml .= '<th>'.$question_y['answers'][($ij)].'</th>';
} else {
$tableHtml .= '<td align="center">';
$votes = SurveyUtil::comparative_check($answers_x, $answers_y, $question_x['answersid'][($ii-1)], $question_y['answersid'][($ij)]);
$votes = self::comparative_check($answers_x, $answers_y, $question_x['answersid'][($ii-1)], $question_y['answersid'][($ij)]);
$tableHtml .= $votes;
array_push(
$chartData,
@ -2066,8 +2066,8 @@ class SurveyUtil
// Getting the survey information
$survey_data = SurveyManager::get_survey($_GET['survey_id']);
$survey_invitations = SurveyUtil::get_invitations($survey_data['survey_code']);
$already_invited = SurveyUtil::get_invited_users($survey_data['code']);
$survey_invitations = self::get_invitations($survey_data['survey_code']);
$already_invited = self::get_invited_users($survey_data['code']);
// Remind unanswered is a special version of remind all reminder
$exclude_users = array();
@ -2156,7 +2156,7 @@ class SurveyUtil
$invitation_text = str_replace('src="../../', 'src="'.api_get_path(WEB_PATH), $invitation_text);
$invitation_text = trim(stripslashes($invitation_text));
}
SurveyUtil::send_invitation_mail($value, $invitation_code, $invitation_title, $invitation_text);
self::send_invitation_mail($value, $invitation_code, $invitation_title, $invitation_text);
$counter++;
}
}
@ -2680,7 +2680,7 @@ class SurveyUtil
$table_survey = Database::get_course_table(TABLE_SURVEY);
$course_id = api_get_course_int_id();
$search_restriction = SurveyUtil::survey_search_restriction();
$search_restriction = self::survey_search_restriction();
if ($search_restriction) {
$search_restriction = 'WHERE c_id = '.$course_id.' AND '.$search_restriction;
} else {
@ -2721,7 +2721,7 @@ class SurveyUtil
$_user = api_get_user_info();
// Searching
$search_restriction = SurveyUtil::survey_search_restriction();
$search_restriction = self::survey_search_restriction();
if ($search_restriction) {
$search_restriction = ' AND '.$search_restriction;
}

@ -216,7 +216,7 @@ class BuyCoursesPlugin extends Plugin
{
return Database::select(
'*',
Database::get_main_table(BuyCoursesPlugin::TABLE_CURRENCY),
Database::get_main_table(self::TABLE_CURRENCY),
[
'where' => ['status = ?' => true]
],
@ -232,7 +232,7 @@ class BuyCoursesPlugin extends Plugin
{
return Database::select(
'*',
Database::get_main_table(BuyCoursesPlugin::TABLE_CURRENCY)
Database::get_main_table(self::TABLE_CURRENCY)
);
}
@ -243,7 +243,7 @@ class BuyCoursesPlugin extends Plugin
public function selectCurrency($selectedId)
{
$currencyTable = Database::get_main_table(
BuyCoursesPlugin::TABLE_CURRENCY
self::TABLE_CURRENCY
);
Database::update(
@ -265,7 +265,7 @@ class BuyCoursesPlugin extends Plugin
public function savePaypalParams($params)
{
return Database::update(
Database::get_main_table(BuyCoursesPlugin::TABLE_PAYPAL),
Database::get_main_table(self::TABLE_PAYPAL),
[
'username' => $params['username'],
'password' => $params['password'],
@ -284,7 +284,7 @@ class BuyCoursesPlugin extends Plugin
{
return Database::select(
'*',
Database::get_main_table(BuyCoursesPlugin::TABLE_PAYPAL),
Database::get_main_table(self::TABLE_PAYPAL),
['id = ?' => 1],
'first'
);
@ -367,8 +367,8 @@ class BuyCoursesPlugin extends Plugin
*/
public function getItemByProduct($productId, $itemType)
{
$buyItemTable = Database::get_main_table(BuyCoursesPlugin::TABLE_ITEM);
$buyCurrencyTable = Database::get_main_table(BuyCoursesPlugin::TABLE_CURRENCY);
$buyItemTable = Database::get_main_table(self::TABLE_ITEM);
$buyCurrencyTable = Database::get_main_table(self::TABLE_CURRENCY);
$fakeItemFrom = "
$buyItemTable i
@ -875,8 +875,8 @@ class BuyCoursesPlugin extends Plugin
*/
public function getSaleListByPaymentType($paymentType = self::PAYMENT_TYPE_PAYPAL)
{
$saleTable = Database::get_main_table(BuyCoursesPlugin::TABLE_SALE);
$currencyTable = Database::get_main_table(BuyCoursesPlugin::TABLE_CURRENCY);
$saleTable = Database::get_main_table(self::TABLE_SALE);
$currencyTable = Database::get_main_table(self::TABLE_CURRENCY);
$userTable = Database::get_main_table(TABLE_MAIN_USER);
$innerJoins = "
@ -903,7 +903,7 @@ class BuyCoursesPlugin extends Plugin
{
return Database::select(
'*',
Database::get_main_table(BuyCoursesPlugin::TABLE_CURRENCY),
Database::get_main_table(self::TABLE_CURRENCY),
[
'where' => ['id = ?' => intval($currencyId)]
],
@ -996,8 +996,8 @@ class BuyCoursesPlugin extends Plugin
*/
public function getSaleListByStatus($status = self::SALE_STATUS_PENDING)
{
$saleTable = Database::get_main_table(BuyCoursesPlugin::TABLE_SALE);
$currencyTable = Database::get_main_table(BuyCoursesPlugin::TABLE_CURRENCY);
$saleTable = Database::get_main_table(self::TABLE_SALE);
$currencyTable = Database::get_main_table(self::TABLE_CURRENCY);
$userTable = Database::get_main_table(TABLE_MAIN_USER);
$innerJoins = "
@ -1239,8 +1239,8 @@ class BuyCoursesPlugin extends Plugin
return [];
}
$saleTable = Database::get_main_table(BuyCoursesPlugin::TABLE_SALE);
$currencyTable = Database::get_main_table(BuyCoursesPlugin::TABLE_CURRENCY);
$saleTable = Database::get_main_table(self::TABLE_SALE);
$currencyTable = Database::get_main_table(self::TABLE_CURRENCY);
$userTable = Database::get_main_table(TABLE_MAIN_USER);
$innerJoins = "
@ -1273,8 +1273,8 @@ class BuyCoursesPlugin extends Plugin
return [];
}
$saleTable = Database::get_main_table(BuyCoursesPlugin::TABLE_SALE);
$currencyTable = Database::get_main_table(BuyCoursesPlugin::TABLE_CURRENCY);
$saleTable = Database::get_main_table(self::TABLE_SALE);
$currencyTable = Database::get_main_table(self::TABLE_CURRENCY);
$userTable = Database::get_main_table(TABLE_MAIN_USER);
$innerJoins = "
@ -1287,7 +1287,7 @@ class BuyCoursesPlugin extends Plugin
"$saleTable s $innerJoins",
[
'where' => [
'u.id = ? AND s.status = ?' => [intval($id), BuyCoursesPlugin::SALE_STATUS_COMPLETED]
'u.id = ? AND s.status = ?' => [intval($id), self::SALE_STATUS_COMPLETED]
],
'order' => 'id DESC'
]
@ -1334,8 +1334,8 @@ class BuyCoursesPlugin extends Plugin
*/
public function getSessionForConfiguration(Session $session, $defaultCurrency = null)
{
$buyItemTable = Database::get_main_table(BuyCoursesPlugin::TABLE_ITEM);
$buyCurrencyTable = Database::get_main_table(BuyCoursesPlugin::TABLE_CURRENCY);
$buyItemTable = Database::get_main_table(self::TABLE_ITEM);
$buyCurrencyTable = Database::get_main_table(self::TABLE_CURRENCY);
$fakeItemFrom = "
$buyItemTable i
@ -1418,7 +1418,7 @@ class BuyCoursesPlugin extends Plugin
*/
public function deleteItem($itemId)
{
$itemTable = Database::get_main_table(BuyCoursesPlugin::TABLE_ITEM);
$itemTable = Database::get_main_table(self::TABLE_ITEM);
$affectedRows = Database::delete(
$itemTable,
['id = ?' => intval($itemId)]
@ -1438,7 +1438,7 @@ class BuyCoursesPlugin extends Plugin
*/
public function registerItem(array $itemData)
{
$itemTable = Database::get_main_table(BuyCoursesPlugin::TABLE_ITEM);
$itemTable = Database::get_main_table(self::TABLE_ITEM);
return Database::insert($itemTable, $itemData);
}
@ -1452,7 +1452,7 @@ class BuyCoursesPlugin extends Plugin
*/
public function updateItem(array $itemData, $productId, $productType)
{
$itemTable = Database::get_main_table(BuyCoursesPlugin::TABLE_ITEM);
$itemTable = Database::get_main_table(self::TABLE_ITEM);
return Database::update(
$itemTable,
@ -1471,7 +1471,7 @@ class BuyCoursesPlugin extends Plugin
*/
public function deleteItemBeneficiaries($itemId)
{
$beneficiaryTable = Database::get_main_table(BuyCoursesPlugin::TABLE_ITEM_BENEFICIARY);
$beneficiaryTable = Database::get_main_table(self::TABLE_ITEM_BENEFICIARY);
return Database::delete(
$beneficiaryTable,
@ -1486,7 +1486,7 @@ class BuyCoursesPlugin extends Plugin
*/
public function registerItemBeneficiaries($itemId, array $userIds)
{
$beneficiaryTable = Database::get_main_table(BuyCoursesPlugin::TABLE_ITEM_BENEFICIARY);
$beneficiaryTable = Database::get_main_table(self::TABLE_ITEM_BENEFICIARY);
$this->deleteItemBeneficiaries($itemId);
@ -1546,9 +1546,9 @@ class BuyCoursesPlugin extends Plugin
$condition = ($payoutId) ? 'AND p.id = '. intval($payoutId) : '';
$condition2 = ($userId) ? ' AND p.user_id = ' . intval($userId) : '';
$typeResult = ($condition) ? 'first' : 'all';
$payoutsTable = Database::get_main_table(BuyCoursesPlugin::TABLE_PAYPAL_PAYOUTS);
$saleTable = Database::get_main_table(BuyCoursesPlugin::TABLE_SALE);
$currencyTable = Database::get_main_table(BuyCoursesPlugin::TABLE_CURRENCY);
$payoutsTable = Database::get_main_table(self::TABLE_PAYPAL_PAYOUTS);
$saleTable = Database::get_main_table(self::TABLE_SALE);
$currencyTable = Database::get_main_table(self::TABLE_CURRENCY);
$userTable = Database::get_main_table(TABLE_MAIN_USER);
$extraFieldTable = Database::get_main_table(TABLE_EXTRA_FIELD);
$extraFieldValues = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES);
@ -1637,7 +1637,7 @@ class BuyCoursesPlugin extends Plugin
*/
public function storePayouts($saleId)
{
$payoutsTable = Database::get_main_table(BuyCoursesPlugin::TABLE_PAYPAL_PAYOUTS);
$payoutsTable = Database::get_main_table(self::TABLE_PAYPAL_PAYOUTS);
$platformCommission = $this->getPlatformCommission();
$sale = $this->getSale($saleId);
@ -1668,7 +1668,7 @@ class BuyCoursesPlugin extends Plugin
*/
public function setStatusPayouts($payoutId, $status)
{
$payoutsTable = Database::get_main_table(BuyCoursesPlugin::TABLE_PAYPAL_PAYOUTS);
$payoutsTable = Database::get_main_table(self::TABLE_PAYPAL_PAYOUTS);
Database::update(
$payoutsTable,
@ -1685,7 +1685,7 @@ class BuyCoursesPlugin extends Plugin
{
return Database::select(
'*',
Database::get_main_table(BuyCoursesPlugin::TABLE_COMMISSION),
Database::get_main_table(self::TABLE_COMMISSION),
['id = ?' => 1],
'first'
);
@ -1698,7 +1698,7 @@ class BuyCoursesPlugin extends Plugin
*/
public function updateCommission($params)
{
$commissionTable = Database::get_main_table(BuyCoursesPlugin::TABLE_COMMISSION);
$commissionTable = Database::get_main_table(self::TABLE_COMMISSION);
return Database::update(
$commissionTable,
@ -1714,7 +1714,7 @@ class BuyCoursesPlugin extends Plugin
*/
public function storeService($service)
{
$servicesTable = Database::get_main_table(BuyCoursesPlugin::TABLE_SERVICES);
$servicesTable = Database::get_main_table(self::TABLE_SERVICES);
$return = Database::insert(
$servicesTable,
@ -1759,7 +1759,7 @@ class BuyCoursesPlugin extends Plugin
*/
public function updateService($service, $id)
{
$servicesTable = Database::get_main_table(BuyCoursesPlugin::TABLE_SERVICES);
$servicesTable = Database::get_main_table(self::TABLE_SERVICES);
if (!empty($service['picture_crop_image_base_64'])) {
$img = str_replace('data:image/png;base64,', '', $service['picture_crop_image_base_64']);
$img = str_replace(' ', '+', $img);
@ -1811,7 +1811,7 @@ class BuyCoursesPlugin extends Plugin
*/
public function getServices($id = null)
{
$servicesTable = Database::get_main_table(BuyCoursesPlugin::TABLE_SERVICES);
$servicesTable = Database::get_main_table(self::TABLE_SERVICES);
$userTable = Database::get_main_table(TABLE_MAIN_USER);
$conditions = null;
@ -1902,8 +1902,8 @@ class BuyCoursesPlugin extends Plugin
$nodeId = 0,
$hot = false
) {
$servicesTable = Database::get_main_table(BuyCoursesPlugin::TABLE_SERVICES);
$servicesSaleTable = Database::get_main_table(BuyCoursesPlugin::TABLE_SERVICES_SALE);
$servicesTable = Database::get_main_table(self::TABLE_SERVICES);
$servicesSaleTable = Database::get_main_table(self::TABLE_SERVICES_SALE);
$conditions = null;
$showData = 'all';
@ -2065,7 +2065,7 @@ class BuyCoursesPlugin extends Plugin
*/
public function getCatalogServiceList($name = null, $min = 0, $max = 0, $appliesTo = '')
{
$servicesTable = Database::get_main_table(BuyCoursesPlugin::TABLE_SERVICES);
$servicesTable = Database::get_main_table(self::TABLE_SERVICES);
$userTable = Database::get_main_table(TABLE_MAIN_USER);
$whereConditions = [
@ -2190,7 +2190,7 @@ class BuyCoursesPlugin extends Plugin
public function saveCulqiParameters($params)
{
return Database::update(
Database::get_main_table(BuyCoursesPlugin::TABLE_CULQI),
Database::get_main_table(self::TABLE_CULQI),
[
'commerce_code' => $params['commerce_code'],
'api_key' => $params['api_key'],
@ -2208,7 +2208,7 @@ class BuyCoursesPlugin extends Plugin
{
return Database::select(
'*',
Database::get_main_table(BuyCoursesPlugin::TABLE_CULQI),
Database::get_main_table(self::TABLE_CULQI),
['id = ?' => 1],
'first'
);
@ -2222,7 +2222,7 @@ class BuyCoursesPlugin extends Plugin
public function saveGlobalParameters($params)
{
return Database::update(
Database::get_main_table(BuyCoursesPlugin::TABLE_GLOBAL_CONFIG),
Database::get_main_table(self::TABLE_GLOBAL_CONFIG),
[
'terms_and_conditions' => $params['terms_and_conditions']
],
@ -2238,7 +2238,7 @@ class BuyCoursesPlugin extends Plugin
{
return Database::select(
'*',
Database::get_main_table(BuyCoursesPlugin::TABLE_GLOBAL_CONFIG),
Database::get_main_table(self::TABLE_GLOBAL_CONFIG),
['id = ?' => 1],
'first'
);

@ -90,8 +90,8 @@ class CourseRecycler
*/
public function recycle_documents()
{
$table = Database :: get_course_table(TABLE_DOCUMENT);
$tableItemProperty = Database :: get_course_table(TABLE_ITEM_PROPERTY);
$table = Database::get_course_table(TABLE_DOCUMENT);
$tableItemProperty = Database::get_course_table(TABLE_ITEM_PROPERTY);
if ($this->type === 'full_backup') {
$sql = "DELETE FROM $tableItemProperty
@ -172,7 +172,7 @@ class CourseRecycler
public function recycle_links()
{
if ($this->course->has_resources(RESOURCE_LINK)) {
$table = Database :: get_course_table(TABLE_LINK);
$table = Database::get_course_table(TABLE_LINK);
$ids = implode(',', array_filter(array_keys($this->course->resources[RESOURCE_LINK])));
if (!empty($ids)) {
$sql = "DELETE FROM $table
@ -187,10 +187,10 @@ class CourseRecycler
*/
public function recycle_forums()
{
$table_category = Database :: get_course_table(TABLE_FORUM_CATEGORY);
$table_forum = Database :: get_course_table(TABLE_FORUM);
$table_thread = Database :: get_course_table(TABLE_FORUM_THREAD);
$table_post = Database :: get_course_table(TABLE_FORUM_POST);
$table_category = Database::get_course_table(TABLE_FORUM_CATEGORY);
$table_forum = Database::get_course_table(TABLE_FORUM);
$table_thread = Database::get_course_table(TABLE_FORUM_THREAD);
$table_post = Database::get_course_table(TABLE_FORUM_POST);
$table_attachment = Database::get_course_table(TABLE_FORUM_ATTACHMENT);
$table_notification = Database::get_course_table(TABLE_FORUM_NOTIFICATION);
$table_mail_queue = Database::get_course_table(TABLE_FORUM_MAIL_QUEUE);
@ -305,8 +305,8 @@ class CourseRecycler
*/
public function recycle_forum_categories()
{
$table_forum = Database :: get_course_table(TABLE_FORUM);
$table_forumcat = Database :: get_course_table(TABLE_FORUM_CATEGORY);
$table_forum = Database::get_course_table(TABLE_FORUM);
$table_forumcat = Database::get_course_table(TABLE_FORUM_CATEGORY);
$sql = "SELECT fc.cat_id FROM ".$table_forumcat." fc
LEFT JOIN ".$table_forum." f
ON
@ -328,8 +328,8 @@ class CourseRecycler
*/
public function recycle_link_categories()
{
$link_cat_table = Database :: get_course_table(TABLE_LINK_CATEGORY);
$link_table = Database :: get_course_table(TABLE_LINK);
$link_cat_table = Database::get_course_table(TABLE_LINK_CATEGORY);
$link_table = Database::get_course_table(TABLE_LINK);
$sql = "SELECT lc.id FROM $link_cat_table lc
LEFT JOIN ".$link_table." l
ON
@ -351,8 +351,8 @@ class CourseRecycler
public function recycle_events()
{
if ($this->course->has_resources(RESOURCE_EVENT)) {
$table = Database :: get_course_table(TABLE_AGENDA);
$table_attachment = Database :: get_course_table(TABLE_AGENDA_ATTACHMENT);
$table = Database::get_course_table(TABLE_AGENDA);
$table_attachment = Database::get_course_table(TABLE_AGENDA_ATTACHMENT);
$ids = implode(',', array_filter(array_keys($this->course->resources[RESOURCE_EVENT])));
if (!empty($ids)) {
@ -373,8 +373,8 @@ class CourseRecycler
public function recycle_announcements()
{
if ($this->course->has_resources(RESOURCE_ANNOUNCEMENT)) {
$table = Database :: get_course_table(TABLE_ANNOUNCEMENT);
$table_attachment = Database :: get_course_table(TABLE_ANNOUNCEMENT_ATTACHMENT);
$table = Database::get_course_table(TABLE_ANNOUNCEMENT);
$table_attachment = Database::get_course_table(TABLE_ANNOUNCEMENT_ATTACHMENT);
$ids = implode(',', array_filter(array_keys($this->course->resources[RESOURCE_ANNOUNCEMENT])));
if (!empty($ids)) {
@ -397,13 +397,13 @@ class CourseRecycler
{
if ($this->course->has_resources(RESOURCE_QUIZ)) {
$table_qui_que = Database :: get_course_table(TABLE_QUIZ_QUESTION);
$table_qui_ans = Database :: get_course_table(TABLE_QUIZ_ANSWER);
$table_qui = Database :: get_course_table(TABLE_QUIZ_TEST);
$table_rel = Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION);
$table_qui_que_opt = Database :: get_course_table(TABLE_QUIZ_QUESTION_OPTION);
$table_qui_que_cat = Database :: get_course_table(TABLE_QUIZ_QUESTION_CATEGORY);
$table_qui_que_rel_cat = Database :: get_course_table(TABLE_QUIZ_QUESTION_REL_CATEGORY);
$table_qui_que = Database::get_course_table(TABLE_QUIZ_QUESTION);
$table_qui_ans = Database::get_course_table(TABLE_QUIZ_ANSWER);
$table_qui = Database::get_course_table(TABLE_QUIZ_TEST);
$table_rel = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);
$table_qui_que_opt = Database::get_course_table(TABLE_QUIZ_QUESTION_OPTION);
$table_qui_que_cat = Database::get_course_table(TABLE_QUIZ_QUESTION_CATEGORY);
$table_qui_que_rel_cat = Database::get_course_table(TABLE_QUIZ_QUESTION_REL_CATEGORY);
$ids = array_keys($this->course->resources[RESOURCE_QUIZ]);
// If the value "-1" is in the ids of elements (questions) to
@ -502,11 +502,11 @@ class CourseRecycler
public function recycle_surveys()
{
if ($this->course->has_resources(RESOURCE_SURVEY)) {
$table_survey = Database :: get_course_table(TABLE_SURVEY);
$table_survey_q = Database :: get_course_table(TABLE_SURVEY_QUESTION);
$table_survey_q_o = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION);
$table_survey_a = Database :: get_course_Table(TABLE_SURVEY_ANSWER);
$table_survey_i = Database :: get_course_table(TABLE_SURVEY_INVITATION);
$table_survey = Database::get_course_table(TABLE_SURVEY);
$table_survey_q = Database::get_course_table(TABLE_SURVEY_QUESTION);
$table_survey_q_o = Database::get_course_table(TABLE_SURVEY_QUESTION_OPTION);
$table_survey_a = Database::get_course_Table(TABLE_SURVEY_ANSWER);
$table_survey_i = Database::get_course_table(TABLE_SURVEY_INVITATION);
$sql = "DELETE FROM $table_survey_i
WHERE c_id = ".$this->course_id;
Database::query($sql);
@ -539,10 +539,10 @@ class CourseRecycler
public function recycle_learnpaths()
{
if ($this->course->has_resources(RESOURCE_LEARNPATH)) {
$table_main = Database :: get_course_table(TABLE_LP_MAIN);
$table_item = Database :: get_course_table(TABLE_LP_ITEM);
$table_view = Database :: get_course_table(TABLE_LP_VIEW);
$table_iv = Database :: get_course_table(TABLE_LP_ITEM_VIEW);
$table_main = Database::get_course_table(TABLE_LP_MAIN);
$table_item = Database::get_course_table(TABLE_LP_ITEM);
$table_view = Database::get_course_table(TABLE_LP_VIEW);
$table_iv = Database::get_course_table(TABLE_LP_ITEM_VIEW);
$table_iv_int = Database::get_course_table(TABLE_LP_IV_INTERACTION);
$table_tool = Database::get_course_table(TABLE_TOOL_LIST);
@ -606,7 +606,7 @@ class CourseRecycler
public function recycle_cours_description()
{
if ($this->course->has_resources(RESOURCE_COURSEDESCRIPTION)) {
$table = Database :: get_course_table(TABLE_COURSE_DESCRIPTION);
$table = Database::get_course_table(TABLE_COURSE_DESCRIPTION);
$ids = implode(',', array_filter(array_keys($this->course->resources[RESOURCE_COURSEDESCRIPTION])));
if (!empty($ids)) {
$sql = "DELETE FROM $table
@ -622,9 +622,9 @@ class CourseRecycler
public function recycle_thematic($session_id = 0)
{
if ($this->course->has_resources(RESOURCE_THEMATIC)) {
$table_thematic = Database :: get_course_table(TABLE_THEMATIC);
$table_thematic_advance = Database :: get_course_table(TABLE_THEMATIC_ADVANCE);
$table_thematic_plan = Database :: get_course_table(TABLE_THEMATIC_PLAN);
$table_thematic = Database::get_course_table(TABLE_THEMATIC);
$table_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE);
$table_thematic_plan = Database::get_course_table(TABLE_THEMATIC_PLAN);
$resources = $this->course->resources;
foreach ($resources[RESOURCE_THEMATIC] as $last_id => $thematic) {
@ -687,8 +687,8 @@ class CourseRecycler
public function recycle_attendance($session_id = 0)
{
if ($this->course->has_resources(RESOURCE_ATTENDANCE)) {
$table_attendance = Database :: get_course_table(TABLE_ATTENDANCE);
$table_attendance_calendar = Database :: get_course_table(TABLE_ATTENDANCE_CALENDAR);
$table_attendance = Database::get_course_table(TABLE_ATTENDANCE);
$table_attendance_calendar = Database::get_course_table(TABLE_ATTENDANCE_CALENDAR);
$resources = $this->course->resources;
foreach ($resources[RESOURCE_ATTENDANCE] as $last_id => $obj) {
@ -717,8 +717,8 @@ class CourseRecycler
public function recycle_work($session_id = 0)
{
if ($this->course->has_resources(RESOURCE_WORK)) {
$table_work = Database :: get_course_table(TABLE_STUDENT_PUBLICATION);
$table_work_assignment = Database :: get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT);
$table_work = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
$table_work_assignment = Database::get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT);
$resources = $this->course->resources;
foreach ($resources[RESOURCE_WORK] as $last_id => $obj) {

@ -277,7 +277,7 @@ class CourseRestorer
return;
}
$table = Database :: get_course_table(TABLE_DOCUMENT);
$table = Database::get_course_table(TABLE_DOCUMENT);
$resources = $this->course->resources;
$path = api_get_path(SYS_COURSE_PATH).$this->course->destination_path.'/';
@ -1092,7 +1092,7 @@ class CourseRestorer
*/
public function restore_forum_category($my_id = null, $sessionId = 0)
{
$forum_cat_table = Database :: get_course_table(TABLE_FORUM_CATEGORY);
$forum_cat_table = Database::get_course_table(TABLE_FORUM_CATEGORY);
$resources = $this->course->resources;
if (!empty($resources[RESOURCE_FORUMCATEGORY])) {
foreach ($resources[RESOURCE_FORUMCATEGORY] as $id => $forum_cat) {
@ -1139,7 +1139,7 @@ class CourseRestorer
*/
public function restore_topic($thread_id, $forum_id, $sessionId = 0)
{
$table = Database :: get_course_table(TABLE_FORUM_THREAD);
$table = Database::get_course_table(TABLE_FORUM_THREAD);
$topic = $this->course->resources[RESOURCE_FORUMTOPIC][$thread_id];
$params = (array)$topic->obj;
@ -1196,7 +1196,7 @@ class CourseRestorer
*/
public function restore_post($id, $topic_id, $forum_id, $sessionId = 0)
{
$table_post = Database :: get_course_table(TABLE_FORUM_POST);
$table_post = Database::get_course_table(TABLE_FORUM_POST);
$post = $this->course->resources[RESOURCE_FORUMPOST][$id];
$params = (array) $post->obj;
$params['c_id'] = $this->destination_course_id;
@ -1244,7 +1244,7 @@ class CourseRestorer
public function restore_links($session_id = 0)
{
if ($this->course->has_resources(RESOURCE_LINK)) {
$link_table = Database :: get_course_table(TABLE_LINK);
$link_table = Database::get_course_table(TABLE_LINK);
$resources = $this->course->resources;
foreach ($resources[RESOURCE_LINK] as $id => $link) {
@ -1309,7 +1309,7 @@ class CourseRestorer
if ($id == 0) {
return 0;
}
$link_cat_table = Database :: get_course_table(TABLE_LINK_CATEGORY);
$link_cat_table = Database::get_course_table(TABLE_LINK_CATEGORY);
$resources = $this->course->resources;
$link_cat = $resources[RESOURCE_LINKCATEGORY][$id];
if (is_object($link_cat) && !$link_cat->is_restored()) {
@ -1345,7 +1345,7 @@ class CourseRestorer
{
if ($this->course->has_resources(RESOURCE_TOOL_INTRO)) {
$sessionId = intval($sessionId);
$tool_intro_table = Database :: get_course_table(TABLE_TOOL_INTRO);
$tool_intro_table = Database::get_course_table(TABLE_TOOL_INTRO);
$resources = $this->course->resources;
foreach ($resources[RESOURCE_TOOL_INTRO] as $id => $tool_intro) {
$sql = "DELETE FROM $tool_intro_table
@ -1388,7 +1388,7 @@ class CourseRestorer
{
if ($this->course->has_resources(RESOURCE_EVENT)) {
$sessionId = intval($sessionId);
$table = Database :: get_course_table(TABLE_AGENDA);
$table = Database::get_course_table(TABLE_AGENDA);
$resources = $this->course->resources;
foreach ($resources[RESOURCE_EVENT] as $id => $event) {
// check resources inside html from ckeditor tool and copy correct urls into recipient course
@ -1427,7 +1427,7 @@ class CourseRestorer
if (!empty($this->course->orig)) {
$table_attachment = Database :: get_course_table(TABLE_AGENDA_ATTACHMENT);
$table_attachment = Database::get_course_table(TABLE_AGENDA_ATTACHMENT);
$sql = 'SELECT path, comment, size, filename
FROM '.$table_attachment.'
WHERE c_id = '.$this->destination_course_id.' AND agenda_id = '.$id;
@ -1444,7 +1444,7 @@ class CourseRestorer
);
//$copy_result = true;
if ($copy_result) {
$table_attachment = Database :: get_course_table(TABLE_AGENDA_ATTACHMENT);
$table_attachment = Database::get_course_table(TABLE_AGENDA_ATTACHMENT);
$params = [
'c_id' => $this->destination_course_id,
@ -1473,7 +1473,7 @@ class CourseRestorer
$destination_path.$new_filename
);
if ($copy_result) {
$table_attachment = Database :: get_course_table(TABLE_AGENDA_ATTACHMENT);
$table_attachment = Database::get_course_table(TABLE_AGENDA_ATTACHMENT);
$params = [
'c_id' => $this->destination_course_id,
@ -1502,7 +1502,7 @@ class CourseRestorer
public function restore_course_descriptions($session_id = 0)
{
if ($this->course->has_resources(RESOURCE_COURSEDESCRIPTION)) {
$table = Database :: get_course_table(TABLE_COURSE_DESCRIPTION);
$table = Database::get_course_table(TABLE_COURSE_DESCRIPTION);
$resources = $this->course->resources;
foreach ($resources[RESOURCE_COURSEDESCRIPTION] as $id => $cd) {
$courseDescription = (array) $cd;
@ -1551,7 +1551,7 @@ class CourseRestorer
{
if ($this->course->has_resources(RESOURCE_ANNOUNCEMENT)) {
$sessionId = intval($sessionId);
$table = Database :: get_course_table(TABLE_ANNOUNCEMENT);
$table = Database::get_course_table(TABLE_ANNOUNCEMENT);
$resources = $this->course->resources;
foreach ($resources[RESOURCE_ANNOUNCEMENT] as $id => $announcement) {
@ -1611,7 +1611,7 @@ class CourseRestorer
);
if ($copy_result) {
$table_attachment = Database :: get_course_table(TABLE_ANNOUNCEMENT_ATTACHMENT);
$table_attachment = Database::get_course_table(TABLE_ANNOUNCEMENT_ATTACHMENT);
$params = [
'c_id' => $this->destination_course_id,
@ -1640,7 +1640,7 @@ class CourseRestorer
$copy_result = copy($origin_path.$announcement->attachment_path, $destination_path.$new_filename);
if ($copy_result) {
$table_attachment = Database :: get_course_table(TABLE_ANNOUNCEMENT_ATTACHMENT);
$table_attachment = Database::get_course_table(TABLE_ANNOUNCEMENT_ATTACHMENT);
$params = [
'c_id' => $this->destination_course_id,
@ -1674,9 +1674,9 @@ class CourseRestorer
$respect_base_content = false
) {
if ($this->course->has_resources(RESOURCE_QUIZ)) {
$table_qui = Database :: get_course_table(TABLE_QUIZ_TEST);
$table_rel = Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION);
$table_doc = Database :: get_course_table(TABLE_DOCUMENT);
$table_qui = Database::get_course_table(TABLE_QUIZ_TEST);
$table_rel = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);
$table_doc = Database::get_course_table(TABLE_DOCUMENT);
$resources = $this->course->resources;
foreach ($resources[RESOURCE_QUIZ] as $id => $quiz) {
@ -2180,9 +2180,9 @@ class CourseRestorer
$sessionId = intval($sessionId);
if ($this->course->has_resources(RESOURCE_SURVEY)) {
$table_sur = Database :: get_course_table(TABLE_SURVEY);
$table_que = Database :: get_course_table(TABLE_SURVEY_QUESTION);
$table_ans = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION);
$table_sur = Database::get_course_table(TABLE_SURVEY);
$table_que = Database::get_course_table(TABLE_SURVEY_QUESTION);
$table_ans = Database::get_course_table(TABLE_SURVEY_QUESTION_OPTION);
$resources = $this->course->resources;
foreach ($resources[RESOURCE_SURVEY] as $id => $survey) {
@ -2296,7 +2296,7 @@ class CourseRestorer
if (isset($survey_data['survey_share']) && is_numeric($survey_data['survey_share'])) {
SurveyManager::delete_survey($survey_data['survey_share'], true,$this->destination_course_id);
}
SurveyManager :: delete_survey($survey_data['survey_id'],false,$this->destination_course_id);
SurveyManager::delete_survey($survey_data['survey_id'],false,$this->destination_course_id);
// Insert the new source survey
$new_id = Database::insert($table_sur, $params);
@ -2356,7 +2356,7 @@ class CourseRestorer
*/
public function is_survey_code_available($survey_code)
{
$table_sur = Database :: get_course_table(TABLE_SURVEY);
$table_sur = Database::get_course_table(TABLE_SURVEY);
$sql = "SELECT * FROM $table_sur
WHERE
c_id = ".$this->destination_course_id." AND
@ -2383,8 +2383,8 @@ class CourseRestorer
if ($question->is_restored()) {
return $question->destination_id;
}
$table_que = Database :: get_course_table(TABLE_SURVEY_QUESTION);
$table_ans = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION);
$table_que = Database::get_course_table(TABLE_SURVEY_QUESTION);
$table_ans = Database::get_course_table(TABLE_SURVEY_QUESTION_OPTION);
// check resources inside html from ckeditor tool and copy correct urls into recipient course
$question->survey_question = DocumentManager::replace_urls_inside_content_html_from_copy_course(
@ -2906,7 +2906,7 @@ class CourseRestorer
public function restore_glossary($session_id = 0)
{
if ($this->course->has_resources(RESOURCE_GLOSSARY)) {
$table_glossary = Database :: get_course_table(TABLE_GLOSSARY);
$table_glossary = Database::get_course_table(TABLE_GLOSSARY);
$resources = $this->course->resources;
foreach ($resources[RESOURCE_GLOSSARY] as $id => $glossary) {
@ -2961,8 +2961,8 @@ class CourseRestorer
{
if ($this->course->has_resources(RESOURCE_WIKI)) {
// wiki table of the target course
$table_wiki = Database :: get_course_table(TABLE_WIKI);
$table_wiki_conf = Database :: get_course_table(TABLE_WIKI_CONF);
$table_wiki = Database::get_course_table(TABLE_WIKI);
$table_wiki_conf = Database::get_course_table(TABLE_WIKI_CONF);
// storing all the resources that have to be copied in an array
$resources = $this->course->resources;
@ -3141,8 +3141,8 @@ class CourseRestorer
public function restore_attendance($session_id = 0)
{
if ($this->course->has_resources(RESOURCE_ATTENDANCE)) {
$table_attendance = Database :: get_course_table(TABLE_ATTENDANCE);
$table_attendance_calendar = Database :: get_course_table(TABLE_ATTENDANCE_CALENDAR);
$table_attendance = Database::get_course_table(TABLE_ATTENDANCE);
$table_attendance_calendar = Database::get_course_table(TABLE_ATTENDANCE_CALENDAR);
$resources = $this->course->resources;
foreach ($resources[RESOURCE_ATTENDANCE] as $id => $obj) {
@ -3203,7 +3203,7 @@ class CourseRestorer
{
require_once api_get_path(SYS_CODE_PATH).'work/work.lib.php';
if ($this->course->has_resources(RESOURCE_WORK)) {
$table_work_assignment = Database :: get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT);
$table_work_assignment = Database::get_course_table(TABLE_STUDENT_PUBLICATION_ASSIGNMENT);
$resources = $this->course->resources;
foreach ($resources[RESOURCE_WORK] as $obj) {

Loading…
Cancel
Save