diff --git a/public/fonts/Harmattan/Harmattan-Regular.ttf b/public/fonts/Harmattan/Harmattan-Regular.ttf new file mode 100644 index 0000000000..4bae9939ee Binary files /dev/null and b/public/fonts/Harmattan/Harmattan-Regular.ttf differ diff --git a/public/fonts/Harmattan/LICENSE.txt b/public/fonts/Harmattan/LICENSE.txt new file mode 100644 index 0000000000..99ac91bb86 --- /dev/null +++ b/public/fonts/Harmattan/LICENSE.txt @@ -0,0 +1,93 @@ +Copyright (c) 2007-2008, The C&MA Guinea Fulbe Team; Copyright renewed 2011-2012, George W. Nuss (http://www.fulbefouta.com), with the Reserved Font Name "Fouta". Copyright (c) 2004-2015, SIL International (http://scripts.sil.org), with Reserved Font Names 'Andika' and 'SIL'. Copyright (c) 2014-2016, SIL International (http://www.sil.org/), with Reserved Font Names "Harmattan" and "SIL". + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/public/main/calendar/agenda_js.php b/public/main/calendar/agenda_js.php index cd6bdec00e..be578b60b6 100644 --- a/public/main/calendar/agenda_js.php +++ b/public/main/calendar/agenda_js.php @@ -7,14 +7,13 @@ $use_anonymous = true; $typeList = ['personal', 'course', 'admin', 'platform']; // Calendar type $type = isset($_REQUEST['type']) && in_array($_REQUEST['type'], $typeList) ? $_REQUEST['type'] : 'personal'; +$userId = isset($_REQUEST['user_id']) ? $_REQUEST['user_id'] : null; if ('personal' === $type || 'admin' === $type) { $cidReset = true; // fixes #5162 } - require_once __DIR__.'/../inc/global.inc.php'; - -$userId = isset($_REQUEST['user_id']) ? $_REQUEST['user_id'] : null; +api_block_inactive_user(); $current_course_tool = TOOL_CALENDAR_EVENT; $this_section = SECTION_MYAGENDA; @@ -231,6 +230,8 @@ if (isset($_GET['session_id'])) { $agenda_ajax_url .= '&session_id='.intval($_GET['session_id']); } +$agenda_ajax_url .= '&sec_token='.Security::get_token(); + $tpl->assign('web_agenda_ajax_url', $agenda_ajax_url); $form = new FormValidator( diff --git a/public/main/exercise/TestCategory.php b/public/main/exercise/TestCategory.php index 9f7e2344ec..af777f7b01 100644 --- a/public/main/exercise/TestCategory.php +++ b/public/main/exercise/TestCategory.php @@ -30,7 +30,6 @@ class TestCategory $this->description = ''; } - /** * return the TestCategory object with id=in_id. * diff --git a/public/main/exercise/export/aiken/aiken_import.inc.php b/public/main/exercise/export/aiken/aiken_import.inc.php index 41fa5caab4..fc894baf0f 100644 --- a/public/main/exercise/export/aiken/aiken_import.inc.php +++ b/public/main/exercise/export/aiken/aiken_import.inc.php @@ -1,6 +1,7 @@ */ require_once __DIR__.'/../inc/global.inc.php'; - -// Clear the exercise session just in case $current_course_tool = TOOL_QUIZ; Exercise::cleanSessionVariables(); $this_section = SECTION_COURSES; @@ -77,7 +75,6 @@ if ($time_control) { if (!in_array($origin, ['learnpath', 'embeddable', 'mobileapp'])) { SessionManager::addFlashSessionReadOnly(); - Display::display_header(); } else { $htmlHeadXtra[] = ' @@ -127,7 +124,7 @@ if (api_get_configuration_value('save_titles_as_html')) { ); } -// Exercise description +// Exercise description. if (!empty($objExercise->description)) { $html .= Display::div($objExercise->description, ['class' => 'exercise_description']); } @@ -155,7 +152,8 @@ if (isset($exercise_stat_info['exe_id'])) { // 2. Exercise button // Notice we not add there the lp_item_view_id because is not already generated -$exercise_url = api_get_path(WEB_CODE_PATH).'exercise/exercise_submit.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'&learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&learnpath_item_view_id='.$learnpathItemViewId.$extra_params; +$exercise_url = api_get_path(WEB_CODE_PATH).'exercise/exercise_submit.php?'. + api_get_cidreq().'&exerciseId='.$objExercise->id.'&learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&learnpath_item_view_id='.$learnpathItemViewId.$extra_params; $exercise_url_button = Display::url( $label, $exercise_url, @@ -164,7 +162,6 @@ $exercise_url_button = Display::url( $btnCheck = ''; $quizCheckButtonEnabled = api_get_configuration_value('quiz_check_button_enable'); - if ($quizCheckButtonEnabled) { $btnCheck = Display::button( 'quiz_check_request_button', @@ -180,7 +177,7 @@ if ($quizCheckButtonEnabled) { ).PHP_EOL.''; } -//3. Checking visibility of the exercise (overwrites the exercise button) +// 3. Checking visibility of the exercise (overwrites the exercise button). $visible_return = $objExercise->is_visible( $learnpath_id, $learnpath_item_id, @@ -212,7 +209,6 @@ $attempts = Event::getExerciseResultsByUser( 'desc' ); $counter = count($attempts); - $my_attempt_array = []; $table_content = ''; @@ -226,7 +222,7 @@ if (in_array( $objExercise->results_disabled, [ RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT, - RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT_NO_FEEDBACK, + //RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT_NO_FEEDBACK, RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK, ]) ) { @@ -273,10 +269,7 @@ if (!empty($attempts)) { } $row = [ 'count' => $i, - 'date' => api_convert_and_format_date( - $attempt_result['start_date'], - DATE_TIME_FORMAT_LONG - ), + 'date' => api_convert_and_format_date($attempt_result['start_date'], DATE_TIME_FORMAT_LONG), 'userIp' => $attempt_result['user_ip'], ]; $attempt_link .= PHP_EOL.$teacher_revised; @@ -341,8 +334,7 @@ if (!empty($attempts)) { $header_names = []; $table = new HTML_Table(['class' => 'table table-striped table-hover']); - - // Hiding score and answer + // Hiding score and answer. switch ($objExercise->results_disabled) { case RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK: if ($blockShowAnswers) { @@ -427,7 +419,6 @@ if (!empty($attempts)) { $selectAttempts = $objExercise->selectAttempts(); if ($selectAttempts) { $attempt_message = get_lang('Attempts').' '.$counter.' / '.$selectAttempts; - if ($counter == $selectAttempts) { $attempt_message = Display::return_message($attempt_message, 'error'); } else { @@ -445,7 +436,6 @@ if ($time_control) { $html .= $message; $disable = api_get_configuration_value('exercises_disable_new_attempts'); - if ($disable && empty($exercise_stat_info)) { $exercise_url_button = Display::return_message(get_lang('The portal do not allowed to start new test for the moment, please come back later.')); } diff --git a/public/main/gradebook/lib/GradebookUtils.php b/public/main/gradebook/lib/GradebookUtils.php index d8f17c45b2..911024572a 100644 --- a/public/main/gradebook/lib/GradebookUtils.php +++ b/public/main/gradebook/lib/GradebookUtils.php @@ -1563,6 +1563,7 @@ class GradebookUtils ) { $userInfo = api_get_user_info($userId); $model = ExerciseLib::getCourseScoreModel(); + /** @var Category $cat */ $cat = $cats[0]; $allcat = $cats[0]->get_subcategories( $userId, @@ -1593,7 +1594,7 @@ class GradebookUtils $studentList, $loadStats ); - + $gradebooktable->hideNavigation = true; $gradebooktable->userId = $userId; if (api_is_allowed_to_edit(null, true)) { @@ -1642,6 +1643,7 @@ class GradebookUtils ]; } } + $file = api_get_path(SYS_ARCHIVE_PATH).uniqid().'.html'; $settings = api_get_configuration_value('gradebook_pdf_export_settings'); @@ -1654,7 +1656,6 @@ class GradebookUtils if ($showFeedBack) { $feedback = '
'.get_lang('Feedback').'
'; - } $content = $table.$graph.$feedback; $result = $pdf->html_to_pdf_with_template( diff --git a/public/main/gradebook/lib/be/attendancelink.class.php b/public/main/gradebook/lib/be/attendancelink.class.php index ab135c0baf..2fe7a76af6 100644 --- a/public/main/gradebook/lib/be/attendancelink.class.php +++ b/public/main/gradebook/lib/be/attendancelink.class.php @@ -138,6 +138,7 @@ class AttendanceLink extends AbstractLink $sum = 0; $sumResult = 0; $bestResult = 0; + while ($data = Database::fetch_array($scores)) { if (!(array_key_exists($data['user_id'], $students))) { if (0 != $attendance['attendance_qualify_max']) { diff --git a/public/main/gradebook/lib/be/category.class.php b/public/main/gradebook/lib/be/category.class.php index 806649a255..cdf1818074 100644 --- a/public/main/gradebook/lib/be/category.class.php +++ b/public/main/gradebook/lib/be/category.class.php @@ -1,4 +1,5 @@ setCertificateFooter(); + } $certificate_list = GradebookUtils::get_list_users_certificates($catId, $userList); $certificate_path_list = []; @@ -2810,12 +2811,16 @@ class Category implements GradebookItem if (empty($category)) { return 0; } + $courseEvaluations = $category->get_evaluations($userId, true); $courseLinks = $category->get_links($userId, true); $evaluationsAndLinks = array_merge($courseEvaluations, $courseLinks); + $categoryScore = 0; for ($i = 0; $i < count($evaluationsAndLinks); $i++) { + /** @var AbstractLink $item */ $item = $evaluationsAndLinks[$i]; + // Set session id from category $item->set_session_id($category->get_session_id()); $score = $item->calc_score($userId); $itemValue = 0; diff --git a/public/main/gradebook/lib/be/evaluation.class.php b/public/main/gradebook/lib/be/evaluation.class.php index fd1ff0e942..da5c553102 100644 --- a/public/main/gradebook/lib/be/evaluation.class.php +++ b/public/main/gradebook/lib/be/evaluation.class.php @@ -122,6 +122,7 @@ class Evaluation implements GradebookItem { $this->setSessionId($sessionId); } + public function get_date() { return $this->created_at; @@ -526,6 +527,7 @@ class Evaluation implements GradebookItem public function calc_score($studentId = null, $type = null) { $allowStats = api_get_configuration_value('allow_gradebook_stats'); + if ($allowStats) { $evaluation = $this->entity; if (!empty($evaluation)) { @@ -597,7 +599,7 @@ class Evaluation implements GradebookItem /** @var Result $res */ foreach ($results as $res) { $score = $res->get_score(); - } + } } return [$score, $this->get_max()]; diff --git a/public/main/gradebook/lib/be/exerciselink.class.php b/public/main/gradebook/lib/be/exerciselink.class.php index deb2e6cbca..1cb0f4fb52 100644 --- a/public/main/gradebook/lib/be/exerciselink.class.php +++ b/public/main/gradebook/lib/be/exerciselink.class.php @@ -127,7 +127,6 @@ class ExerciseLink extends AbstractLink public function calc_score($studentId = null, $type = null) { $allowStats = api_get_configuration_value('allow_gradebook_stats'); - if ($allowStats) { $link = $this->entity; if (!empty($link)) { @@ -138,15 +137,18 @@ class ExerciseLink extends AbstractLink $bestResult = $link->getBestScore(); return [$bestResult, $weight]; + break; case 'average': $count = count($link->getUserScoreList()); + //$count = count($this->getStudentList()); if (empty($count)) { return [0, $weight]; } $sumResult = array_sum($link->getUserScoreList()); return [$sumResult / $count, $weight]; + break; case 'ranking': return [null, null]; @@ -227,11 +229,11 @@ class ExerciseLink extends AbstractLink $lpList[] = $lpData['lp_id']; } } else { - if ((int) $lpData['session_id'] == $sessionId) { - $lpList[] = $lpData['lp_id']; + if ((int) $lpData['session_id'] == $sessionId) { + $lpList[] = $lpData['lp_id']; + } } } - } if (empty($lpList) && !empty($sessionId)) { // Check also if an LP was added in the base course. diff --git a/public/main/gradebook/lib/fe/gradebooktable.class.php b/public/main/gradebook/lib/fe/gradebooktable.class.php index f75b58dcb1..71ecd8f349 100644 --- a/public/main/gradebook/lib/fe/gradebooktable.class.php +++ b/public/main/gradebook/lib/fe/gradebooktable.class.php @@ -100,25 +100,23 @@ class GradebookTable extends SortableTable $this->set_header($column++, get_lang('Type'), '', 'width="20px"'); $this->set_header($column++, get_lang('Name'), false); - if (false == $this->exportToPdf) { $this->set_header($column++, get_lang('Description'), false); } $model = ExerciseLib::getCourseScoreModel(); - $settings = api_get_configuration_value('gradebook_pdf_export_settings'); $showWeight = true; if ($this->exportToPdf && isset($settings['hide_score_weight']) && $settings['hide_score_weight']) { $showWeight = false; } if ($showWeight) { - $this->set_header( - $column++, - get_lang('Weight'), - '', - 'width="100px"' - ); + $this->set_header( + $column++, + get_lang('Weight'), + '', + 'width="100px"' + ); } if (!$this->teacherView) { @@ -228,7 +226,6 @@ class GradebookTable extends SortableTable // Average $average = $this->datagen->buildAverageResultColumn($item); $defaultData[$item->get_id()]['average'] = $average; - // Ranking /*if (!empty($this->studentList)) { $invalidateRanking = true; @@ -382,7 +379,6 @@ class GradebookTable extends SortableTable $total_categories_weight = 0; $scoredisplay = ScoreDisplay::instance(); - $totalBest = [0, 0]; $totalAverage = [0, 0]; @@ -395,7 +391,6 @@ class GradebookTable extends SortableTable $userExerciseScoreInCategory = api_get_configuration_value( 'gradebook_use_exercise_score_settings_in_categories' ); - $useExerciseScoreInTotal = api_get_configuration_value('gradebook_use_exercise_score_settings_in_total'); $course_code = api_get_course_id(); $session_id = api_get_session_id(); @@ -405,7 +400,7 @@ class GradebookTable extends SortableTable if ($this->exportToPdf && isset($settings['hide_score_weight']) && $settings['hide_score_weight']) { $showWeight = false; } - + $totalAverageList = []; // Categories. if (!empty($data_array)) { foreach ($data_array as $data) { @@ -413,12 +408,10 @@ class GradebookTable extends SortableTable $row = []; /** @var AbstractLink $item */ $item = $data[0]; - // If the item is invisible, wrap it in a span with class invisible $invisibility_span_open = $isAllowedToEdit && '0' == $item->is_visible() ? '' : ''; $invisibility_span_close = $isAllowedToEdit && '0' == $item->is_visible() ? '' : ''; - // Id if ($this->teacherView) { if (false == $this->exportToPdf) { $row[] = $this->build_id_column($item); @@ -469,7 +462,6 @@ class GradebookTable extends SortableTable } $category_weight = $item->get_weight(); - if ($this->teacherView) { $weight_total_links += $data[3]; } @@ -482,21 +474,12 @@ class GradebookTable extends SortableTable $row[] = $this->build_edit_column($item); } } else { - /*$score = $item->calc_score($this->userId); - if (!empty($score[1])) { - $score = $score[0] / $score[1] * $item->get_weight(); - $score = $scoredisplay->display_score([$score, null], SCORE_SIMPLE); - } else { - $categoryScore = null; - }*/ - // Students get the results and certificates columns $value_data = isset($data[4]) ? $data[4] : null; $best = isset($data['best']) ? $data['best'] : null; $average = isset($data['average']) ? $data['average'] : null; $ranking = isset($data['ranking']) ? $data['ranking'] : null; $totalResult = []; - if (isset($data['result_score'])) { $totalResult = [ $data['result_score'][0], @@ -509,17 +492,16 @@ class GradebookTable extends SortableTable $scoredisplay->format_score($totalBest[0] + $data['best_score'][0]), $scoredisplay->format_score($totalBest[1] + $data['best_score'][1]), ]; - $totalAverage = [0, 0]; if (isset($data['average_score']) && !empty($data['average_score'])) { - $totalAverage = [ - $data['average_score'][0], - $data['average_score'][1], - ]; + $totalAverage = [ + $data['average_score'][0], + $data['average_score'][1], + ]; } } - // Student result + // Score if (empty($model)) { $row[] = $value_data; } else { @@ -529,6 +511,7 @@ class GradebookTable extends SortableTable ); } + $totalAverageList[$item->get_id()] = $totalAverage; $mode = SCORE_AVERAGE; if ($userExerciseScoreInCategory) { $mode = SCORE_SIMPLE; @@ -608,6 +591,7 @@ class GradebookTable extends SortableTable $sub_cat_info->exportToPdf = $this->exportToPdf; $sub_cat_info->preLoadDataKey = $this->getPreloadDataKey(); $sub_cat_info->userId = $user_id; + $data_array2 = $sub_cat_info->get_data( $sorting, $from, @@ -621,7 +605,6 @@ class GradebookTable extends SortableTable foreach ($data_array2 as $data) { $row = []; $item = $data[0]; - //if the item is invisible, wrap it in a span with class invisible $invisibility_span_open = $isAllowedToEdit && '0' == $item->is_visible() ? '' : ''; $invisibility_span_close = $isAllowedToEdit && '0' == $item->is_visible() ? '' : ''; @@ -639,7 +622,6 @@ class GradebookTable extends SortableTable // Type $row[] = $this->build_type_column($item, ['style' => 'padding-left:5px']); - // Name. $row[] = $invisibility_span_open.'    '. $this->build_name_link($item, $type, 4).$invisibility_span_close; @@ -654,7 +636,7 @@ class GradebookTable extends SortableTable // Weight if ($showWeight) { - $row[] = $invisibility_span_open.$weight.$invisibility_span_close; + $row[] = $invisibility_span_open.$weight.$invisibility_span_close; } // Admins get an edit column. @@ -672,25 +654,22 @@ class GradebookTable extends SortableTable } else { // Students get the results and certificates columns $eval_n_links = array_merge($alleval, $alllink); - if (count($eval_n_links) > 0) { $value_data = isset($data[4]) ? $data[4] : null; if (!is_null($value_data)) { // Result $row[] = $value_data; - $best = isset($data['best']) ? $data['best'] : null; $average = isset($data['average']) ? $data['average'] : null; $ranking = isset($data['ranking']) ? $data['ranking'] : null; - if (empty($model)) { + // Ranking if (in_array(1, $this->loadStats)) { - // Ranking $row[] = $ranking; } + // Best if (in_array(2, $this->loadStats)) { - // Best $row[] = $best; } @@ -784,6 +763,7 @@ class GradebookTable extends SortableTable $sortable_data[] = $row; } } else { + $showPercentage = false === $this->datagen->hidePercentage; // Total for student. if (count($main_cat) > 1) { $main_weight = (int) $main_cat[0]->get_weight(); @@ -812,6 +792,7 @@ class GradebookTable extends SortableTable false, true ); + if ($useExerciseScoreInTotal) { $totalResult = ExerciseLib::show_score($myTotal, $main_weight, false); } @@ -827,8 +808,9 @@ class GradebookTable extends SortableTable } if ($showWeight) { - $row[] = $main_weight; + $row[] = $main_weight; } + $row[] = $totalResult; $categoryId = $main_cat[0]->get_id(); @@ -865,18 +847,14 @@ class GradebookTable extends SortableTable } $totalRanking = AbstractLink::getCurrentUserRanking($user_id, $totalRanking); - if ($useExerciseScoreInTotal) { - $totalRanking = ExerciseLib::show_score($totalRanking[0], $totalRanking[1], false); - } else { $totalRanking = $scoredisplay->display_score( $totalRanking, SCORE_DIV, SCORE_BOTH, true, - true, + true, true ); - } if ($invalidateRanking) { $totalRanking = null; @@ -892,6 +870,7 @@ class GradebookTable extends SortableTable $totalBest[1] = $main_weight; $defaultData[$categoryId]['best'] = $totalBest; } + if ($useExerciseScoreInTotal) { if (isset($totalBest['score'])) { $totalBestScore = $totalBest['score']; @@ -899,16 +878,16 @@ class GradebookTable extends SortableTable $totalBestScore = $totalBest; } - $totalBest = ExerciseLib::show_score($totalBestScore[0], $totalBestScore[1], true); + $totalBest = ExerciseLib::show_score($totalBestScore[0], $totalBestScore[1], $showPercentage); } else { - $totalBest = $scoredisplay->display_score( - $totalBest, - SCORE_DIV, - SCORE_BOTH, + $totalBest = $scoredisplay->display_score( + $totalBest, + SCORE_DIV, + SCORE_BOTH, true, false, - true - ); + true + ); } $row[] = $totalBest; } @@ -917,10 +896,21 @@ class GradebookTable extends SortableTable if (isset($defaultData[$categoryId]) && isset($defaultData[$categoryId]['average'])) { $totalAverage = $defaultData[$categoryId]['average']; } else { + $averageWeight = 0; + $categoryAverage = 0; + foreach ($totalAverageList as $averageScore) { + $categoryAverage += $averageScore[0]; + $averageWeight += $averageScore[1]; + } + $categoryAverage = $categoryAverage / count($totalAverageList); + //$averageWeight = $averageWeight ($totalAverageList); + // Overwrite main weight - $totalAverage[0] = $average / count($this->studentList); - $totalAverage[1] = $main_weight; - $defaultData[$categoryId]['average'] = $totalBest; + //$totalAverage[0] = $average / count($this->studentList); + //$totalAverage[1] = $main_weight; + $totalAverage[0] = $categoryAverage; + $totalAverage[1] = $averageWeight; + //$defaultData[$categoryId]['average'] = $totalBest; } if ($useExerciseScoreInTotal) { @@ -930,16 +920,16 @@ class GradebookTable extends SortableTable $totalAverageScore = $totalAverage; } - $totalAverage = ExerciseLib::show_score($totalAverageScore[0], $totalAverageScore[1], true); + $totalAverage = ExerciseLib::show_score($totalAverageScore[0], $totalAverageScore[1], $showPercentage); } else { - $totalAverage = $scoredisplay->display_score( - $totalAverage, - SCORE_DIV, - SCORE_BOTH, + $totalAverage = $scoredisplay->display_score( + $totalAverage, + SCORE_DIV, + SCORE_BOTH, true, false, - true - ); + true + ); } $row[] = $totalAverage; @@ -1062,8 +1052,8 @@ class GradebookTable extends SortableTable $dataSet->addPoints($data['average'], get_lang('Average')); $dataSet->addPoints($data['categories'], 'categories'); $dataSet->setAbscissa('categories'); - $xSize = 600; - $ySize = 400; + $xSize = 700; + $ySize = 500; $pChart = new pImage($xSize, $ySize, $dataSet); /* Turn of Antialiasing */ $pChart->Antialias = false; @@ -1085,8 +1075,9 @@ class GradebookTable extends SortableTable $pChart->setGraphArea(50, 30, $xSize - 50, $ySize - 70); $pChart->setFontProperties( [ - 'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', - 'FontSize' => 12, + 'FontName' => api_get_path(SYS_FONTS_PATH).'Harmattan/Harmattan-Regular.ttf', + /*'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',*/ + 'FontSize' => 10, ] ); @@ -1233,6 +1224,7 @@ class GradebookTable extends SortableTable $categoryId = $item->getCategory()->get_id(); $is_student = api_is_student(); $cat = new Category(); + switch ($item->get_item_type()) { case 'C': // Category @@ -1286,7 +1278,7 @@ class GradebookTable extends SortableTable } // no break because of return case 'L': - // link + // Link $course_id = CourseManager::get_course_by_category($categoryId); $show_message = $cat->show_message_resource_delete($course_id); @@ -1328,13 +1320,13 @@ class GradebookTable extends SortableTable { switch ($item->get_item_type()) { case 'C': - // category + // Category return GradebookUtils::build_edit_icons_cat($item, $this->currentcat); case 'E': - // evaluation + // Evaluation return GradebookUtils::build_edit_icons_eval($item, $this->currentcat->get_id()); case 'L': - // link + // Link return GradebookUtils::build_edit_icons_link($item, $this->currentcat->get_id()); } } diff --git a/public/main/gradebook/lib/flatview_data_generator.class.php b/public/main/gradebook/lib/flatview_data_generator.class.php index 7ffb46686b..e8453e332d 100644 --- a/public/main/gradebook/lib/flatview_data_generator.class.php +++ b/public/main/gradebook/lib/flatview_data_generator.class.php @@ -602,6 +602,7 @@ class FlatViewDataGenerator $row[] = $displayScore; } } + if ($customDisplayIsStandalone) { if ($export_to_pdf) { $row['display_custom'] = $scoreDisplay->display_custom($total_score); @@ -609,6 +610,7 @@ class FlatViewDataGenerator $row[] = $scoreDisplay->display_custom($total_score); } } + unset($score); $data[] = $row; } diff --git a/public/main/gradebook/lib/gradebook_data_generator.class.php b/public/main/gradebook/lib/gradebook_data_generator.class.php index fad75ac4de..371a82838f 100644 --- a/public/main/gradebook/lib/gradebook_data_generator.class.php +++ b/public/main/gradebook/lib/gradebook_data_generator.class.php @@ -65,6 +65,7 @@ class GradebookDataGenerator $this->items = array_merge($allcats, $allevals, $tabLinkToDisplay); $this->evals_links = array_merge($allevals, $tabLinkToDisplay); $this->userId = api_get_user_id(); + $this->hidePercentage = api_get_configuration_value('hide_gradebook_percentage_user_result'); } /** @@ -108,19 +109,14 @@ class GradebookDataGenerator $allitems = $this->items; usort($allitems, ['GradebookDataGenerator', 'sort_by_name']); - $userId = $this->userId; - - // Get selected items $visibleItems = array_slice($allitems, $start, $count); $userCount = !empty($studentList) ? count($studentList) : 0; - // Generate the data to display $data = []; $allowStats = api_get_configuration_value('allow_gradebook_stats'); $scoreDisplay = ScoreDisplay::instance(); $defaultData = Session::read($this->preLoadDataKey); - $model = ExerciseLib::getCourseScoreModel(); $useExerciseScoreInTotal = api_get_configuration_value('gradebook_use_exercise_score_settings_in_total'); @@ -146,7 +142,6 @@ class GradebookDataGenerator $ignore_score_color, false ); - $row[] = $resultColumn['display']; $row['result_score'] = $resultColumn['score']; $row['result_score_weight'] = $resultColumn['score_weight']; @@ -214,7 +209,7 @@ class GradebookDataGenerator $row['average'] = $average['display']; $row['average_score'] = $average['score']; - // Ranking + // Ranking. if ($allowStats) { // Ranking if (isset($defaultData[$item->get_id()]) && @@ -249,74 +244,89 @@ class GradebookDataGenerator $evals = []; $links = []; if ('C' === $item->get_item_type()) { - /** @var Category $item */ $evals = $item->get_evaluations(null); $links = $item->get_links(null); - } - foreach ($studentList as $user) { - $ressum = 0; - $weightsum = 0; - $bestResult = 0; - - if (!empty($evals)) { - foreach ($evals as $eval) { - $evalres = $eval->calc_score($user['user_id'], null); - $eval->setStudentList($studentList); - - if (isset($evalres) && 0 != $eval->get_weight()) { - $evalweight = $eval->get_weight(); - $weightsum += $evalweight; - if (!empty($evalres[1])) { - $ressum += $evalres[0] / $evalres[1] * $evalweight; - } - if ($ressum > $bestResult) { - $bestResult = $ressum; - } - } else { - if (0 != $eval->get_weight()) { + foreach ($studentList as $user) { + $ressum = 0; + $weightsum = 0; + $bestResult = 0; + if (!empty($evals)) { + foreach ($evals as $eval) { + $evalres = $eval->calc_score($user['user_id'], null); + $eval->setStudentList($studentList); + + if (isset($evalres) && 0 != $eval->get_weight()) { $evalweight = $eval->get_weight(); $weightsum += $evalweight; + if (!empty($evalres[1])) { + $ressum += $evalres[0] / $evalres[1] * $evalweight; + } + + if ($ressum > $bestResult) { + $bestResult = $ressum; + } + } else { + if (0 != $eval->get_weight()) { + $evalweight = $eval->get_weight(); + $weightsum += $evalweight; + } } } } - } - - if (!empty($links)) { - foreach ($links as $link) { - $link->setStudentList($studentList); - - if ($session_id) { - $link->set_session_id($session_id); - } - - $linkres = $link->calc_score($user['user_id'], null); - if (!empty($linkres) && 0 != $link->get_weight()) { - $linkweight = $link->get_weight(); - $link_res_denom = 0 == $linkres[1] ? 1 : $linkres[1]; - - $weightsum += $linkweight; - $ressum += $linkres[0] / $link_res_denom * $linkweight; - if ($ressum > $bestResult) { - $bestResult = $ressum; + if (!empty($links)) { + foreach ($links as $link) { + $link->setStudentList($studentList); + if ($session_id) { + $link->set_session_id($session_id); } - } else { - // Adding if result does not exists - if (0 != $link->get_weight()) { + $linkres = $link->calc_score($user['user_id'], null); + if (!empty($linkres) && 0 != $link->get_weight()) { $linkweight = $link->get_weight(); + $link_res_denom = 0 == $linkres[1] ? 1 : $linkres[1]; + $weightsum += $linkweight; + $ressum += $linkres[0] / $link_res_denom * $linkweight; + if ($ressum > $bestResult) { + $bestResult = $ressum; + } + } else { + // Adding if result does not exists + if (0 != $link->get_weight()) { + $linkweight = $link->get_weight(); + $weightsum += $linkweight; + } } } } - } - if (!empty($ressum)) { - $invalidateResults = false; + if (!empty($ressum)) { + $invalidateResults = false; + } + $rankingStudentList[$user['user_id']] = $ressum; } + } - $rankingStudentList[$user['user_id']] = $ressum; + if (empty($rankingStudentList)) { + foreach ($studentList as $user) { + $score = $this->build_result_column( + $user['user_id'], + $item, + $ignore_score_color, + true + ); + if (!empty($score['score'][0])) { + $invalidateResults = false; + } + + $rankingStudentList[$user['user_id']] = 0; + if ($score['score']) { + $rankingStudentList[$user['user_id']] = $score['score'][0]; + } + } } } + $score = AbstractLink::getCurrentUserRanking($userId, $rankingStudentList); } @@ -352,7 +362,7 @@ class GradebookDataGenerator if ($useExerciseScoreInTotal) { $bestScore = $best['score']; $best['display'] = ExerciseLib::show_score($bestScore[0], $bestScore[1], true); - } else { + } else { $best = $defaultData[$item->get_id()]['best']; } } else { @@ -361,10 +371,8 @@ class GradebookDataGenerator $row['best'] = $best['display']; $row['best_score'] = $best['score']; - $rankingStudentList = []; $invalidateResults = true; - // Average if (isset($defaultData[$item->get_id()]) && isset($defaultData[$item->get_id()]['average'])) { $average = $defaultData[$item->get_id()]['average']; @@ -479,7 +487,8 @@ class GradebookDataGenerator if ($item1->get_item_type() == $item2->get_item_type()) { return $this->sort_by_name($item1, $item2); } - return $item1->get_item_type() < $item2->get_item_type() ? -1 : 1; + + return $item1->get_item_type() < $item2->get_item_type() ? -1 : 1; } /** @@ -509,7 +518,8 @@ class GradebookDataGenerator if ($item1->get_weight() == $item2->get_weight()) { return $this->sort_by_name($item1, $item2); } - return $item1->get_weight() < $item2->get_weight() ? -1 : 1; + + return $item1->get_weight() < $item2->get_weight() ? -1 : 1; } /** @@ -540,7 +550,8 @@ class GradebookDataGenerator if ($timestamp1 == $timestamp2) { return $this->sort_by_name($item1, $item2); } - return $timestamp1 < $timestamp2 ? -1 : 1; + + return $timestamp1 < $timestamp2 ? -1 : 1; } /** @@ -565,10 +576,11 @@ class GradebookDataGenerator } $scoreMode = SCORE_DIV_PERCENT_WITH_CUSTOM; + $showPercentage = true; if ($this->hidePercentage) { $scoreMode = SCORE_DIV; + $showPercentage = false; } - $scoreDisplay = ScoreDisplay::instance(); $display = $scoreDisplay->display_score( $score, @@ -583,7 +595,7 @@ class GradebookDataGenerator $display = ExerciseLib::show_score( $score[0], $score[1], - false + $showPercentage ); } @@ -591,7 +603,7 @@ class GradebookDataGenerator $display = ExerciseLib::show_score( $score[0], $score[1], - true + $showPercentage ); } @@ -618,8 +630,10 @@ class GradebookDataGenerator $scoreDisplay = ScoreDisplay::instance(); $scoreMode = SCORE_DIV_PERCENT_WITH_CUSTOM; + $showPercentage = true; if ($this->hidePercentage) { $scoreMode = SCORE_DIV; + $showPercentage = false; } $display = $scoreDisplay->display_score( @@ -633,7 +647,7 @@ class GradebookDataGenerator $type = $item->get_item_type(); if ('L' === $type && 'ExerciseLink' === get_class($item)) { - $display = ExerciseLib::show_score($score[0], $score[1], false); + $display = ExerciseLib::show_score($score[0], $score[1], $showPercentage); $result = ExerciseLib::convertScoreToPlatformSetting($score[0], $score[1]); $score[0] = $result['score']; $score[1] = $result['weight']; @@ -642,7 +656,7 @@ class GradebookDataGenerator $display = ExerciseLib::show_score( $score[0], $score[1], - true + $showPercentage ); } } @@ -699,7 +713,6 @@ class GradebookDataGenerator $scoreDisplay = ScoreDisplay::instance(); $score = $item->calc_score($userId); $model = ExerciseLib::getCourseScoreModel(); - if (!empty($score)) { switch ($item->get_item_type()) { // category @@ -718,6 +731,7 @@ class GradebookDataGenerator true ); } + return [ 'display' => $display, 'score' => $score, @@ -813,7 +827,8 @@ class GradebookDataGenerator if (is_int($date)) { return api_convert_and_format_date($date); } - return api_format_date($date); + + return api_format_date($date); } } } diff --git a/public/main/gradebook/lib/gradebook_result.class.php b/public/main/gradebook/lib/gradebook_result.class.php index f0745a84bf..3be6468b20 100644 --- a/public/main/gradebook/lib/gradebook_result.class.php +++ b/public/main/gradebook/lib/gradebook_result.class.php @@ -32,6 +32,7 @@ class GradeBookResult $data = ''; //build the results //titles + foreach ($dato[0] as $header_col) { if (!empty($header_col)) { if (is_array($header_col)) { diff --git a/public/main/gradebook/lib/scoredisplay.class.php b/public/main/gradebook/lib/scoredisplay.class.php index c91b4b0b80..7161907181 100644 --- a/public/main/gradebook/lib/scoredisplay.class.php +++ b/public/main/gradebook/lib/scoredisplay.class.php @@ -309,6 +309,7 @@ class ScoreDisplay return $hasEmptyDecimals; } + /** * Display a score according to the current settings. * @@ -334,7 +335,6 @@ class ScoreDisplay $removeEmptyDecimals = false ) { $my_score = $score == 0 ? [] : $score; - switch ($type) { case SCORE_BAR: $percentage = $my_score[0] / $my_score[1] * 100; @@ -342,7 +342,6 @@ class ScoreDisplay return Display::bar_progress($percentage); break; case SCORE_NUMERIC: - $percentage = $my_score[0] / $my_score[1] * 100; return round($percentage); @@ -351,6 +350,7 @@ class ScoreDisplay if (!isset($my_score[0])) { $my_score[0] = 0; } + return $this->format_score($my_score[0], $ignoreDecimals); break; } @@ -459,7 +459,6 @@ class ScoreDisplay if (!empty($custom)) { $custom = ' - '.$custom; } - $div = $this->display_as_div($score, false, $removeEmptyDecimals); /*return $div. @@ -565,7 +564,7 @@ class ScoreDisplay $removeEmptyDecimals ) : 0; - return $score[0].' / '.$score[1]; + return $score[0].' / '.$score[1]; } /** @@ -655,7 +654,8 @@ class ScoreDisplay return $converted2; } - return null; + + return null; } /** diff --git a/public/main/gradebook/lib/user_data_generator.class.php b/public/main/gradebook/lib/user_data_generator.class.php index 80644114c6..55e8241ff7 100644 --- a/public/main/gradebook/lib/user_data_generator.class.php +++ b/public/main/gradebook/lib/user_data_generator.class.php @@ -337,9 +337,9 @@ class UserDataGenerator } else { $avgscore = $item->calc_score('', 'average'); } - $scoredisplay = ScoreDisplay::instance(); $displaytype = SCORE_AVERAGE; + return $scoredisplay->display_score($avgscore, $displaytype); } diff --git a/public/main/group/group_space.php b/public/main/group/group_space.php index 895e1f0325..a4bbd5aec3 100644 --- a/public/main/group/group_space.php +++ b/public/main/group/group_space.php @@ -21,7 +21,6 @@ require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php'; $group_id = api_get_group_id(); $user_id = api_get_user_id(); - $current_group = GroupManager::get_group_properties($group_id); $group_id = $current_group['iid']; if (empty($current_group)) { diff --git a/public/main/inc/ajax/agenda.ajax.php b/public/main/inc/ajax/agenda.ajax.php index 30672ac3f2..4bb51b7e74 100644 --- a/public/main/inc/ajax/agenda.ajax.php +++ b/public/main/inc/ajax/agenda.ajax.php @@ -35,6 +35,9 @@ switch ($action) { if (!$agenda->getIsAllowedToEdit()) { break; } + if (false === Security::check_token('get')) { + exit; + } $add_as_announcement = $_REQUEST['add_as_annonuncement'] ?? null; $title = $_REQUEST['title'] ?? null; $content = $_REQUEST['content'] ?? null; @@ -59,6 +62,9 @@ switch ($action) { if (!$agenda->getIsAllowedToEdit()) { break; } + if (false === Security::check_token('get')) { + exit; + } $id_list = explode('_', $_REQUEST['id']); $id = $id_list[1]; $agenda->editEvent( @@ -74,6 +80,9 @@ switch ($action) { if (!$agenda->getIsAllowedToEdit()) { break; } + if (false === Security::check_token('get')) { + exit; + } $id_list = explode('_', $_REQUEST['id']); $id = $id_list[1]; $deleteAllEventsFromSerie = isset($_REQUEST['delete_all_events']) ? true : false; @@ -83,6 +92,9 @@ switch ($action) { if (!$agenda->getIsAllowedToEdit()) { break; } + if (false === Security::check_token('get')) { + exit; + } $minute_delta = $_REQUEST['minute_delta']; $id = explode('_', $_REQUEST['id']); $id = $id[1]; @@ -92,6 +104,9 @@ switch ($action) { if (!$agenda->getIsAllowedToEdit()) { break; } + if (false === Security::check_token('get')) { + exit; + } $minute_delta = $_REQUEST['minute_delta']; $allDay = $_REQUEST['all_day']; $id = explode('_', $_REQUEST['id']); @@ -124,7 +139,7 @@ switch ($action) { echo $events; break; case 'get_user_agenda': - //Used in the admin user list + // Used in the admin user list. api_protect_admin_script(); if (api_is_allowed_to_edit(null, true)) { diff --git a/public/main/inc/lib/exercise.lib.php b/public/main/inc/lib/exercise.lib.php index a8042d254f..7a78000fd0 100644 --- a/public/main/inc/lib/exercise.lib.php +++ b/public/main/inc/lib/exercise.lib.php @@ -150,9 +150,9 @@ class ExerciseLib '; } - // Iterate through answers + // Iterate through answers. $x = 1; - //mark letters for each answer + // Mark letters for each answer. $letter = 'A'; $answer_matching = []; $cpt1 = []; @@ -2673,6 +2673,7 @@ HOTSPOT; if (is_null($score) && is_null($weight)) { return '-'; } + $decimalSeparator = empty($decimalSeparator) ? '.' : $decimalSeparator; $thousandSeparator = empty($thousandSeparator) ? ',' : $thousandSeparator; @@ -2722,7 +2723,7 @@ HOTSPOT; } if ($show_percentage) { - $percentageSign = '%'; + $percentageSign = ' %'; if ($hidePercentageSign) { $percentageSign = ''; } @@ -2745,7 +2746,7 @@ HOTSPOT; $html = $scoreBasedInModel; } - // Ignore other formats and use the configuratio['exercise_score_format'] value + // Ignore other formats and use the configuration['exercise_score_format'] value // But also keep the round values settings. $format = api_get_configuration_value('exercise_score_format'); if (!empty($format)) { @@ -4361,6 +4362,7 @@ EOT; if ($save_user_result) { $numberAttempts++; } + $showTotalScore = false; if ($objExercise->results_disabled == RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT) { $showTotalScore = true; @@ -4372,6 +4374,7 @@ EOT; $show_only_score = false; $showTotalScoreAndUserChoicesInLastAttempt = true; } + if ($objExercise->results_disabled == RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT_NO_FEEDBACK) { $showTotalScore = true; $show_results = true; @@ -4380,6 +4383,22 @@ EOT; if ($numberAttempts >= $objExercise->attempts) { $showTotalScoreAndUserChoicesInLastAttempt = true; } + + // Check if the current attempt is the last. + if (false === $save_user_result && !empty($attempts)) { + $showTotalScoreAndUserChoicesInLastAttempt = false; + $position = 1; + foreach ($attempts as $attempt) { + if ($exeId == $attempt['exe_id']) { + break; + } + $position++; + } + + if ($position == $objExercise->attempts) { + $showTotalScoreAndUserChoicesInLastAttempt = true; + } + } } } @@ -4398,6 +4417,7 @@ EOT; } } + // When exporting to PDF hide feedback/comment/score show warning in hotspot. if ($allowExportPdf && $isExport) { $showTotalScore = false; $showQuestionScore = false; @@ -4408,11 +4428,12 @@ EOT; $objExercise->hideExpectedAnswer = true; $show_results = true; } + if ('embeddable' !== $origin && !empty($exercise_stat_info['exe_user_id']) && !empty($studentInfo) ) { - // Shows exercise header + // Shows exercise header. echo $objExercise->showExerciseResultHeader( $studentInfo, $exercise_stat_info, @@ -4438,7 +4459,6 @@ EOT; $exerciseResult = null; $exerciseResultCoordinates = null; $delineationResults = null; - if (true === $save_user_result && in_array( $objExercise->getFeedbackType(), [EXERCISE_FEEDBACK_TYPE_DIRECT, EXERCISE_FEEDBACK_TYPE_POPUP] @@ -4521,6 +4541,7 @@ EOT; if (!isset($category_list[$objQuestionTmp->category]['no_answer'])) { $category_list[$objQuestionTmp->category]['no_answer'] = 0; } + $category_list[$objQuestionTmp->category]['score'] += $my_total_score; $category_list[$objQuestionTmp->category]['total'] += $my_total_weight; if ($scorePassed) { @@ -4539,7 +4560,6 @@ EOT; $category_list[$objQuestionTmp->category]['total_questions']++; $category_was_added_for_this_test = true; } - if (isset($objQuestionTmp->category_list) && !empty($objQuestionTmp->category_list)) { foreach ($objQuestionTmp->category_list as $category_id) { $category_list[$category_id]['score'] += $my_total_score; @@ -4599,11 +4619,11 @@ EOT; 'comments' => $comnt, 'user_answered' => $result['user_answered'], ]; + $score = []; if ($show_results) { $score = $calculatedScore; } - if (in_array($objQuestionTmp->type, [FREE_ANSWER, ORAL_EXPRESSION, ANNOTATION])) { $reviewScore = [ 'score' => $my_total_score, @@ -4635,8 +4655,10 @@ EOT; if ($show_results) { $question_content .= ''; } + $calculatedScore['question_content'] = $question_content; $attemptResult[] = $calculatedScore; + if ($objExercise->showExpectedChoice()) { $exercise_content .= Display::div( Display::panel($question_content), @@ -4652,7 +4674,7 @@ EOT; ); } } - } // end foreach() block that loops over all questions + } } $totalScoreText = null; @@ -4810,6 +4832,7 @@ EOT; if (!empty($remainingMessage)) { echo Display::return_message($remainingMessage, 'normal', false); } + $failedAnswersCount = 0; $wrongQuestionHtml = ''; $all = ''; @@ -5022,6 +5045,7 @@ EOT; return self::isSuccessExerciseResult($score, $weight, $passPercentage); } + /** * @param float $score * @param float $weight diff --git a/public/main/inc/lib/userportal.lib.php b/public/main/inc/lib/userportal.lib.php index 15c9895394..c1541d3a47 100644 --- a/public/main/inc/lib/userportal.lib.php +++ b/public/main/inc/lib/userportal.lib.php @@ -917,6 +917,14 @@ class IndexManager ]; } + if (api_get_configuration_value('show_my_lps_page')) { + $items[] = [ + 'icon' => Display::return_icon('learnpath.png', get_lang('MyLps')), + 'link' => api_get_path(WEB_CODE_PATH).'lp/my_list.php', + 'title' => get_lang('MyLps'), + ]; + } + if (bbb::showGlobalConferenceLink($userInfo)) { $bbb = new bbb('', '', true, api_get_user_id()); $url = $bbb->getListingUrl(); @@ -931,8 +939,19 @@ class IndexManager ]; } - if (true === api_get_configuration_value('whispeak_auth_enabled')) { - $itemTitle = WhispeakAuthPlugin::create()->get_title(); + if ('true' === api_get_plugin_setting('zoom', 'tool_enable')) { + $zoomPlugin = new ZoomPlugin(); + $blocks = $zoomPlugin->getProfileBlockItems(); + foreach ($blocks as $item) { + $items[] = $item; + } + } + + if ( + true === api_get_configuration_value('whispeak_auth_enabled') && + !WhispeakAuthPlugin::checkUserIsEnrolled($userId) + ) { + $itemTitle = get_plugin_lang('EnrollmentTitle', WhispeakAuthPlugin::class); $items[] = [ 'class' => 'whispeak-enrollment', @@ -1026,14 +1045,12 @@ class IndexManager } // Sort courses - if (true != api_get_configuration_value('view_grid_courses')) { - $items[] = [ - 'class' => 'order-course', - 'icon' => Display::return_icon('order-course.png', get_lang('Sort courses')), - 'link' => api_get_path(WEB_CODE_PATH).'auth/sort_my_courses.php', - 'title' => get_lang('Sort courses'), - ]; - } + $items[] = [ + 'class' => 'order-course', + 'icon' => Display::return_icon('order-course.png', get_lang('Sort courses')), + 'link' => api_get_path(WEB_CODE_PATH).'auth/sort_my_courses.php', + 'title' => get_lang('Sort courses'), + ]; // Session history if (isset($_GET['history']) && 1 == intval($_GET['history'])) { diff --git a/public/main/lp/lp_report.php b/public/main/lp/lp_report.php index 4c4b471941..4379ec04ae 100644 --- a/public/main/lp/lp_report.php +++ b/public/main/lp/lp_report.php @@ -50,12 +50,13 @@ if (empty($lp)) { $urlBase = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq().'&action=report&lp_id='.$lpId; $url = $urlBase.'&group_filter='.$groupFilter; $allowUserGroups = api_get_configuration_value('allow_lp_subscription_to_usergroups'); + +$course = api_get_course_entity($courseId); +$session = api_get_session_entity($sessionId); + $em = Database::getManager(); // Check LP subscribers if ('1' === $lp->getSubscribeUsers()) { - $course = api_get_course_entity($courseId); - $session = api_get_session_entity($sessionId); - /** @var ItemPropertyRepository $itemRepo */ $itemRepo = $em->getRepository('ChamiloCourseBundle:CItemProperty'); $subscribedUsersInLp = $itemRepo->getUsersSubscribedToItem( diff --git a/public/main/survey/fillsurvey.php b/public/main/survey/fillsurvey.php index e11f2e7245..f7724739e4 100644 --- a/public/main/survey/fillsurvey.php +++ b/public/main/survey/fillsurvey.php @@ -145,6 +145,7 @@ if ('auto' === $invitationcode && isset($_GET['scode'])) { } // From here we use the new invitationcode auto-userid-surveycode string $_GET['invitationcode'] = $autoInvitationcode; + Session::write('auto_invitation_code_'.$surveyCode, $autoInvitationcode); $invitationcode = $autoInvitationcode; } }