diff --git a/assets/js/app.js b/assets/js/app.js index 05253c0b6f..8c775b5da2 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -21,6 +21,10 @@ import 'select2/dist/css/select2.min.css'; // Gets HTML content from tinymce window.getContentFromEditor = function (id) { + if (typeof tinymce == "undefined") { + return false; + } + let content = ''; if (tinymce.get(id)) { content = tinymce.get(id).getContent(); diff --git a/assets/vue/views/documents/DocumentForHtmlEditor.vue b/assets/vue/views/documents/DocumentForHtmlEditor.vue index b1516539b2..1aba0a7d71 100644 --- a/assets/vue/views/documents/DocumentForHtmlEditor.vue +++ b/assets/vue/views/documents/DocumentForHtmlEditor.vue @@ -237,8 +237,7 @@ export default { returnToEditor(item) { const url = item.contentUrl; - // Tiny mce - console.log(url); + // Tiny mce. window.parent.postMessage({ url: url }, '*'); diff --git a/public/main/exercise/exercise.class.php b/public/main/exercise/exercise.class.php index 2495f4e5c3..d6711ef3bb 100644 --- a/public/main/exercise/exercise.class.php +++ b/public/main/exercise/exercise.class.php @@ -8697,12 +8697,12 @@ class Exercise } if (!isset($students[$data['exe_user_id']])) { - if (0 != $data['exe_weighting']) { - $students[$data['exe_user_id']] = $data['exe_result']; - if ($data['exe_result'] > $bestResult) { - $bestResult = $data['exe_result']; + if (0 != $data['max_score']) { + $students[$data['exe_user_id']] = $data['score']; + if ($data['score'] > $bestResult) { + $bestResult = $data['score']; } - $sumResult += $data['exe_result']; + $sumResult += $data['score']; } } } @@ -9404,8 +9404,8 @@ class Exercise $row_track = Database:: fetch_array($qryres); $attempt_text = get_lang('Latest attempt').' : '; $attempt_text .= ExerciseLib::show_score( - $row_track['exe_result'], - $row_track['exe_weighting'] + $row_track['score'], + $row_track['max_score'] ); } else { //No attempts @@ -9868,7 +9868,7 @@ class Exercise $TBL_LP_ITEM_VIEW = Database::get_course_table(TABLE_LP_ITEM_VIEW); $TBL_LP_ITEM = Database::get_course_table(TABLE_LP_ITEM); - $sql = "SELECT start_date, exe_date, exe_result, exe_weighting, exe_exo_id, exe_duration + $sql = "SELECT start_date, exe_date, score, max_score, exe_exo_id, exe_duration FROM $TBL_TRACK_EXERCICES WHERE exe_id = $safe_exe_id AND exe_user_id = $userId"; $res = Database::query($sql); @@ -9879,20 +9879,20 @@ class Exercise } $duration = (int) $row_dates['exe_duration']; - $score = (float) $row_dates['exe_result']; - $max_score = (float) $row_dates['exe_weighting']; + $score = (float) $row_dates['score']; + $max_score = (float) $row_dates['max_score']; $sql = "UPDATE $TBL_LP_ITEM SET max_score = '$max_score' WHERE iid = $safe_item_id"; Database::query($sql); - $sql = "SELECT id FROM $TBL_LP_ITEM_VIEW + $sql = "SELECT iid FROM $TBL_LP_ITEM_VIEW WHERE c_id = $course_id AND lp_item_id = $safe_item_id AND lp_view_id = $viewId - ORDER BY id DESC + ORDER BY iid DESC LIMIT 1"; $res_last_attempt = Database::query($sql); @@ -10429,11 +10429,11 @@ class Exercise $resultPercentage = 0; - if (isset($attempt['exe_result']) && isset($attempt['exe_weighting'])) { - $weight = (int) $attempt['exe_weighting']; + if (isset($attempt['score']) && isset($attempt['max_score'])) { + $weight = (int) $attempt['max_score']; $weight = (0 == $weight) ? 1 : $weight; $resultPercentage = float_format( - ($attempt['exe_result'] / $weight) * 100, + ($attempt['score'] / $weight) * 100, 1 ); } diff --git a/public/main/inc/lib/exercise.lib.php b/public/main/inc/lib/exercise.lib.php index ca8016fc39..729405b9b0 100644 --- a/public/main/inc/lib/exercise.lib.php +++ b/public/main/inc/lib/exercise.lib.php @@ -5623,17 +5623,17 @@ EOT; switch ($type) { case 'correct_student': $selectCount = 'count(DISTINCT te.exe_user_id)'; - $scoreCondition = ' AND exe_result = exe_weighting '; + $scoreCondition = ' AND score = max_score '; break; case 'wrong_student': $selectCount = 'count(DISTINCT te.exe_user_id)'; - $scoreCondition = ' AND exe_result != exe_weighting '; + $scoreCondition = ' AND score != max_score '; break; case 'correct': - $scoreCondition = ' AND exe_result = exe_weighting '; + $scoreCondition = ' AND score = max_score '; break; case 'wrong': - $scoreCondition = ' AND exe_result != exe_weighting '; + $scoreCondition = ' AND score != max_score '; break; } diff --git a/public/main/inc/lib/tracking.lib.php b/public/main/inc/lib/tracking.lib.php index 8141f887ae..b47736b04c 100644 --- a/public/main/inc/lib/tracking.lib.php +++ b/public/main/inc/lib/tracking.lib.php @@ -7588,8 +7588,8 @@ class Tracking // Process data. $array = [ 'exe_date' => get_lang('Date'), - 'exe_result' => get_lang('Score'), - 'exe_weighting' => get_lang('Weighting'), + 'score' => get_lang('Score'), + 'max_score' => get_lang('Weighting'), ]; foreach ($item as $key => $value) { if (in_array($key, array_keys($array))) { @@ -7714,8 +7714,8 @@ class Tracking if (!empty($bestScoreData)) { $quizData[5] = ExerciseLib::show_score( - $bestScoreData['exe_result'], - $bestScoreData['exe_weighting'] + $bestScoreData['score'], + $bestScoreData['max_score'] ); } @@ -7728,8 +7728,8 @@ class Tracking if (!empty($exerciseAttempt)) { // Always getting the BEST attempt - $score = $exerciseAttempt['exe_result']; - $weighting = $exerciseAttempt['exe_weighting']; + $score = $exerciseAttempt['score']; + $weighting = $exerciseAttempt['max_score']; $exeId = $exerciseAttempt['exe_id']; $latestAttemptUrl = $webCodePath.'exercise/result.php?' @@ -8817,7 +8817,7 @@ class TrackingCourseLog $best = null; if ($bestExerciseResult) { - $best = $bestExerciseResult['exe_result'] / $bestExerciseResult['exe_weighting']; + $best = $bestExerciseResult['score'] / $bestExerciseResult['max_score']; $best = round($best, 2) * 100; $best .= '%'; } diff --git a/public/main/tracking/courseLog.php b/public/main/tracking/courseLog.php index c0fe58db9f..fe54d6de89 100644 --- a/public/main/tracking/courseLog.php +++ b/public/main/tracking/courseLog.php @@ -871,8 +871,8 @@ if (!empty($groupList)) { $best = 0; if (!empty($results)) { foreach ($results as $result) { - if (!empty($result['exe_weighting'])) { - $score = $result['exe_result'] / $result['exe_weighting']; + if (!empty($result['max_score'])) { + $score = $result['score'] / $result['max_score ']; if ($score > $best) { $best = $score; } @@ -968,8 +968,8 @@ if (!empty($groupList)) { $best = 0; if (!empty($results)) { foreach ($results as $result) { - if (!empty($result['exe_weighting'])) { - $score = $result['exe_result'] / $result['exe_weighting']; + if (!empty($result['max_score'])) { + $score = $result['score'] / $result['max_score']; if ($score > $best) { $best = $score; }