Minor - format code + update docs

pull/2487/head
jmontoyaa 8 years ago
parent f0190a3144
commit 76c9db0d80
  1. 83
      main/exercise/exercise_result.class.php
  2. 8
      main/exercise/question.class.php
  3. 22
      main/exercise/unique_answer_no_option.class.php

@ -46,8 +46,7 @@ class ExerciseResult
$exercise_id = 0,
$hotpotato_name = null
) {
$return = array();
$return = array();
$TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST);
$TBL_TABLE_LP_MAIN = Database::get_course_table(TABLE_LP_MAIN);
@ -69,19 +68,19 @@ class ExerciseResult
if (empty($user_id)) {
$user_id_and = null;
$sql = "SELECT ".(api_is_western_name_order() ? "firstname as userpart1, lastname userpart2" : "lastname as userpart1, firstname as userpart2").",
official_code,
ce.title as extitle,
te.exe_result as exresult ,
te.exe_weighting as exweight,
te.exe_date as exdate,
te.exe_id as exid,
email as exemail,
te.start_date as exstart,
steps_counter as exstep,
exe_user_id as excruid,
te.exe_duration as duration,
te.orig_lp_id as orig_lp_id,
tlm.name as lp_name
official_code,
ce.title as extitle,
te.exe_result as exresult ,
te.exe_weighting as exweight,
te.exe_date as exdate,
te.exe_id as exid,
email as exemail,
te.start_date as exstart,
steps_counter as exstep,
exe_user_id as excruid,
te.exe_duration as duration,
te.orig_lp_id as orig_lp_id,
tlm.name as lp_name
FROM $TBL_EXERCISES AS ce
INNER JOIN $TBL_TRACK_EXERCISES AS te
ON (te.exe_exo_id = ce.id)
@ -97,21 +96,21 @@ class ExerciseResult
} else {
$user_id_and = ' AND te.exe_user_id = ' . api_get_user_id() . ' ';
// get only this user's results
$sql="SELECT ".(api_is_western_name_order() ? "firstname as userpart1, lastname userpart2" : "lastname as userpart1, firstname as userpart2").",
official_code,
ce.title as extitle,
te.exe_result as exresult,
te.exe_weighting as exweight,
te.exe_date as exdate,
te.exe_id as exid,
email as exemail,
te.start_date as exstart,
steps_counter as exstep,
exe_user_id as excruid,
te.exe_duration as duration,
ce.results_disabled as exdisabled,
te.orig_lp_id as orig_lp_id,
tlm.name as lp_name
$sql = "SELECT ".(api_is_western_name_order() ? "firstname as userpart1, lastname userpart2" : "lastname as userpart1, firstname as userpart2").",
official_code,
ce.title as extitle,
te.exe_result as exresult,
te.exe_weighting as exweight,
te.exe_date as exdate,
te.exe_id as exid,
email as exemail,
te.start_date as exstart,
steps_counter as exstep,
exe_user_id as excruid,
te.exe_duration as duration,
ce.results_disabled as exdisabled,
te.orig_lp_id as orig_lp_id,
tlm.name as lp_name
FROM $TBL_EXERCISES AS ce
INNER JOIN $TBL_TRACK_EXERCISES AS te
ON (te.exe_exo_id = ce.id)
@ -177,10 +176,12 @@ class ExerciseResult
$i = 0;
foreach ($results as $result) {
$revised = false;
//revised or not
$sql_exe = "SELECT exe_id FROM $TBL_TRACK_ATTEMPT_RECORDING
WHERE author != '' AND exe_id = ".Database :: escape_string($result['exid'])."
$sql_exe = "SELECT exe_id
FROM $TBL_TRACK_ATTEMPT_RECORDING
WHERE
author != '' AND
exe_id = ".Database :: escape_string($result['exid'])."
LIMIT 1";
$query = Database::query($sql_exe);
@ -276,8 +277,7 @@ class ExerciseResult
}
/**
* Exports the complete report as a CSV file
*
* Exports the complete report as a CSV file *
* @param string $document_path Document path inside the document tool
* @param integer $user_id Optional user ID
* @param boolean $export_user_fields Whether to include user fields or not
@ -410,7 +410,7 @@ class ExerciseResult
$data .= "\n";
}
//output the results
// output the results
$len = strlen($data);
header('Content-type: application/octet-stream');
header('Content-Type: application/force-download');
@ -662,7 +662,16 @@ class ExerciseResult
}
}
$worksheet->setCellValueByColumnAndRow($column, $line, api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset));
$worksheet->setCellValueByColumnAndRow(
$column,
$line,
api_html_entity_decode(
strip_tags($row['title']),
ENT_QUOTES,
$charset
)
);
$column++;
$worksheet->setCellValueByColumnAndRow($column, $line, $row['start_date']);
$column++;

@ -1571,15 +1571,15 @@ abstract class Question
/**
* abstract function which creates the form to create / edit the answers of the question
* @param the FormValidator instance
* @param FormValidator $form
*/
abstract function createAnswersForm($form);
abstract public function createAnswersForm($form);
/**
* abstract function which process the creation of answers
* @param the FormValidator instance
* @param the FormValidator $form
*/
abstract function processAnswersCreation($form);
abstract public function processAnswersCreation($form);
/**
* Displays the menu of question types

@ -17,20 +17,18 @@ class UniqueAnswerNoOption extends Question
public static $typePicture = 'mcuao.png';
public static $explanationLangVar = 'UniqueAnswerNoOption';
/**
* Constructor
*/
public function __construct()
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this -> type = UNIQUE_ANSWER_NO_OPTION;
$this -> isContent = $this-> getIsContent();
}
parent::__construct();
$this -> type = UNIQUE_ANSWER_NO_OPTION;
$this -> isContent = $this-> getIsContent();
}
/**
* function which redifines Question::createAnswersForm
* @param the formvalidator instance
* @param the answers number to display
/**
* @inheritdoc
*/
public function createAnswersForm($form)
{

Loading…
Cancel
Save