diff --git a/main/exercise/exercise.class.php b/main/exercise/exercise.class.php index 5ecc77e580..829e8c32a7 100755 --- a/main/exercise/exercise.class.php +++ b/main/exercise/exercise.class.php @@ -4405,7 +4405,7 @@ class Exercise $correctAnswer = $listTeacherAnswerTemp[$j]; if (empty($correctAnswer)) { - continue; + break; } if (FillBlanks::isStudentAnswerGood( @@ -4421,7 +4421,7 @@ class Exercise } if (FillBlanks::FILL_THE_BLANK_MENU != $listCorrectAnswers['words_types'][$j]) { - continue; + break; } $listMenu = FillBlanks::getFillTheBlankMenuAnswers($correctAnswer, false); diff --git a/main/exercise/fill_blanks.class.php b/main/exercise/fill_blanks.class.php index 665a71ae51..7ae831a95a 100755 --- a/main/exercise/fill_blanks.class.php +++ b/main/exercise/fill_blanks.class.php @@ -688,8 +688,6 @@ class FillBlanks extends Question * @param string $correctAnswer [words] of the info array of the answer field * @param bool $fromDatabase Optional * @param bool $studentAnswerIsHash Optional. - * - * @return bool */ public static function isStudentAnswerGood( string $studentAnswer, diff --git a/main/inc/lib/MoodleImport.php b/main/inc/lib/MoodleImport.php index 0c973e4b05..574b06e58a 100644 --- a/main/inc/lib/MoodleImport.php +++ b/main/inc/lib/MoodleImport.php @@ -389,7 +389,7 @@ class MoodleImport * * @param resource $moduleXml XML file * - * @return mixed | array if is a valid xml file, false otherwise + * @return mixed|array if is a valid xml file, false otherwise */ public function readForumModule($moduleXml) { @@ -416,7 +416,7 @@ class MoodleImport * * @param resource $moduleXml XML file * - * @return mixed | array if is a valid xml file, false otherwise + * @return mixed|array if is a valid xml file, false otherwise */ public function readResourceModule($moduleXml) { @@ -447,7 +447,7 @@ class MoodleImport * * @param resource $moduleXml XML file * - * @return mixed | array if is a valid xml file, false otherwise + * @return mixed|array if is a valid xml file, false otherwise */ public function readUrlModule($moduleXml) { @@ -474,7 +474,7 @@ class MoodleImport * * @param resource $moduleXml XML file * - * @return mixed | array if is a valid xml file, false otherwise + * @return mixed|array if is a valid xml file, false otherwise */ public function readQuizModule($moduleXml) { @@ -516,7 +516,7 @@ class MoodleImport * @param resource $filesXml XML file * @param int $contextId * - * @return mixed | array if is a valid xml file, false otherwise + * @return mixed|array if is a valid xml file, false otherwise */ public function readMainFilesXml($filesXml, $contextId) { @@ -578,7 +578,7 @@ class MoodleImport * @param resource $questionsXml XML file * @param int $questionId * - * @return mixed | array if is a valid xml file, false otherwise + * @return mixed|array if is a valid xml file, false otherwise */ public function readMainQuestionsXml($questionsXml, $questionId) { diff --git a/main/inc/lib/image.lib.php b/main/inc/lib/image.lib.php index 0757259a08..a9c7be13d9 100755 --- a/main/inc/lib/image.lib.php +++ b/main/inc/lib/image.lib.php @@ -439,7 +439,7 @@ class GDWrapper extends ImageWrapper } $deltaw = (int) (($thumbw - $width) / 2); $deltah = (int) (($thumbh - $height) / 2); - $dst_img = @ImageCreateTrueColor($thumbw, $thumbh); + $dst_img = @imagecreatetruecolor($thumbw, $thumbh); @imagealphablending($dst_img, false); @imagesavealpha($dst_img, true); @@ -459,14 +459,14 @@ class GDWrapper extends ImageWrapper } $deltaw = 0; $deltah = 0; - $dst_img = @ImageCreateTrueColor($width, $height); + $dst_img = @imagecreatetruecolor($width, $height); @imagealphablending($dst_img, false); @imagesavealpha($dst_img, true); $this->width = $width; $this->height = $height; } $src_img = $this->bg; - @ImageCopyResampled( + @imagecopyresampled( $dst_img, $src_img, $deltaw, @@ -475,8 +475,8 @@ class GDWrapper extends ImageWrapper 0, $width, $height, - ImageSX($src_img), - ImageSY($src_img) + imagesx($src_img), + imagesy($src_img) ); $this->bg = $dst_img; @imagedestroy($src_img); diff --git a/main/inc/lib/legal.lib.php b/main/inc/lib/legal.lib.php index 11f16e388f..f4bc67be85 100755 --- a/main/inc/lib/legal.lib.php +++ b/main/inc/lib/legal.lib.php @@ -235,7 +235,7 @@ class LegalManager * * @param int $language language id * - * @return bool | int the version or false if does not exist + * @return bool|int the version or false if does not exist */ public static function get_last_version($language) { diff --git a/main/inc/lib/sessionmanager.lib.php b/main/inc/lib/sessionmanager.lib.php index 03ecfbbbb9..568ef87629 100755 --- a/main/inc/lib/sessionmanager.lib.php +++ b/main/inc/lib/sessionmanager.lib.php @@ -4754,7 +4754,7 @@ class SessionManager * @param int $id * @param bool $checkSession * - * @return mixed | bool true if pass the check, api_not_allowed otherwise + * @return mixed|bool true if pass the check, api_not_allowed otherwise */ public static function protectSession($id, $checkSession = true) { @@ -9776,6 +9776,46 @@ class SessionManager return $content; } + public static function importAgendaFromSessionModel(int $modelSessionId, int $sessionId, int $courseId) + { + $em = Database::getManager(); + $repo = $em->getRepository('ChamiloCourseBundle:CCalendarEvent'); + + $courseInfo = api_get_course_info_by_id($courseId); + $session = api_get_session_entity($sessionId); + $modelSession = api_get_session_entity($modelSessionId); + + $sessionDateDiff = $modelSession->getAccessStartDate()->diff($session->getAccessStartDate()); + + $events = $repo->findBy( + ['cId' => $courseId, 'sessionId' => $modelSessionId] + ); + + $agenda = new Agenda('course'); + $agenda->set_course($courseInfo); + $agenda->setSessionId($sessionId); + + foreach ($events as $event) { + $startDate = $event->getStartDate()->add($sessionDateDiff); + $endDate = $event->getEndDate()->add($sessionDateDiff); + + $agenda->addEvent( + $startDate->format('Y-m-d H:i:s'), + $endDate->format('Y-m-d H:i:s'), + 'false', + $event->getTitle(), + $event->getContent(), + ['GROUP:0'], + false, + null, + [], + [], + $event->getComment(), + $event->getColor() + ); + } + } + /** * @param int $id * @@ -9913,44 +9953,4 @@ class SessionManager return -1; } } - - public static function importAgendaFromSessionModel(int $modelSessionId, int $sessionId, int $courseId) - { - $em = Database::getManager(); - $repo = $em->getRepository('ChamiloCourseBundle:CCalendarEvent'); - - $courseInfo = api_get_course_info_by_id($courseId); - $session = api_get_session_entity($sessionId); - $modelSession = api_get_session_entity($modelSessionId); - - $sessionDateDiff = $modelSession->getAccessStartDate()->diff($session->getAccessStartDate()); - - $events = $repo->findBy( - ['cId' => $courseId, 'sessionId' => $modelSessionId] - ); - - $agenda = new Agenda('course'); - $agenda->set_course($courseInfo); - $agenda->setSessionId($sessionId); - - foreach ($events as $event) { - $startDate = $event->getStartDate()->add($sessionDateDiff); - $endDate = $event->getEndDate()->add($sessionDateDiff); - - $agenda->addEvent( - $startDate->format('Y-m-d H:i:s'), - $endDate->format('Y-m-d H:i:s'), - 'false', - $event->getTitle(), - $event->getContent(), - ['GROUP:0'], - false, - null, - [], - [], - $event->getComment(), - $event->getColor() - ); - } - } } diff --git a/main/inc/lib/tracking.lib.php b/main/inc/lib/tracking.lib.php index 1cc4033fb8..517b25b671 100755 --- a/main/inc/lib/tracking.lib.php +++ b/main/inc/lib/tracking.lib.php @@ -6669,8 +6669,8 @@ class Tracking } /** - * @param string $tool - * @param sessionEntity |null $session Optional + * @param string $tool + * @param sessionEntity|null $session Optional * * @throws \Doctrine\ORM\NonUniqueResultException * diff --git a/main/lp/learnpath.class.php b/main/lp/learnpath.class.php index 9b6cc7f785..563d9c4512 100755 --- a/main/lp/learnpath.class.php +++ b/main/lp/learnpath.class.php @@ -8075,9 +8075,6 @@ class learnpath return $return; } - /** - * - */ public function displaySurveyForm( $action = 'add', $id = 0, @@ -13818,6 +13815,7 @@ EOD; 'lp_item_id' => $id_in_path, 'origin' => 'learnpath', ]; + return $autoSurveyLink.'&'.http_build_query($lpParams); } diff --git a/main/survey/surveyUtil.class.php b/main/survey/surveyUtil.class.php index 0c11c45c8f..d4c0e20fa1 100755 --- a/main/survey/surveyUtil.class.php +++ b/main/survey/surveyUtil.class.php @@ -155,7 +155,7 @@ class SurveyUtil $sessionCondition = " , session_id = $sessionId"; } - $sql = "INSERT INTO $table_survey_answer SET + $sql = "INSERT INTO $table_survey_answer SET c_id = $course_id, user = '".Database::escape_string($user)."', survey_id = '".Database::escape_string($survey_id)."', @@ -684,7 +684,7 @@ class SurveyUtil } $form->setDefaults(['lp_item' => $lpItemId]); echo $form->returnForm(); - } else if ('comparativereport' == $actionReport) { + } elseif ('comparativereport' == $actionReport) { $form->addSelect('lp_item', get_lang('FilterByLp'), $options); } } @@ -2353,7 +2353,6 @@ class SurveyUtil $lpItemId = isset($_REQUEST['lp_item']) ? (int) $_REQUEST['lp_item'] : ''; $sessionId = api_get_session_id(); - $url = api_get_self().'?'.api_get_cidreq().'&action='.Security::remove_XSS($_GET['action']) .'&survey_id='.$surveyId.'&xaxis='.$xAxis.'&y='.$yAxis; diff --git a/src/Chamilo/CourseBundle/Entity/CSurveyAnswer.php b/src/Chamilo/CourseBundle/Entity/CSurveyAnswer.php index 30d108f927..096781fcfe 100644 --- a/src/Chamilo/CourseBundle/Entity/CSurveyAnswer.php +++ b/src/Chamilo/CourseBundle/Entity/CSurveyAnswer.php @@ -259,7 +259,7 @@ class CSurveyAnswer } /** - * Get session Id + * Get session Id. * * @return int */ @@ -269,7 +269,7 @@ class CSurveyAnswer } /** - * Set session Id + * Set session Id. * * @param int $sessionId * @@ -283,7 +283,7 @@ class CSurveyAnswer } /** - * Get the lp item Id + * Get the lp item Id. * * @return int */ @@ -293,9 +293,7 @@ class CSurveyAnswer } /** - * Set lp item Id - * - * @param int $lpItemId + * Set lp item Id. * * @return CSurveyAnswer */