MDL-32322 quiz reports: fix PHPdoc comments. Thanks Smurf.

This commit is contained in:
Tim Hunt 2012-04-20 11:34:56 +01:00
parent c0270961a8
commit 9d58dae33b
5 changed files with 98 additions and 4 deletions

View File

@ -91,7 +91,8 @@ abstract class quiz_attempts_report extends quiz_default_report {
} }
/** /**
* @return moodle_url the base URL for this report. * Get the base URL for this report.
* @return moodle_url the URL.
*/ */
protected function get_base_url() { protected function get_base_url() {
return new moodle_url('/mod/quiz/report.php', return new moodle_url('/mod/quiz/report.php',

View File

@ -74,8 +74,10 @@ class mod_quiz_attempts_report_options {
/** /**
* Constructor. * Constructor.
* @param string $mode which report these options are for.
* @param object $quiz the settings for the quiz being reported on. * @param object $quiz the settings for the quiz being reported on.
* @param object $cm the course module objects for the quiz being reported on. * @param object $cm the course module objects for the quiz being reported on.
* @param object $coures the course settings for the coures this quiz is in.
*/ */
public function __construct($mode, $quiz, $cm, $course) { public function __construct($mode, $quiz, $cm, $course) {
$this->mode = $mode; $this->mode = $mode;
@ -87,7 +89,8 @@ class mod_quiz_attempts_report_options {
} }
/** /**
* @return array the URL parameters required to show the report with these options. * Get the URL parameters required to show the report with these options.
* @return array URL parameter name => value.
*/ */
protected function get_url_params() { protected function get_url_params() {
return array( return array(
@ -99,7 +102,8 @@ class mod_quiz_attempts_report_options {
} }
/** /**
* @return moodle_url the URL to show the report with these options. * Get the URL to show the report with these options.
* @return moodle_url the URL.
*/ */
public function get_url() { public function get_url() {
return new moodle_url('/mod/quiz/report.php', $this->get_url_params()); return new moodle_url('/mod/quiz/report.php', $this->get_url_params());

View File

@ -49,17 +49,48 @@ abstract class quiz_attempts_report_table extends table_sql {
*/ */
protected $lateststeps = null; protected $lateststeps = null;
/** @var object the quiz settings for the quiz we are reporting on. */
protected $quiz; protected $quiz;
/** @var context the quiz context. */
protected $context; protected $context;
/** @var string HTML fragment to select the first/best/last attempt, if appropriate. */
protected $qmsubselect; protected $qmsubselect;
/** @var object mod_quiz_attempts_report_options the options affecting this report. */
protected $options; protected $options;
/** @var bool whether to only display the first/best/last attempt for each student. */
protected $qmfilter; protected $qmfilter;
/** @var int which attempts/students to include in the report.. */
protected $attemptsmode; protected $attemptsmode;
/** @var object the ids of the students in the currently selected group, if applicable. */
protected $groupstudents; protected $groupstudents;
/** @var object the ids of the students in the course. */
protected $students; protected $students;
/** @var object the questions that comprise this quiz.. */
protected $questions; protected $questions;
/** @var bool whether to include the column with checkboxes to select each attempt. */
protected $includecheckboxes; protected $includecheckboxes;
/**
* Constructor
* @param string $uniqueid
* @param object $quiz
* @param context $context
* @param string $qmsubselect
* @param mod_quiz_attempts_report_options $options
* @param array $groupstudents
* @param array $students
* @param array $questions
* @param moodle_url $reporturl
*/
public function __construct($uniqueid, $quiz, $context, $qmsubselect, public function __construct($uniqueid, $quiz, $context, $qmsubselect,
mod_quiz_attempts_report_options $options, $groupstudents, $students, mod_quiz_attempts_report_options $options, $groupstudents, $students,
$questions, $reporturl) { $questions, $reporturl) {
@ -77,6 +108,11 @@ abstract class quiz_attempts_report_table extends table_sql {
$this->options = $options; $this->options = $options;
} }
/**
* Generate the display of the checkbox column.
* @param object $attempt the table row being output.
* @return string HTML content to go inside the td.
*/
public function col_checkbox($attempt) { public function col_checkbox($attempt) {
if ($attempt->attempt) { if ($attempt->attempt) {
return '<input type="checkbox" name="attemptid[]" value="'.$attempt->attempt.'" />'; return '<input type="checkbox" name="attemptid[]" value="'.$attempt->attempt.'" />';
@ -85,6 +121,11 @@ abstract class quiz_attempts_report_table extends table_sql {
} }
} }
/**
* Generate the display of the user's picture column.
* @param object $attempt the table row being output.
* @return string HTML content to go inside the td.
*/
public function col_picture($attempt) { public function col_picture($attempt) {
global $OUTPUT; global $OUTPUT;
$user = new stdClass(); $user = new stdClass();
@ -97,6 +138,11 @@ abstract class quiz_attempts_report_table extends table_sql {
return $OUTPUT->user_picture($user); return $OUTPUT->user_picture($user);
} }
/**
* Generate the display of the user's full name column.
* @param object $attempt the table row being output.
* @return string HTML content to go inside the td.
*/
public function col_fullname($attempt) { public function col_fullname($attempt) {
$html = parent::col_fullname($attempt); $html = parent::col_fullname($attempt);
if ($this->is_downloading()) { if ($this->is_downloading()) {
@ -108,6 +154,11 @@ abstract class quiz_attempts_report_table extends table_sql {
get_string('reviewattempt', 'quiz'), array('class' => 'reviewlink')); get_string('reviewattempt', 'quiz'), array('class' => 'reviewlink'));
} }
/**
* Generate the display of the start time column.
* @param object $attempt the table row being output.
* @return string HTML content to go inside the td.
*/
public function col_timestart($attempt) { public function col_timestart($attempt) {
if ($attempt->attempt) { if ($attempt->attempt) {
return userdate($attempt->timestart, $this->strtimeformat); return userdate($attempt->timestart, $this->strtimeformat);
@ -116,6 +167,11 @@ abstract class quiz_attempts_report_table extends table_sql {
} }
} }
/**
* Generate the display of the finish time column.
* @param object $attempt the table row being output.
* @return string HTML content to go inside the td.
*/
public function col_timefinish($attempt) { public function col_timefinish($attempt) {
if ($attempt->attempt && $attempt->timefinish) { if ($attempt->attempt && $attempt->timefinish) {
return userdate($attempt->timefinish, $this->strtimeformat); return userdate($attempt->timefinish, $this->strtimeformat);
@ -124,6 +180,11 @@ abstract class quiz_attempts_report_table extends table_sql {
} }
} }
/**
* Generate the display of the time taken column.
* @param object $attempt the table row being output.
* @return string HTML content to go inside the td.
*/
public function col_duration($attempt) { public function col_duration($attempt) {
if ($attempt->timefinish) { if ($attempt->timefinish) {
return format_time($attempt->timefinish - $attempt->timestart); return format_time($attempt->timefinish - $attempt->timestart);
@ -134,6 +195,11 @@ abstract class quiz_attempts_report_table extends table_sql {
} }
} }
/**
* Generate the display of the feedback column.
* @param object $attempt the table row being output.
* @return string HTML content to go inside the td.
*/
public function col_feedbacktext($attempt) { public function col_feedbacktext($attempt) {
if (!$attempt->timefinish) { if (!$attempt->timefinish) {
return '-'; return '-';
@ -224,7 +290,6 @@ abstract class quiz_attempts_report_table extends table_sql {
* *
* @param qubaid_condition $qubaids used to restrict which usages are included * @param qubaid_condition $qubaids used to restrict which usages are included
* in the query. See {@link qubaid_condition}. * in the query. See {@link qubaid_condition}.
* @param array $slots A list of slots for the questions you want to konw about.
* @return array of records. See the SQL in this function to see the fields available. * @return array of records. See the SQL in this function to see the fields available.
*/ */
protected function load_question_latest_steps(qubaid_condition $qubaids) { protected function load_question_latest_steps(qubaid_condition $qubaids) {
@ -241,6 +306,8 @@ abstract class quiz_attempts_report_table extends table_sql {
} }
/** /**
* Does this report require the detailed information for each question from the
* question_attempts_steps table?
* @return bool should {@link query_db()} call {@link load_question_latest_steps}? * @return bool should {@link query_db()} call {@link load_question_latest_steps}?
*/ */
protected function requires_latest_steps_loaded() { protected function requires_latest_steps_loaded() {

View File

@ -38,6 +38,17 @@ class quiz_overview_table extends quiz_attempts_report_table {
protected $regradedqs = array(); protected $regradedqs = array();
/**
* Constructor
* @param object $quiz
* @param context $context
* @param string $qmsubselect
* @param quiz_overview_options $options
* @param array $groupstudents
* @param array $students
* @param array $questions
* @param moodle_url $reporturl
*/
public function __construct($quiz, $context, $qmsubselect, public function __construct($quiz, $context, $qmsubselect,
quiz_overview_options $options, $groupstudents, $students, $questions, $reporturl) { quiz_overview_options $options, $groupstudents, $students, $questions, $reporturl) {
parent::__construct('mod-quiz-report-overview-report', $quiz , $context, parent::__construct('mod-quiz-report-overview-report', $quiz , $context,

View File

@ -36,6 +36,17 @@ require_once($CFG->dirroot . '/mod/quiz/report/attemptsreport_table.php');
*/ */
class quiz_responses_table extends quiz_attempts_report_table { class quiz_responses_table extends quiz_attempts_report_table {
/**
* Constructor
* @param object $quiz
* @param context $context
* @param string $qmsubselect
* @param quiz_responses_options $options
* @param array $groupstudents
* @param array $students
* @param array $questions
* @param moodle_url $reporturl
*/
public function __construct($quiz, $context, $qmsubselect, quiz_responses_options $options, public function __construct($quiz, $context, $qmsubselect, quiz_responses_options $options,
$groupstudents, $students, $questions, $reporturl) { $groupstudents, $students, $questions, $reporturl) {
parent::__construct('mod-quiz-report-responses-report', $quiz, $context, parent::__construct('mod-quiz-report-responses-report', $quiz, $context,