Minor - partial update from 1.11.x

pull/3063/head
Julio 7 years ago
parent df90787f8e
commit c921b68523
  1. 2
      main/attendance/attendance_sheet.php
  2. 4
      main/auth/courses_categories.php
  3. 2
      main/badge/assign.php
  4. 2
      main/course_home/course_home.php
  5. 5
      main/course_info/about.php
  6. 1
      main/course_info/infocours.php
  7. 2
      main/course_progress/index.php
  8. 2
      main/document/create_audio.php
  9. 3
      main/document/downloadfolder.inc.php
  10. 10
      main/exercise/export/aiken/aiken_import.inc.php
  11. 2
      main/exercise/export/scorm/ScormQuestion.php
  12. 2
      main/forum/editpost.php
  13. 2
      main/forum/editthread.php
  14. 2
      main/forum/forumqualify.php
  15. 2
      main/forum/index.php
  16. 2
      main/forum/newthread.php
  17. 2
      main/forum/reply.php
  18. 2
      main/forum/viewforumcategory.php
  19. 5
      main/glossary/glossary.js.php
  20. 2
      main/glossary/index.php
  21. 2
      main/group/group.php
  22. 2
      main/group/group_category.php
  23. 2
      main/group/member_settings.php
  24. 2
      main/group/tutor_settings.php
  25. 4
      main/inc/ajax/lang.ajax.php
  26. 191
      main/inc/ajax/session.ajax.php
  27. 2
      main/inc/lib/AnnouncementManager.php
  28. 2
      main/inc/lib/CourseChatUtils.php
  29. 47
      main/inc/lib/CoursesAndSessionsCatalog.class.php
  30. 2
      main/inc/lib/api.lib.php
  31. 66
      main/inc/lib/course.lib.php
  32. 2
      main/inc/lib/course_category.lib.php
  33. 38
      main/inc/lib/course_description.lib.php
  34. 11
      main/inc/lib/elfinder/connectorAction.php
  35. 19
      main/inc/lib/notification.lib.php
  36. 117
      main/inc/lib/social.lib.php
  37. 2
      main/inc/lib/statistics.lib.php
  38. 2
      main/link/link.php
  39. 2
      main/lp/lp_add_item.php
  40. 2
      main/lp/lp_controller.php
  41. 15
      main/lp/lp_edit.php
  42. 4
      main/lp/lp_edit_item.php
  43. 4
      main/lp/lp_view.php
  44. 4
      main/lp/scorm_api.php
  45. 2
      main/mySpace/exercise_category_report.php
  46. 4
      main/mySpace/slider.js
  47. 2
      main/notebook/index.php
  48. 2
      main/session/session_add.php
  49. 2
      main/session/session_edit.php
  50. 2
      main/social/group_topics.php
  51. 2
      main/social/myfiles.php
  52. 3
      main/social/profile.php
  53. 2
      main/survey/fillsurvey.php
  54. 2
      main/survey/question.php
  55. 4
      main/survey/survey_list.php
  56. 2
      main/template/default/agenda/planification.tpl
  57. 2
      main/ticket/new_ticket.php
  58. 2
      main/ticket/report.php
  59. 2
      main/ticket/ticket_details.php
  60. 2
      main/ticket/tickets.php
  61. 2
      main/ticket/tutor.php
  62. 2
      main/timeline/view.php
  63. 2
      main/tracking/courseLog.php
  64. 2
      main/user/class.php
  65. 2
      main/wiki/index.php
  66. 2
      main/work/view.php
  67. 2
      main/work/work.lib.php

