diff --git a/main/course_info/delete_course.php b/main/course_info/delete_course.php index 3eba99646b..d99050fe18 100755 --- a/main/course_info/delete_course.php +++ b/main/course_info/delete_course.php @@ -1,4 +1,5 @@ '.get_lang('Course').' : '.$current_course_name.' ('.$current_course_code.') '; + $message = '

'.get_lang('CourseTitle').' : '.$current_course_name.'

'; + $message .= '

'.get_lang('CourseCode').' : '.$current_course_code.'

'; $message .= get_lang('HasDel'); $message .= '

'.get_lang('BackHome').''; } else { /* message if code course is incorrect */ - $message = '

'.get_lang('Course').' : '.$current_course_name.' ('.$current_course_code.')

'; + $message = '

'.get_lang('CourseTitle').' : '.$current_course_name.'

'; + $message .= '

'.get_lang('CourseCode').' : '.$current_course_code.'

'; $message .= '

'.get_lang('CourseRegistrationCodeIncorrect').'

'; $message .= '

*' .get_lang('CourseCodeConfirmation') diff --git a/main/document/download.php b/main/document/download.php index 60b14e8bc1..8cfe588620 100755 --- a/main/document/download.php +++ b/main/document/download.php @@ -1,19 +1,17 @@ api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq(), 'name' => get_lang('Groups'), @@ -86,11 +78,6 @@ if (!empty($groupId)) { "url" => api_get_path(WEB_CODE_PATH)."group/group_space.php?".api_get_cidreq(), "name" => get_lang('GroupSpace'), ]; - - $path = explode('/', $dir); - if ('/'.$path[1] != $group['directory']) { - api_not_allowed(true); - } } $interbreadcrumb[] = ["url" => "./document.php?id=".$document_id.'&'.api_get_cidreq(), "name" => get_lang('Documents')]; @@ -98,7 +85,6 @@ $interbreadcrumb[] = ["url" => "./document.php?id=".$document_id.'&'.api_get_cid if (!api_is_allowed_in_course()) { api_not_allowed(true); } - if (!($is_allowed_to_edit || $groupRights || DocumentManager::is_my_shared_folder( api_get_user_id(), @@ -109,7 +95,6 @@ if (!($is_allowed_to_edit || $groupRights || api_not_allowed(true); } -/* Header */ Event::event_access_tool(TOOL_DOCUMENT); $display_dir = $dir; @@ -139,9 +124,7 @@ if (isset($document_data['parents'])) { } } -//make some vars $wamiuserid = api_get_user_id(); - $htmlHeadXtra[] = ''; $htmlHeadXtra[] = ''; $htmlHeadXtra[] = ''; @@ -157,15 +140,12 @@ $actions = Display::toolbarButton( [], false ); - $template = new Template($nameTools); $template->assign('directory', $wamidir); $template->assign('user_id', api_get_user_id()); $template->assign('reload_page', 1); - $layout = $template->get_template('document/record_audio.tpl'); $content = $template->fetch($layout); - $template->assign( 'actions', Display::toolbarAction('toolbar', [$actions]) diff --git a/main/exercise/MatchingDraggable.php b/main/exercise/MatchingDraggable.php index 06d2fed3a0..8395150f6b 100644 --- a/main/exercise/MatchingDraggable.php +++ b/main/exercise/MatchingDraggable.php @@ -1,4 +1,5 @@ 0; } + public function hasQuestionWithType($type) + { + $type = (int) $type; + + $table = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); + $tableQuestion = Database::get_course_table(TABLE_QUIZ_QUESTION); + $sql = "SELECT q.id + FROM $table e + INNER JOIN $tableQuestion q + ON (e.question_id = q.id AND e.c_id = q.c_id) + WHERE + q.type = $type AND + e.c_id = {$this->course_id} AND + e.exercice_id = ".$this->id; + + $result = Database::query($sql); + + return Database::num_rows($result) > 0; + } + public function hasQuestionWithTypeNotInList(array $questionTypeList) { if (empty($questionTypeList)) { @@ -2588,7 +2608,7 @@ class Exercise { // Feedback type. $feedback = []; - $feedback[] = $form->createElement( + $endTest = $form->createElement( 'radio', 'exerciseFeedbackType', null, @@ -2611,54 +2631,60 @@ class Exercise ] ); + $feedback[] = $endTest; + $feedback[] = $noFeedBack; + + $scenarioEnabled = 'true' === api_get_setting('enable_quiz_scenario'); $freeze = true; - if ('true' === api_get_setting('enable_quiz_scenario')) { + if ($scenarioEnabled) { if ($this->getQuestionCount() > 0) { - //if (in_array($feedbackType, [EXERCISE_FEEDBACK_TYPE_DIRECT, EXERCISE_FEEDBACK_TYPE_POPUP])) { $hasDifferentQuestion = $this->hasQuestionWithTypeNotInList([UNIQUE_ANSWER, HOT_SPOT_DELINEATION]); + if (false === $hasDifferentQuestion) { $freeze = false; } - /*} else { - $freeze = false; - }*/ } else { $freeze = false; } - } else { - $freeze = false; - } - $direct = $form->createElement( - 'radio', - 'exerciseFeedbackType', - null, - get_lang('DirectFeedback'), - EXERCISE_FEEDBACK_TYPE_DIRECT, - [ - 'id' => 'exerciseType_'.EXERCISE_FEEDBACK_TYPE_DIRECT, - 'onclick' => 'check_direct_feedback()', - ] - ); + $direct = $form->createElement( + 'radio', + 'exerciseFeedbackType', + null, + get_lang('DirectFeedback'), + EXERCISE_FEEDBACK_TYPE_DIRECT, + [ + 'id' => 'exerciseType_'.EXERCISE_FEEDBACK_TYPE_DIRECT, + 'onclick' => 'check_direct_feedback()', + ] + ); - $directPopUp = $form->createElement( - 'radio', - 'exerciseFeedbackType', - null, - get_lang('ExerciseDirectPopUp'), - EXERCISE_FEEDBACK_TYPE_POPUP, - ['id' => 'exerciseType_'.EXERCISE_FEEDBACK_TYPE_POPUP, 'onclick' => 'check_direct_feedback()'] - ); + $directPopUp = $form->createElement( + 'radio', + 'exerciseFeedbackType', + null, + get_lang('ExerciseDirectPopUp'), + EXERCISE_FEEDBACK_TYPE_POPUP, + ['id' => 'exerciseType_'.EXERCISE_FEEDBACK_TYPE_POPUP, 'onclick' => 'check_direct_feedback()'] + ); - if ($freeze) { - //$noFeedBack->freeze(); - $direct->freeze(); - $directPopUp->freeze(); - } + if ($freeze) { + $direct->freeze(); + $directPopUp->freeze(); + } - $feedback[] = $noFeedBack; - $feedback[] = $direct; - $feedback[] = $directPopUp; + // If has delineation freeze all. + $hasDelineation = $this->hasQuestionWithType(HOT_SPOT_DELINEATION); + if ($hasDelineation) { + $endTest->freeze(); + $noFeedBack->freeze(); + $direct->freeze(); + $directPopUp->freeze(); + } + + $feedback[] = $direct; + $feedback[] = $directPopUp; + } $form->addGroup( $feedback, @@ -2668,10 +2694,6 @@ class Exercise get_lang('FeedbackDisplayOptions'), ] ); - - if ($freeze) { - //$group->freeze(); - } } /** @@ -9929,7 +9951,7 @@ class Exercise Session::erase('categoryList'); Session::erase('exerciseResult'); Session::erase('firstTime'); - + Session::erase('time_per_question'); Session::erase('exerciseResultCoordinates'); Session::erase('hotspot_coord'); Session::erase('hotspot_dest'); diff --git a/main/exercise/exercise_global_report.php b/main/exercise/exercise_global_report.php index 08333c7687..a281547f65 100644 --- a/main/exercise/exercise_global_report.php +++ b/main/exercise/exercise_global_report.php @@ -28,7 +28,7 @@ $header[] = get_lang('FirstName'); $header[] = get_lang('LastName'); $header[] = get_lang('Email'); $header[] = get_lang('OfficialCode'); -//$header[] = 'NIF'; + /** @var TestCategory $categoryInfo */ foreach ($categories as $categoryInfo) { $header[] = 'Aciertos: '.$categoryInfo->name; @@ -107,11 +107,6 @@ foreach ($students as $studentInfo) { $categoryData[$categoryInfo->id]['score'] += $categoryItem['score']; } } - /*foreach ($stats['attempts_result_list'] as $attempt) { - // Only first item - $userExerciseData[$exerciseId] = $attempt['score']; - break; - }*/ $userExerciseData[$exerciseId] = $stats['total_score']; } foreach ($categories as $categoryInfo) { @@ -139,9 +134,6 @@ foreach ($students as $studentInfo) { $list[] = $data; } -//var_dump($list);exit; -$filePath = Export::arrayToCsv($list, get_lang('Report'), true); +$filePath = Export::arrayToCsv($list, get_lang('Report'), true); DocumentManager::file_send_for_download($filePath, true, get_lang('Report').'.csv'); - - diff --git a/main/exercise/exercise_result.php b/main/exercise/exercise_result.php index ae62309c45..fc2e9086a3 100755 --- a/main/exercise/exercise_result.php +++ b/main/exercise/exercise_result.php @@ -99,7 +99,7 @@ if (api_is_course_admin() && !in_array($origin, ['learnpath', 'embeddable'])) { 'admin.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id ) .Display::url( - Display::return_icon('edit.png', get_lang('ModifyExercise'), [], 32), + Display::return_icon('settings.png', get_lang('ModifyExercise'), [], 32), 'exercise_admin.php?'.api_get_cidreq().'&modifyExercise=yes&exerciseId='.$objExercise->id ), ] diff --git a/main/exercise/exercise_show.php b/main/exercise/exercise_show.php index 405f681f74..31c1657ada 100755 --- a/main/exercise/exercise_show.php +++ b/main/exercise/exercise_show.php @@ -972,7 +972,7 @@ if ($isFeedbackAllowed) { } } -if ($isFeedbackAllowed && $origin != 'learnpath' && $origin != 'student_progress') { +if ($isFeedbackAllowed && $origin !== 'learnpath' && $origin !== 'student_progress') { if (in_array($origin, ['tracking_course', 'user_course', 'correct_exercise_in_lp'])) { $formUrl = api_get_path(WEB_CODE_PATH).'exercise/exercise_report.php?'.api_get_cidreq().'&'; $formUrl .= http_build_query([ diff --git a/main/exercise/question.class.php b/main/exercise/question.class.php index d5785539b6..c24d2ac3cd 100755 --- a/main/exercise/question.class.php +++ b/main/exercise/question.class.php @@ -169,6 +169,7 @@ abstract class Question $objQuestion->feedback = isset($object->feedback) ? $object->feedback : ''; $objQuestion->code = isset($object->code) ? $object->code : ''; $categoryInfo = TestCategory::getCategoryInfoForQuestion($id, $course_id); + if (!empty($categoryInfo)) { if (isset($categoryInfo['category_id'])) { $objQuestion->category = (int) $categoryInfo['category_id']; diff --git a/main/gradebook/lib/be/evaluation.class.php b/main/gradebook/lib/be/evaluation.class.php index 49e09948cc..8532b107f2 100755 --- a/main/gradebook/lib/be/evaluation.class.php +++ b/main/gradebook/lib/be/evaluation.class.php @@ -117,6 +117,11 @@ class Evaluation implements GradebookItem $this->sessionId = (int) $sessionId; } + public function set_session_id($sessionId) + { + $this->setSessionId($sessionId); + } + public function get_date() { return $this->created_at; diff --git a/main/inc/lib/course_home.lib.php b/main/inc/lib/course_home.lib.php index 8d02690f2b..dc6345f646 100755 --- a/main/inc/lib/course_home.lib.php +++ b/main/inc/lib/course_home.lib.php @@ -610,6 +610,7 @@ class CourseHome // if the course homepage is loaded many times, so the list of hidden // tools might benefit from a shared memory storage later on $list = api_get_settings('Tools', 'list', api_get_current_access_url_id()); + $hide_list = []; $check = false; foreach ($list as $line) { @@ -834,7 +835,6 @@ class CourseHome $courseId = api_get_course_int_id(); $is_platform_admin = api_is_platform_admin(); $courseInfo = api_get_course_info(); - $allowEditionInSession = api_get_configuration_value('allow_edit_tool_visibility_in_session'); if ($session_id == 0) { @@ -847,12 +847,21 @@ class CourseHome } } + $disableUsers = 3 === (int) $courseInfo['visibility'] && + api_get_configuration_value('disable_change_user_visibility_for_public_courses'); + $items = []; $app_plugin = new AppPlugin(); - if (isset($all_tools_list)) { $lnk = ''; foreach ($all_tools_list as &$tool) { + $allowChangeVisibility = true; + $showIcon = true; + if ('user/user.php' === $tool['link'] && $disableUsers) { + $allowChangeVisibility = false; + $tool['visibility'] = 0; + $showIcon = $is_allowed_to_edit; + } $item = []; $studentview = false; $tool['original_link'] = $tool['link']; @@ -878,6 +887,10 @@ class CourseHome continue; } + if (false === $showIcon) { + continue; + } + // This part displays the links to hide or remove a tool. // These links are only visible by the course manager. unset($lnk); @@ -885,7 +898,7 @@ class CourseHome $item['extra'] = null; $toolAdmin = isset($tool['admin']) ? $tool['admin'] : ''; - if ($is_allowed_to_edit) { + if ($is_allowed_to_edit && $allowChangeVisibility) { if (empty($session_id)) { if (isset($tool['id'])) { if ($tool['visibility'] == '1' && $toolAdmin != '1') { diff --git a/main/inc/lib/display.lib.php b/main/inc/lib/display.lib.php index d02ad506fc..69203e4489 100755 --- a/main/inc/lib/display.lib.php +++ b/main/inc/lib/display.lib.php @@ -2194,7 +2194,7 @@ class Display switch ($fileInfo['extension']) { case 'mp3': case 'webm': - $html = '