From fcbcc74b3e6a2c62ee1f6fb372f3c8ae9d6c928e Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 17 Jun 2021 13:11:49 +0200 Subject: [PATCH] Fix fatal error --- .../exercise/export/scorm/ScormExercise.php | 19 +++++++++++-------- public/main/mySpace/index.php | 7 ++++--- public/main/mySpace/lp_tracking.php | 4 ++-- public/main/mySpace/myStudents.php | 12 ++++++------ public/main/mySpace/progression.php | 4 ++-- 5 files changed, 25 insertions(+), 21 deletions(-) diff --git a/public/main/exercise/export/scorm/ScormExercise.php b/public/main/exercise/export/scorm/ScormExercise.php index 1c05886683..e9cb3c15ab 100644 --- a/public/main/exercise/export/scorm/ScormExercise.php +++ b/public/main/exercise/export/scorm/ScormExercise.php @@ -2,6 +2,7 @@ /* For licensing terms, see /license.txt */ +use Chamilo\CoreBundle\Framework\Container; use Chamilo\CourseBundle\Entity\CQuiz; use Symfony\Component\Serializer\Encoder\JsonEncoder; use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; @@ -100,11 +101,11 @@ class ScormExercise */ public function end_body() { - $button = '
'.$button.''; @@ -127,7 +128,7 @@ class ScormExercise .''."\n"; }*/ - list($js, $html) = $this->exportQuestions(); + [$js, $html] = $this->exportQuestions(); return $this->startPage() .$this->start_header() @@ -157,8 +158,10 @@ class ScormExercise $em = Database::getManager(); // Export cquiz data + $quizRepo = Container::getQuizRepository(); /** @var CQuiz $exercise */ - $exercise = $em->find('ChamiloCourseBundle:CQuiz', $this->exercise->iId); + $exercise = $quizRepo->find($this->exercise->iId); + $exercise->setDescription(''); $exercise->setTextWhenFinished(''); @@ -169,7 +172,7 @@ class ScormExercise $counter = 0; $scormQuestion = new ScormQuestion(); foreach ($this->exercise->selectQuestionList() as $q) { - list($jstmp, $htmltmp) = $scormQuestion->exportQuestionToScorm($q, $counter); + [$jstmp, $htmltmp] = $scormQuestion->exportQuestionToScorm($q, $counter); $js .= $jstmp."\n"; $html .= $htmltmp."\n"; $counter++; diff --git a/public/main/mySpace/index.php b/public/main/mySpace/index.php index ebfbe02e3b..990ff013ca 100644 --- a/public/main/mySpace/index.php +++ b/public/main/mySpace/index.php @@ -33,8 +33,6 @@ $skipData = api_get_configuration_value('tracking_skip_generic_data'); $logInfo = [ 'tool' => SECTION_TRACKING, - 'tool_id' => 0, - 'tool_id_detail' => 0, ]; Event::registerLog($logInfo); @@ -340,7 +338,10 @@ if (false === $skipData) { $csv_content[] = [get_lang('Learners')]; $csv_content[] = [get_lang('InactivesLearners'), $nb_inactive_students]; $csv_content[] = [get_lang('Time spent on portal'), $totalTimeSpent]; - $csv_content[] = [get_lang('Average number of courses to which my learners are subscribed'), round($avg_courses_per_student, 3)]; + $csv_content[] = [ + get_lang('Average number of courses to which my learners are subscribed'), + round($avg_courses_per_student, 3), + ]; $csv_content[] = [ get_lang('Progress in courses'), is_null($avgTotalProgress) diff --git a/public/main/mySpace/lp_tracking.php b/public/main/mySpace/lp_tracking.php index 36b1e99ecb..2af3d543e7 100644 --- a/public/main/mySpace/lp_tracking.php +++ b/public/main/mySpace/lp_tracking.php @@ -98,8 +98,8 @@ switch ($action) { api_not_allowed(); } - $view = $em->getRepository(\Chamilo\CourseBundle\Entity\CLpView::class)->find($itemView->getLpViewId()); - $lp = $em->getRepository(\Chamilo\CourseBundle\Entity\CLp::class)->find($view->getLpId()); + $view = $itemView->getView(); + $lp = $view->getLp(); $duration = learnpathItem::getScormTimeFromParameter('js', $itemView->getTotalTime()); $endTime = $itemView->getStartTime() + $itemView->getTotalTime(); diff --git a/public/main/mySpace/myStudents.php b/public/main/mySpace/myStudents.php index eadb8c1988..274d5e9b71 100644 --- a/public/main/mySpace/myStudents.php +++ b/public/main/mySpace/myStudents.php @@ -918,7 +918,7 @@ if (is_numeric($avg_student_score)) { } $userInfoExtra['student_score'] = (float) $score; -$userInfoExtra['student_progress'] = (float) $avg_student_progress; +$userInfoExtra['student_progress'] = $avg_student_progress; $userInfoExtra['first_connection'] = $first_connection_date; $userInfoExtra['last_connection'] = $last_connection_date; $userInfoExtra['last_connection_in_course'] = api_format_date( @@ -1999,13 +1999,13 @@ if (empty($details)) { } echo ''; - if (!empty($hookContents)) { + /*if (!empty($hookContents)) { foreach ($hookContents as $hookContent) { if (isset($hookContent['value'])) { echo Display::tag('td', $hookContent['value'], $hookContent['attrs']); } } - } + }*/ echo ''; $data_exercices[$i][] = $exercise->getTitle(); @@ -2022,11 +2022,11 @@ if (empty($details)) { if (!empty($hookContents)) { $csvContentIndex = count($csv_content) - 1; - foreach ($hookContents as $hookContent) { + /*foreach ($hookContents as $hookContent) { if (isset($hookContent['value'])) { $csv_content[$csvContentIndex][] = strip_tags($hookContent['value']); } - } + }*/ } $i++; } @@ -2044,7 +2044,7 @@ if (empty($details)) { $user_list = SurveyManager::get_people_who_filled_survey( $survey['survey_id'], false, - $courseInfo['real_id'] + $course->getId() ); $survey_done = Display::return_icon( 'accept_na.png', diff --git a/public/main/mySpace/progression.php b/public/main/mySpace/progression.php index deaed29592..48b5e6cc09 100644 --- a/public/main/mySpace/progression.php +++ b/public/main/mySpace/progression.php @@ -36,8 +36,8 @@ $result_course = Database::query($sql_course); if (Database::num_rows($result_course) > 0) { if (isset($_POST['export'])) { - $export_result = export_csv($header, $data, 'test.csv'); // TODO: There is no data for exporting yet. - echo Display::return_message($export_result, 'error'); + //$export_result = export_csv($header, $data, 'test.csv'); // TODO: There is no data for exporting yet. + //echo Display::return_message($export_result, 'error'); } echo '