Minor: Fix code style

pull/4086/head
Angel Fernando Quiroz Campos 4 years ago committed by GitHub
parent fed86b0eda
commit da0ff1b2e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      main/exercise/exercise.class.php
  2. 2
      main/exercise/fill_blanks.class.php
  3. 12
      main/inc/lib/MoodleImport.php
  4. 10
      main/inc/lib/image.lib.php
  5. 2
      main/inc/lib/legal.lib.php
  6. 82
      main/inc/lib/sessionmanager.lib.php
  7. 4
      main/inc/lib/tracking.lib.php
  8. 4
      main/lp/learnpath.class.php
  9. 5
      main/survey/surveyUtil.class.php
  10. 10
      src/Chamilo/CourseBundle/Entity/CSurveyAnswer.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);

@ -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,

@ -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)
{

@ -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);

@ -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)
{

@ -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()
);
}
}
}

@ -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
*

@ -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);
}

@ -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;

@ -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
*/

Loading…
Cancel
Save