@ -182,7 +182,7 @@ if (api_is_allowed_to_edit(null, true) ||
});
}
$(document).ready(function() {
$(function() {
$("table.tableWithFloatingHeader").each(function() {
$(this).wrap("<div class=\"divTableWithFloatingHeader\" style=\"position:relative\"></div>");

@ -36,7 +36,7 @@ $code = isset($code) ? $code : null;
?>
<script>
$(document).ready( function() {
$(function() {
$('.star-rating li a').on('click', function(event) {
var id = $(this).parents('ul').attr('id');
$('#vote_label2_' + id).html("<?php echo get_lang('Loading'); ?>");
@ -300,7 +300,7 @@ function getOptionSelect($categories, $codeType)
continue;
}
if ($level > 0) {
$separate = str_repeat("--", $level);
$separate = str_repeat('--', $level);
} else {
$separate = '';
}

@ -418,7 +418,7 @@ if ($disableList) {
}
$htmlHeadXtra[] = '<script>
$(document).ready(function() {
$(function() {
$("#skill").on("change", function() {
$(location).attr("href", "'.$url.'&id="+$(this).val());
});

@ -34,7 +34,7 @@ require_once __DIR__.'/../inc/global.inc.php';
$htmlHeadXtra[] = '<script>
/* option show/hide thematic-block */
$(document).ready(function(){
$(function() {
$("#thematic-show").click(function(){
$(".btn-hide-thematic").hide();
$(".btn-show-thematic").show(); //show using class

@ -19,6 +19,11 @@ $cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
$courseId = isset($_GET['course_id']) ? (int) $_GET['course_id'] : 0;
if (empty($courseId)) {
api_not_allowed(true);
}
$token = Security::get_existing_token();
$em = Database::getManager();
//userID

@ -746,7 +746,6 @@ $form->addHtml('
');
if (api_get_configuration_value('allow_exercise_auto_launch')) {
// Auto launch exercise
$group = [];
$group[] = $form->createElement(

@ -89,7 +89,7 @@ $default_thematic_plan_title = $thematic->get_default_thematic_plan_title();
// Only when I see the 3 columns. Avoids double or triple click binding for onclick event
$htmlHeadXtra[] = '<script>
$(document).ready(function() {
$(function() {
$(".thematic_advance_actions, .thematic_tools ").hide();
$(".thematic_content").mouseover(function() {
var id = parseInt(this.id.split("_")[3]);

@ -162,7 +162,7 @@ echo '</div>';
<!-- javascript and styles for textareaCounter-->
<script>
var info;
$(document).ready(function () {
$(function() {
var options = {
'maxCharacterSize': 100,
'originalStyle': 'originalTextareaInfo',

@ -175,8 +175,6 @@ if (api_is_allowed_to_edit()) {
}
}
}
//error_log($sysCoursePath.$courseInfo['path'].'/document'.$not_deleted_file['path']);
//error_log($sysCoursePath.$courseInfo['path'].'/document'.$remove_dir);
$zip->add(
$sysCoursePath.$courseInfo['path'].'/document'.$not_deleted_file['path'],
PCLZIP_OPT_REMOVE_PATH,
@ -189,7 +187,6 @@ if (api_is_allowed_to_edit()) {
Session::erase('doc_files_to_download');
} else {
// For other users, we need to create a zip file with only visible files and folders
if ($path == '/') {
$querypath = ''; // To prevent ...path LIKE '//%'... in query
} else {

@ -338,15 +338,7 @@ function aiken_parse_file(&$exercise_info, $exercisePath, $file, $questionFile)
$new_question = true;
} else {
if (empty($exercise_info['question'][$question_index]['title'])) {
if (strlen($info) < 100) {
$exercise_info['question'][$question_index]['title'] = $info;
} else {
//Question itself (use a 100-chars long title and a larger description)
$exercise_info['question'][$question_index]['title'] = trim(substr($info, 0, 100)).'...';
//$exercise_info['question'][$question_index]['description'] = $info;
}
} else {
//$exercise_info['question'][$question_index]['description'] = $info;
$exercise_info['question'][$question_index]['title'] = $info;
}
}
}

@ -196,7 +196,7 @@ class ScormQuestion extends Question
$weight = $this->selectWeighting();
$js = '
questions.push('.$this->js_id.');
$(document).ready(function() {
$(function() {
if (exerciseInfo.randomAnswers == true) {
$("#question_'.$this->js_id.'").shuffleRows();
}

@ -110,7 +110,7 @@ $table_link = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
/* Header */
$htmlHeadXtra[] = <<<JS
<script>
$(document).on('ready', function() {
$(function() {
$('#reply-add-attachment').on('click', function(e) {
e.preventDefault();

@ -123,7 +123,7 @@ $tableLink = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
/* Header */
$htmlHeadXtra[] = <<<JS
<script>
$(document).on('ready', function() {
$(function() {
$('[name="thread_qualify_gradebook"]:checkbox').change(function () {
if (this.checked) {
$('#options_field').show();

@ -77,7 +77,7 @@ if (isset($_POST['idtextqualify'])) {
/* Including necessary files */
$htmlHeadXtra[] = '<script>
$(document).ready(function(){
$(function() {
$(\'.hide-me\').slideUp()
});

@ -30,7 +30,7 @@ api_protect_course_script(true);
$current_course_tool = TOOL_FORUM;
$htmlHeadXtra[] = '<script>
$(document).ready(function() {
$(function() {
$(\'.hide-me\').slideUp();
});

@ -138,7 +138,7 @@ if (!empty($groupId)) {
$htmlHeadXtra[] = "
<script>
$(document).on('ready', function() {
$(function() {
$('#reply-add-attachment').on('click', function(e) {
e.preventDefault();

@ -132,7 +132,7 @@ if (!empty($groupId)) {
/* Header */
$htmlHeadXtra[] = <<<JS
<script>
$(document).on('ready', function() {
$(function() {
$('#reply-add-attachment').on('click', function(e) {
e.preventDefault();

@ -32,7 +32,7 @@ Session::erase('_gid');
api_protect_course_script(true);
$htmlHeadXtra[] = '<script>
$(document).ready(function(){
$(function() {
$(\'.hide-me\').slideUp()
});

@ -3,9 +3,11 @@
require_once __DIR__.'/../inc/global.inc.php';
header('Content-type: application/x-javascript');
$origin = api_get_origin();
$tpl = new Template();
$tpl = new Template('', false, false, false, true, false, false);
$glossaryExtraTools = api_get_setting('show_glossary_in_extra_tools');
@ -24,6 +26,5 @@ if ($showGlossary) {
$addReady = isset($_GET['add_ready']) ? true : false;
$tpl->assign('add_ready', $addReady);
$contentTemplate = $tpl->get_template($templateName);
header('Content-type: application/x-javascript');
$tpl->display($contentTemplate);
}

@ -26,7 +26,7 @@ function setFocus(){
$("#glossary_title").focus();
}
$(document).ready(function () {
$(function() {
setFocus();
$( "#dialog:ui-dialog" ).dialog( "destroy" );
$( "#dialog-confirm" ).dialog({

@ -30,7 +30,7 @@ $sessionId = api_get_session_id();
api_protect_course_script(true);
$htmlHeadXtra[] = '<script>
$(document).ready( function() {
$(function() {
var i;
for (i=0; i<$(".actions").length; i++) {
if ($(".actions:eq("+i+")").html()=="<table border=\"0\"></table>" || $(".actions:eq("+i+")").html()=="" || $(".actions:eq("+i+")").html()==null) {

@ -84,7 +84,7 @@ if (isset($_GET['id'])) {
}
$htmlHeadXtra[] = '<script>
$(document).ready( function() {
$(function() {
$("#max_member").on("focus", function() {
$("#max_member_selected").attr("checked", true);
});

@ -115,7 +115,7 @@ function check_group_members($value)
}
$htmlHeadXtra[] = '<script>
$(document).ready( function() {
$(function() {
$("#max_member").on("focus", function() {
$("#max_member_selected").attr("checked", true);
});

@ -99,7 +99,7 @@ function sort_users($user_a, $user_b)
}
$htmlHeadXtra[] = '<script>
$(document).ready( function() {
$(function() {
$("#max_member").on("focus", function() {
$("#max_member_selected").attr("checked", true);
});

@ -12,6 +12,8 @@ $action = $_REQUEST['a'];
switch ($action) {
case 'translate_html':
header('Content-type: application/x-javascript');
$translate = api_get_configuration_value('translate_html');
if (!$translate) {
@ -33,7 +35,7 @@ switch ($action) {
$languageInfo = api_get_language_info($languageId);
echo '
$(document).ready(function() {
$(function() {
'.$hideAll.'
var defaultLanguageFromUser = "'.$languageInfo['isocode'].'";
$("span:lang('.$languageInfo['isocode'].')").filter(

@ -243,6 +243,197 @@ switch ($action) {
echo json_encode($courseListToSelect);
break;
case 'get_basic_course_documents_list':
case 'get_basic_course_documents_form':
$courseId = isset($_GET['course']) ? (int) $_GET['course'] : 0;
$sessionId = isset($_GET['session']) ? (int) $_GET['session'] : 0;
$currentUserId = api_get_user_id();
$em = Database::getManager();
$course = $em->find('ChamiloCoreBundle:Course', $courseId);
$session = $em->find('ChamiloCoreBundle:Session', $sessionId);
if (!$course || !$session) {
break;
}
if (!api_is_platform_admin(true) || $session->getSessionAdminId() != $currentUserId) {
break;
}
$folderName = '/basic-course-documents__'.$session->getId().'__0';
if ('get_basic_course_documents_list' === $action) {
$courseInfo = api_get_course_info_by_id($course->getId());
$exists = DocumentManager::folderExists('/basic-course-documents', $courseInfo, $session->getId(), 0);
if (!$exists) {
$courseDir = $courseInfo['directory'].'/document';
$sysCoursePath = api_get_path(SYS_COURSE_PATH);
$baseWorkDir = $sysCoursePath.$courseDir;
$newFolderData = create_unexisting_directory(
$courseInfo,
$currentUserId,
$session->getId(),
0,
0,
$baseWorkDir,
'/basic-course-documents',
get_lang('BasicCourseDocuments'),
1
);
$id = (int) $newFolderData['iid'];
} else {
$id = DocumentManager::get_document_id($courseInfo, $folderName, $session->getId());
}
$http_www = api_get_path(WEB_COURSE_PATH).$courseInfo['directory'].'/document';
$documentAndFolders = DocumentManager::getAllDocumentData(
$courseInfo,
$folderName,
0,
0,
false,
false,
$session->getId()
);
$documentAndFolders = array_filter(
$documentAndFolders,
function (array $documentData) {
return $documentData['filetype'] != 'folder';
}
);
$documentAndFolders = array_map(
function (array $documentData) use ($course, $session, $courseInfo, $currentUserId, $http_www, $folderName, $id) {
$downloadUrl = api_get_path(WEB_CODE_PATH).'document/document.php?'
.api_get_cidreq_params($course->getCode(), $session->getId()).'&'
.http_build_query(['action' => 'download', 'id' => $documentData['id']]);
$deleteUrl = api_get_path(WEB_AJAX_PATH).'session.ajax.php?'
.http_build_query(
[
'a' => 'delete_basic_course_documents',
'deleteid' => $documentData['id'],
'curdirpath' => $folderName,
'course' => $course->getId(),
'session' => $session->getId(),
]
);
$row = [];
$row[] = DocumentManager::build_document_icon_tag($documentData['filetype'], $documentData['path']);
$row[] = Display::url($documentData['title'], $downloadUrl);
$row[] = format_file_size($documentData['size']);
$row[] = date_to_str_ago($documentData['lastedit_date']).PHP_EOL
.'<div class="muted"><small>'
.api_get_local_time($documentData['lastedit_date'])
."</small></div>";
$row[] = Display::url(
Display::return_icon('save.png', get_lang('Download')),
$downloadUrl
)
.PHP_EOL
.Display::url(
Display::return_icon('delete.png', get_lang('Delete')),
$deleteUrl,
[
'class' => 'delete_document',
'data-course' => $course->getId(),
'data-session' => $session->getId(),
]
);
return $row;
},
$documentAndFolders
);
$table = new SortableTableFromArray($documentAndFolders, 1, count($documentAndFolders));
$table->set_header(0, get_lang('Type'), false, [], ['class' => 'text-center', 'width' => '60px']);
$table->set_header(1, get_lang('Name'), false);
$table->set_header(2, get_lang('Size'), false, [], ['class' => 'text-right', 'style' => 'width: 80px;']);
$table->set_header(3, get_lang('Date'), false, [], ['class' => 'text-center', 'style' => 'width: 200px;']);
$table->set_header(4, get_lang('Actions'), false, [], ['class' => 'text-center']);
$table->display();
}
if ('get_basic_course_documents_form' === $action) {
$form = new FormValidator('get_basic_course_documents_form_'.$session->getId());
$form->addMultipleUpload(
api_get_path(WEB_AJAX_PATH).'document.ajax.php?'
.api_get_cidreq_params($course->getCode(), $session->getId())
.'&a=upload_file&curdirpath='.$folderName,
''
);
$form->display();
}
break;
case 'delete_basic_course_documents':
$curdirpath = isset($_GET['curdirpath']) ? Security::remove_XSS($_GET['curdirpath']) : null;
$docId = isset($_GET['deleteid']) ? (int) $_GET['deleteid'] : 0;
$courseId = isset($_GET['course']) ? (int) $_GET['course'] : 0;
$sessionId = isset($_GET['session']) ? (int) $_GET['session'] : 0;
if (empty($curdirpath) || empty($docId) || empty($courseId) || empty($sessionId)) {
break;
}
$em = Database::getManager();
$courseInfo = api_get_course_info_by_id($courseId);
$session = $em->find('ChamiloCoreBundle:Session', $sessionId);
$currentUserId = api_get_user_id();
if (empty($courseInfo) || !$session) {
break;
}
if (!api_is_platform_admin(true) || $session->getSessionAdminId() != $currentUserId) {
break;
}
$sysCoursePath = api_get_path(SYS_COURSE_PATH);
$courseDir = $courseInfo['directory'].'/document';
$baseWorkDir = $sysCoursePath.$courseDir;
$documentInfo = DocumentManager::get_document_data_by_id(
$docId,
$courseInfo['code'],
false,
$session->getId()
);
if (empty($documentInfo)) {
break;
}
if ($documentInfo['filetype'] != 'link') {
$deletedDocument = DocumentManager::delete_document(
$courseInfo,
null,
$baseWorkDir,
$session->getId(),
$docId
);
} else {
$deletedDocument = DocumentManager::deleteCloudLink(
$courseInfo,
$docId
);
}
if (!$deletedDocument) {
break;
}
echo true;
break;
default:
echo '';
}

@ -1337,7 +1337,7 @@ class AnnouncementManager
public static function get_attachment($announcementId)
{
$table = Database::get_course_table(TABLE_ANNOUNCEMENT_ATTACHMENT);
$announcementId = intval($announcementId);
$announcementId = (int) $announcementId;
$courseId = api_get_course_int_id();
$row = [];
$sql = 'SELECT id, path, filename, comment

@ -90,6 +90,8 @@ class CourseChatUtils
if (empty($message)) {
return false;
}
$friendId = (int) $friendId;
$user = api_get_user_entity($this->userId);
$courseInfo = api_get_course_info_by_id($this->courseId);
$isMaster = api_is_course_admin();

@ -497,30 +497,37 @@ class CoursesAndSessionsCatalog
$urlCondition = ' (access_url_id = '.$urlId.' OR access_url_id = 1) AND ';
}
$sql = "SELECT *
FROM $courseTable as course
INNER JOIN $tbl_url_rel_course as url_rel_course
ON (url_rel_course.c_id = course.id)
WHERE
access_url_id = $urlId AND
(
code LIKE '%".$search_term_safe."%' OR
title LIKE '%".$search_term_safe."%' OR
tutor_name LIKE '%".$search_term_safe."%'
)
$avoidCoursesCondition
$visibilityCondition
ORDER BY title, visual_code ASC
$limitFilter
";
$sql = "SELECT course.*
FROM $courseTable as course
INNER JOIN $tbl_url_rel_course as url_rel_course
ON (url_rel_course.c_id = course.id)
WHERE
access_url_id = $urlId AND
(
code LIKE '%".$search_term_safe."%' OR
title LIKE '%".$search_term_safe."%' OR
tutor_name LIKE '%".$search_term_safe."%'
)
$avoidCoursesCondition
$visibilityCondition
ORDER BY title, visual_code ASC
$limitFilter
";
}
}
$result_find = Database::query($sql);
$courses = [];
while ($row = Database::fetch_array($result_find)) {
$row['registration_code'] = !empty($row['registration_code']);
$count_users = count(CourseManager::get_user_list_from_course_code($row['code']));
$count_connections_last_month = Tracking::get_course_connections_count(
$countUsers = CourseManager::get_user_list_from_course_code(
$row['code'],
0,
null,
null,
null,
true
);
$connectionsLastMonth = Tracking::get_course_connections_count(
$row['id'],
0,
api_get_utc_datetime(time() - (30 * 86400))
@ -541,8 +548,8 @@ class CoursesAndSessionsCatalog
'registration_code' => $row['registration_code'],
'creation_date' => $row['creation_date'],
'visibility' => $row['visibility'],
'count_users' => $count_users,
'count_connections' => $count_connections_last_month,
'count_users' => $countUsers,
'count_connections' => $connectionsLastMonth,
];
}

@ -8090,7 +8090,7 @@ function api_get_password_checker_js($usernameInputId, $passwordInputId)
same_as_username : \"".get_lang('YourPasswordCannotBeTheSameAsYourUsername')."\"
};
$(document).ready(function() {
$(function() {
var lang = ".json_encode($translations).";
var options = {
onLoad : function () {

@ -1071,11 +1071,10 @@ class CourseManager
$session_id = 0
) {
$user_id = (int) $user_id;
$session_id = (int) $session_id;
if (empty($session_id)) {
$session_id = api_get_session_id();
} else {
$session_id = (int) $session_id;
}
$condition_course = '';
@ -1085,7 +1084,7 @@ class CourseManager
return false;
}
$courseId = $courseInfo['real_id'];
$condition_course = ' AND c_id = '.$courseId;
$condition_course = " AND c_id = $courseId";
}
$sql = "SELECT * FROM ".Database::get_main_table(TABLE_MAIN_COURSE_USER)."
@ -1107,22 +1106,22 @@ class CourseManager
}
$tableSessionCourseUser = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$sql = 'SELECT 1 FROM '.$tableSessionCourseUser.'
WHERE user_id = '.$user_id.' AND session_id = '.$session_id.' '.$condition_course;
$sql = "SELECT 1 FROM $tableSessionCourseUser
WHERE user_id = $user_id AND session_id = $session_id $condition_course";
if (Database::num_rows(Database::query($sql)) > 0) {
return true;
}
$sql = 'SELECT 1 FROM '.$tableSessionCourseUser.'
WHERE user_id = '.$user_id.' AND session_id = '.$session_id.' AND status = 2 '.$condition_course;
$sql = "SELECT 1 FROM $tableSessionCourseUser
WHERE user_id = $user_id AND session_id = $session_id AND status = 2 $condition_course";
if (Database::num_rows(Database::query($sql)) > 0) {
return true;
}
$sql = 'SELECT 1 FROM '.Database::get_main_table(TABLE_MAIN_SESSION).
' WHERE id = '.$session_id.' AND id_coach='.$user_id;
" WHERE id = $session_id AND id_coach = $user_id";
if (Database::num_rows(Database::query($sql)) > 0) {
return true;
@ -1293,7 +1292,7 @@ class CourseManager
// we have to check if it is a valid field that can be sorted on
if (!strstr($order_by, 'ORDER BY')) {
if (!empty($order_by)) {
$order_by = 'ORDER BY '.$order_by;
$order_by = "ORDER BY $order_by";
} else {
$order_by = '';
}
@ -1326,7 +1325,7 @@ class CourseManager
if (!empty($courseCodeList)) {
$courseCodeListForSession = array_map(['Database', 'escape_string'], $courseCodeList);
$courseCodeListForSession = implode('","', $courseCodeListForSession);
$courseCondition = ' course.code IN ("'.$courseCodeListForSession.'") ';
$courseCondition = " course.code IN ('$courseCodeListForSession') ";
}
$sql .= ' FROM '.Database::get_main_table(TABLE_MAIN_USER).' as user ';
@ -1381,7 +1380,7 @@ class CourseManager
ON course_rel_user.c_id = course.id ";
if (!empty($course_code)) {
$sql .= ' AND course_rel_user.c_id = "'.$courseId.'"';
$sql .= " AND course_rel_user.c_id = $courseId";
}
$where[] = ' course_rel_user.c_id IS NOT NULL ';
@ -1403,17 +1402,17 @@ class CourseManager
$extraFieldInfo = UserManager::get_extra_field_information_by_name($extraField);
if (!empty($extraFieldInfo)) {
$fieldValuesTable = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES);
$sql .= ' LEFT JOIN '.$fieldValuesTable.' as ufv
$sql .= " LEFT JOIN $fieldValuesTable as ufv
ON (
user.id = ufv.item_id AND
(field_id = '.$extraFieldInfo['id'].' OR field_id IS NULL)
)';
(field_id = ".$extraFieldInfo['id']." OR field_id IS NULL)
)";
$extraFieldWasAdded = true;
}
}
}
$sql .= ' WHERE '.$filter_by_status_condition.' '.implode(' OR ', $where);
$sql .= " WHERE $filter_by_status_condition ".implode(' OR ', $where);
if ($multiple_access_url) {
$current_access_url_id = api_get_current_access_url_id();
@ -1440,7 +1439,7 @@ class CourseManager
if (isset($filterByActive)) {
$filterByActive = (int) $filterByActive;
$sql .= ' AND user.active = '.$filterByActive;
$sql .= " AND user.active = $filterByActive";
}
if (!empty($searchByKeyword)) {
@ -1452,7 +1451,7 @@ class CourseManager
) ";
}
$sql .= ' '.$order_by.' '.$limit;
$sql .= " $order_by $limit";
$rs = Database::query($sql);
$users = [];
@ -1679,7 +1678,7 @@ class CourseManager
$status = null
) {
// variable initialisation
$session_id = intval($session_id);
$session_id = (int) $session_id;
$course_code = Database::escape_string($course_code);
$tblUser = Database::get_main_table(TABLE_MAIN_USER);
$tblSessionCourseUser = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
@ -1755,12 +1754,12 @@ class CourseManager
$course_code = Database::escape_string($course_code);
$courseInfo = api_get_course_info($course_code);
$courseId = $courseInfo['real_id'];
$session_id = intval($session_id);
$session_id = (int) $session_id;
$users = [];
// We get the coach for the given course in a given session.
$sql = 'SELECT user_id FROM '.Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER).
' WHERE session_id = '.$session_id.' AND c_id = '.$courseId.' AND status = 2';
" WHERE session_id = $session_id AND c_id = $courseId AND status = 2";
$rs = Database::query($sql);
while ($user = Database::fetch_array($rs)) {
$userInfo = api_get_user_info($user['user_id']);
@ -1823,7 +1822,7 @@ class CourseManager
FROM ".Database::get_main_table(TABLE_MAIN_COURSE_USER)." cu
INNER JOIN $userTable u
ON cu.user_id = u.user_id
WHERE c_id = '$courseId' AND cu.status = ".STUDENT;
WHERE c_id = $courseId AND cu.status = ".STUDENT;
if (!$includeInvitedUsers) {
$sql .= " AND u.status != ".INVITEE;
@ -1866,7 +1865,7 @@ class CourseManager
}
if ($session_id != 0) {
$sql_query .= ' AND scu.session_id = '.$session_id;
$sql_query .= " AND scu.session_id = $session_id";
}
if (!$includeInvitedUsers) {
@ -2850,7 +2849,7 @@ class CourseManager
ON (course.id = url.c_id)
WHERE
url.access_url_id = $urlId AND
cru.user_id = '$user_id'
cru.user_id = $user_id
$withoutSpecialCourses
$languageCondition
ORDER BY course.title
@ -3052,27 +3051,6 @@ class CourseManager
return $extraField->save($params);
}
/**
* Updates course attribute. Note that you need to check that your
* attribute is valid before you use this function.
*
* @param int $id Course id
* @param string $name Attribute name
* @param string $value Attribute value
*
* @return Doctrine\DBAL\Driver\Statement|null True if attribute was successfully updated,
* false if course was not found or attribute name is invalid
*/
public static function update_attribute($id, $name, $value)
{
$id = (int) $id;
$table = Database::get_main_table(TABLE_MAIN_COURSE);
$sql = "UPDATE $table SET $name = '".Database::escape_string($value)."'
WHERE id = $id";
return Database::query($sql);
}
/**
* Update course attributes. Will only update attributes with a non-empty value.
* Note that you NEED to check that your attributes are valid before using this function.

@ -482,8 +482,8 @@ class CourseCategory
*/
public static function listCategories($categorySource)
{
$categorySource = isset($categorySource) ? $categorySource : null;
$categories = self::getCategories($categorySource);
$categorySource = Security::remove_XSS($categorySource);
if (count($categories) > 0) {
$table = new HTML_Table(['class' => 'data_table']);

@ -248,44 +248,6 @@ class CourseDescription
return $last_id > 0 ? 1 : 0;
}
/**
* Insert a row like history inside track_e_item_property table
* first you must set description_type, title, content, progress and
* session_id properties with the object CourseDescription.
*
* @param int $description_type
*
* @return int affected rows
*/
public function insert_stats($description_type)
{
$table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ITEM_PROPERTY);
$description_id = $this->get_id_by_description_type($description_type);
$course_id = api_get_course_int_id();
$course_code = api_get_course_id();
$item_property_id = api_get_item_property_id(
$course_code,
TOOL_COURSE_DESCRIPTION,
$description_id
);
$params = [
'c_id' => api_get_course_int_id(),
'course_id' => $course_id,
'item_property_id' => $item_property_id,
'title' => $this->title,
'content' => $this->content,
'progress' => $this->progress,
'lastedit_date' => api_get_utc_datetime(),
'lastedit_user_id' => api_get_user_id(),
'session_id' => $this->session_id,
];
$result = Database::insert($table, $params);
return $result ? 1 : 0;
}
/**
* Update a description, first you must set description_type, title, content, progress
* and session_id properties with the object CourseDescription.

@ -20,6 +20,17 @@ if (empty($driverList)) {
//'CourseUserDriver',
//'HomeDriver'
];
$block = api_get_configuration_value('block_editor_file_manager_for_students');
$newDriverList = [];
if ($block && !api_is_allowed_to_edit()) {
foreach ($driverList as $driver) {
if ($driver === 'CourseDriver') {
continue;
}
$newDriverList[] = $driver;
}
$driverList = $newDriverList;
}
}
$connector->setDriverList($driverList);

@ -452,25 +452,6 @@ class Notification extends Model
$content = $content.'<br /><br />'.$linkToNewMessage;
}
/*$courseInfo = api_get_course_info();
// Add course info
if (!empty($courseInfo)) {
$sessionId = api_get_session_id();
if (empty($sessionId)) {
$courseNotification = sprintf(get_lang('ThisEmailWasSentViaCourseX'), $courseInfo['title']);
} else {
$sessionInfo = api_get_session_info($sessionId);
if (!empty($sessionInfo)) {
$courseNotification = sprintf(
get_lang('ThisEmailWasSentViaCourseXInSessionX'),
$courseInfo['title'],
$sessionInfo['title']
);
}
}
$content = $content.'<br /><br />'.$courseNotification;
}*/
// You have received this message because you are subscribed text
$content = $content.'<br /><hr><i>'.
sprintf(

@ -2904,7 +2904,7 @@ class SocialManager extends UserManager
if ($countPost > self::DEFAULT_WALL_POSTS) {
$htmlHeadXtra[] = '<script>
$(document).ready(function() {
$(function() {
var container = $("#wallMessages");
container.jscroll({
loadingHtml: "<div class=\"well_border\">'.get_lang('Loading').' </div>",
@ -2966,8 +2966,8 @@ class SocialManager extends UserManager
});
}
$(document).ready(function() {
timeAgo();
$(function() {
timeAgo();
/*$(".delete_message").on("click", function() {
var id = $(this).attr("id");
@ -3330,4 +3330,115 @@ class SocialManager extends UserManager
return $social_group_block;
}
/**
* Returns the formatted header message post.
*
* @param int $authorInfo
* @param int $receiverInfo
* @param array $message Message data
*
* @return string $html The formatted header message post
*/
private static function headerMessagePost($authorInfo, $receiverInfo, $message)
{
$currentUserId = api_get_user_id();
$iconStatus = null;
$authorId = (int) $authorInfo['user_id'];
$receiverId = (int) $receiverInfo['user_id'];
$userStatus = (int) $authorInfo['status'];
$urlImg = api_get_path(WEB_IMG_PATH);
$isAdmin = self::is_admin($authorId);
if ($userStatus === 5) {
if ($authorInfo['has_certificates']) {
$iconStatus = '<img class="pull-left" src="'.$urlImg.'icons/svg/identifier_graduated.svg" width="22px" height="22px">';
} else {
$iconStatus = '<img class="pull-left" src="'.$urlImg.'icons/svg/identifier_student.svg" width="22px" height="22px">';
}
} else {
if ($userStatus === 1) {
if ($isAdmin) {
$iconStatus = '<img class="pull-left" src="'.$urlImg.'icons/svg/identifier_admin.svg" width="22px" height="22px">';
} else {
$iconStatus = '<img class="pull-left" src="'.$urlImg.'icons/svg/identifier_teacher.svg" width="22px" height="22px">';
}
}
}
$date = Display::dateToStringAgoAndLongDate($message['send_date']);
$avatarAuthor = $authorInfo['avatar'];
$urlAuthor = api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$authorId;
$nameCompleteAuthor = $authorInfo['complete_name'];
$urlReceiver = api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$receiverId;
$nameCompleteReceiver = $receiverInfo['complete_name'];
$htmlReceiver = '';
if ($authorId !== $receiverId) {
$htmlReceiver = ' > <a href="'.$urlReceiver.'">'.$nameCompleteReceiver.'</a> ';
}
if (!empty($message['group_info'])) {
$htmlReceiver = ' > <a href="'.$message['group_info']['url'].'">'.$message['group_info']['name'].'</a> ';
}
$canEdit = ($currentUserId == $authorInfo['user_id'] || $currentUserId == $receiverInfo['user_id']) && empty($message['group_info']);
if (!empty($message['thread_id'])) {
$htmlReceiver = ' > <a href="'.$message['thread_url'].'">'.$message['forum_title'].'</a> ';
$canEdit = false;
}
$postAttachment = self::getPostAttachment($message);
$html = '';
$html .= '<div class="top-mediapost" >';
$html .= '<div class="pull-right btn-group btn-group-sm">';
$html .= MessageManager::getLikesButton(
$message['id'],
$currentUserId,
!empty($message['group_info']['id']) ? (int) $message['group_info']['id'] : 0
);
if ($canEdit) {
$htmlDelete = Display::url(
Display::returnFontAwesomeIcon('trash', '', true),
'javascript:void(0)',
[
'id' => 'message_'.$message['id'],
'title' => get_lang('SocialMessageDelete'),
'onclick' => 'deleteMessage('.$message['id'].')',
'class' => 'btn btn-default',
]
);
$html .= $htmlDelete;
}
$html .= '</div>';
$html .= '<div class="user-image" >';
$html .= '<a href="'.$urlAuthor.'">
<img class="avatar-thumb" src="'.$avatarAuthor.'" alt="'.$nameCompleteAuthor.'"></a>';
$html .= '</div>';
$html .= '<div class="user-data">';
$html .= $iconStatus;
$html .= '<div class="username"><a href="'.$urlAuthor.'">'.$nameCompleteAuthor.'</a>'.$htmlReceiver.'</div>';
$html .= '<div class="post-date">'.$date.'</div>';
$html .= '</div>';
$html .= '<div class="msg-content">';
if (!empty($postAttachment)) {
$html .= '<div class="post-attachment thumbnail">';
$html .= $postAttachment;
$html .= '</div>';
}
$html .= '<div>'.Security::remove_XSS($message['content']).'</div>';
$html .= '</div>';
$html .= '</div>'; // end mediaPost
// Popularity post functionality
$html .= '<div class="popularity-mediapost"></div>';
return $html;
}
}

@ -1130,7 +1130,7 @@ class Statistics
{
$chartCode = '
<script>
$(document).ready(function() {
$(function() {
$.ajax({
url: "'.$url.'",
type: "POST",

@ -25,7 +25,7 @@ $this_section = SECTION_COURSES;
api_protect_course_script(true);
$htmlHeadXtra[] = '<script>
$(document).ready( function() {
$(function() {
for (i=0;i<$(".actions").length;i++) {
if ($(".actions:eq("+i+")").html()=="<table border=\"0\"></table>" || $(".actions:eq("+i+")").html()=="" || $(".actions:eq("+i+")").html()==null) {
$(".actions:eq("+i+")").hide();

@ -159,7 +159,7 @@ function confirmation(name) {
}
}
$(document).ready(function() {
$(function() {
jQuery('.scrollbar-inner').scrollbar();
$('#subtab ').on('click', 'a:first', function() {

@ -62,7 +62,7 @@ $htmlHeadXtra[] = '
// uncomment for some debug display utility
/*
$(document).ready(function() {
$(function() {
buildLPtree_debug($("#lp_item_list"), 0, 0);
alert(lp_id_list+"\n\n"+lptree_debug);
});

@ -158,7 +158,6 @@ $form->addElement('html', '<div class="help-block">'.get_lang('LpPrerequisiteDes
$form->addElement('html', '</div>');
$form->addElement('html', '<div class="col-md-2"></div>');
$form->addElement('html', '</div>');
// Time Control
if (Tracking::minimunTimeAvailable(api_get_session_id(), api_get_course_int_id())) {
$accumulateTime = $_SESSION['oLP']->getAccumulateWorkTime();
@ -284,13 +283,13 @@ echo Display::return_icon('course_setting_layout.png');
echo '</div>';
echo '</div>';
echo "
<script>
$(document).on('ready', function () {
$('[name=\'hide_toc_frame\']').on('change', function() {
$('#pnl-frm').toggleClass('col-md-8').toggleClass('col-sm-12');
$('#pnl-toc').toggleClass('col-md-4').toggleClass('hide');
});
<script>
$(function() {
$('[name=\'hide_toc_frame\']').on('change', function() {
$('#pnl-frm').toggleClass('col-md-8').toggleClass('col-sm-12');
$('#pnl-toc').toggleClass('col-md-4').toggleClass('hide');
});
</script>
});
</script>
";
Display::display_footer();

@ -22,7 +22,7 @@ $learnPath = Session::read('oLP');
/* Header and action code */
$htmlHeadXtra[] = '<script>'.$learnPath->get_js_dropdown_array().'
$(document).on("ready", function() {
$(function() {
CKEDITOR.on("instanceReady", function (e) {
showTemplates("content_lp");
});
@ -96,7 +96,7 @@ function confirmation(name) {
}
}
$(document).ready(function() {
$(function() {
jQuery('.scrollbar-inner').scrollbar();
expandColumnToogle('#hide_bar_template', {
selector: '#lp_sidebar'

@ -126,7 +126,7 @@ $htmlHeadXtra[] = api_get_css_asset('qtip2/jquery.qtip.min.css');
$htmlHeadXtra[] = api_get_asset('qtip2/jquery.qtip.min.js');
$htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.frameready.js"></script>';
$htmlHeadXtra[] = '<script>
$(document).ready(function() {
$(function() {
$("div#log_content_cleaner").bind("click", function() {
$("div#log_content").empty();
});
@ -137,7 +137,7 @@ var chamilo_xajax_handler = window.oxajax;
$allowLpItemTip = api_get_configuration_value('hide_accessibility_label_on_lp_item') === false;
if ($allowLpItemTip) {
$htmlHeadXtra[] = '<script>
$(document).ready(function() {
$(function() {
$(".scorm_item_normal").qtip({
content: {
text: function(event, api) {

@ -223,7 +223,7 @@ var courseUrl = '?cidReq='+olms.lms_course_code+'&id_session='+olms.lms_session_
addEvent(window, 'load', addListeners, false);
// Initialize stuff when the page is loaded
$(document).ready(function() {
$(function() {
logit_lms('document.ready event starts');
logit_lms('These logs are generated by the main/lp/scorm_api.php JS '
+ 'library when the admin has clicked on the debug icon in the '
@ -2249,7 +2249,7 @@ function attach_glossary_into_scorm(type) {
}
if (type == 'fix_links') {
$(document).ready(function() {
$(function() {
var objects = $("iframe").contents().find('object');
var pathname = location.pathname;

@ -27,7 +27,7 @@ $defaults['course_id'] = $courseId;
$htmlHeadXtra[] = api_get_jqgrid_js();
$htmlHeadXtra[] = '<script>
$(document).ready( function() {
$(function() {
$("#exercise_course_id").on("change", function(e) {
var data = $(this).select2(\'data\');
var option = data[0];

@ -31,7 +31,7 @@ function sliderClose()
$(".slider").animate({"height": sliderHeight}, {duration: "fast" });
}
$(document).ready(function () {
$(function() {
// Show the slider content
$('.slider').show();
$('.slider').each(function () {
@ -40,4 +40,4 @@ $(document).ready(function () {
});
$(".slider").css("height", sliderHeight);
});
});

@ -26,7 +26,7 @@ $htmlHeadXtra[] = '<script>
function setFocus(){
$("#note_title").focus();
}
$(document).ready(function () {
$(function() {
setFocus();
});
</script>';

@ -84,7 +84,7 @@ $xajax->processRequests();
$htmlHeadXtra[] = $xajax->getJavascript('../inc/lib/xajax/');
$htmlHeadXtra[] = "
<script>
$(document).ready( function() {
$(function() {
accessSwitcher(0);
});

@ -205,7 +205,7 @@ $form->display();
?>
<script>
$(document).ready( function() {
$(function() {
<?php
if (!empty($sessionInfo['duration'])) {

@ -149,7 +149,7 @@ function add_image_form() {
}
}
$(document).ready(function() {
$(function() {
if ($("#msg_'.$message_id.'").length) {
$("html,body").animate({
scrollTop: $("#msg_'.$message_id.'").offset().top

@ -62,7 +62,7 @@ function register_friend(element_input) {
}
}
$(document).on("ready", function () {
$(function() {
$("#el-finder")
.elfinder({
url: "'.api_get_path(WEB_LIBRARY_PATH).'elfinder/php/connector.php",

@ -180,7 +180,7 @@ $socialAutoExtendLink = SocialManager::getAutoExtendLink($user_id, $countPost);
// Added a Jquery Function to return the Preview of OpenGraph URL Content
$htmlHeadXtra[] = '<script>
$(document).ready(function() {
$(function() {
var getUrl = $("[name=\'social_wall_new_msg_main\']");
var matchUrl = /https?:\/\/w{0,3}\w*?\.(\w*?\.)?\w{2,3}\S*|www\.(\w*?\.)?\w*?\.\w{2,3}\S*|(\w*?\.)?\w*?\.\w{2,3}[\/\?]\S*/ ;
@ -244,7 +244,6 @@ if ($show_full_profile) {
// Block Social Sessions
if (count($sessionList) > 0) {
//$social_session_block = $htmlSessionList;
$social_session_block = $sessionList;
}

@ -530,7 +530,7 @@ if ($survey_data['form_fields'] != '' &&
// the $jquery_ready_content variable collects all functions
// that will be load in the $(document).ready javascript function
$htmlHeadXtra[] = '<script>
$(document).ready(function(){
$(function() {
'.$jquery_ready_content.'
});
</script>';

@ -11,7 +11,7 @@
require_once __DIR__.'/../inc/global.inc.php';
$htmlHeadXtra[] = '<script>
$(document).ready( function() {
$(function() {
$("button").click(function() {
$("#is_executable").attr("value",$(this).attr("name"));
});

@ -48,6 +48,8 @@ $isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh(
if ($isDrhOfCourse) {
Display::display_header(get_lang('SurveyList'));
// Tool introduction
Display::display_introduction_section('survey', 'left');
SurveyUtil::displaySurveyListForDrh();
Display::display_footer();
exit;
@ -56,6 +58,8 @@ if ($isDrhOfCourse) {
if (!api_is_allowed_to_edit(false, true)) {
// Coach can see this
Display::display_header(get_lang('SurveyList'));
// Tool introduction
Display::display_introduction_section('survey', 'left');
SurveyUtil::getSurveyList($currentUserId);
Display::display_footer();
exit;

@ -29,7 +29,7 @@
<tr>
<th class="col-session">{{ 'Session'|get_lang }}</th>
{% for i in 1..52 %}
<th class="col-week text-center"><span>{{ i }}</span></th>
<th class="col-week text-center" title="{{ 'WeekX'|get_lang|format(i) }}"><span>{{ i }}</span></th>
{% endfor %}
</tr>
</thead>

@ -43,7 +43,7 @@ function updateCourseList(sessionId) {
}, "json");
}
$(document).on("ready", function () {
$(function() {
$("select#session_id").on("change", function () {
var sessionId = parseInt(this.value, 10);
updateCourseList(sessionId);

@ -21,7 +21,7 @@ $this_section = 'Reports';
Session::erase('this_section');
$htmlHeadXtra[] = '<script>
$(document).ready(function(){
$(function() {
$( "#keyword_start_date_start" ).datepicker({ dateFormat: '."'yy-mm-dd'".' });
$( "#keyword_start_date_end" ).datepicker({ dateFormat: '."'yy-mm-dd'".' });
});

@ -20,7 +20,7 @@ $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('TicketDetail')];
$disableReponseButtons = '';
$htmlHeadXtra[] = '<script>
$(document).ready(function() {
$(function() {
$("#dialog-form").dialog({
autoOpen: false,
height: 450,

@ -36,7 +36,7 @@ function clear_course_list(div_course) {
$("div#"+div_course).hide("");
}
$(document).ready(function() {
$(function() {
$("#advanced_search_form").css("display","none");
});

@ -9,7 +9,7 @@ require_once __DIR__.'/../inc/global.inc.php';
require_once __DIR__.'/tutor_report.lib.php';
$htmlHeadXtra[] = '<script>
$(document).ready(function (){
$(function() {
$(".ajax").click(function() {
var url = this.href;
var dialog = $("#dialog");

@ -21,7 +21,7 @@ $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/timelin
$htmlHeadXtra[] = api_get_js('timeline/timeline-min.js');
$htmlHeadXtra[] = '
<script>
$(document).ready(function() {
$(function() {
var timeline = new VMM.Timeline();
timeline.init("'.$url.'");
});

@ -121,7 +121,7 @@ $js = "<script>
// be sure that these columns always exists
// see headers = array();
// tab of header texts
$(document).ready( function() {
$(function() {
init_hide();
var columnsToHide = ".$columnsToHide.";
if (columnsToHide) {

@ -30,7 +30,7 @@ $groupFilter = isset($_GET['group_filter']) ? intval($_GET['group_filter']) : 0;
$htmlHeadXtra[] = '
<script>
$(document).ready( function() {
$(function() {
$("#group_filter").change(function() {
window.location = "class.php?'.api_get_cidreq().'&type='.$type.'" +"&group_filter=" + $(this).val();
});

@ -34,7 +34,7 @@ function setFocus() {
$("#search_title").focus();
}
$(document).ready(function() {
$(function() {
setFocus();
$("#start_date_toggle").click(function() {
$("#start_date").toggle();

@ -6,7 +6,7 @@ $current_course_tool = TOOL_STUDENTPUBLICATION;
require_once 'work.lib.php';
$id = isset($_GET['id']) ? intval($_GET['id']) : null;
$id = isset($_GET['id']) ? (int) $_GET['id'] : null;
$work = get_work_data_by_id($id);
if (empty($id) || empty($work)) {

@ -144,7 +144,7 @@ function get_work_data_by_id($id, $courseId = 0, $sessionId = 0)
}
if (in_array($fileType, ['image/jpeg', 'image/jpg', 'image/png', 'image/gif'])) {
$work['show_content'] = Display::img($work['show_url'], $work['title']);
$work['show_content'] = Display::img($work['show_url'], $work['title'], null, false);
} elseif (false !== strpos($fileType, 'video/')) {
$work['show_content'] = Display::tag(
'video',

Loading…
Cancel
Save