Minor - format code.

pull/2487/head
jmontoyaa 8 years ago
parent 15a5074e3d
commit 0c4d9ec95a
  1. 40
      main/exercise/export/qti2/qti2_export.php
  2. 11
      main/exercise/fill_blanks.class.php

@ -43,7 +43,7 @@ class ImsAssessmentItem
* This opens the <item> block, with correct attributes.
*
*/
function start_item()
public function start_item()
{
$categoryTitle = '';
if (!empty($this->question->category)) {
@ -69,7 +69,7 @@ class ImsAssessmentItem
* End the XML flow, closing the </item> tag.
*
*/
function end_item()
public function end_item()
{
return "</assessmentItem>\n";
}
@ -78,7 +78,7 @@ class ImsAssessmentItem
* Start the itemBody
*
*/
function start_item_body()
public function start_item_body()
{
return ' <itemBody>'."\n";
}
@ -87,7 +87,7 @@ class ImsAssessmentItem
* End the itemBody part.
*
*/
function end_item_body()
public function end_item_body()
{
return " </itemBody>\n";
}
@ -96,7 +96,7 @@ class ImsAssessmentItem
* add the response processing template used.
*
*/
function add_response_processing()
public function add_response_processing()
{
return ' <responseProcessing template="http://www.imsglobal.org/question/qti_v2p1/rptemplates/map_correct"/>'."\n";
}
@ -109,7 +109,7 @@ class ImsAssessmentItem
* @param $standalone: Boolean stating if it should be exported as a stand-alone question
* @return string string, the XML flow for an Item.
*/
function export($standalone = false)
public function export($standalone = false)
{
$head = $foot = '';
if ($standalone) {
@ -168,7 +168,7 @@ class ImsSection
$this->exercise = $exe;
}
function start_section()
public function start_section()
{
$out = '<section
ident = "EXO_' . $this->exercise->selectId().'"
@ -177,12 +177,12 @@ class ImsSection
return $out;
}
function end_section()
public function end_section()
{
return "</section>\n";
}
function export_duration()
public function export_duration()
{
if ($max_time = $this->exercise->selectTimeLimit()) {
// return exercise duration in ISO8601 format.
@ -198,7 +198,7 @@ class ImsSection
* Export the presentation (Exercise's description)
* @author Amand Tihon <amand@alrj.org>
*/
function export_presentation()
public function export_presentation()
{
$out = "<presentation_material><flow_mat><material>\n"
. " <mattext><![CDATA[".formatExerciseQtiDescription($this->exercise->selectDescription())."]]></mattext>\n"
@ -211,7 +211,7 @@ class ImsSection
* Either sequential, through all questions, or random, with a selected number of questions.
* @author Amand Tihon <amand@alrj.org>
*/
function export_ordering()
public function export_ordering()
{
$out = '';
if ($n = $this->exercise->getShuffle()) {
@ -234,7 +234,7 @@ class ImsSection
* Export the questions, as a succession of <items>
* @author Amand Tihon <amand@alrj.org>
*/
function export_questions()
public function export_questions()
{
$out = '';
foreach ($this->exercise->selectQuestionList() as $q) {
@ -250,7 +250,7 @@ class ImsSection
* @return string string containing the XML flow
* @author Amand Tihon <amand@alrj.org>
*/
function export($standalone)
public function export($standalone)
{
$head = $foot = '';
if ($standalone) {
@ -326,7 +326,7 @@ class ImsItem
*
* @author Amand Tihon <amand@alrj.org>
*/
function start_item()
public function start_item()
{
return '<item title="'.cleanAttribute(formatExerciseQtiDescription($this->question->selectTitle())).'" ident="'.$this->questionIdent.'">'."\n";
}
@ -336,7 +336,7 @@ class ImsItem
*
* @author Amand Tihon <amand@alrj.org>
*/
function end_item()
public function end_item()
{
return "</item>\n";
}
@ -349,7 +349,7 @@ class ImsItem
*
* @author Amand Tihon <amand@alrj.org>
*/
function start_presentation()
public function start_presentation()
{
return '<presentation label="'.$this->questionIdent.'"><flow>'."\n"
. '<material><mattext>'.formatExerciseQtiDescription($this->question->selectDescription())."</mattext></material>\n";
@ -360,7 +360,7 @@ class ImsItem
*
* @author Amand Tihon <amand@alrj.org>
*/
function end_presentation()
public function end_presentation()
{
return "</flow></presentation>\n";
}
@ -370,7 +370,7 @@ class ImsItem
*
* @author Amand Tihon <amand@alrj.org>
*/
function start_processing()
public function start_processing()
{
return '<resprocessing><outcomes><decvar vartype="Integer" defaultval="0" /></outcomes>'."\n";
}
@ -380,7 +380,7 @@ class ImsItem
*
* @author Amand Tihon <amand@alrj.org>
*/
function end_processing()
public function end_processing()
{
return "</resprocessing>\n";
}
@ -394,7 +394,7 @@ class ImsItem
* @return string string, the XML flow for an Item.
* @author Amand Tihon <amand@alrj.org>
*/
function export($standalone = False)
public function export($standalone = False)
{
global $charset;
$head = $foot = "";

@ -497,7 +497,6 @@ class FillBlanks extends Question
$displayForStudent,
$inBlankNumber
) {
$result = '';
$inTabTeacherSolution = $listAnswersInfo['tabwords'];
$inTeacherSolution = $inTabTeacherSolution[$inBlankNumber];
switch (self::getFillTheBlankAnswerType($inTeacherSolution)) {
@ -506,12 +505,14 @@ class FillBlanks extends Question
// the blank menu
// display a menu from answer separated with |
// if display for student, shuffle the correct answer menu
$listMenu = self::getFillTheBlankMenuAnswers($inTeacherSolution, $displayForStudent);
$resultOptions = ['' => '--'];
$listMenu = self::getFillTheBlankMenuAnswers(
$inTeacherSolution,
$displayForStudent
);
$resultOptions = ['' => '--'];
foreach ($listMenu as $item) {
$item = self::trimOption($item);
$resultOptions[$item] = $item;
}
@ -749,7 +750,7 @@ class FillBlanks extends Question
// remove [ and ] in string
array_walk(
$listWords[0],
function(&$value, $key, $tabBlankChar) {
function (&$value, $key, $tabBlankChar) {
$trimChars = '';
for ($i = 0; $i < count($tabBlankChar); $i++) {
$trimChars .= $tabBlankChar[$i];

Loading…
Cancel
Save