Minor - Fix psalm issues

pull/3432/head
Julio Montoya 5 years ago
parent b81286c4b6
commit 18cd94a5cb
  1. 10
      public/main/course_progress/index.php
  2. 6
      public/main/exercise/admin.php
  3. 13
      public/main/exercise/aiken.php
  4. 2
      public/main/exercise/exercise.php
  5. 8
      public/main/exercise/exercise_report.php
  6. 6
      public/main/exercise/exercise_show.php
  7. 5
      public/main/exercise/exercise_submit.php
  8. 5
      public/main/exercise/export/qti2/Ims2Question.php
  9. 2
      public/main/exercise/hotspot_actionscript.as.php
  10. 10
      public/main/inc/lib/api.lib.php
  11. 15
      public/main/inc/lib/course_description.lib.php

@ -17,6 +17,7 @@ $current_course_tool = TOOL_COURSE_PROGRESS;
// protect a course script // protect a course script
api_protect_course_script(true); api_protect_course_script(true);
$courseId = api_get_course_int_id(); $courseId = api_get_course_int_id();
$description_type = null;
// get actions // get actions
$actions = [ $actions = [
@ -132,7 +133,6 @@ $interbreadcrumb[] = [
]; ];
$actionLeft = ''; $actionLeft = '';
// instance thematic object for using like library here // instance thematic object for using like library here
$thematicManager = new Thematic(); $thematicManager = new Thematic();
@ -724,10 +724,10 @@ switch ($action) {
} else { } else {
$header_form = $default_thematic_plan_title[$description_type]; $header_form = $default_thematic_plan_title[$description_type];
} }
if (!$error) { /*if (!$error) {
$token = md5(uniqid(rand(), true)); $token = md5(uniqid(rand(), true));
Session::write('thematic_plan_token', $token); Session::write('thematic_plan_token', $token);
} }*/
// display form // display form
$form = new FormValidator( $form = new FormValidator(
@ -779,7 +779,7 @@ switch ($action) {
} }
// error messages // error messages
if ($error) { /*if ($error) {
Display::addFlash( Display::addFlash(
Display::return_message( Display::return_message(
get_lang('The form contains incorrect or incomplete data. Please check your input.'), get_lang('The form contains incorrect or incomplete data. Please check your input.'),
@ -787,7 +787,7 @@ switch ($action) {
false false
) )
); );
} }*/
$content = $form->returnForm(); $content = $form->returnForm();
break; break;
case 'thematic_plan_delete': case 'thematic_plan_delete':

@ -106,12 +106,12 @@ if (isset($_REQUEST['convertAnswer'])) {
$objAnswer = Session::read('objAnswer'); $objAnswer = Session::read('objAnswer');
$_course = api_get_course_info(); $_course = api_get_course_info();
// tables used in the exercise tool // tables used in the exercise tool.
if (!empty($_GET['action']) && 'exportqti2' == $_GET['action'] && !empty($_GET['questionId'])) { if (!empty($_GET['action']) && 'exportqti2' === $_GET['action'] && !empty($_GET['questionId'])) {
require_once 'export/qti2/qti2_export.php'; require_once 'export/qti2/qti2_export.php';
$export = export_question_qti($_GET['questionId'], true); $export = export_question_qti($_GET['questionId'], true);
$qid = (int) $_GET['questionId']; $qid = (int) $_GET['questionId'];
$name = 'qti2_export_'.$qid.'.zip';
$zip = api_create_zip($name); $zip = api_create_zip($name);
$zip->addFile("qti2export_$qid.xml", $export); $zip->addFile("qti2export_$qid.xml", $export);
$zip->finish(); $zip->finish();

@ -12,12 +12,8 @@ require_once __DIR__.'/../inc/global.inc.php';
api_protect_course_script(true); api_protect_course_script(true);
$lib_path = api_get_path(LIBRARY_PATH); require_once __DIR__.'/export/aiken/aiken_import.inc.php';
$main_path = api_get_path(SYS_CODE_PATH); require_once __DIR__.'/export/aiken/aiken_classes.php';
// including additional libraries
require_once $main_path.'exercise/export/aiken/aiken_import.inc.php';
require_once $main_path.'exercise/export/aiken/aiken_classes.php';
// section (for the tabs) // section (for the tabs)
$this_section = SECTION_COURSES; $this_section = SECTION_COURSES;
@ -44,11 +40,6 @@ if (api_is_allowed_to_edit(null, true)) {
} }
} }
// display header
Display::display_header(get_lang('Import Aiken quiz'), 'Exercises'); Display::display_header(get_lang('Import Aiken quiz'), 'Exercises');
// display Aiken form
aiken_display_form(); aiken_display_form();
// display the footer
Display::display_footer(); Display::display_footer();

@ -231,7 +231,7 @@ if ($is_allowedToEdit && !empty($action)) {
if ($limitTeacherAccess && !api_is_platform_admin()) { if ($limitTeacherAccess && !api_is_platform_admin()) {
api_not_allowed(true); api_not_allowed(true);
} }
require_once api_get_path(SYS_CODE_PATH).'exercise/export/qti2/qti2_export.php'; require_once __DIR__.'/export/qti2/qti2_export.php';
$export = export_exercise_to_qti($exerciseId, true); $export = export_exercise_to_qti($exerciseId, true);
$xmlReader = new XMLReader(); $xmlReader = new XMLReader();

@ -203,7 +203,11 @@ if (isset($_REQUEST['comments']) &&
} }
// From the database. // From the database.
$marksFromDatabase = 0;
if (isset($questionListData[$questionId])) {
$marksFromDatabase = $questionListData[$questionId]['marks']; $marksFromDatabase = $questionListData[$questionId]['marks'];
}
if (in_array($question->type, [FREE_ANSWER, ORAL_EXPRESSION, ANNOTATION])) { if (in_array($question->type, [FREE_ANSWER, ORAL_EXPRESSION, ANNOTATION])) {
// From the form. // From the form.
$params['marks'] = $marks; $params['marks'] = $marks;
@ -232,11 +236,11 @@ if (isset($_REQUEST['comments']) &&
$recording = new TrackEAttemptRecording(); $recording = new TrackEAttemptRecording();
$recording $recording
->setExeId($id) ->setExeId($id)
->setQuestionId($my_questionid) ->setQuestionId($questionId)
->setAuthor(api_get_user_id()) ->setAuthor(api_get_user_id())
->setTeacherComment($my_comments) ->setTeacherComment($my_comments)
->setExeId($id) ->setExeId($id)
->setMarks($my_marks) ->setMarks($marks)
->setSessionId(api_get_session_id()) ->setSessionId(api_get_session_id())
; ;

@ -570,7 +570,7 @@ foreach ($questionList as $questionId) {
<script> <script>
AnnotationQuestion({ AnnotationQuestion({
questionId: '.(int) $questionId.', questionId: '.(int) $questionId.',
exerciseId: '.(int) $id.', exerciseId: '.$id.',
relPath: \''.$relPath.'\', relPath: \''.$relPath.'\',
courseId: '.(int) $courseInfo['real_id'].' courseId: '.(int) $courseInfo['real_id'].'
}); });
@ -850,14 +850,12 @@ foreach ($questionList as $questionId) {
$countPendingQuestions++; $countPendingQuestions++;
} }
} }
unset($objAnswerTmp);
$i++; $i++;
$contents = ob_get_clean(); $contents = ob_get_clean();
$question_content = '<div class="question_row">'; $question_content = '<div class="question_row">';
if ($show_results && $objQuestionTmp) { if ($show_results && $objQuestionTmp) {
$objQuestionTmp->export = 'export' == $action; $objQuestionTmp->export = 'export' === $action;
// Shows question title an description // Shows question title an description
$question_content .= $objQuestionTmp->return_header( $question_content .= $objQuestionTmp->return_header(
$objExercise, $objExercise,

@ -1136,7 +1136,8 @@ if ($limit_time_exists) {
} }
// Blocking empty start times see BT#2800 // Blocking empty start times see BT#2800
global $_custom; // @todo use api_get_configuration_value()
/*global $_custom;
if (isset($_custom['exercises_hidden_when_no_start_date']) && if (isset($_custom['exercises_hidden_when_no_start_date']) &&
$_custom['exercises_hidden_when_no_start_date'] $_custom['exercises_hidden_when_no_start_date']
) { ) {
@ -1154,7 +1155,7 @@ if (isset($_custom['exercises_hidden_when_no_start_date']) &&
exit; exit;
} }
} }
} }*/
if ($time_control) { if ($time_control) {
echo $objExercise->returnTimeLeftDiv(); echo $objExercise->returnTimeLeftDiv();

@ -17,6 +17,7 @@ class Ims2Question extends Question
public function setAnswer() public function setAnswer()
{ {
switch ($this->type) { switch ($this->type) {
case TF:
case MCUA: case MCUA:
$answer = new ImsAnswerMultipleChoice($this->id); $answer = new ImsAnswerMultipleChoice($this->id);
@ -24,10 +25,6 @@ class Ims2Question extends Question
case MCMA: case MCMA:
$answer = new ImsAnswerMultipleChoice($this->id); $answer = new ImsAnswerMultipleChoice($this->id);
return $answer;
case TF:
$answer = new ImsAnswerMultipleChoice($this->id);
return $answer; return $answer;
case FIB: case FIB:
$answer = new ImsAnswerFillInBlanks($this->id); $answer = new ImsAnswerFillInBlanks($this->id);

@ -113,7 +113,7 @@ $attemptInfo = Database::select(
[ [
'where' => [ 'where' => [
'exe_exo_id = ? AND c_id = ? AND exe_user_id = ? AND status = ?' => [ 'exe_exo_id = ? AND c_id = ? AND exe_user_id = ? AND status = ?' => [
(int) $exerciseId, $exerciseId,
$course_id, $course_id,
api_get_user_id(), api_get_user_id(),
'incomplete', 'incomplete',

@ -18,6 +18,8 @@ use Symfony\Component\Finder\Finder;
use Symfony\Component\Mime\Address; use Symfony\Component\Mime\Address;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Core\User\UserInterface;
use ZipStream\Option\Archive;
use ZipStream\ZipStream;
/** /**
* This is a code library for Chamilo. * This is a code library for Chamilo.
@ -8434,18 +8436,16 @@ function api_get_language_list_for_flag()
/** /**
* @param string $name * @param string $name
* *
* @return \ZipStream\ZipStream * @return ZipStream
*/ */
function api_create_zip($name) function api_create_zip($name)
{ {
$zipStreamOptions = new \ZipStream\Option\Archive(); $zipStreamOptions = new Archive();
$zipStreamOptions->setSendHttpHeaders(true); $zipStreamOptions->setSendHttpHeaders(true);
$zipStreamOptions->setContentDisposition('attachment'); $zipStreamOptions->setContentDisposition('attachment');
$zipStreamOptions->setContentType('application/x-zip'); $zipStreamOptions->setContentType('application/x-zip');
$zip = new \ZipStream\ZipStream($name, $zipStreamOptions); return new ZipStream($name, $zipStreamOptions);
return $zip;
} }
/** /**

@ -2,6 +2,9 @@
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CCourseDescription;
/** /**
* This file contains a class used like library provides functions for * This file contains a class used like library provides functions for
* course description tool. It's also used like model to * course description tool. It's also used like model to
@ -9,13 +12,6 @@
* *
* @author Christian Fasanando <christian1827@gmail.com> * @author Christian Fasanando <christian1827@gmail.com>
*/ */
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CCourseDescription;
/**
* Class CourseDescription course descriptions.
*/
class CourseDescription class CourseDescription
{ {
private $id; private $id;
@ -26,9 +22,6 @@ class CourseDescription
private $description_type; private $description_type;
private $progress; private $progress;
/**
* Constructor.
*/
public function __construct() public function __construct()
{ {
} }
@ -115,7 +108,7 @@ class CourseDescription
* first you must set session_id property with the object CourseDescription. * first you must set session_id property with the object CourseDescription.
* *
* @param int $description_type Description type * @param int $description_type Description type
* @param string $courseId Course code (optional) * @param int $courseId Course code (optional)
* @param int $session_id Session id (optional) * @param int $session_id Session id (optional)
* *
* @return array List of fields from the descriptions found of the given type * @return array List of fields from the descriptions found of the given type

Loading…
Cancel
Save