MDL-20636 Eliminate integer and boolean in PHPdoc comments. should be int and bool.
This commit is contained in:
+40
-40
@@ -32,8 +32,8 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* This class keeps track of the various access rules that apply to a particular
|
||||
* quiz, with convinient methods for seeing whether access is allowed.
|
||||
*
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class quiz_access_manager {
|
||||
private $_quizobj;
|
||||
@@ -47,8 +47,8 @@ class quiz_access_manager {
|
||||
* Create an instance for a particular quiz.
|
||||
* @param object $quizobj An instance of the class quiz from attemptlib.php.
|
||||
* The quiz we will be controlling access to.
|
||||
* @param integer $timenow The time to use as 'now'.
|
||||
* @param boolean $canignoretimelimits Whether this user is exempt from time
|
||||
* @param int $timenow The time to use as 'now'.
|
||||
* @param bool $canignoretimelimits Whether this user is exempt from time
|
||||
* limits (has_capability('mod/quiz:ignoretimelimits', ...)).
|
||||
*/
|
||||
public function __construct($quizobj, $timenow, $canignoretimelimits) {
|
||||
@@ -99,7 +99,7 @@ class quiz_access_manager {
|
||||
* Print each message in an array, surrounded by <p>, </p> tags.
|
||||
*
|
||||
* @param array $messages the array of message strings.
|
||||
* @param boolean $return if true, return a string, instead of outputting.
|
||||
* @param bool $return if true, return a string, instead of outputting.
|
||||
*
|
||||
* @return mixed, if $return is true, return the string that would have been output, otherwise
|
||||
* return null.
|
||||
@@ -137,7 +137,7 @@ class quiz_access_manager {
|
||||
* any restrictions in force now, return an array of reasons why access
|
||||
* should be blocked. If access is OK, return false.
|
||||
*
|
||||
* @param integer $numattempts the number of previous attempts this user has made.
|
||||
* @param int $numattempts the number of previous attempts this user has made.
|
||||
* @param object|false $lastattempt information about the user's last completed attempt.
|
||||
* if there is not a previous attempt, the false is passed.
|
||||
* @return mixed An array of reason why access is not allowed, or an empty array
|
||||
@@ -173,9 +173,9 @@ class quiz_access_manager {
|
||||
* quiz. Used, for example, to change the label by the grade displayed on the view page from
|
||||
* 'your current grade is' to 'your final grade is'.
|
||||
*
|
||||
* @param integer $numattempts the number of previous attempts this user has made.
|
||||
* @param int $numattempts the number of previous attempts this user has made.
|
||||
* @param object $lastattempt information about the user's last completed attempt.
|
||||
* @return boolean true if there is no way the user will ever be allowed to attempt this quiz again.
|
||||
* @return bool true if there is no way the user will ever be allowed to attempt this quiz again.
|
||||
*/
|
||||
public function is_finished($numprevattempts, $lastattempt) {
|
||||
foreach ($this->_rules as $rule) {
|
||||
@@ -233,10 +233,10 @@ class quiz_access_manager {
|
||||
* depending on the access restrictions. The link will pop up a 'secure' window, if
|
||||
* necessary.
|
||||
*
|
||||
* @param boolean $canpreview whether this user can preview. This affects whether they must
|
||||
* @param bool $canpreview whether this user can preview. This affects whether they must
|
||||
* use a secure window.
|
||||
* @param string $buttontext the label to put on the button.
|
||||
* @param boolean $unfinished whether the button is to continue an existing attempt,
|
||||
* @param bool $unfinished whether the button is to continue an existing attempt,
|
||||
* or start a new one. This affects whether a javascript alert is shown.
|
||||
*/
|
||||
public function print_start_attempt_button($canpreview, $buttontext, $unfinished) {
|
||||
@@ -272,7 +272,7 @@ class quiz_access_manager {
|
||||
* Send the user back to the quiz view page. Normally this is just a redirect, but
|
||||
* If we were in a secure window, we close this window, and reload the view window we came from.
|
||||
*
|
||||
* @param boolean $canpreview This affects whether we have to worry about secure window stuff.
|
||||
* @param bool $canpreview This affects whether we have to worry about secure window stuff.
|
||||
*/
|
||||
public function back_to_view_page($canpreview, $message = '') {
|
||||
global $CFG, $OUTPUT, $PAGE;
|
||||
@@ -301,7 +301,7 @@ class quiz_access_manager {
|
||||
* Print a control to finish the review. Normally this is just a link, but if we are
|
||||
* in a secure window, it needs to be a button that does M.mod_quiz.secure_window.close.
|
||||
*
|
||||
* @param boolean $canpreview This affects whether we have to worry about secure window stuff.
|
||||
* @param bool $canpreview This affects whether we have to worry about secure window stuff.
|
||||
*/
|
||||
public function print_finish_review_link($canpreview, $return = false) {
|
||||
global $CFG;
|
||||
@@ -343,7 +343,7 @@ class quiz_access_manager {
|
||||
* Actually ask the user for the password, if they have not already given it this session.
|
||||
* This function only returns is access is OK.
|
||||
*
|
||||
* @param boolean $canpreview used to enfore securewindow stuff.
|
||||
* @param bool $canpreview used to enfore securewindow stuff.
|
||||
*/
|
||||
public function do_password_check($canpreview) {
|
||||
if (!is_null($this->_passwordrule)) {
|
||||
@@ -409,9 +409,9 @@ class quiz_access_manager {
|
||||
* If $reviewoptions->attempt is false, meaning that students can't review this
|
||||
* attempt at the moment, return an appropriate string explaining why.
|
||||
*
|
||||
* @param integer $when One of the mod_quiz_display_options::DURING,
|
||||
* @param int $when One of the mod_quiz_display_options::DURING,
|
||||
* IMMEDIATELY_AFTER, LATER_WHILE_OPEN or AFTER_CLOSE constants.
|
||||
* @param boolean $short if true, return a shorter string.
|
||||
* @param bool $short if true, return a shorter string.
|
||||
* @return string an appropraite message.
|
||||
*/
|
||||
public function cannot_review_message($when, $short = false) {
|
||||
@@ -444,8 +444,8 @@ class quiz_access_manager {
|
||||
* as true) if access should be blocked. Slighly unnatural, but acutally the easist
|
||||
* way to implement this.
|
||||
*
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
abstract class quiz_access_rule_base {
|
||||
protected $_quiz;
|
||||
@@ -462,7 +462,7 @@ abstract class quiz_access_rule_base {
|
||||
}
|
||||
/**
|
||||
* Whether or not a user should be allowed to start a new attempt at this quiz now.
|
||||
* @param integer $numattempts the number of previous attempts this user has made.
|
||||
* @param int $numattempts the number of previous attempts this user has made.
|
||||
* @param object $lastattempt information about the user's last completed attempt.
|
||||
* @return string false if access should be allowed, a message explaining the reason if access should be prevented.
|
||||
*/
|
||||
@@ -491,9 +491,9 @@ abstract class quiz_access_rule_base {
|
||||
* this quiz, then return true. This is used so we can know whether to display a
|
||||
* final grade on the view page. This will only be called if there is not a currently
|
||||
* active attempt for this user.
|
||||
* @param integer $numattempts the number of previous attempts this user has made.
|
||||
* @param int $numattempts the number of previous attempts this user has made.
|
||||
* @param object $lastattempt information about the user's last completed attempt.
|
||||
* @return boolean true if this rule means that this user will never be allowed another
|
||||
* @return bool true if this rule means that this user will never be allowed another
|
||||
* attempt at this quiz.
|
||||
*/
|
||||
public function is_finished($numprevattempts, $lastattempt) {
|
||||
@@ -504,7 +504,7 @@ abstract class quiz_access_rule_base {
|
||||
* If, becuase of this rule, the user has to finish their attempt by a certain time,
|
||||
* you should override this method to return the amount of time left in seconds.
|
||||
* @param object $attempt the current attempt
|
||||
* @param integer $timenow the time now. We don't use $this->_timenow, so we can
|
||||
* @param int $timenow the time now. We don't use $this->_timenow, so we can
|
||||
* give the user a more accurate indication of how much time is left.
|
||||
* @return mixed false if there is no deadline, of the time left in seconds if there is one.
|
||||
*/
|
||||
@@ -516,8 +516,8 @@ abstract class quiz_access_rule_base {
|
||||
/**
|
||||
* A rule controlling the number of attempts allowed.
|
||||
*
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class num_attempts_access_rule extends quiz_access_rule_base {
|
||||
public function description() {
|
||||
@@ -537,8 +537,8 @@ class num_attempts_access_rule extends quiz_access_rule_base {
|
||||
/**
|
||||
* A rule enforcing open and close dates.
|
||||
*
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class open_close_date_access_rule extends quiz_access_rule_base {
|
||||
public function description() {
|
||||
@@ -589,8 +589,8 @@ class open_close_date_access_rule extends quiz_access_rule_base {
|
||||
/**
|
||||
* A rule imposing the delay between attemtps settings.
|
||||
*
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class inter_attempt_delay_access_rule extends quiz_access_rule_base {
|
||||
public function prevent_new_attempt($numprevattempts, $lastattempt) {
|
||||
@@ -616,7 +616,7 @@ class inter_attempt_delay_access_rule extends quiz_access_rule_base {
|
||||
/**
|
||||
* Compute the next time a student would be allowed to start an attempt,
|
||||
* according to this rule.
|
||||
* @param integer $numprevattempts number of previous attempts.
|
||||
* @param int $numprevattempts number of previous attempts.
|
||||
* @param object $lastattempt information about the previous attempt.
|
||||
* @return number the time.
|
||||
*/
|
||||
@@ -649,8 +649,8 @@ class inter_attempt_delay_access_rule extends quiz_access_rule_base {
|
||||
/**
|
||||
* A rule implementing the ipaddress check against the ->submet setting.
|
||||
*
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class ipaddress_access_rule extends quiz_access_rule_base {
|
||||
public function prevent_access() {
|
||||
@@ -666,8 +666,8 @@ class ipaddress_access_rule extends quiz_access_rule_base {
|
||||
* A rule representing the password check. It does not actually implement the check,
|
||||
* that has to be done directly in attempt.php, but this facilitates telling users about it.
|
||||
*
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class password_access_rule extends quiz_access_rule_base {
|
||||
public function description() {
|
||||
@@ -686,7 +686,7 @@ class password_access_rule extends quiz_access_rule_base {
|
||||
* Actually ask the user for the password, if they have not already given it this session.
|
||||
* This function only returns is access is OK.
|
||||
*
|
||||
* @param boolean $canpreview used to enfore securewindow stuff.
|
||||
* @param bool $canpreview used to enfore securewindow stuff.
|
||||
* @param object $accessmanager the accessmanager calling us.
|
||||
* @return mixed return null, unless $return is true, and a form needs to be displayed.
|
||||
*/
|
||||
@@ -778,8 +778,8 @@ class password_access_rule extends quiz_access_rule_base {
|
||||
* A rule representing the time limit. It does not actually restrict access, but we use this
|
||||
* class to encapsulate some of the relevant code.
|
||||
*
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class time_limit_access_rule extends quiz_access_rule_base {
|
||||
public function description() {
|
||||
@@ -794,8 +794,8 @@ class time_limit_access_rule extends quiz_access_rule_base {
|
||||
* A rule for ensuring that the quiz is opened in a popup, with some JavaScript
|
||||
* to prevent copying and pasting, etc.
|
||||
*
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class securewindow_access_rule extends quiz_access_rule_base {
|
||||
/**
|
||||
@@ -819,7 +819,7 @@ class securewindow_access_rule extends quiz_access_rule_base {
|
||||
* Make a link to the review page for an attempt.
|
||||
*
|
||||
* @param string $linktext the desired link text.
|
||||
* @param integer $attemptid the attempt id.
|
||||
* @param int $attemptid the attempt id.
|
||||
* @return string HTML for the link.
|
||||
*/
|
||||
public function make_review_link($linktext, $attemptid) {
|
||||
@@ -854,8 +854,8 @@ class securewindow_access_rule extends quiz_access_rule_base {
|
||||
/**
|
||||
* A rule representing the safe browser check.
|
||||
*
|
||||
* @copyright 2009 Oliver Rahs
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2009 Oliver Rahs
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class safebrowser_access_rule extends quiz_access_rule_base {
|
||||
public function prevent_access() {
|
||||
|
||||
+89
-84
@@ -35,9 +35,9 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* Class for quiz exceptions. Just saves a couple of arguments on the
|
||||
* constructor for a moodle_exception.
|
||||
*
|
||||
* @copyright 2008 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @since Moodle 2.0
|
||||
* @copyright 2008 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @since Moodle 2.0
|
||||
*/
|
||||
class moodle_quiz_exception extends moodle_exception {
|
||||
function __construct($quizobj, $errorcode, $a = NULL, $link = '', $debuginfo = null) {
|
||||
@@ -48,6 +48,7 @@ class moodle_quiz_exception extends moodle_exception {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A class encapsulating a quiz and the questions it contains, and making the
|
||||
* information available to scripts like view.php.
|
||||
@@ -56,9 +57,9 @@ class moodle_quiz_exception extends moodle_exception {
|
||||
* extra information only when necessary or when asked. The class tracks which questions
|
||||
* are loaded.
|
||||
*
|
||||
* @copyright 2008 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @since Moodle 2.0
|
||||
* @copyright 2008 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @since Moodle 2.0
|
||||
*/
|
||||
class quiz {
|
||||
// Fields initialised in the constructor.
|
||||
@@ -80,7 +81,7 @@ class quiz {
|
||||
* @param object $quiz the row from the quiz table.
|
||||
* @param object $cm the course_module object for this quiz.
|
||||
* @param object $course the row from the course table for the course we belong to.
|
||||
* @param boolean $getcontext intended for testing - stops the constructor getting the context.
|
||||
* @param bool $getcontext intended for testing - stops the constructor getting the context.
|
||||
*/
|
||||
function __construct($quiz, $cm, $course, $getcontext = true) {
|
||||
$this->quiz = $quiz;
|
||||
@@ -96,8 +97,8 @@ class quiz {
|
||||
/**
|
||||
* Static function to create a new quiz object for a specific user.
|
||||
*
|
||||
* @param integer $quizid the the quiz id.
|
||||
* @param integer $userid the the userid.
|
||||
* @param int $quizid the the quiz id.
|
||||
* @param int $userid the the userid.
|
||||
* @return quiz the new quiz object
|
||||
*/
|
||||
static public function create($quizid, $userid) {
|
||||
@@ -153,7 +154,7 @@ class quiz {
|
||||
}
|
||||
|
||||
// Simple getters ======================================================================
|
||||
/** @return integer the course id. */
|
||||
/** @return int the course id. */
|
||||
public function get_courseid() {
|
||||
return $this->course->id;
|
||||
}
|
||||
@@ -163,7 +164,7 @@ class quiz {
|
||||
return $this->course;
|
||||
}
|
||||
|
||||
/** @return integer the quiz id. */
|
||||
/** @return int the quiz id. */
|
||||
public function get_quizid() {
|
||||
return $this->quiz->id;
|
||||
}
|
||||
@@ -178,12 +179,12 @@ class quiz {
|
||||
return $this->quiz->name;
|
||||
}
|
||||
|
||||
/** @return integer the number of attempts allowed at this quiz (0 = infinite). */
|
||||
/** @return int the number of attempts allowed at this quiz (0 = infinite). */
|
||||
public function get_num_attempts_allowed() {
|
||||
return $this->quiz->attempts;
|
||||
}
|
||||
|
||||
/** @return integer the course_module id. */
|
||||
/** @return int the course_module id. */
|
||||
public function get_cmid() {
|
||||
return $this->cm->id;
|
||||
}
|
||||
@@ -199,7 +200,7 @@ class quiz {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean wether the current user is someone who previews the quiz,
|
||||
* @return bool wether the current user is someone who previews the quiz,
|
||||
* rather than attempting it.
|
||||
*/
|
||||
public function is_preview_user() {
|
||||
@@ -217,7 +218,7 @@ class quiz {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $id the question id.
|
||||
* @param int $id the question id.
|
||||
* @return object the question object with that id.
|
||||
*/
|
||||
public function get_question($id) {
|
||||
@@ -243,7 +244,7 @@ class quiz {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $timenow the current time as a unix timestamp.
|
||||
* @param int $timenow the current time as a unix timestamp.
|
||||
* @return quiz_access_manager and instance of the quiz_access_manager class for this quiz at this time.
|
||||
*/
|
||||
public function get_access_manager($timenow) {
|
||||
@@ -286,7 +287,7 @@ class quiz {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $attemptid the id of an attempt.
|
||||
* @param int $attemptid the id of an attempt.
|
||||
* @return string the URL of that attempt.
|
||||
*/
|
||||
public function attempt_url($attemptid) {
|
||||
@@ -303,7 +304,7 @@ class quiz {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $attemptid the id of an attempt.
|
||||
* @param int $attemptid the id of an attempt.
|
||||
* @return string the URL of the review of that attempt.
|
||||
*/
|
||||
public function review_url($attemptid) {
|
||||
@@ -335,13 +336,14 @@ class quiz {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This class extends the quiz class to hold data about the state of a particular attempt,
|
||||
* in addition to the data about the quiz.
|
||||
*
|
||||
* @copyright 2008 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @since Moodle 2.0
|
||||
* @copyright 2008 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @since Moodle 2.0
|
||||
*/
|
||||
class quiz_attempt {
|
||||
// Fields initialised in the constructor.
|
||||
@@ -405,7 +407,7 @@ class quiz_attempt {
|
||||
/**
|
||||
* Static function to create a new quiz_attempt object given an attemptid.
|
||||
*
|
||||
* @param integer $attemptid the attempt id.
|
||||
* @param int $attemptid the attempt id.
|
||||
* @return quiz_attempt the new quiz_attempt object
|
||||
*/
|
||||
static public function create($attemptid) {
|
||||
@@ -415,7 +417,7 @@ class quiz_attempt {
|
||||
/**
|
||||
* Static function to create a new quiz_attempt object given a usage id.
|
||||
*
|
||||
* @param integer $usageid the attempt usage id.
|
||||
* @param int $usageid the attempt usage id.
|
||||
* @return quiz_attempt the new quiz_attempt object
|
||||
*/
|
||||
static public function create_from_usage_id($usageid) {
|
||||
@@ -470,17 +472,17 @@ class quiz_attempt {
|
||||
return $this->quizobj;
|
||||
}
|
||||
|
||||
/** @return integer the course id. */
|
||||
/** @return int the course id. */
|
||||
public function get_courseid() {
|
||||
return $this->quizobj->get_courseid();
|
||||
}
|
||||
|
||||
/** @return integer the course id. */
|
||||
/** @return int the course id. */
|
||||
public function get_course() {
|
||||
return $this->quizobj->get_course();
|
||||
}
|
||||
|
||||
/** @return integer the quiz id. */
|
||||
/** @return int the quiz id. */
|
||||
public function get_quizid() {
|
||||
return $this->quizobj->get_quizid();
|
||||
}
|
||||
@@ -501,37 +503,37 @@ class quiz_attempt {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean wether the current user is someone who previews the quiz,
|
||||
* @return bool wether the current user is someone who previews the quiz,
|
||||
* rather than attempting it.
|
||||
*/
|
||||
public function is_preview_user() {
|
||||
return $this->quizobj->is_preview_user();
|
||||
}
|
||||
|
||||
/** @return integer the number of attempts allowed at this quiz (0 = infinite). */
|
||||
/** @return int the number of attempts allowed at this quiz (0 = infinite). */
|
||||
public function get_num_attempts_allowed() {
|
||||
return $this->quizobj->get_num_attempts_allowed();
|
||||
}
|
||||
|
||||
/** @return integer number fo pages in this quiz. */
|
||||
/** @return int number fo pages in this quiz. */
|
||||
public function get_num_pages() {
|
||||
return count($this->pagelayout);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $timenow the current time as a unix timestamp.
|
||||
* @param int $timenow the current time as a unix timestamp.
|
||||
* @return quiz_access_manager and instance of the quiz_access_manager class for this quiz at this time.
|
||||
*/
|
||||
public function get_access_manager($timenow) {
|
||||
return $this->quizobj->get_access_manager($timenow);
|
||||
}
|
||||
|
||||
/** @return integer the attempt id. */
|
||||
/** @return int the attempt id. */
|
||||
public function get_attemptid() {
|
||||
return $this->attempt->id;
|
||||
}
|
||||
|
||||
/** @return integer the attempt unique id. */
|
||||
/** @return int the attempt unique id. */
|
||||
public function get_uniqueid() {
|
||||
return $this->attempt->uniqueid;
|
||||
}
|
||||
@@ -541,22 +543,22 @@ class quiz_attempt {
|
||||
return $this->attempt;
|
||||
}
|
||||
|
||||
/** @return integer the number of this attemp (is it this user's first, second, ... attempt). */
|
||||
/** @return int the number of this attemp (is it this user's first, second, ... attempt). */
|
||||
public function get_attempt_number() {
|
||||
return $this->attempt->attempt;
|
||||
}
|
||||
|
||||
/** @return integer the id of the user this attempt belongs to. */
|
||||
/** @return int the id of the user this attempt belongs to. */
|
||||
public function get_userid() {
|
||||
return $this->attempt->userid;
|
||||
}
|
||||
|
||||
/** @return boolean whether this attempt has been finished (true) or is still in progress (false). */
|
||||
/** @return bool whether this attempt has been finished (true) or is still in progress (false). */
|
||||
public function is_finished() {
|
||||
return $this->attempt->timefinish != 0;
|
||||
}
|
||||
|
||||
/** @return boolean whether this attempt is a preview attempt. */
|
||||
/** @return bool whether this attempt is a preview attempt. */
|
||||
public function is_preview() {
|
||||
return $this->attempt->preview;
|
||||
}
|
||||
@@ -565,7 +567,7 @@ class quiz_attempt {
|
||||
* Is this a student dealing with their own attempt/teacher previewing,
|
||||
* or someone with 'mod/quiz:viewreports' reviewing someone elses attempt.
|
||||
*
|
||||
* @return boolean whether this situation should be treated as someone looking at their own
|
||||
* @return bool whether this situation should be treated as someone looking at their own
|
||||
* attempt. The distinction normally only matters when an attempt is being reviewed.
|
||||
*/
|
||||
public function is_own_attempt() {
|
||||
@@ -635,7 +637,7 @@ class quiz_attempt {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer one of the mod_quiz_display_options::DURING,
|
||||
* @return int one of the mod_quiz_display_options::DURING,
|
||||
* IMMEDIATELY_AFTER, LATER_WHILE_OPEN or AFTER_CLOSE constants.
|
||||
*/
|
||||
public function get_attempt_state() {
|
||||
@@ -666,7 +668,7 @@ class quiz_attempt {
|
||||
|
||||
/**
|
||||
* @param int $page page number
|
||||
* @return boolean true if this is the last page of the quiz.
|
||||
* @return bool true if this is the last page of the quiz.
|
||||
*/
|
||||
public function is_last_page($page) {
|
||||
return $page == count($this->pagelayout) - 1;
|
||||
@@ -693,7 +695,7 @@ class quiz_attempt {
|
||||
|
||||
/**
|
||||
* Get the question_attempt object for a particular question in this attempt.
|
||||
* @param integer $slot the number used to identify this question within this attempt.
|
||||
* @param int $slot the number used to identify this question within this attempt.
|
||||
* @return question_attempt
|
||||
*/
|
||||
public function get_question_attempt($slot) {
|
||||
@@ -702,8 +704,8 @@ class quiz_attempt {
|
||||
|
||||
/**
|
||||
* Is a particular question in this attempt a real question, or something like a description.
|
||||
* @param integer $slot the number used to identify this question within this attempt.
|
||||
* @return boolean whether that question is a real question.
|
||||
* @param int $slot the number used to identify this question within this attempt.
|
||||
* @return bool whether that question is a real question.
|
||||
*/
|
||||
public function is_real_question($slot) {
|
||||
return $this->quba->get_question($slot)->length != 0;
|
||||
@@ -711,8 +713,8 @@ class quiz_attempt {
|
||||
|
||||
/**
|
||||
* Is a particular question in this attempt a real question, or something like a description.
|
||||
* @param integer $slot the number used to identify this question within this attempt.
|
||||
* @return boolean whether that question is a real question.
|
||||
* @param int $slot the number used to identify this question within this attempt.
|
||||
* @return bool whether that question is a real question.
|
||||
*/
|
||||
public function is_question_flagged($slot) {
|
||||
return $this->quba->get_question_attempt($slot)->is_flagged();
|
||||
@@ -722,7 +724,7 @@ class quiz_attempt {
|
||||
* Return the grade obtained on a particular question, if the user is permitted to see it.
|
||||
* You must previously have called load_question_states to load the state data about this question.
|
||||
*
|
||||
* @param integer $slot the number used to identify this question within this attempt.
|
||||
* @param int $slot the number used to identify this question within this attempt.
|
||||
* @return string the formatted grade, to the number of decimal places specified by the quiz.
|
||||
*/
|
||||
public function get_question_number($slot) {
|
||||
@@ -733,7 +735,7 @@ class quiz_attempt {
|
||||
* Return the grade obtained on a particular question, if the user is permitted to see it.
|
||||
* You must previously have called load_question_states to load the state data about this question.
|
||||
*
|
||||
* @param integer $slot the number used to identify this question within this attempt.
|
||||
* @param int $slot the number used to identify this question within this attempt.
|
||||
* @return string the formatted grade, to the number of decimal places specified by the quiz.
|
||||
*/
|
||||
public function get_question_name($slot) {
|
||||
@@ -744,8 +746,8 @@ class quiz_attempt {
|
||||
* Return the grade obtained on a particular question, if the user is permitted to see it.
|
||||
* You must previously have called load_question_states to load the state data about this question.
|
||||
*
|
||||
* @param integer $slot the number used to identify this question within this attempt.
|
||||
* @param boolean $showcorrectness Whether right/partial/wrong states should
|
||||
* @param int $slot the number used to identify this question within this attempt.
|
||||
* @param bool $showcorrectness Whether right/partial/wrong states should
|
||||
* be distinguised.
|
||||
* @return string the formatted grade, to the number of decimal places specified by the quiz.
|
||||
*/
|
||||
@@ -758,7 +760,7 @@ class quiz_attempt {
|
||||
* You must previously have called load_question_states to load the state
|
||||
* data about this question.
|
||||
*
|
||||
* @param integer $slot the number used to identify this question within this attempt.
|
||||
* @param int $slot the number used to identify this question within this attempt.
|
||||
* @return string the formatted grade, to the number of decimal places specified by the quiz.
|
||||
*/
|
||||
public function get_question_mark($slot) {
|
||||
@@ -767,8 +769,8 @@ class quiz_attempt {
|
||||
|
||||
/**
|
||||
* Get the time of the most recent action performed on a question.
|
||||
* @param integer $slot the number used to identify this question within this usage.
|
||||
* @return integer timestamp.
|
||||
* @param int $slot the number used to identify this question within this usage.
|
||||
* @return int timestamp.
|
||||
*/
|
||||
public function get_question_action_time($slot) {
|
||||
return $this->quba->get_question_action_time($slot);
|
||||
@@ -790,12 +792,12 @@ class quiz_attempt {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $slot if speified, the slot number of a specific question to link to.
|
||||
* @param integer $page if specified, a particular page to link to. If not givem deduced
|
||||
* @param int $slot if speified, the slot number of a specific question to link to.
|
||||
* @param int $page if specified, a particular page to link to. If not givem deduced
|
||||
* from $slot, or goes to the first page.
|
||||
* @param integer $questionid a question id. If set, will add a fragment to the URL
|
||||
* @param int $questionid a question id. If set, will add a fragment to the URL
|
||||
* to jump to a particuar question on the page.
|
||||
* @param integer $thispage if not -1, the current page. Will cause links to other things on
|
||||
* @param int $thispage if not -1, the current page. Will cause links to other things on
|
||||
* this page to be output as only a fragment.
|
||||
* @return string the URL to continue this attempt.
|
||||
*/
|
||||
@@ -818,12 +820,12 @@ class quiz_attempt {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $slot indicates which question to link to.
|
||||
* @param integer $page if specified, the URL of this particular page of the attempt, otherwise
|
||||
* @param int $slot indicates which question to link to.
|
||||
* @param int $page if specified, the URL of this particular page of the attempt, otherwise
|
||||
* the URL will go to the first page. If -1, deduce $page from $slot.
|
||||
* @param boolean $showall if true, the URL will be to review the entire attempt on one page,
|
||||
* @param bool $showall if true, the URL will be to review the entire attempt on one page,
|
||||
* and $page will be ignored.
|
||||
* @param integer $thispage if not -1, the current page. Will cause links to other things on
|
||||
* @param int $thispage if not -1, the current page. Will cause links to other things on
|
||||
* this page to be output as only a fragment.
|
||||
* @return string the URL to review this attempt.
|
||||
*/
|
||||
@@ -851,7 +853,7 @@ class quiz_attempt {
|
||||
|
||||
/**
|
||||
* Initialise the JS etc. required by one question.
|
||||
* @param integer $questionid the question id.
|
||||
* @param int $questionid the question id.
|
||||
*/
|
||||
public function get_question_html_head_contributions($slot) {
|
||||
return $this->quba->render_question_head_html($slot) .
|
||||
@@ -882,8 +884,8 @@ class quiz_attempt {
|
||||
* Generate the HTML that displayes the question in its current state, with
|
||||
* the appropriate display options.
|
||||
*
|
||||
* @param integer $id the id of a question in this quiz attempt.
|
||||
* @param boolean $reviewing is the being printed on an attempt or a review page.
|
||||
* @param int $id the id of a question in this quiz attempt.
|
||||
* @param bool $reviewing is the being printed on an attempt or a review page.
|
||||
* @param string $thispageurl the URL of the page this question is being printed on.
|
||||
* @return string HTML for the question in its current state.
|
||||
*/
|
||||
@@ -897,9 +899,9 @@ class quiz_attempt {
|
||||
* Like {@link render_question()} but displays the question at the past step
|
||||
* indicated by $seq, rather than showing the latest step.
|
||||
*
|
||||
* @param integer $id the id of a question in this quiz attempt.
|
||||
* @param integer $seq the seq number of the past state to display.
|
||||
* @param boolean $reviewing is the being printed on an attempt or a review page.
|
||||
* @param int $id the id of a question in this quiz attempt.
|
||||
* @param int $seq the seq number of the past state to display.
|
||||
* @param bool $reviewing is the being printed on an attempt or a review page.
|
||||
* @param string $thispageurl the URL of the page this question is being printed on.
|
||||
* @return string HTML for the question in its current state.
|
||||
*/
|
||||
@@ -912,8 +914,8 @@ class quiz_attempt {
|
||||
/**
|
||||
* Wrapper round print_question from lib/questionlib.php.
|
||||
*
|
||||
* @param integer $id the id of a question in this quiz attempt.
|
||||
* @param boolean $reviewing is the being printed on an attempt or a review page.
|
||||
* @param int $id the id of a question in this quiz attempt.
|
||||
* @param bool $reviewing is the being printed on an attempt or a review page.
|
||||
* @param string $thispageurl the URL of the page this question is being printed on.
|
||||
*/
|
||||
public function render_question_for_commenting($slot) {
|
||||
@@ -926,8 +928,8 @@ class quiz_attempt {
|
||||
/**
|
||||
* Check wheter access should be allowed to a particular file.
|
||||
*
|
||||
* @param integer $id the id of a question in this quiz attempt.
|
||||
* @param boolean $reviewing is the being printed on an attempt or a review page.
|
||||
* @param int $id the id of a question in this quiz attempt.
|
||||
* @param bool $reviewing is the being printed on an attempt or a review page.
|
||||
* @param string $thispageurl the URL of the page this question is being printed on.
|
||||
* @return string HTML for the question in its current state.
|
||||
*/
|
||||
@@ -988,7 +990,7 @@ class quiz_attempt {
|
||||
/**
|
||||
* Process all the actions that were submitted as part of the current request.
|
||||
*
|
||||
* @param integer $timestamp the timestamp that should be stored as the modifed
|
||||
* @param int $timestamp the timestamp that should be stored as the modifed
|
||||
* time in the database for these actions. If null, will use the current time.
|
||||
*/
|
||||
public function process_all_actions($timestamp) {
|
||||
@@ -1061,10 +1063,10 @@ class quiz_attempt {
|
||||
* Used by {@link attempt_url()} and {@link review_url()}.
|
||||
*
|
||||
* @param string $script. Used in the URL like /mod/quiz/$script.php
|
||||
* @param integer $slot identifies the specific question on the page to jump to. 0 to just use the $page parameter.
|
||||
* @param integer $page -1 to look up the page number from the slot, otherwise the page number to go to.
|
||||
* @param boolean $showall if true, return a URL with showall=1, and not page number
|
||||
* @param integer $thispage the page we are currently on. Links to questions on this
|
||||
* @param int $slot identifies the specific question on the page to jump to. 0 to just use the $page parameter.
|
||||
* @param int $page -1 to look up the page number from the slot, otherwise the page number to go to.
|
||||
* @param bool $showall if true, return a URL with showall=1, and not page number
|
||||
* @param int $thispage the page we are currently on. Links to questions on this
|
||||
* page will just be a fragment #q123. -1 to disable this.
|
||||
* @return The requested URL.
|
||||
*/
|
||||
@@ -1110,13 +1112,14 @@ class quiz_attempt {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Represents the navigation panel, and builds a {@link block_contents} to allow
|
||||
* it to be output.
|
||||
*
|
||||
* @copyright 2008 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @since Moodle 2.0
|
||||
* @copyright 2008 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @since Moodle 2.0
|
||||
*/
|
||||
abstract class quiz_nav_panel_base {
|
||||
/** @var quiz_attempt */
|
||||
@@ -1176,7 +1179,7 @@ abstract class quiz_nav_panel_base {
|
||||
|
||||
/**
|
||||
* @param question_attempt $qa
|
||||
* @param boolean $showcorrectness
|
||||
* @param bool $showcorrectness
|
||||
* @return array class name => descriptive string.
|
||||
*/
|
||||
protected function get_attributes(question_attempt $qa, $showcorrectness) {
|
||||
@@ -1245,12 +1248,13 @@ abstract class quiz_nav_panel_base {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Specialisation of {@link quiz_nav_panel_base} for the attempt quiz page.
|
||||
*
|
||||
* @copyright 2008 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @since Moodle 2.0
|
||||
* @copyright 2008 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @since Moodle 2.0
|
||||
*/
|
||||
class quiz_attempt_nav_panel extends quiz_nav_panel_base {
|
||||
protected function get_question_url($slot) {
|
||||
@@ -1270,12 +1274,13 @@ class quiz_attempt_nav_panel extends quiz_nav_panel_base {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Specialisation of {@link quiz_nav_panel_base} for the review quiz page.
|
||||
*
|
||||
* @copyright 2008 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @since Moodle 2.0
|
||||
* @copyright 2008 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @since Moodle 2.0
|
||||
*/
|
||||
class quiz_review_nav_panel extends quiz_nav_panel_base {
|
||||
protected function get_question_url($slot) {
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* @package moodlecore
|
||||
* @package moodlecore
|
||||
* @subpackage backup-moodle2
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,6 +31,9 @@ require_once($CFG->dirroot . '/mod/quiz/backup/moodle2/backup_quiz_stepslib.php'
|
||||
/**
|
||||
* quiz backup task that provides all the settings and steps to perform one
|
||||
* complete backup of the activity
|
||||
*
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class backup_quiz_activity_task extends backup_activity_task {
|
||||
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* @package moodlecore
|
||||
* @package moodlecore
|
||||
* @subpackage backup-moodle2
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
|
||||
@@ -28,6 +28,9 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Define all the backup steps that will be used by the backup_quiz_activity_task
|
||||
*
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class backup_quiz_activity_structure_step extends backup_questions_activity_structure_step {
|
||||
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* @package moodlecore
|
||||
* @package moodlecore
|
||||
* @subpackage backup-moodle2
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
|
||||
@@ -31,6 +31,9 @@ require_once($CFG->dirroot . '/mod/quiz/backup/moodle2/restore_quiz_stepslib.php
|
||||
/**
|
||||
* quiz restore task that provides all the settings and steps to perform one
|
||||
* complete restore of the activity
|
||||
*
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class restore_quiz_activity_task extends restore_activity_task {
|
||||
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* @package moodlecore
|
||||
* @package moodlecore
|
||||
* @subpackage backup-moodle2
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
|
||||
@@ -28,6 +28,9 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Structure step to restore one quiz activity
|
||||
*
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class restore_quiz_activity_structure_step extends restore_questions_activity_structure_step {
|
||||
|
||||
|
||||
+29
-20
@@ -59,7 +59,7 @@ function quiz_remove_question($quiz, $questionid) {
|
||||
/**
|
||||
* Remove an empty page from the quiz layout. If that is not possible, do nothing.
|
||||
* @param string $layout the existinng layout, $quiz->questions.
|
||||
* @param integer $index the position into $layout where the empty page should be removed.
|
||||
* @param int $index the position into $layout where the empty page should be removed.
|
||||
* @return the updated layout
|
||||
*/
|
||||
function quiz_delete_empty_page($layout, $index) {
|
||||
@@ -88,7 +88,7 @@ function quiz_delete_empty_page($layout, $index) {
|
||||
* @param object $quiz The extended quiz object as used by edit.php
|
||||
* This is updated by this function
|
||||
* @param int $page Which page in quiz to add the question on. If 0 (default), add at the end
|
||||
* @return boolean false if the question was already in the quiz
|
||||
* @return bool false if the question was already in the quiz
|
||||
*/
|
||||
function quiz_add_quiz_question($id, $quiz, $page = 0) {
|
||||
global $DB;
|
||||
@@ -203,7 +203,7 @@ function quiz_add_random_questions($quiz, $addonpage, $categoryid, $number, $inc
|
||||
/**
|
||||
* Add a page break after at particular position$.
|
||||
* @param string $layout the existinng layout, $quiz->questions.
|
||||
* @param integer $index the position into $layout where the empty page should be removed.
|
||||
* @param int $index the position into $layout where the empty page should be removed.
|
||||
* @return the updated layout
|
||||
*/
|
||||
function quiz_add_page_break_at($layout, $index) {
|
||||
@@ -220,7 +220,7 @@ function quiz_add_page_break_at($layout, $index) {
|
||||
/**
|
||||
* Add a page break after a particular question.
|
||||
* @param string $layout the existinng layout, $quiz->questions.
|
||||
* @param integer $qustionid the question to add the page break after.
|
||||
* @param int $qustionid the question to add the page break after.
|
||||
* @return the updated layout
|
||||
*/
|
||||
function quiz_add_page_break_after($layout, $questionid) {
|
||||
@@ -253,9 +253,9 @@ function quiz_save_new_layout($quiz) {
|
||||
* Saves changes to the question grades in the quiz_question_instances table.
|
||||
* It does not update 'sumgrades' in the quiz table.
|
||||
*
|
||||
* @param integer grade The maximal grade for the question
|
||||
* @param integer $questionid The id of the question
|
||||
* @param integer $quizid The id of the quiz to update / add the instances for.
|
||||
* @param int grade The maximal grade for the question
|
||||
* @param int $questionid The id of the question
|
||||
* @param int $quizid The id of the quiz to update / add the instances for.
|
||||
*/
|
||||
function quiz_update_question_instance($grade, $questionid, $quiz) {
|
||||
global $DB;
|
||||
@@ -306,7 +306,7 @@ function _quiz_move_question($layout, $questionid, $shift) {
|
||||
* Move a particular question one space earlier in the $quiz->questions list.
|
||||
* If that is not possible, do nothing.
|
||||
* @param string $layout the existinng layout, $quiz->questions.
|
||||
* @param integer $questionid the id of a question.
|
||||
* @param int $questionid the id of a question.
|
||||
* @return the updated layout
|
||||
*/
|
||||
function quiz_move_question_up($layout, $questionid) {
|
||||
@@ -317,7 +317,7 @@ function quiz_move_question_up($layout, $questionid) {
|
||||
* Move a particular question one space later in the $quiz->questions list.
|
||||
* If that is not possible, do nothing.
|
||||
* @param string $layout the existinng layout, $quiz->questions.
|
||||
* @param integer $questionid the id of a question.
|
||||
* @param int $questionid the id of a question.
|
||||
* @return the updated layout
|
||||
*/
|
||||
function quiz_move_question_down($layout, $questionid) {
|
||||
@@ -334,10 +334,10 @@ function quiz_move_question_down($layout, $questionid) {
|
||||
* $quiz->grades
|
||||
* @param object $pageurl The url of the current page with the parameters required
|
||||
* for links returning to the current page, as a moodle_url object
|
||||
* @param boolean $allowdelete Indicates whether the delete icons should be displayed
|
||||
* @param boolean $reordertool Indicates whether the reorder tool should be displayed
|
||||
* @param boolean $quiz_qbanktool Indicates whether the question bank should be displayed
|
||||
* @param boolean $hasattempts Indicates whether the quiz has attempts
|
||||
* @param bool $allowdelete Indicates whether the delete icons should be displayed
|
||||
* @param bool $reordertool Indicates whether the reorder tool should be displayed
|
||||
* @param bool $quiz_qbanktool Indicates whether the question bank should be displayed
|
||||
* @param bool $hasattempts Indicates whether the quiz has attempts
|
||||
*/
|
||||
function quiz_print_question_list($quiz, $pageurl, $allowdelete, $reordertool,
|
||||
$quiz_qbanktool, $hasattempts, $defaultcategoryobj) {
|
||||
@@ -762,7 +762,7 @@ function quiz_print_singlequestion($question, $returnurl, $quiz) {
|
||||
* @param object $question A question object from the database questions table
|
||||
* @param object $questionurl The url of the question editing page as a moodle_url object
|
||||
* @param object $quiz The quiz in the context of which the question is being displayed
|
||||
* @param boolean $quiz_qbanktool Indicate to this function if the question bank window open
|
||||
* @param bool $quiz_qbanktool Indicate to this function if the question bank window open
|
||||
*/
|
||||
function quiz_print_randomquestion(&$question, &$pageurl, &$quiz, $quiz_qbanktool) {
|
||||
global $DB, $OUTPUT;
|
||||
@@ -929,10 +929,10 @@ function print_random_option_icon($question) {
|
||||
* Creates a textual representation of a question for display.
|
||||
*
|
||||
* @param object $question A question object from the database questions table
|
||||
* @param boolean $showicon If true, show the question's icon with the question. False by default.
|
||||
* @param boolean $showquestiontext If true (default), show question text after question name.
|
||||
* @param bool $showicon If true, show the question's icon with the question. False by default.
|
||||
* @param bool $showquestiontext If true (default), show question text after question name.
|
||||
* If false, show only question name.
|
||||
* @param boolean $return If true (default), return the output. If false, print it.
|
||||
* @param bool $return If true (default), return the output. If false, print it.
|
||||
*/
|
||||
function quiz_question_tostring(&$question, $showicon = false, $showquestiontext = true, $return = true) {
|
||||
global $COURSE;
|
||||
@@ -970,6 +970,9 @@ function quiz_question_tostring(&$question, $showicon = false, $showquestiontext
|
||||
|
||||
/**
|
||||
* A column type for the add this question to the quiz.
|
||||
*
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class question_bank_add_to_quiz_action_column extends question_bank_action_column_base {
|
||||
protected $stradd;
|
||||
@@ -1000,6 +1003,9 @@ class question_bank_add_to_quiz_action_column extends question_bank_action_colum
|
||||
|
||||
/**
|
||||
* A column type for the name followed by the start of the question text.
|
||||
*
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class question_bank_question_name_text_column extends question_bank_question_name_column {
|
||||
public function get_name() {
|
||||
@@ -1029,6 +1035,9 @@ class question_bank_question_name_text_column extends question_bank_question_nam
|
||||
|
||||
/**
|
||||
* Subclass to customise the view of the question bank for the quiz editing screen.
|
||||
*
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class quiz_question_bank_view extends question_bank_view {
|
||||
protected $quizhasattempts = false;
|
||||
@@ -1048,7 +1057,7 @@ class quiz_question_bank_view extends question_bank_view {
|
||||
* Let the question bank display know whether the quiz has been attempted,
|
||||
* hence whether some bits of UI, like the add this question to the quiz icon,
|
||||
* should be displayed.
|
||||
* @param boolean $quizhasattempts whether the quiz has attempts.
|
||||
* @param bool $quizhasattempts whether the quiz has attempts.
|
||||
*/
|
||||
public function set_quiz_has_attempts($quizhasattempts) {
|
||||
$this->quizhasattempts = $quizhasattempts;
|
||||
@@ -1139,8 +1148,8 @@ class quiz_question_bank_view extends question_bank_view {
|
||||
* @param object $quiz The quiz object of the quiz in question
|
||||
* @param object $pageurl The url of the current page with the parameters required
|
||||
* for links returning to the current page, as a moodle_url object
|
||||
* @param integer $tabindex The tabindex to start from for the form elements created
|
||||
* @return integer The tabindex from which the calling page can continue, that is,
|
||||
* @param int $tabindex The tabindex to start from for the form elements created
|
||||
* @return int The tabindex from which the calling page can continue, that is,
|
||||
* the last value used +1.
|
||||
*/
|
||||
function quiz_print_grading_form($quiz, $pageurl, $tabindex) {
|
||||
|
||||
+11
-11
@@ -135,7 +135,7 @@ function quiz_update_instance($quiz, $mform) {
|
||||
* and any data that depends on it.
|
||||
*
|
||||
* @param int $id the id of the quiz to delete.
|
||||
* @return boolean success or failure.
|
||||
* @return bool success or failure.
|
||||
*/
|
||||
function quiz_delete_instance($id) {
|
||||
global $DB;
|
||||
@@ -164,7 +164,7 @@ function quiz_delete_instance($id) {
|
||||
* Deletes a quiz override from the database and clears any corresponding calendar events
|
||||
*
|
||||
* @param object $quiz The quiz object.
|
||||
* @param integer $overrideid The id of the override being deleted
|
||||
* @param int $overrideid The id of the override being deleted
|
||||
* @return bool true on success
|
||||
*/
|
||||
function quiz_delete_override($quiz, $overrideid) {
|
||||
@@ -211,7 +211,7 @@ function quiz_delete_all_overrides($quiz) {
|
||||
* passwords.
|
||||
*
|
||||
* @param object $quiz The quiz object.
|
||||
* @param integer $userid The userid.
|
||||
* @param int $userid The userid.
|
||||
* @return object $quiz The updated quiz object.
|
||||
*/
|
||||
function quiz_update_effective_access($quiz, $userid) {
|
||||
@@ -316,7 +316,7 @@ function quiz_delete_all_attempts($quiz) {
|
||||
* Get the best current grade for a particular user in a quiz.
|
||||
*
|
||||
* @param object $quiz the quiz settings.
|
||||
* @param integer $userid the id of the user.
|
||||
* @param int $userid the id of the user.
|
||||
* @return float the user's current grade for this quiz, or NULL if this user does
|
||||
* not have a grade on this quiz.
|
||||
*/
|
||||
@@ -338,7 +338,7 @@ function quiz_get_best_grade($quiz, $userid) {
|
||||
* divide by them).
|
||||
*
|
||||
* @param object $quiz a row from the quiz table.
|
||||
* @return boolean whether this is a graded quiz.
|
||||
* @return bool whether this is a graded quiz.
|
||||
*/
|
||||
function quiz_has_grades($quiz) {
|
||||
return $quiz->grade >= 0.000005 && $quiz->sumgrades >= 0.000005;
|
||||
@@ -427,8 +427,8 @@ function quiz_cron() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $quizid the quiz id.
|
||||
* @param integer $userid the userid.
|
||||
* @param int $quizid the quiz id.
|
||||
* @param int $userid the userid.
|
||||
* @param string $status 'all', 'finished' or 'unfinished' to control
|
||||
* @param bool $includepreviews
|
||||
* @return an array of all the user's attempts at this quiz. Returns an empty array if there are none.
|
||||
@@ -1159,7 +1159,7 @@ function quiz_get_post_actions() {
|
||||
|
||||
/**
|
||||
* @param array $questionids of question ids.
|
||||
* @return boolean whether any of these questions are used by any instance of this module.
|
||||
* @return bool whether any of these questions are used by any instance of this module.
|
||||
*/
|
||||
function quiz_questions_in_use($questionids) {
|
||||
global $DB;
|
||||
@@ -1269,7 +1269,7 @@ function quiz_reset_userdata($data) {
|
||||
*
|
||||
* @param int $attemptuniqueid int attempt id
|
||||
* @param int $questionid int question id
|
||||
* @return boolean to indicate access granted or denied
|
||||
* @return bool to indicate access granted or denied
|
||||
*/
|
||||
function quiz_check_file_access($attemptuniqueid, $questionid, $context = null) {
|
||||
global $USER, $DB, $CFG;
|
||||
@@ -1380,7 +1380,7 @@ function quiz_print_overview($courses, &$htmlarray) {
|
||||
*
|
||||
* @param object $quiz the quiz object. Only $quiz->id is used at the moment.
|
||||
* @param object $cm the cm object. Only $cm->course, $cm->groupmode and $cm->groupingid fields are used at the moment.
|
||||
* @param boolean $returnzero if false (default), when no attempts have been made '' is returned instead of 'Attempts: 0'.
|
||||
* @param bool $returnzero if false (default), when no attempts have been made '' is returned instead of 'Attempts: 0'.
|
||||
* @param int $currentgroup if there is a concept of current group where this method is being called
|
||||
* (e.g. a report) pass it in here. Default 0 which means no current group.
|
||||
* @return string a string like "Attempts: 123", "Attemtps 123 (45 from your groups)" or
|
||||
@@ -1420,7 +1420,7 @@ function quiz_num_attempt_summary($quiz, $cm, $returnzero = false, $currentgroup
|
||||
* @param object $quiz the quiz object. Only $quiz->id is used at the moment.
|
||||
* @param object $cm the cm object. Only $cm->course, $cm->groupmode and $cm->groupingid fields are used at the moment.
|
||||
* @param object $context the quiz context.
|
||||
* @param boolean $returnzero if false (default), when no attempts have been made '' is returned instead of 'Attempts: 0'.
|
||||
* @param bool $returnzero if false (default), when no attempts have been made '' is returned instead of 'Attempts: 0'.
|
||||
* @param int $currentgroup if there is a concept of current group where this method is being called
|
||||
* (e.g. a report) pass it in here. Default 0 which means no current group.
|
||||
* @return string HTML fragment for the link.
|
||||
|
||||
+34
-34
@@ -67,11 +67,11 @@ define('QUIZ_SHOW_TIME_BEFORE_DEADLINE', '3600');
|
||||
* NOT written to the database.
|
||||
*
|
||||
* @param object $quiz the quiz to create an attempt for.
|
||||
* @param integer $attemptnumber the sequence number for the attempt.
|
||||
* @param int $attemptnumber the sequence number for the attempt.
|
||||
* @param object $lastattempt the previous attempt by this user, if any. Only needed
|
||||
* if $attemptnumber > 1 and $quiz->attemptonlast is true.
|
||||
* @param integer $timenow the time the attempt was started at.
|
||||
* @param boolean $ispreview whether this new attempt is a preview.
|
||||
* @param int $timenow the time the attempt was started at.
|
||||
* @param bool $ispreview whether this new attempt is a preview.
|
||||
*
|
||||
* @return object the newly created attempt object.
|
||||
*/
|
||||
@@ -114,8 +114,8 @@ function quiz_create_attempt($quiz, $attemptnumber, $lastattempt, $timenow, $isp
|
||||
* Returns an unfinished attempt (if there is one) for the given
|
||||
* user on the given quiz. This function does not return preview attempts.
|
||||
*
|
||||
* @param integer $quizid the id of the quiz.
|
||||
* @param integer $userid the id of the user.
|
||||
* @param int $quizid the id of the quiz.
|
||||
* @param int $userid the id of the user.
|
||||
*
|
||||
* @return mixed the unfinished attempt if there is one, false if not.
|
||||
*/
|
||||
@@ -132,8 +132,8 @@ function quiz_get_user_attempt_unfinished($quizid, $userid) {
|
||||
* Returns the most recent attempt by a given user on a given quiz.
|
||||
* May be finished, or may not.
|
||||
*
|
||||
* @param integer $quizid the id of the quiz.
|
||||
* @param integer $userid the id of the user.
|
||||
* @param int $quizid the id of the quiz.
|
||||
* @param int $userid the id of the user.
|
||||
*
|
||||
* @return mixed the attempt if there is one, false if not.
|
||||
*/
|
||||
@@ -192,7 +192,7 @@ function quiz_delete_attempt($attempt, $quiz) {
|
||||
* Delete all the preview attempts at a quiz, or possibly all the attempts belonging
|
||||
* to one user.
|
||||
* @param object $quiz the quiz object.
|
||||
* @param integer $userid (optional) if given, only delete the previews belonging to this user.
|
||||
* @param int $userid (optional) if given, only delete the previews belonging to this user.
|
||||
*/
|
||||
function quiz_delete_previews($quiz, $userid = null) {
|
||||
global $DB;
|
||||
@@ -207,8 +207,8 @@ function quiz_delete_previews($quiz, $userid = null) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $quizid The quiz id.
|
||||
* @return boolean whether this quiz has any (non-preview) attempts.
|
||||
* @param int $quizid The quiz id.
|
||||
* @return bool whether this quiz has any (non-preview) attempts.
|
||||
*/
|
||||
function quiz_has_attempts($quizid) {
|
||||
global $DB;
|
||||
@@ -223,7 +223,7 @@ function quiz_has_attempts($quizid) {
|
||||
* @param string $layout the string representing the quiz layout. Each page is represented as a
|
||||
* comma separated list of question ids and 0 indicating page breaks.
|
||||
* So 5,2,0,3,0 means questions 5 and 2 on page 1 and question 3 on page 2
|
||||
* @param integer $page the number of the current page.
|
||||
* @param int $page the number of the current page.
|
||||
* @return string comma separated list of question ids
|
||||
*/
|
||||
function quiz_questions_on_page($layout, $page) {
|
||||
@@ -254,7 +254,7 @@ function quiz_questions_in_quiz($layout) {
|
||||
* Returns the number of pages in a quiz layout
|
||||
*
|
||||
* @param string $layout The string representing the quiz layout. Always ends in ,0
|
||||
* @return integer The number of pages in the quiz.
|
||||
* @return int The number of pages in the quiz.
|
||||
*/
|
||||
function quiz_number_of_pages($layout) {
|
||||
return substr_count(',' . $layout, ',0');
|
||||
@@ -264,7 +264,7 @@ function quiz_number_of_pages($layout) {
|
||||
* Returns the number of questions in the quiz layout
|
||||
*
|
||||
* @param string $layout the string representing the quiz layout.
|
||||
* @return integer The number of questions in the quiz.
|
||||
* @return int The number of questions in the quiz.
|
||||
*/
|
||||
function quiz_number_of_questions_in_quiz($layout) {
|
||||
// TODO is this still used.
|
||||
@@ -281,7 +281,7 @@ function quiz_number_of_questions_in_quiz($layout) {
|
||||
*
|
||||
* @param string $quizlayout The string representing the layout for the whole quiz
|
||||
* @param string $pagelayout The string representing the layout for the current page
|
||||
* @return integer the number of the first question
|
||||
* @return int the number of the first question
|
||||
*/
|
||||
function quiz_first_questionnumber($quizlayout, $pagelayout) {
|
||||
// TODO is this still used.
|
||||
@@ -303,8 +303,8 @@ function quiz_first_questionnumber($quizlayout, $pagelayout) {
|
||||
* Re-paginates the quiz layout
|
||||
*
|
||||
* @param string $layout The string representing the quiz layout.
|
||||
* @param integer $perpage The number of questions per page
|
||||
* @param boolean $shuffle Should the questions be reordered randomly?
|
||||
* @param int $perpage The number of questions per page
|
||||
* @param bool $shuffle Should the questions be reordered randomly?
|
||||
* @return string the new layout string
|
||||
*/
|
||||
function quiz_repaginate($layout, $perpage, $shuffle = false) {
|
||||
@@ -375,7 +375,7 @@ function quiz_get_all_question_grades($quiz) {
|
||||
*
|
||||
* @param float $rawgrade the unadjusted grade, fof example $attempt->sumgrades
|
||||
* @param object $quiz the quiz object. Only the fields grade, sumgrades and decimalpoints are used.
|
||||
* @param boolean|string $format whether to format the results for display
|
||||
* @param bool|string $format whether to format the results for display
|
||||
* or 'question' to format a question grade (different number of decimal places.
|
||||
* @return float|string the rescaled grade, or null/the lang string 'notyetgraded' if the $grade is null.
|
||||
*/
|
||||
@@ -429,7 +429,7 @@ function quiz_feedback_for_grade($grade, $quiz, $context) {
|
||||
|
||||
/**
|
||||
* @param object $quiz the quiz database row.
|
||||
* @return boolean Whether this quiz has any non-blank feedback text.
|
||||
* @return bool Whether this quiz has any non-blank feedback text.
|
||||
*/
|
||||
function quiz_has_feedback($quiz) {
|
||||
global $DB;
|
||||
@@ -490,7 +490,7 @@ function quiz_update_all_attempt_sumgrades($quiz) {
|
||||
*
|
||||
* @param float $newgrade the new maximum grade for the quiz.
|
||||
* @param object $quiz the quiz we are updating. Passed by reference so its grade field can be updated too.
|
||||
* @return boolean indicating success or failure.
|
||||
* @return bool indicating success or failure.
|
||||
*/
|
||||
function quiz_set_grade($newgrade, $quiz) {
|
||||
global $DB;
|
||||
@@ -546,11 +546,11 @@ function quiz_set_grade($newgrade, $quiz) {
|
||||
* Save the overall grade for a user at a quiz in the quiz_grades table
|
||||
*
|
||||
* @param object $quiz The quiz for which the best grade is to be calculated and then saved.
|
||||
* @param integer $userid The userid to calculate the grade for. Defaults to the current user.
|
||||
* @param int $userid The userid to calculate the grade for. Defaults to the current user.
|
||||
* @param array $attempts The attempts of this user. Useful if you are
|
||||
* looping through many users. Attempts can be fetched in one master query to
|
||||
* avoid repeated querying.
|
||||
* @return boolean Indicates success or failure.
|
||||
* @return bool Indicates success or failure.
|
||||
*/
|
||||
function quiz_save_best_grade($quiz, $userid = null, $attempts = array()) {
|
||||
global $DB;
|
||||
@@ -882,7 +882,7 @@ function quiz_upgrade_states($attempt) {
|
||||
|
||||
/**
|
||||
* @param object $quiz the quiz.
|
||||
* @param integer $cmid the course_module object for this quiz.
|
||||
* @param int $cmid the course_module object for this quiz.
|
||||
* @param object $question the question.
|
||||
* @param string $returnurl url to return to after action is done.
|
||||
* @return string html for a number of icons linked to action pages for a
|
||||
@@ -895,7 +895,7 @@ function quiz_question_action_icons($quiz, $cmid, $question, $returnurl) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $cmid the course_module.id for this quiz.
|
||||
* @param int $cmid the course_module.id for this quiz.
|
||||
* @param object $question the question.
|
||||
* @param string $returnurl url to return to after action is done.
|
||||
* @param string $contentbeforeicon some HTML content to be added inside the link, before the icon.
|
||||
@@ -938,7 +938,7 @@ function quiz_question_edit_button($cmid, $question, $returnurl, $contentafteric
|
||||
/**
|
||||
* @param object $quiz the quiz
|
||||
* @param object $question the question
|
||||
* @param boolean $label if true, show the preview question label after the icon
|
||||
* @param bool $label if true, show the preview question label after the icon
|
||||
* @return the HTML for a preview question icon.
|
||||
*/
|
||||
function quiz_question_preview_button($quiz, $question, $label = false) {
|
||||
@@ -974,7 +974,7 @@ function quiz_question_preview_button($quiz, $question, $label = false) {
|
||||
/**
|
||||
* @param object $attempt the attempt.
|
||||
* @param object $context the quiz context.
|
||||
* @return integer whether flags should be shown/editable to the current user for this attempt.
|
||||
* @return int whether flags should be shown/editable to the current user for this attempt.
|
||||
*/
|
||||
function quiz_get_flag_option($attempt, $context) {
|
||||
global $USER;
|
||||
@@ -991,7 +991,7 @@ function quiz_get_flag_option($attempt, $context) {
|
||||
* Work out what state this quiz attempt is in.
|
||||
* @param object $quiz the quiz settings
|
||||
* @param object $attempt the quiz_attempt database row.
|
||||
* @return integer one of the mod_quiz_display_options::DURING,
|
||||
* @return int one of the mod_quiz_display_options::DURING,
|
||||
* IMMEDIATELY_AFTER, LATER_WHILE_OPEN or AFTER_CLOSE constants.
|
||||
*/
|
||||
function quiz_attempt_state($quiz, $attempt) {
|
||||
@@ -1095,7 +1095,7 @@ function quiz_get_combined_reviewoptions($quiz, $attempts) {
|
||||
* - Finally, add a ",0" in the end if there is none
|
||||
*
|
||||
* @param $string $layout the quiz layout to clean up, usually from $quiz->questions.
|
||||
* @param boolean $removeemptypages If true, remove empty pages from the quiz. False by default.
|
||||
* @param bool $removeemptypages If true, remove empty pages from the quiz. False by default.
|
||||
* @return $string the cleaned-up layout
|
||||
*/
|
||||
function quiz_clean_layout($layout, $removeemptypages = false) {
|
||||
@@ -1141,8 +1141,8 @@ function quiz_clean_layout($layout, $removeemptypages = false) {
|
||||
/**
|
||||
* Get the slot for a question with a particular id.
|
||||
* @param object $quiz the quiz settings.
|
||||
* @param integer $questionid the of a question in the quiz.
|
||||
* @return integer the corresponding slot. Null if the question is not in the quiz.
|
||||
* @param int $questionid the of a question in the quiz.
|
||||
* @return int the corresponding slot. Null if the question is not in the quiz.
|
||||
*/
|
||||
function quiz_get_slot_for_question($quiz, $questionid) {
|
||||
$questionids = quiz_questions_in_quiz($quiz->questions);
|
||||
@@ -1374,8 +1374,8 @@ function quiz_get_js_module() {
|
||||
* An extension of question_display_options that includes the extra options used
|
||||
* by the quiz.
|
||||
*
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class mod_quiz_display_options extends question_display_options {
|
||||
/**#@+
|
||||
@@ -1403,7 +1403,7 @@ class mod_quiz_display_options extends question_display_options {
|
||||
/**
|
||||
* Set up the various options from the quiz settings, and a time constant.
|
||||
* @param object $quiz the quiz settings.
|
||||
* @param integer $one of the {@link DURING}, {@link IMMEDIATELY_AFTER},
|
||||
* @param int $one of the {@link DURING}, {@link IMMEDIATELY_AFTER},
|
||||
* {@link LATER_WHILE_OPEN} or {@link AFTER_CLOSE} constants.
|
||||
* @return mod_quiz_display_options set up appropriately.
|
||||
*/
|
||||
@@ -1443,8 +1443,8 @@ class mod_quiz_display_options extends question_display_options {
|
||||
* A {@link qubaid_condition} for finding all the question usages belonging to
|
||||
* a particular quiz.
|
||||
*
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class quibaid_for_quiz extends qubaid_join {
|
||||
public function __construct($quizid, $includepreviews = true, $onlyfinished = false) {
|
||||
|
||||
@@ -35,8 +35,8 @@ require_once($CFG->libdir.'/tablelib.php');
|
||||
/**
|
||||
* Base class for quiz reports that are basically a table with one row for each attempt.
|
||||
*
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
abstract class quiz_attempt_report extends quiz_default_report {
|
||||
/** @var object the quiz context. */
|
||||
@@ -49,7 +49,7 @@ abstract class quiz_attempt_report extends quiz_default_report {
|
||||
* Should the grades be displayed in this report. That depends on the quiz
|
||||
* display options, and whether the quiz is graded.
|
||||
* @param object $quiz the quiz settings.
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
protected function should_show_grades($quiz) {
|
||||
if (!is_null($this->showgrades)) {
|
||||
@@ -108,10 +108,10 @@ abstract class quiz_attempt_report extends quiz_default_report {
|
||||
|
||||
/**
|
||||
* Alters $attemptsmode and $pagesize if the current values are inappropriate.
|
||||
* @param integer $attemptsmode what sort of attemtps to display (may be updated)
|
||||
* @param integer $pagesize number of records to display per page (may be updated)
|
||||
* @param int $attemptsmode what sort of attemtps to display (may be updated)
|
||||
* @param int $pagesize number of records to display per page (may be updated)
|
||||
* @param object $course the course settings.
|
||||
* @param integer $currentgroup the currently selected group. 0 for none.
|
||||
* @param int $currentgroup the currently selected group. 0 for none.
|
||||
*/
|
||||
protected function validate_common_options(&$attemptsmode, &$pagesize, $course, $currentgroup) {
|
||||
if ($currentgroup) {
|
||||
@@ -136,8 +136,8 @@ abstract class quiz_attempt_report extends quiz_default_report {
|
||||
* Contruct all the parts of the main database query.
|
||||
* @param object $quiz the quiz settings.
|
||||
* @param string $qmsubselect SQL fragment from {@link quiz_report_qm_filter_select()}.
|
||||
* @param boolean $qmfilter whether to show all, or only the final grade attempt.
|
||||
* @param integer $attemptsmode which attemtps to show. One of the QUIZ_REPORT_ATTEMPTS_... constants.
|
||||
* @param bool $qmfilter whether to show all, or only the final grade attempt.
|
||||
* @param int $attemptsmode which attemtps to show. One of the QUIZ_REPORT_ATTEMPTS_... constants.
|
||||
* @param array $reportstudents list if userids of users to include in the report.
|
||||
* @return array with 4 elements ($fields, $from, $where, $params) that can be used to
|
||||
* build the actual database query.
|
||||
@@ -312,7 +312,7 @@ abstract class quiz_attempt_report extends quiz_default_report {
|
||||
* @param array $headers the columns headings.
|
||||
* @param moodle_url $reporturl the URL of this report.
|
||||
* @param array $displayoptions the display options.
|
||||
* @param boolean $collapsible whether to allow columns in the report to be collapsed.
|
||||
* @param bool $collapsible whether to allow columns in the report to be collapsed.
|
||||
*/
|
||||
protected function set_up_table_columns($table, $columns, $headers, $reporturl, $displayoptions, $collapsible) {
|
||||
$table->define_columns($columns);
|
||||
@@ -362,8 +362,8 @@ abstract class quiz_attempt_report extends quiz_default_report {
|
||||
/**
|
||||
* Base class for the table used by {@link quiz_attempt_report}s.
|
||||
*
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
abstract class quiz_attempt_report_table extends table_sql {
|
||||
public $useridfield = 'userid';
|
||||
@@ -485,7 +485,7 @@ abstract class quiz_attempt_report_table extends table_sql {
|
||||
*
|
||||
* @param string $data HTML fragment. The text to make into the link.
|
||||
* @param object $attempt data for the row of the table being output.
|
||||
* @param integer $slot the number used to identify this question within this usage.
|
||||
* @param int $slot the number used to identify this question within this usage.
|
||||
*/
|
||||
public function make_review_link($data, $attempt, $slot) {
|
||||
global $OUTPUT;
|
||||
@@ -562,7 +562,7 @@ abstract class quiz_attempt_report_table extends table_sql {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean 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() {
|
||||
return false;
|
||||
@@ -572,7 +572,7 @@ abstract class quiz_attempt_report_table extends table_sql {
|
||||
* Is this a column that depends on joining to the latest state information?
|
||||
* If so, return the corresponding slot. If not, return false.
|
||||
* @param string $column a column name
|
||||
* @return integer false if no, else a slot.
|
||||
* @return int false if no, else a slot.
|
||||
*/
|
||||
protected function is_latest_step_column($column) {
|
||||
return false;
|
||||
@@ -580,7 +580,7 @@ abstract class quiz_attempt_report_table extends table_sql {
|
||||
|
||||
/**
|
||||
* Get any fields that might be needed when sorting on date for a particular slot.
|
||||
* @param integer $slot the slot for the column we want.
|
||||
* @param int $slot the slot for the column we want.
|
||||
* @param string $alias the table alias for latest state information relating to that slot.
|
||||
*/
|
||||
protected function get_required_latest_state_fields($slot, $alias) {
|
||||
@@ -595,7 +595,7 @@ abstract class quiz_attempt_report_table extends table_sql {
|
||||
* 'table' with alias qa$slot, with columns that are a union of
|
||||
* the columns of the question_attempts and question_attempts_states tables.
|
||||
*
|
||||
* @param integer $slot the question to add information for.
|
||||
* @param int $slot the question to add information for.
|
||||
*/
|
||||
protected function add_latest_state_join($slot) {
|
||||
$alias = 'qa' . $slot;
|
||||
|
||||
@@ -205,8 +205,8 @@ class quiz_grading_report extends quiz_default_report {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $slot
|
||||
* @param integer $questionid
|
||||
* @param int $slot
|
||||
* @param int $questionid
|
||||
* @param string $grade
|
||||
* @param mixed $page = true, link to current page. false = omit page.
|
||||
* number = link to specific page.
|
||||
@@ -508,13 +508,13 @@ class quiz_grading_report extends quiz_default_report {
|
||||
* $limitnum. A special value 'random' can be passed as $orderby, in which case
|
||||
* $limitfrom is ignored.
|
||||
*
|
||||
* @param integer $slot The slot for the questions you want to konw about.
|
||||
* @param integer $questionid (optional) Only return attempts that were of this specific question.
|
||||
* @param int $slot The slot for the questions you want to konw about.
|
||||
* @param int $questionid (optional) Only return attempts that were of this specific question.
|
||||
* @param string $summarystate 'all', 'needsgrading', 'autograded' or 'manuallygraded'.
|
||||
* @param string $orderby 'random', 'date', 'student' or 'idnumber'.
|
||||
* @param integer $page implements paging of the results.
|
||||
* @param int $page implements paging of the results.
|
||||
* Ignored if $orderby = random or $pagesize is null.
|
||||
* @param integer $pagesize implements paging of the results. null = all.
|
||||
* @param int $pagesize implements paging of the results. null = all.
|
||||
*/
|
||||
function get_usage_ids_where_question_in_state($summarystate, $slot,
|
||||
$questionid = null, $orderby = 'random', $page = 0, $pagesize = null) {
|
||||
|
||||
@@ -33,8 +33,8 @@ require_once($CFG->libdir . '/formslib.php');
|
||||
/**
|
||||
* Quiz overview report settings form.
|
||||
*
|
||||
* @copyright 2008 Jamie Pratt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2008 Jamie Pratt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class mod_quiz_report_overview_settings extends moodleform {
|
||||
|
||||
|
||||
@@ -35,8 +35,8 @@ require_once($CFG->dirroot.'/mod/quiz/report/overview/overview_table.php');
|
||||
/**
|
||||
* Quiz report subclass for the overview (grades) report.
|
||||
*
|
||||
* @copyright 1999 onwards Martin Dougiamas and others {@link http://moodle.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 1999 onwards Martin Dougiamas and others {@link http://moodle.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class quiz_overview_report extends quiz_attempt_report {
|
||||
|
||||
@@ -338,7 +338,7 @@ class quiz_overview_report extends quiz_attempt_report {
|
||||
* However, $attempt->sumgrades is updated, if this is not a dry run.
|
||||
*
|
||||
* @param object $attempt the quiz attempt to regrade.
|
||||
* @param boolean $dryrun if true, do a pretend regrade, otherwise do it for real.
|
||||
* @param bool $dryrun if true, do a pretend regrade, otherwise do it for real.
|
||||
* @param array $slots if null, regrade all questions, otherwise, just regrade
|
||||
* the quetsions with those slots.
|
||||
*/
|
||||
@@ -382,7 +382,7 @@ class quiz_overview_report extends quiz_attempt_report {
|
||||
* Regrade attempts for this quiz, exactly which attempts are regraded is
|
||||
* controlled by the parameters.
|
||||
* @param object $quiz the quiz settings.
|
||||
* @param boolean $dryrun if true, do a pretend regrade, otherwise do it for real.
|
||||
* @param bool $dryrun if true, do a pretend regrade, otherwise do it for real.
|
||||
* @param array $groupstudents blank for all attempts, otherwise regrade attempts
|
||||
* for these users.
|
||||
* @param array $attemptids blank for all attempts, otherwise only regrade
|
||||
|
||||
@@ -44,7 +44,7 @@ define('QUIZ_REPORT_ATTEMPTS_ALL_STUDENTS', 3);
|
||||
* including the keys passed as the next param.
|
||||
* @param array $keys Array of strings with the names of the properties on the
|
||||
* objects in datum that you want to index the multidimensional array by.
|
||||
* @param boolean $keysunique If there is not only one object for each
|
||||
* @param bool $keysunique If there is not only one object for each
|
||||
* combination of keys you are using you should set $keysunique to true.
|
||||
* Otherwise all the object will be added to a zero based array. So the array
|
||||
* returned will have count($keys) + 1 indexs.
|
||||
@@ -178,8 +178,8 @@ function quiz_report_qm_filter_select($quiz, $quizattemptsalias = 'quiza') {
|
||||
/**
|
||||
* Get the nuber of students whose score was in a particular band for this quiz.
|
||||
* @param number $bandwidth the width of each band.
|
||||
* @param integer $bands the number of bands
|
||||
* @param integer $quizid the quiz id.
|
||||
* @param int $bands the number of bands
|
||||
* @param int $quizid the quiz id.
|
||||
* @param array $userids list of user ids.
|
||||
* @return array band number => number of users with scores in that band.
|
||||
*/
|
||||
@@ -250,7 +250,7 @@ function quiz_report_highlighting_grading_method($quiz, $qmsubselect, $qmfilter)
|
||||
* processed ready for display.
|
||||
*
|
||||
* @param float $grade a grade on this quiz.
|
||||
* @param integer $quizid the id of the quiz object.
|
||||
* @param int $quizid the id of the quiz object.
|
||||
* @return string the comment that corresponds to this grade (empty string if there is not one.
|
||||
*/
|
||||
function quiz_report_feedback_for_grade($grade, $quizid, $context) {
|
||||
@@ -290,7 +290,7 @@ function quiz_report_feedback_for_grade($grade, $quizid, $context) {
|
||||
* Format a number as a percentage out of $quiz->sumgrades
|
||||
* @param number $rawgrade the mark to format.
|
||||
* @param object $quiz the quiz settings
|
||||
* @param boolean $round whether to round the results ot $quiz->decimalpoints.
|
||||
* @param bool $round whether to round the results ot $quiz->decimalpoints.
|
||||
*/
|
||||
function quiz_report_scale_summarks_as_percentage($rawmark, $quiz, $round = true) {
|
||||
if ($quiz->sumgrades == 0) {
|
||||
|
||||
@@ -43,8 +43,8 @@ require_once($CFG->dirroot.'/mod/quiz/report/responses/responses_table.php');
|
||||
* Like the overview report, there are options for showing students with/without
|
||||
* attempts, and for deleting selected attempts.
|
||||
*
|
||||
* @copyright 1999 onwards Martin Dougiamas and others {@link http://moodle.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 1999 onwards Martin Dougiamas and others {@link http://moodle.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class quiz_responses_report extends quiz_attempt_report {
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ class quiz_report_responses_table extends quiz_attempt_report_table {
|
||||
|
||||
/**
|
||||
* Get any fields that might be needed when sorting on date for a particular slot.
|
||||
* @param integer $slot the slot for the column we want.
|
||||
* @param int $slot the slot for the column we want.
|
||||
* @param string $alias the table alias for latest state information relating to that slot.
|
||||
*/
|
||||
protected function get_required_latest_state_fields($slot, $alias) {
|
||||
|
||||
@@ -92,10 +92,10 @@ class quiz_statistics_question_stats {
|
||||
/**
|
||||
* Load the data that will be needed to perform the calculations.
|
||||
*
|
||||
* @param integer $quizid the quiz id.
|
||||
* @param integer $currentgroup the current group. 0 for none.
|
||||
* @param int $quizid the quiz id.
|
||||
* @param int $currentgroup the current group. 0 for none.
|
||||
* @param array $groupstudents students in this group.
|
||||
* @param boolean $allattempts use all attempts, or just first attempts.
|
||||
* @param bool $allattempts use all attempts, or just first attempts.
|
||||
*/
|
||||
public function load_step_data($quizid, $currentgroup, $groupstudents, $allattempts) {
|
||||
global $DB;
|
||||
@@ -276,7 +276,7 @@ class quiz_statistics_question_stats {
|
||||
*
|
||||
* @param object $step the state to add to the statistics.
|
||||
* @param object $stats the question statistics we are accumulating.
|
||||
* @param boolean $positionstat whether this is a statistic of position of question.
|
||||
* @param bool $positionstat whether this is a statistic of position of question.
|
||||
*/
|
||||
protected function initial_steps_walker($step, $stats, $positionstat = true) {
|
||||
$stats->s++;
|
||||
@@ -320,7 +320,7 @@ class quiz_statistics_question_stats {
|
||||
*
|
||||
* @param object $step the state to add to the statistics.
|
||||
* @param object $stats the question statistics we are accumulating.
|
||||
* @param boolean $positionstat whether this is a statistic of position of question.
|
||||
* @param bool $positionstat whether this is a statistic of position of question.
|
||||
*/
|
||||
protected function secondary_steps_walker($step, $stats) {
|
||||
$markdifference = $step->mark - $stats->markaverage;
|
||||
|
||||
@@ -384,7 +384,7 @@ class quiz_statistics_report extends quiz_default_report {
|
||||
|
||||
/**
|
||||
* Output the table that lists all the questions in the quiz with their statistics.
|
||||
* @param integer $s number of attempts.
|
||||
* @param int $s number of attempts.
|
||||
* @param array $questions the questions in the quiz.
|
||||
* @param array $subquestions the subquestions of any random questions.
|
||||
*/
|
||||
@@ -529,7 +529,7 @@ class quiz_statistics_report extends quiz_default_report {
|
||||
|
||||
/**
|
||||
* Output the HTML needed to show the statistics graph.
|
||||
* @param integer $quizstatsid the id of the statistics to show in the graph.
|
||||
* @param int $quizstatsid the id of the statistics to show in the graph.
|
||||
*/
|
||||
protected function output_statistics_graph($quizstatsid, $s) {
|
||||
global $OUTPUT;
|
||||
@@ -550,8 +550,8 @@ class quiz_statistics_report extends quiz_default_report {
|
||||
* Return the stats data for when there are no stats to show.
|
||||
*
|
||||
* @param array $questions question definitions.
|
||||
* @param integer $firstattemptscount number of first attempts (optional).
|
||||
* @param integer $firstattemptscount total number of attempts (optional).
|
||||
* @param int $firstattemptscount number of first attempts (optional).
|
||||
* @param int $firstattemptscount total number of attempts (optional).
|
||||
* @return array with three elements:
|
||||
* - integer $s Number of attempts included in the stats (0).
|
||||
* - array $quizstats The statistics for overall attempt scores.
|
||||
@@ -575,9 +575,9 @@ class quiz_statistics_report extends quiz_default_report {
|
||||
* Compute the quiz statistics.
|
||||
*
|
||||
* @param object $quizid the quiz id.
|
||||
* @param integer $currentgroup the current group. 0 for none.
|
||||
* @param boolean $nostudentsingroup true if there a no students.
|
||||
* @param boolean $useallattempts use all attempts, or just first attempts.
|
||||
* @param int $currentgroup the current group. 0 for none.
|
||||
* @param bool $nostudentsingroup true if there a no students.
|
||||
* @param bool $useallattempts use all attempts, or just first attempts.
|
||||
* @param array $groupstudents students in this group.
|
||||
* @param array $questions question definitions.
|
||||
* @return array with three elements:
|
||||
@@ -735,9 +735,9 @@ class quiz_statistics_report extends quiz_default_report {
|
||||
* Load the cached statistics from the database.
|
||||
*
|
||||
* @param object $quiz the quiz settings
|
||||
* @param integer $currentgroup the current group. 0 for none.
|
||||
* @param boolean $nostudentsingroup true if there a no students.
|
||||
* @param boolean $useallattempts use all attempts, or just first attempts.
|
||||
* @param int $currentgroup the current group. 0 for none.
|
||||
* @param bool $nostudentsingroup true if there a no students.
|
||||
* @param bool $useallattempts use all attempts, or just first attempts.
|
||||
* @param array $groupstudents students in this group.
|
||||
* @param array $questions question definitions.
|
||||
* @return array with 4 elements:
|
||||
@@ -796,8 +796,8 @@ class quiz_statistics_report extends quiz_default_report {
|
||||
* Store the statistics in the cache tables in the database.
|
||||
*
|
||||
* @param object $quizid the quiz id.
|
||||
* @param integer $currentgroup the current group. 0 for none.
|
||||
* @param boolean $useallattempts use all attempts, or just first attempts.
|
||||
* @param int $currentgroup the current group. 0 for none.
|
||||
* @param bool $useallattempts use all attempts, or just first attempts.
|
||||
* @param object $quizstats The statistics for overall attempt scores.
|
||||
* @param array $questions The questions, with an additional _stats field.
|
||||
* @param array $subquestions The subquestions, if any, with an additional _stats field.
|
||||
@@ -840,9 +840,9 @@ class quiz_statistics_report extends quiz_default_report {
|
||||
* or by recomputing them.
|
||||
*
|
||||
* @param object $quiz the quiz settings.
|
||||
* @param integer $currentgroup the current group. 0 for none.
|
||||
* @param boolean $nostudentsingroup true if there a no students.
|
||||
* @param boolean $useallattempts use all attempts, or just first attempts.
|
||||
* @param int $currentgroup the current group. 0 for none.
|
||||
* @param bool $nostudentsingroup true if there a no students.
|
||||
* @param bool $useallattempts use all attempts, or just first attempts.
|
||||
* @param array $groupstudents students in this group.
|
||||
* @param array $questions question definitions.
|
||||
* @return array with 4 elements:
|
||||
@@ -928,10 +928,10 @@ class quiz_statistics_report extends quiz_default_report {
|
||||
* Generate the snipped of HTML that says when the stats were last caculated,
|
||||
* with a recalcuate now button.
|
||||
* @param object $quizstats the overall quiz statistics.
|
||||
* @param integer $quizid the quiz id.
|
||||
* @param integer $currentgroup the id of the currently selected group, or 0.
|
||||
* @param int $quizid the quiz id.
|
||||
* @param int $currentgroup the id of the currently selected group, or 0.
|
||||
* @param array $groupstudents ids of students in the group.
|
||||
* @param boolean $useallattempts whether to use all attempts, instead of just first attempts.
|
||||
* @param bool $useallattempts whether to use all attempts, instead of just first attempts.
|
||||
* @return string a HTML snipped saying when the stats were last computed, or blank if that is not appropriate.
|
||||
*/
|
||||
protected function output_caching_info($quizstats, $quizid, $currentgroup,
|
||||
@@ -973,9 +973,9 @@ class quiz_statistics_report extends quiz_default_report {
|
||||
/**
|
||||
* Clear the cached data for a particular report configuration. This will
|
||||
* trigger a re-computation the next time the report is displayed.
|
||||
* @param integer $quizid the quiz id.
|
||||
* @param integer $currentgroup a group id, or 0.
|
||||
* @param boolean $useallattempts whether all attempts, or just first attempts are included.
|
||||
* @param int $quizid the quiz id.
|
||||
* @param int $currentgroup a group id, or 0.
|
||||
* @param bool $useallattempts whether all attempts, or just first attempts are included.
|
||||
*/
|
||||
protected function clear_cached_data($quizid, $currentgroup, $useallattempts) {
|
||||
global $DB;
|
||||
@@ -995,7 +995,7 @@ class quiz_statistics_report extends quiz_default_report {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean $useallattempts whether we are using all attempts.
|
||||
* @param bool $useallattempts whether we are using all attempts.
|
||||
* @return the appropriate lang string to describe this option.
|
||||
*/
|
||||
protected function using_attempts_string($useallattempts) {
|
||||
|
||||
@@ -77,14 +77,14 @@ class quiz_statistics_response_analyser {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean whether this analysis has more than one subpart.
|
||||
* @return bool whether this analysis has more than one subpart.
|
||||
*/
|
||||
public function has_subparts() {
|
||||
return count($this->responseclasses) > 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean whether this analysis has (a subpart with) more than one
|
||||
* @return bool whether this analysis has (a subpart with) more than one
|
||||
* response class.
|
||||
*/
|
||||
public function has_response_classes() {
|
||||
@@ -97,7 +97,7 @@ class quiz_statistics_response_analyser {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean whether this analysis has a response class more than one
|
||||
* @return bool whether this analysis has a response class more than one
|
||||
* different acutal response.
|
||||
*/
|
||||
public function has_actual_responses() {
|
||||
@@ -160,9 +160,9 @@ class quiz_statistics_response_analyser {
|
||||
/**
|
||||
* Store the computed response analysis in the quiz_question_response_stats
|
||||
* table.
|
||||
* @param integer $quizstatisticsid the cached quiz statistics to load the
|
||||
* @param int $quizstatisticsid the cached quiz statistics to load the
|
||||
* data corresponding to.
|
||||
* @return boolean true if cached data was found in the database and loaded,
|
||||
* @return bool true if cached data was found in the database and loaded,
|
||||
* otherwise false, to mean no data was loaded.
|
||||
*/
|
||||
public function load_cached($quizstatisticsid) {
|
||||
@@ -185,7 +185,7 @@ class quiz_statistics_response_analyser {
|
||||
/**
|
||||
* Store the computed response analysis in the quiz_question_response_stats
|
||||
* table.
|
||||
* @param integer $quizstatisticsid the cached quiz statistics this correspons to.
|
||||
* @param int $quizstatisticsid the cached quiz statistics this correspons to.
|
||||
*/
|
||||
public function store_cached($quizstatisticsid) {
|
||||
global $DB;
|
||||
|
||||
@@ -52,8 +52,8 @@ class testable_quiz_statistics_question_stats extends quiz_statistics_question_s
|
||||
/**
|
||||
* Unit tests for (some of) quiz_statistics_question_stats.
|
||||
*
|
||||
* @copyright 2008 Jamie Pratt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2008 Jamie Pratt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class quiz_statistics_question_stats_test extends UnitTestCase {
|
||||
public static $includecoverage = array('mod/quiz/report/reportlib.php');
|
||||
|
||||
@@ -33,8 +33,8 @@ require_once($CFG->libdir . '/formslib.php');
|
||||
/**
|
||||
* This is the settings form for the quiz statistics report.
|
||||
*
|
||||
* @copyright 2008 Jamie Pratt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2008 Jamie Pratt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class quiz_statistics_statistics_settings_form extends moodleform {
|
||||
function definition() {
|
||||
|
||||
@@ -38,8 +38,8 @@ require_once($CFG->libdir . '/tablelib.php');
|
||||
* The responses may be grouped, either by subpart of the question, or by the
|
||||
* answer they match.
|
||||
*
|
||||
* @copyright 2008 Jamie Pratt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2008 Jamie Pratt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class quiz_report_statistics_question_table extends flexible_table {
|
||||
/** @var object this question with a _stats field. */
|
||||
@@ -60,7 +60,7 @@ class quiz_report_statistics_question_table extends flexible_table {
|
||||
*
|
||||
* @param moodle_url $reporturl the URL to redisplay this report.
|
||||
* @param object $question a question with a _stats field
|
||||
* @param boolean $hassubqs
|
||||
* @param bool $hassubqs
|
||||
*/
|
||||
public function setup($reporturl, $questiondata, quiz_statistics_response_analyser $responesstats) {
|
||||
$this->questiondata = $questiondata;
|
||||
|
||||
@@ -56,9 +56,9 @@ class quiz_report_statistics_table extends flexible_table {
|
||||
* call flexible_table::setup() method.
|
||||
*
|
||||
* @param object $quiz the quiz settings
|
||||
* @param integer $cmid the quiz course_module id
|
||||
* @param int $cmid the quiz course_module id
|
||||
* @param moodle_url $reporturl the URL to redisplay this report.
|
||||
* @param integer $s number of attempts included in the statistics.
|
||||
* @param int $s number of attempts included in the statistics.
|
||||
*/
|
||||
function setup($quiz, $cmid, $reporturl, $s) {
|
||||
$this->quiz = $quiz;
|
||||
@@ -326,7 +326,7 @@ class quiz_report_statistics_table extends flexible_table {
|
||||
* This method encapsulates the test for wheter a question should be considered dubious.
|
||||
* @param object question the question object with a property _stats which
|
||||
* includes all the stats for the question.
|
||||
* @return boolean is this question possibly not pulling it's weight?
|
||||
* @return bool is this question possibly not pulling it's weight?
|
||||
*/
|
||||
protected function is_dubious_question($question) {
|
||||
if (!is_numeric($question->_stats->discriminativeefficiency)) {
|
||||
|
||||
@@ -74,7 +74,7 @@ class mod_quiz_admin_review_setting extends admin_setting {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer all times.
|
||||
* @return int all times.
|
||||
*/
|
||||
public static function all_on() {
|
||||
return self::DURING | self::IMMEDIATELY_AFTER | self::LATER_WHILE_OPEN |
|
||||
|
||||
@@ -33,8 +33,8 @@ require_once($CFG->dirroot . '/mod/quiz/locallib.php');
|
||||
/**
|
||||
* Unit tests for {@link mod_quiz_display_options}.
|
||||
*
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class mod_quiz_display_options_test extends UnitTestCase {
|
||||
function test_num_attempts_access_rule() {
|
||||
|
||||
@@ -33,8 +33,8 @@ defined('MOODLE_INTERNAL') || die();
|
||||
*
|
||||
* This is the old version of interactive mode.
|
||||
*
|
||||
* @copyright 2009 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2009 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class qbehaviour_adaptive extends question_behaviour_with_save {
|
||||
const IS_ARCHETYPAL = true;
|
||||
|
||||
@@ -130,8 +130,8 @@ abstract class question_behaviour {
|
||||
* @param string $component the name of the component we are serving files for.
|
||||
* @param string $filearea the name of the file area.
|
||||
* @param array $args the remaining bits of the file path.
|
||||
* @param boolean $forcedownload whether the user must be forced to download the file.
|
||||
* @return boolean true if the user can access this file.
|
||||
* @param bool $forcedownload whether the user must be forced to download the file.
|
||||
* @return bool true if the user can access this file.
|
||||
*/
|
||||
public function check_file_access($options, $component, $filearea, $args, $forcedownload) {
|
||||
$this->adjust_display_options($options);
|
||||
@@ -314,7 +314,7 @@ abstract class question_behaviour {
|
||||
* Generate a brief textual description of the current state of the question,
|
||||
* normally displayed under the question number.
|
||||
*
|
||||
* @param boolean $showcorrectness Whether right/partial/wrong states should
|
||||
* @param bool $showcorrectness Whether right/partial/wrong states should
|
||||
* be distinguised.
|
||||
* @return string a brief summary of the current state of the qestion attempt.
|
||||
*/
|
||||
@@ -341,7 +341,7 @@ abstract class question_behaviour {
|
||||
* the comment, and the mark (if given) is the same.
|
||||
*
|
||||
* @param question_attempt_step $pendingstep contains the new responses.
|
||||
* @return boolean whether the new response is the same as we already have.
|
||||
* @return bool whether the new response is the same as we already have.
|
||||
*/
|
||||
protected function is_same_comment($pendingstep) {
|
||||
$previouscomment = $this->qa->get_last_behaviour_var('comment');
|
||||
@@ -409,7 +409,7 @@ abstract class question_behaviour {
|
||||
* @param question_attempt_pending_step $pendingstep a partially initialised step
|
||||
* containing all the information about the action that is being peformed.
|
||||
* This information can be accessed using {@link question_attempt_step::get_behaviour_var()}.
|
||||
* @return boolean either {@link question_attempt::KEEP} or {@link question_attempt::DISCARD}
|
||||
* @return bool either {@link question_attempt::KEEP} or {@link question_attempt::DISCARD}
|
||||
*/
|
||||
public abstract function process_action(question_attempt_pending_step $pendingstep);
|
||||
|
||||
@@ -418,7 +418,7 @@ abstract class question_behaviour {
|
||||
* be suitable for most subclasses.
|
||||
* @param question_attempt_pending_step $pendingstep a partially initialised step
|
||||
* containing all the information about the action that is being peformed.
|
||||
* @return boolean either {@link question_attempt::KEEP}
|
||||
* @return bool either {@link question_attempt::KEEP}
|
||||
*/
|
||||
public function process_comment(question_attempt_pending_step $pendingstep) {
|
||||
if (!$this->qa->get_state()->is_finished()) {
|
||||
@@ -500,8 +500,8 @@ abstract class question_behaviour {
|
||||
* action that is suitable for most questions that implement the
|
||||
* {@link question_manually_gradable} interface.
|
||||
*
|
||||
* @copyright 2009 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2009 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
abstract class question_behaviour_with_save extends question_behaviour {
|
||||
public function required_question_definition_type() {
|
||||
@@ -512,7 +512,7 @@ abstract class question_behaviour_with_save extends question_behaviour {
|
||||
* Work out whether the response in $pendingstep are significantly different
|
||||
* from the last set of responses we have stored.
|
||||
* @param question_attempt_step $pendingstep contains the new responses.
|
||||
* @return boolean whether the new response is the same as we already have.
|
||||
* @return bool whether the new response is the same as we already have.
|
||||
*/
|
||||
protected function is_same_response(question_attempt_step $pendingstep) {
|
||||
return $this->question->is_same_response(
|
||||
@@ -526,7 +526,7 @@ abstract class question_behaviour_with_save extends question_behaviour {
|
||||
* behaviours, for example the CBM ones, have their own parts to the
|
||||
* response.
|
||||
* @param question_attempt_step $pendingstep contains the new responses.
|
||||
* @return boolean whether the new response is complete.
|
||||
* @return bool whether the new response is complete.
|
||||
*/
|
||||
protected function is_complete_response(question_attempt_step $pendingstep) {
|
||||
return $this->question->is_complete_response($pendingstep->get_qt_data());
|
||||
@@ -537,7 +537,7 @@ abstract class question_behaviour_with_save extends question_behaviour {
|
||||
* most subclasses.
|
||||
* @param question_attempt_pending_step $pendingstep a partially initialised step
|
||||
* containing all the information about the action that is being peformed.
|
||||
* @return boolean either {@link question_attempt::KEEP} or {@link question_attempt::DISCARD}
|
||||
* @return bool either {@link question_attempt::KEEP} or {@link question_attempt::DISCARD}
|
||||
*/
|
||||
public function process_save(question_attempt_pending_step $pendingstep) {
|
||||
if ($this->qa->get_state()->is_finished()) {
|
||||
@@ -588,8 +588,8 @@ abstract class question_behaviour_with_save extends question_behaviour {
|
||||
* This helper class contains the constants and methods required for
|
||||
* manipulating scores for certainly based marking.
|
||||
*
|
||||
* @copyright 2009 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2009 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
abstract class question_cbm {
|
||||
/**#@+ @var integer named constants for the certainty levels. */
|
||||
@@ -615,7 +615,7 @@ abstract class question_cbm {
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* @return integer the default certaintly level that should be assuemd if
|
||||
* @return int the default certaintly level that should be assuemd if
|
||||
* the student does not choose one.
|
||||
*/
|
||||
public static function default_certainty() {
|
||||
@@ -625,7 +625,7 @@ abstract class question_cbm {
|
||||
/**
|
||||
* Given a fraction, and a certainly, compute the adjusted fraction.
|
||||
* @param number $fraction the raw fraction for this question.
|
||||
* @param integer $certainty one of the certainly level constants.
|
||||
* @param int $certainty one of the certainly level constants.
|
||||
* @return number the adjusted fraction taking the certainly into account.
|
||||
*/
|
||||
public static function adjust_fraction($fraction, $certainty) {
|
||||
@@ -633,7 +633,7 @@ abstract class question_cbm {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $certainty one of the LOW/MED/HIGH constants.
|
||||
* @param int $certainty one of the LOW/MED/HIGH constants.
|
||||
* @return string a textual desciption of this certainly.
|
||||
*/
|
||||
public static function get_string($certainty) {
|
||||
|
||||
@@ -36,7 +36,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* when the whole attempt is finished, their answer is graded.
|
||||
*
|
||||
* @copyright 2009 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class qbehaviour_deferredfeedback extends question_behaviour_with_save {
|
||||
const IS_ARCHETYPAL = true;
|
||||
|
||||
@@ -33,7 +33,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* feedback behaviour.
|
||||
*
|
||||
* @copyright 2009 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class qbehaviour_deferredfeedback_renderer extends qbehaviour_renderer {
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ require_once(dirname(__FILE__) . '/../../../engine/simpletest/helpers.php');
|
||||
* Unit tests for the deferred feedback behaviour.
|
||||
*
|
||||
* @copyright 2009 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class qbehaviour_deferredfeedback_walkthrough_test extends qbehaviour_walkthrough_test_base {
|
||||
public function test_deferredfeedback_feedback_truefalse() {
|
||||
|
||||
@@ -62,7 +62,7 @@ class qbehaviour_interactive extends question_behaviour_with_save {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean are we are currently in the try_again state.
|
||||
* @return bool are we are currently in the try_again state.
|
||||
*/
|
||||
protected function is_try_again_state() {
|
||||
$laststep = $this->qa->get_last_step();
|
||||
|
||||
+83
-18
@@ -18,10 +18,10 @@
|
||||
/**
|
||||
* Functions used to show question editing interface
|
||||
*
|
||||
* @package moodlecore
|
||||
* @package moodlecore
|
||||
* @subpackage questionbank
|
||||
* @copyright 1999 onwards Martin Dougiamas and others {@link http://moodle.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 1999 onwards Martin Dougiamas and others {@link http://moodle.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
|
||||
@@ -93,8 +93,8 @@ function get_questions_category( $category, $noparent=false, $recurse=true, $exp
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $categoryid a category id.
|
||||
* @return boolean whether this is the only top-level category in a context.
|
||||
* @param int $categoryid a category id.
|
||||
* @return bool whether this is the only top-level category in a context.
|
||||
*/
|
||||
function question_is_only_toplevel_category_in_context($categoryid) {
|
||||
global $DB;
|
||||
@@ -110,7 +110,7 @@ function question_is_only_toplevel_category_in_context($categoryid) {
|
||||
/**
|
||||
* Check whether this user is allowed to delete this category.
|
||||
*
|
||||
* @param integer $todelete a category id.
|
||||
* @param int $todelete a category id.
|
||||
*/
|
||||
function question_can_delete_cat($todelete) {
|
||||
global $DB;
|
||||
@@ -122,6 +122,13 @@ function question_can_delete_cat($todelete) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Base class for representing a column in a {@link question_bank_view}.
|
||||
*
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
abstract class question_bank_column_base {
|
||||
/**
|
||||
* @var question_bank_view
|
||||
@@ -150,7 +157,7 @@ abstract class question_bank_column_base {
|
||||
|
||||
/**
|
||||
* Output the column header cell.
|
||||
* @param integer $currentsort 0 for none. 1 for normal sort, -1 for reverse sort.
|
||||
* @param int $currentsort 0 for none. 1 for normal sort, -1 for reverse sort.
|
||||
*/
|
||||
public function display_header() {
|
||||
echo '<th class="header ' . $this->get_classes() . '" scope="col">';
|
||||
@@ -336,7 +343,7 @@ abstract class question_bank_column_base {
|
||||
|
||||
/**
|
||||
* Helper method for building sort clauses.
|
||||
* @param boolean $reverse whether the normal direction should be reversed.
|
||||
* @param bool $reverse whether the normal direction should be reversed.
|
||||
* @param string $normaldir 'ASC' or 'DESC'
|
||||
* @return string 'ASC' or 'DESC'
|
||||
*/
|
||||
@@ -370,8 +377,12 @@ abstract class question_bank_column_base {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A column with a checkbox for each question with name q{questionid}.
|
||||
*
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class question_bank_checkbox_column extends question_bank_column_base {
|
||||
protected $strselect;
|
||||
@@ -409,8 +420,12 @@ class question_bank_checkbox_column extends question_bank_column_base {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A column type for the name of the question type.
|
||||
*
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class question_bank_question_type_column extends question_bank_column_base {
|
||||
public function get_name() {
|
||||
@@ -438,8 +453,12 @@ class question_bank_question_type_column extends question_bank_column_base {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A column type for the name of the question name.
|
||||
*
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class question_bank_question_name_column extends question_bank_column_base {
|
||||
protected $checkboxespresent = null;
|
||||
@@ -483,8 +502,12 @@ class question_bank_question_name_column extends question_bank_column_base {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A column type for the name of the question creator.
|
||||
*
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class question_bank_creator_name_column extends question_bank_column_base {
|
||||
public function get_name() {
|
||||
@@ -520,8 +543,12 @@ class question_bank_creator_name_column extends question_bank_column_base {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A column type for the name of the question last modifier.
|
||||
*
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class question_bank_modifier_name_column extends question_bank_column_base {
|
||||
public function get_name() {
|
||||
@@ -557,8 +584,12 @@ class question_bank_modifier_name_column extends question_bank_column_base {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A base class for actions that are an icon that lets you manipulate the question in some way.
|
||||
*
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
abstract class question_bank_action_column_base extends question_bank_column_base {
|
||||
|
||||
@@ -581,6 +612,13 @@ abstract class question_bank_action_column_base extends question_bank_column_bas
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Base class for question bank columns that just contain an action icon.
|
||||
*
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class question_bank_edit_action_column extends question_bank_action_column_base {
|
||||
protected $stredit;
|
||||
protected $strview;
|
||||
@@ -605,6 +643,13 @@ class question_bank_edit_action_column extends question_bank_action_column_base
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Question bank columns for the preview action icon.
|
||||
*
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class question_bank_preview_action_column extends question_bank_action_column_base {
|
||||
protected $strpreview;
|
||||
|
||||
@@ -636,6 +681,13 @@ class question_bank_preview_action_column extends question_bank_action_column_ba
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Question bank columns for the move action icon.
|
||||
*
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class question_bank_move_action_column extends question_bank_action_column_base {
|
||||
protected $strmove;
|
||||
|
||||
@@ -655,8 +707,12 @@ class question_bank_move_action_column extends question_bank_action_column_base
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* action to delete (or hide) a question, or restore a previously hidden question.
|
||||
*
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class question_bank_delete_action_column extends question_bank_action_column_base {
|
||||
protected $strdelete;
|
||||
@@ -691,6 +747,9 @@ class question_bank_delete_action_column extends question_bank_action_column_bas
|
||||
|
||||
/**
|
||||
* Base class for 'columns' that are actually displayed as a row following the main question row.
|
||||
*
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
abstract class question_bank_row_base extends question_bank_column_base {
|
||||
public function is_extra_row() {
|
||||
@@ -713,6 +772,9 @@ abstract class question_bank_row_base extends question_bank_column_base {
|
||||
|
||||
/**
|
||||
* A column type for the name of the question name.
|
||||
*
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class question_bank_question_text_row extends question_bank_row_base {
|
||||
protected $formatoptions;
|
||||
@@ -761,6 +823,9 @@ class question_bank_question_text_row extends question_bank_row_base {
|
||||
* + generating the right fragments of SQL to ensure the necessary data is present,
|
||||
* and sorted in the right order.
|
||||
* + outputting table headers.
|
||||
*
|
||||
* @copyright 2009 Tim Hunt
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class question_bank_view {
|
||||
const MAX_SORTS = 3;
|
||||
@@ -865,14 +930,14 @@ class question_bank_view {
|
||||
|
||||
/**
|
||||
* @param string $colname a column internal name.
|
||||
* @return boolean is this column included in the output?
|
||||
* @return bool is this column included in the output?
|
||||
*/
|
||||
public function has_column($colname) {
|
||||
return isset($this->visiblecolumns[$colname]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer The number of columns in the table.
|
||||
* @return int The number of columns in the table.
|
||||
*/
|
||||
public function get_column_count() {
|
||||
return count($this->visiblecolumns);
|
||||
@@ -961,7 +1026,7 @@ class question_bank_view {
|
||||
|
||||
/**
|
||||
* @param $sort a column or column_subsort name.
|
||||
* @return integer the current sort order for this column -1, 0, 1
|
||||
* @return int the current sort order for this column -1, 0, 1
|
||||
*/
|
||||
public function get_primary_sort_order($sort) {
|
||||
$order = reset($this->sort);
|
||||
@@ -976,7 +1041,7 @@ class question_bank_view {
|
||||
/**
|
||||
* Get a URL to redisplay the page with a new sort for the question bank.
|
||||
* @param string $sort the column, or column_subsort to sort on.
|
||||
* @param boolean $newsortreverse whether to sort in reverse order.
|
||||
* @param bool $newsortreverse whether to sort in reverse order.
|
||||
* @return string The new URL.
|
||||
*/
|
||||
public function new_sort_url($sort, $newsortreverse) {
|
||||
@@ -1222,8 +1287,8 @@ class question_bank_view {
|
||||
* @param int $recurse This is 1 if subcategories should be included, 0 otherwise
|
||||
* @param int $page The number of the page to be displayed
|
||||
* @param int $perpage Number of questions to show per page
|
||||
* @param boolean $showhidden True if also hidden questions should be displayed
|
||||
* @param boolean $showquestiontext whether the text of each question should be shown in the list
|
||||
* @param bool $showhidden True if also hidden questions should be displayed
|
||||
* @param bool $showquestiontext whether the text of each question should be shown in the list
|
||||
*/
|
||||
protected function display_question_list($contexts, $pageurl, $categoryandcontext,
|
||||
$cm = null, $recurse=1, $page=0, $perpage=100, $showhidden=false,
|
||||
@@ -1489,8 +1554,8 @@ class question_bank_view {
|
||||
* Common setup for all pages for editing questions.
|
||||
* @param string $baseurl the name of the script calling this funciton. For examle 'qusetion/edit.php'.
|
||||
* @param string $edittab code for this edit tab
|
||||
* @param boolean $requirecmid require cmid? default false
|
||||
* @param boolean $requirecourseid require courseid, if cmid is not given? default true
|
||||
* @param bool $requirecmid require cmid? default false
|
||||
* @param bool $requirecourseid require courseid, if cmid is not given? default true
|
||||
* @return array $thispageurl, $contexts, $cmid, $cm, $module, $pagevars
|
||||
*/
|
||||
function question_edit_setup($edittab, $baseurl, $requirecmid = false, $requirecourseid = true) {
|
||||
@@ -1737,12 +1802,12 @@ function print_qtype_to_add_option($qtype) {
|
||||
* which in turn goes to question/question.php before getting back to $params['returnurl']
|
||||
* (by default the question bank screen).
|
||||
*
|
||||
* @param integer $categoryid The id of the category that the new question should be added to.
|
||||
* @param int $categoryid The id of the category that the new question should be added to.
|
||||
* @param array $params Other paramters to add to the URL. You need either $params['cmid'] or
|
||||
* $params['courseid'], and you should probably set $params['returnurl']
|
||||
* @param string $caption the text to display on the button.
|
||||
* @param string $tooltip a tooltip to add to the button (optional).
|
||||
* @param boolean $disabled if true, the button will be disabled.
|
||||
* @param bool $disabled if true, the button will be disabled.
|
||||
*/
|
||||
function create_new_question_button($categoryid, $params, $caption, $tooltip = '', $disabled = false) {
|
||||
global $CFG, $PAGE, $OUTPUT;
|
||||
|
||||
@@ -58,7 +58,7 @@ abstract class question_bank {
|
||||
/**
|
||||
* Get the question type class for a particular question type.
|
||||
* @param string $qtypename the question type name. For example 'multichoice' or 'shortanswer'.
|
||||
* @param boolean $mustexist if false, the missing question type is returned when
|
||||
* @param bool $mustexist if false, the missing question type is returned when
|
||||
* the requested question type is not installed.
|
||||
* @return question_type the corresponding question type class.
|
||||
*/
|
||||
@@ -97,7 +97,7 @@ abstract class question_bank {
|
||||
|
||||
/**
|
||||
* @param string $qtypename the internal name of a question type. For example multichoice.
|
||||
* @return boolean whether users are allowed to create questions of this type.
|
||||
* @return bool whether users are allowed to create questions of this type.
|
||||
*/
|
||||
public static function qtype_enabled($qtypename) {
|
||||
$config = self::get_config();
|
||||
@@ -108,7 +108,7 @@ abstract class question_bank {
|
||||
|
||||
/**
|
||||
* @param string $qtypename the internal name of a question type. For example multichoice.
|
||||
* @return boolean whether this question type exists.
|
||||
* @return bool whether this question type exists.
|
||||
*/
|
||||
public static function qtype_exists($qtypename) {
|
||||
return array_key_exists($qtypename, get_plugin_list('qtype'));
|
||||
@@ -195,8 +195,8 @@ abstract class question_bank {
|
||||
/**
|
||||
* Load a question definition from the database. The object returned
|
||||
* will actually be of an appropriate {@link question_definition} subclass.
|
||||
* @param integer $questionid the id of the question to load.
|
||||
* @param boolean $allowshuffle if false, then any shuffle option on the selected quetsion is disabled.
|
||||
* @param int $questionid the id of the question to load.
|
||||
* @param bool $allowshuffle if false, then any shuffle option on the selected quetsion is disabled.
|
||||
* @return question_definition loaded from the database.
|
||||
*/
|
||||
public static function load_question($questionid, $allowshuffle = true) {
|
||||
@@ -275,10 +275,17 @@ abstract class question_bank {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Class for loading questions according to various criteria.
|
||||
*
|
||||
* @copyright 2009 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class question_finder {
|
||||
/**
|
||||
* Get the ids of all the questions in a list of categoryies.
|
||||
* @param integer|string|array $categoryids either a categoryid, or a comma-separated list
|
||||
* @param int|string|array $categoryids either a categoryid, or a comma-separated list
|
||||
* category ids, or an array of them.
|
||||
* @param string $extraconditions extra conditions to AND with the rest of the where clause.
|
||||
* @return array questionid => questionid.
|
||||
|
||||
+20
-20
@@ -125,7 +125,7 @@ class question_engine_data_mapper {
|
||||
|
||||
/**
|
||||
* Load a {@link question_attempt_step} from the database.
|
||||
* @param integer $stepid the id of the step to load.
|
||||
* @param int $stepid the id of the step to load.
|
||||
* @param question_attempt_step the step that was loaded.
|
||||
*/
|
||||
public function load_question_attempt_step($stepid) {
|
||||
@@ -159,7 +159,7 @@ WHERE
|
||||
/**
|
||||
* Load a {@link question_attempt} from the database, including all its
|
||||
* steps.
|
||||
* @param integer $questionattemptid the id of the question attempt to load.
|
||||
* @param int $questionattemptid the id of the question attempt to load.
|
||||
* @param question_attempt the question attempt that was loaded.
|
||||
*/
|
||||
public function load_question_attempt($questionattemptid) {
|
||||
@@ -213,7 +213,7 @@ ORDER BY
|
||||
/**
|
||||
* Load a {@link question_usage_by_activity} from the database, including
|
||||
* all its {@link question_attempt}s and all their steps.
|
||||
* @param integer $qubaid the id of the usage to load.
|
||||
* @param int $qubaid the id of the usage to load.
|
||||
* @param question_usage_by_activity the usage that was loaded.
|
||||
*/
|
||||
public function load_questions_usage_by_activity($qubaid) {
|
||||
@@ -394,14 +394,14 @@ ORDER BY
|
||||
*
|
||||
* @param qubaid_condition $qubaids used to restrict which usages are included
|
||||
* in the query. See {@link qubaid_condition}.
|
||||
* @param integer $slot The slot for the questions you want to konw about.
|
||||
* @param integer $questionid (optional) Only return attempts that were of this specific question.
|
||||
* @param int $slot The slot for the questions you want to konw about.
|
||||
* @param int $questionid (optional) Only return attempts that were of this specific question.
|
||||
* @param string $summarystate the summary state of interest, or 'all'.
|
||||
* @param string $orderby the column to order by.
|
||||
* @param array $params any params required by any of the SQL fragments.
|
||||
* @param integer $limitfrom implements paging of the results.
|
||||
* @param int $limitfrom implements paging of the results.
|
||||
* Ignored if $orderby = random or $limitnum is null.
|
||||
* @param integer $limitnum implements paging of the results. null = all.
|
||||
* @param int $limitnum implements paging of the results. null = all.
|
||||
* @return array with two elements, an array of usage ids, and a count of the total number.
|
||||
*/
|
||||
public function load_questions_usages_where_question_in_state(
|
||||
@@ -519,7 +519,7 @@ ORDER BY qa.slot
|
||||
/**
|
||||
* Load a {@link question_attempt} from the database, including all its
|
||||
* steps.
|
||||
* @param integer $questionid the question to load all the attempts fors.
|
||||
* @param int $questionid the question to load all the attempts fors.
|
||||
* @param qubaid_condition $qubaids used to restrict which usages are included
|
||||
* in the query. See {@link qubaid_condition}.
|
||||
* @return array of question_attempts.
|
||||
@@ -654,7 +654,7 @@ ORDER BY
|
||||
|
||||
/**
|
||||
* Delete all the steps for a question attempt.
|
||||
* @param integer $qaids question_attempt id.
|
||||
* @param int $qaids question_attempt id.
|
||||
*/
|
||||
public function delete_steps_for_question_attempts($qaids) {
|
||||
if (empty($qaids)) {
|
||||
@@ -670,7 +670,7 @@ ORDER BY
|
||||
|
||||
/**
|
||||
* Delete all the previews for a given question.
|
||||
* @param integer $questionid question id.
|
||||
* @param int $questionid question id.
|
||||
*/
|
||||
public function delete_previews($questionid) {
|
||||
$previews = $this->db->get_records_sql_menu("
|
||||
@@ -688,10 +688,10 @@ ORDER BY
|
||||
|
||||
/**
|
||||
* Update the flagged state of a question in the database.
|
||||
* @param integer $qubaid the question usage id.
|
||||
* @param integer $questionid the question id.
|
||||
* @param integer $sessionid the question_attempt id.
|
||||
* @param boolean $newstate the new state of the flag. true = flagged.
|
||||
* @param int $qubaid the question usage id.
|
||||
* @param int $questionid the question id.
|
||||
* @param int $sessionid the question_attempt id.
|
||||
* @param bool $newstate the new state of the flag. true = flagged.
|
||||
*/
|
||||
public function update_question_attempt_flag($qubaid, $questionid, $qaid, $slot, $newstate) {
|
||||
if (!$this->db->record_exists('question_attempts', array('id' => $qaid,
|
||||
@@ -721,7 +721,7 @@ ORDER BY
|
||||
* state corresponding to $summarystate.
|
||||
* @param string $summarystate one of
|
||||
* inprogress, needsgrading, manuallygraded or autograded
|
||||
* @param boolean $equal if false, do a NOT IN test. Default true.
|
||||
* @param bool $equal if false, do a NOT IN test. Default true.
|
||||
* @return string SQL fragment.
|
||||
*/
|
||||
public function in_summary_state_test($summarystate, $equal = true, $prefix = 'summarystates') {
|
||||
@@ -733,7 +733,7 @@ ORDER BY
|
||||
* Change the maxmark for the question_attempt with number in usage $slot
|
||||
* for all the specified question_attempts.
|
||||
* @param qubaid_condition $qubaids Selects which usages are updated.
|
||||
* @param integer $slot the number is usage to affect.
|
||||
* @param int $slot the number is usage to affect.
|
||||
* @param number $newmaxmark the new max mark to set.
|
||||
*/
|
||||
public function set_max_mark_in_attempts(qubaid_condition $qubaids, $slot, $newmaxmark) {
|
||||
@@ -808,7 +808,7 @@ ORDER BY
|
||||
|
||||
/**
|
||||
* @param array $questionids of question ids.
|
||||
* @return boolean whether any of these questions are being used by the question engine.
|
||||
* @return bool whether any of these questions are being used by the question engine.
|
||||
*/
|
||||
public function questions_in_use(array $questionids) {
|
||||
list($test, $params) = $this->db->get_in_or_equal($questionids);
|
||||
@@ -938,7 +938,7 @@ class question_engine_unit_of_work implements question_usage_observer {
|
||||
* FROM $qubaids->from_question_attempts('qa')
|
||||
* WHERE $qubaids->where() AND qa.slot = 1
|
||||
*
|
||||
* @copyright 2010 The Open University
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
abstract class qubaid_condition {
|
||||
@@ -976,7 +976,7 @@ abstract class qubaid_condition {
|
||||
* This class represents a restriction on the set of question_usage ids to include
|
||||
* in a larger database query based on an explicit list of ids.
|
||||
*
|
||||
* @copyright 2010 The Open University
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class qubaid_list extends qubaid_condition {
|
||||
@@ -1046,7 +1046,7 @@ class qubaid_list extends qubaid_condition {
|
||||
*
|
||||
* where $from, $usageidcolumn and $where are the arguments to the constructor.
|
||||
*
|
||||
* @copyright 2010 The Open University
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class qubaid_join extends qubaid_condition {
|
||||
|
||||
+112
-104
@@ -68,7 +68,7 @@ abstract class question_engine {
|
||||
|
||||
/**
|
||||
* Load a {@link question_usage_by_activity} from the database, based on its id.
|
||||
* @param integer $qubaid the id of the usage to load.
|
||||
* @param int $qubaid the id of the usage to load.
|
||||
* @return question_usage_by_activity loaded from the database.
|
||||
*/
|
||||
public static function load_questions_usage_by_activity($qubaid) {
|
||||
@@ -94,7 +94,7 @@ abstract class question_engine {
|
||||
|
||||
/**
|
||||
* Delete a {@link question_usage_by_activity} from the database, based on its id.
|
||||
* @param integer $qubaid the id of the usage to delete.
|
||||
* @param int $qubaid the id of the usage to delete.
|
||||
*/
|
||||
public static function delete_questions_usage_by_activity($qubaid) {
|
||||
global $CFG;
|
||||
@@ -103,7 +103,7 @@ abstract class question_engine {
|
||||
|
||||
/**
|
||||
* Delete a {@link question_usage_by_activity} from the database, based on its id.
|
||||
* @param integer $qubaid the id of the usage to delete.
|
||||
* @param int $qubaid the id of the usage to delete.
|
||||
*/
|
||||
public static function delete_questions_usage_by_activities($where, $params) {
|
||||
$dm = new question_engine_data_mapper();
|
||||
@@ -114,7 +114,7 @@ abstract class question_engine {
|
||||
* Change the maxmark for the question_attempt with number in usage $slot
|
||||
* for all the specified question_attempts.
|
||||
* @param qubaid_condition $qubaids Selects which usages are updated.
|
||||
* @param integer $slot the number is usage to affect.
|
||||
* @param int $slot the number is usage to affect.
|
||||
* @param number $newmaxmark the new max mark to set.
|
||||
*/
|
||||
public static function set_max_mark_in_attempts(qubaid_condition $qubaids,
|
||||
@@ -125,7 +125,7 @@ abstract class question_engine {
|
||||
|
||||
/**
|
||||
* @param array $questionids of question ids.
|
||||
* @return boolean whether any of these questions are being used by the question engine.
|
||||
* @return bool whether any of these questions are being used by the question engine.
|
||||
*/
|
||||
public static function questions_in_use(array $questionids) {
|
||||
$dm = new question_engine_data_mapper();
|
||||
@@ -494,15 +494,15 @@ class question_display_options {
|
||||
/**
|
||||
* Contains the logic for handling question flags.
|
||||
*
|
||||
* @copyright 2010 The Open University
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
abstract class question_flags {
|
||||
/**
|
||||
* Get the checksum that validates that a toggle request is valid.
|
||||
* @param integer $qubaid the question usage id.
|
||||
* @param integer $questionid the question id.
|
||||
* @param integer $sessionid the question_attempt id.
|
||||
* @param int $qubaid the question usage id.
|
||||
* @param int $questionid the question id.
|
||||
* @param int $sessionid the question_attempt id.
|
||||
* @param object $user the user. If null, defaults to $USER.
|
||||
* @return string that needs to be sent to question/toggleflag.php for it to work.
|
||||
*/
|
||||
@@ -531,12 +531,12 @@ abstract class question_flags {
|
||||
/**
|
||||
* If the request seems valid, update the flag state of a question attempt.
|
||||
* Throws exceptions if this is not a valid update request.
|
||||
* @param integer $qubaid the question usage id.
|
||||
* @param integer $questionid the question id.
|
||||
* @param integer $sessionid the question_attempt id.
|
||||
* @param int $qubaid the question usage id.
|
||||
* @param int $questionid the question id.
|
||||
* @param int $sessionid the question_attempt id.
|
||||
* @param string $checksum checksum, as computed by {@link get_toggle_checksum()}
|
||||
* corresponding to the last three arguments.
|
||||
* @param boolean $newstate the new state of the flag. true = flagged.
|
||||
* @param bool $newstate the new state of the flag. true = flagged.
|
||||
*/
|
||||
public static function update_flag($qubaid, $questionid, $qaid, $slot, $checksum, $newstate) {
|
||||
// Check the checksum - it is very hard to know who a question session belongs
|
||||
@@ -583,6 +583,14 @@ abstract class question_flags {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Exception thrown when the system detects that a student has done something
|
||||
* out-of-order to a question. This can happen, for example, if they click
|
||||
* the back button in a quiz, then try to submit a different response.
|
||||
*
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class question_out_of_sequence_exception extends moodle_exception {
|
||||
function __construct($qubaid, $slot, $postdata) {
|
||||
if ($postdata == null) {
|
||||
@@ -681,7 +689,7 @@ class question_usage_by_activity {
|
||||
return $this->owningcomponent;
|
||||
}
|
||||
|
||||
/** @return integer|string If this usage came from the database, then the id
|
||||
/** @return int|string If this usage came from the database, then the id
|
||||
* from the question_usages table is returned. Otherwise a random string is
|
||||
* returned. */
|
||||
public function get_id() {
|
||||
@@ -699,7 +707,7 @@ class question_usage_by_activity {
|
||||
/**
|
||||
* For internal use only. Used by {@link question_engine_data_mapper} to set
|
||||
* the id when a usage is saved to the database.
|
||||
* @param integer $id the newly determined id for this usage.
|
||||
* @param int $id the newly determined id for this usage.
|
||||
*/
|
||||
public function set_id_from_database($id) {
|
||||
$this->id = $id;
|
||||
@@ -717,7 +725,7 @@ class question_usage_by_activity {
|
||||
* @param question_definition $question the question to add.
|
||||
* @param number $maxmark the maximum this question will be marked out of in
|
||||
* this attempt (optional). If not given, $question->defaultmark is used.
|
||||
* @return integer the number used to identify this question within this usage.
|
||||
* @return int the number used to identify this question within this usage.
|
||||
*/
|
||||
public function add_question(question_definition $question, $maxmark = null) {
|
||||
$qa = new question_attempt($question, $this->get_id(),
|
||||
@@ -734,7 +742,7 @@ class question_usage_by_activity {
|
||||
|
||||
/**
|
||||
* Get the question_definition for a question in this attempt.
|
||||
* @param integer $slot the number used to identify this question within this usage.
|
||||
* @param int $slot the number used to identify this question within this usage.
|
||||
* @return question_definition the requested question object.
|
||||
*/
|
||||
public function get_question($slot) {
|
||||
@@ -746,13 +754,13 @@ class question_usage_by_activity {
|
||||
return array_keys($this->questionattempts);
|
||||
}
|
||||
|
||||
/** @return integer the identifying number of the first question that was added to this usage. */
|
||||
/** @return int the identifying number of the first question that was added to this usage. */
|
||||
public function get_first_question_number() {
|
||||
reset($this->questionattempts);
|
||||
return key($this->questionattempts);
|
||||
}
|
||||
|
||||
/** @return integer the number of questions that are currently in this usage. */
|
||||
/** @return int the number of questions that are currently in this usage. */
|
||||
public function question_count() {
|
||||
return count($this->questionattempts);
|
||||
}
|
||||
@@ -773,7 +781,7 @@ class question_usage_by_activity {
|
||||
* Check whether $number actually corresponds to a question attempt that is
|
||||
* part of this usage. Throws an exception if not.
|
||||
*
|
||||
* @param integer $slot a number allegedly identifying a question within this usage.
|
||||
* @param int $slot a number allegedly identifying a question within this usage.
|
||||
*/
|
||||
protected function check_slot($slot) {
|
||||
if (!array_key_exists($slot, $this->questionattempts)) {
|
||||
@@ -786,7 +794,7 @@ class question_usage_by_activity {
|
||||
* that {@link question_attempt} objects should be considered part of the inner
|
||||
* workings of the question engine, and should not, if possible, be accessed directly.
|
||||
*
|
||||
* @param integer $slot the number used to identify this question within this usage.
|
||||
* @param int $slot the number used to identify this question within this usage.
|
||||
* @return question_attempt the corresponding {@link question_attempt} object.
|
||||
*/
|
||||
public function get_question_attempt($slot) {
|
||||
@@ -796,7 +804,7 @@ class question_usage_by_activity {
|
||||
|
||||
/**
|
||||
* Get the current state of the attempt at a question.
|
||||
* @param integer $slot the number used to identify this question within this usage.
|
||||
* @param int $slot the number used to identify this question within this usage.
|
||||
* @return question_state.
|
||||
*/
|
||||
public function get_question_state($slot) {
|
||||
@@ -804,8 +812,8 @@ class question_usage_by_activity {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $slot the number used to identify this question within this usage.
|
||||
* @param boolean $showcorrectness Whether right/partial/wrong states should
|
||||
* @param int $slot the number used to identify this question within this usage.
|
||||
* @param bool $showcorrectness Whether right/partial/wrong states should
|
||||
* be distinguised.
|
||||
* @return string A brief textual description of the current state.
|
||||
*/
|
||||
@@ -815,8 +823,8 @@ class question_usage_by_activity {
|
||||
|
||||
/**
|
||||
* Get the time of the most recent action performed on a question.
|
||||
* @param integer $slot the number used to identify this question within this usage.
|
||||
* @return integer timestamp.
|
||||
* @param int $slot the number used to identify this question within this usage.
|
||||
* @return int timestamp.
|
||||
*/
|
||||
public function get_question_action_time($slot) {
|
||||
return $this->get_question_attempt($slot)->get_last_action_time();
|
||||
@@ -824,7 +832,7 @@ class question_usage_by_activity {
|
||||
|
||||
/**
|
||||
* Get the current fraction awarded for the attempt at a question.
|
||||
* @param integer $slot the number used to identify this question within this usage.
|
||||
* @param int $slot the number used to identify this question within this usage.
|
||||
* @return number|null The current fraction for this question, or null if one has
|
||||
* not been assigned yet.
|
||||
*/
|
||||
@@ -834,7 +842,7 @@ class question_usage_by_activity {
|
||||
|
||||
/**
|
||||
* Get the current mark awarded for the attempt at a question.
|
||||
* @param integer $slot the number used to identify this question within this usage.
|
||||
* @param int $slot the number used to identify this question within this usage.
|
||||
* @return number|null The current mark for this question, or null if one has
|
||||
* not been assigned yet.
|
||||
*/
|
||||
@@ -844,7 +852,7 @@ class question_usage_by_activity {
|
||||
|
||||
/**
|
||||
* Get the maximum mark possible for the attempt at a question.
|
||||
* @param integer $slot the number used to identify this question within this usage.
|
||||
* @param int $slot the number used to identify this question within this usage.
|
||||
* @return number the available marks for this question.
|
||||
*/
|
||||
public function get_question_max_mark($slot) {
|
||||
@@ -853,7 +861,7 @@ class question_usage_by_activity {
|
||||
|
||||
/**
|
||||
* Get the current mark awarded for the attempt at a question.
|
||||
* @param integer $slot the number used to identify this question within this usage.
|
||||
* @param int $slot the number used to identify this question within this usage.
|
||||
* @return number|null The current mark for this question, or null if one has
|
||||
* not been assigned yet.
|
||||
*/
|
||||
@@ -893,7 +901,7 @@ class question_usage_by_activity {
|
||||
* Get the {@link core_question_renderer}, in collaboration with appropriate
|
||||
* {@link qbehaviour_renderer} and {@link qtype_renderer} subclasses, to generate the
|
||||
* HTML to display this question.
|
||||
* @param integer $slot the number used to identify this question within this usage.
|
||||
* @param int $slot the number used to identify this question within this usage.
|
||||
* @param question_display_options $options controls how the question is rendered.
|
||||
* @param string|null $number The question number to display. 'i' is a special
|
||||
* value that gets displayed as Information. Null means no number is displayed.
|
||||
@@ -906,7 +914,7 @@ class question_usage_by_activity {
|
||||
/**
|
||||
* Generate any bits of HTML that needs to go in the <head> tag when this question
|
||||
* is displayed in the body.
|
||||
* @param integer $slot the number used to identify this question within this usage.
|
||||
* @param int $slot the number used to identify this question within this usage.
|
||||
* @return string HTML fragment.
|
||||
*/
|
||||
public function render_question_head_html($slot) {
|
||||
@@ -917,8 +925,8 @@ class question_usage_by_activity {
|
||||
* Like {@link render_question()} but displays the question at the past step
|
||||
* indicated by $seq, rather than showing the latest step.
|
||||
*
|
||||
* @param integer $slot the number used to identify this question within this usage.
|
||||
* @param integer $seq the seq number of the past state to display.
|
||||
* @param int $slot the number used to identify this question within this usage.
|
||||
* @param int $seq the seq number of the past state to display.
|
||||
* @param question_display_options $options controls how the question is rendered.
|
||||
* @param string|null $number The question number to display. 'i' is a special
|
||||
* value that gets displayed as Information. Null means no number is displayed.
|
||||
@@ -930,13 +938,13 @@ class question_usage_by_activity {
|
||||
|
||||
/**
|
||||
* Checks whether the users is allow to be served a particular file.
|
||||
* @param integer $slot the number used to identify this question within this usage.
|
||||
* @param int $slot the number used to identify this question within this usage.
|
||||
* @param question_display_options $options the options that control display of the question.
|
||||
* @param string $component the name of the component we are serving files for.
|
||||
* @param string $filearea the name of the file area.
|
||||
* @param array $args the remaining bits of the file path.
|
||||
* @param boolean $forcedownload whether the user must be forced to download the file.
|
||||
* @return boolean true if the user can access this file.
|
||||
* @param bool $forcedownload whether the user must be forced to download the file.
|
||||
* @return bool true if the user can access this file.
|
||||
*/
|
||||
public function check_file_access($slot, $options, $component, $filearea, $args, $forcedownload) {
|
||||
return $this->get_question_attempt($slot)->check_file_access($options, $component, $filearea, $args, $forcedownload);
|
||||
@@ -949,7 +957,7 @@ class question_usage_by_activity {
|
||||
* database.
|
||||
*
|
||||
* @param array $records Raw records loaded from the database.
|
||||
* @param integer $questionattemptid The id of the question_attempt to extract.
|
||||
* @param int $questionattemptid The id of the question_attempt to extract.
|
||||
* @return question_attempt The newly constructed question_attempt_step.
|
||||
*/
|
||||
public function replace_loaded_question_attempt_info($slot, $qa) {
|
||||
@@ -960,7 +968,7 @@ class question_usage_by_activity {
|
||||
/**
|
||||
* You should probably not use this method in code outside the question engine.
|
||||
* The main reason for exposing it was for the benefit of unit tests.
|
||||
* @param integer $slot the number used to identify this question within this usage.
|
||||
* @param int $slot the number used to identify this question within this usage.
|
||||
* @return string return the prefix that is pre-pended to field names in the HTML
|
||||
* that is output.
|
||||
*/
|
||||
@@ -970,7 +978,7 @@ class question_usage_by_activity {
|
||||
|
||||
/**
|
||||
* Start the attempt at a question that has been added to this usage.
|
||||
* @param integer $slot the number used to identify this question within this usage.
|
||||
* @param int $slot the number used to identify this question within this usage.
|
||||
*/
|
||||
public function start_question($slot) {
|
||||
$qa = $this->get_question_attempt($slot);
|
||||
@@ -992,7 +1000,7 @@ class question_usage_by_activity {
|
||||
* Start the attempt at a question, starting from the point where the previous
|
||||
* question_attempt $oldqa had reached. This is used by the quiz 'Each attempt
|
||||
* builds on last' mode.
|
||||
* @param integer $slot the number used to identify this question within this usage.
|
||||
* @param int $slot the number used to identify this question within this usage.
|
||||
* @param question_attempt $oldqa a previous attempt at this quetsion that
|
||||
* defines the starting point.
|
||||
*/
|
||||
@@ -1011,7 +1019,7 @@ class question_usage_by_activity {
|
||||
*
|
||||
* This function also does {@link update_question_flags()}.
|
||||
*
|
||||
* @param integer $timestamp optional, use this timestamp as 'now'.
|
||||
* @param int $timestamp optional, use this timestamp as 'now'.
|
||||
* @param array $postdata optional, only intended for testing. Use this data
|
||||
* instead of the data from $_POST.
|
||||
*/
|
||||
@@ -1036,7 +1044,7 @@ class question_usage_by_activity {
|
||||
* Get the submitted data from the current request that belongs to this
|
||||
* particular question.
|
||||
*
|
||||
* @param integer $slot the number used to identify this question within this usage.
|
||||
* @param int $slot the number used to identify this question within this usage.
|
||||
* @param $postdata optional, only intended for testing. Use this data
|
||||
* instead of the data from $_POST.
|
||||
* @return array submitted data specific to this question.
|
||||
@@ -1047,7 +1055,7 @@ class question_usage_by_activity {
|
||||
|
||||
/**
|
||||
* Process a specific action on a specific question.
|
||||
* @param integer $slot the number used to identify this question within this usage.
|
||||
* @param int $slot the number used to identify this question within this usage.
|
||||
* @param $submitteddata the submitted data that constitutes the action.
|
||||
*/
|
||||
public function process_action($slot, $submitteddata, $timestamp = null) {
|
||||
@@ -1059,7 +1067,7 @@ class question_usage_by_activity {
|
||||
/**
|
||||
* Check that the sequence number, that detects weird things like the student
|
||||
* clicking back, is OK.
|
||||
* @param integer $slot the number used to identify this question within this usage.
|
||||
* @param int $slot the number used to identify this question within this usage.
|
||||
* @param array $submitteddata the submitted data that constitutes the action.
|
||||
*/
|
||||
public function validate_sequence_number($slot, $postdata = null) {
|
||||
@@ -1090,7 +1098,7 @@ class question_usage_by_activity {
|
||||
/**
|
||||
* Get the correct response to a particular question. Passing the results of
|
||||
* this method to {@link process_action()} will probably result in full marks.
|
||||
* @param integer $slot the number used to identify this question within this usage.
|
||||
* @param int $slot the number used to identify this question within this usage.
|
||||
* @return array that constitutes a correct response to this question.
|
||||
*/
|
||||
public function get_correct_response($slot) {
|
||||
@@ -1108,7 +1116,7 @@ class question_usage_by_activity {
|
||||
* After the active phase is over, the only changes possible are things like
|
||||
* manual grading, or changing the flag state.
|
||||
*
|
||||
* @param integer $slot the number used to identify this question within this usage.
|
||||
* @param int $slot the number used to identify this question within this usage.
|
||||
*/
|
||||
public function finish_question($slot, $timestamp = null) {
|
||||
$qa = $this->get_question_attempt($slot);
|
||||
@@ -1129,7 +1137,7 @@ class question_usage_by_activity {
|
||||
|
||||
/**
|
||||
* Perform a manual grading action on a question attempt.
|
||||
* @param integer $slot the number used to identify this question within this usage.
|
||||
* @param int $slot the number used to identify this question within this usage.
|
||||
* @param string $comment the comment being added to the question attempt.
|
||||
* @param number $mark the mark that is being assigned. Can be null to just
|
||||
* add a comment.
|
||||
@@ -1143,8 +1151,8 @@ class question_usage_by_activity {
|
||||
/**
|
||||
* Regrade a question in this usage. This replays the sequence of submitted
|
||||
* actions to recompute the outcomes.
|
||||
* @param integer $slot the number used to identify this question within this usage.
|
||||
* @param boolean $finished whether the question attempt should be forced to be finished
|
||||
* @param int $slot the number used to identify this question within this usage.
|
||||
* @param bool $finished whether the question attempt should be forced to be finished
|
||||
* after the regrade, or whether it may still be in progress (default false).
|
||||
* @param number $newmaxmark (optional) if given, will change the max mark while regrading.
|
||||
*/
|
||||
@@ -1167,7 +1175,7 @@ class question_usage_by_activity {
|
||||
|
||||
/**
|
||||
* Regrade all the questions in this usage (without changing their max mark).
|
||||
* @param boolean $finished whether each question should be forced to be finished
|
||||
* @param bool $finished whether each question should be forced to be finished
|
||||
* after the regrade, or whether it may still be in progress (default false).
|
||||
*/
|
||||
public function regrade_all_questions($finished = false) {
|
||||
@@ -1182,7 +1190,7 @@ class question_usage_by_activity {
|
||||
* For internal use only.
|
||||
*
|
||||
* @param array $records Raw records loaded from the database.
|
||||
* @param integer $questionattemptid The id of the question_attempt to extract.
|
||||
* @param int $questionattemptid The id of the question_attempt to extract.
|
||||
* @return question_attempt The newly constructed question_attempt_step.
|
||||
*/
|
||||
public static function load_from_records(&$records, $qubaid) {
|
||||
@@ -1248,7 +1256,7 @@ class question_attempt_iterator implements Iterator, ArrayAccess {
|
||||
public function current() {
|
||||
return $this->offsetGet(current($this->slots));
|
||||
}
|
||||
/** @return integer */
|
||||
/** @return int */
|
||||
public function key() {
|
||||
return current($this->slots);
|
||||
}
|
||||
@@ -1258,12 +1266,12 @@ class question_attempt_iterator implements Iterator, ArrayAccess {
|
||||
public function rewind() {
|
||||
reset($this->slots);
|
||||
}
|
||||
/** @return boolean */
|
||||
/** @return bool */
|
||||
public function valid() {
|
||||
return current($this->slots) !== false;
|
||||
}
|
||||
|
||||
/** @return boolean */
|
||||
/** @return bool */
|
||||
public function offsetExists($slot) {
|
||||
return in_array($slot, $this->slots);
|
||||
}
|
||||
@@ -1379,7 +1387,7 @@ class question_attempt {
|
||||
* indirectly, by calling {@link question_usage_by_activity::add_question()}.
|
||||
*
|
||||
* @param question_definition $question the question this is an attempt at.
|
||||
* @param integer|string $usageid The id of the
|
||||
* @param int|string $usageid The id of the
|
||||
* {@link question_usage_by_activity} we belong to. Used by {@link get_field_prefix()}.
|
||||
* @param question_usage_observer $observer tracks changes to the useage this
|
||||
* attempt is part of. (Optional, a {@link question_usage_null_observer} is
|
||||
@@ -1411,19 +1419,19 @@ class question_attempt {
|
||||
/**
|
||||
* Set the number used to identify this question_attempt within the usage.
|
||||
* For internal use only.
|
||||
* @param integer $slot
|
||||
* @param int $slot
|
||||
*/
|
||||
public function set_number_in_usage($slot) {
|
||||
$this->slot = $slot;
|
||||
}
|
||||
|
||||
/** @return integer the number used to identify this question_attempt within the usage. */
|
||||
/** @return int the number used to identify this question_attempt within the usage. */
|
||||
public function get_slot() {
|
||||
return $this->slot;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer the id of row for this question_attempt, if it is stored in the
|
||||
* @return int the id of row for this question_attempt, if it is stored in the
|
||||
* database. null if not.
|
||||
*/
|
||||
public function get_database_id() {
|
||||
@@ -1432,14 +1440,14 @@ class question_attempt {
|
||||
|
||||
/**
|
||||
* For internal use only. Set the id of the corresponding database row.
|
||||
* @param integer $id the id of row for this question_attempt, if it is
|
||||
* @param int $id the id of row for this question_attempt, if it is
|
||||
* stored in the database.
|
||||
*/
|
||||
public function set_database_id($id) {
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
/** @return integer|string the id of the {@link question_usage_by_activity} we belong to. */
|
||||
/** @return int|string the id of the {@link question_usage_by_activity} we belong to. */
|
||||
public function get_usage_id() {
|
||||
return $this->usageid;
|
||||
}
|
||||
@@ -1447,7 +1455,7 @@ class question_attempt {
|
||||
/**
|
||||
* Set the id of the {@link question_usage_by_activity} we belong to.
|
||||
* For internal use only.
|
||||
* @param integer|string the new id.
|
||||
* @param int|string the new id.
|
||||
*/
|
||||
public function set_usage_id($usageid) {
|
||||
$this->usageid = $usageid;
|
||||
@@ -1468,14 +1476,14 @@ class question_attempt {
|
||||
|
||||
/**
|
||||
* Set the flagged state of this question.
|
||||
* @param boolean $flagged the new state.
|
||||
* @param bool $flagged the new state.
|
||||
*/
|
||||
public function set_flagged($flagged) {
|
||||
$this->flagged = $flagged;
|
||||
$this->observer->notify_attempt_modified($this);
|
||||
}
|
||||
|
||||
/** @return boolean whether this question is currently flagged. */
|
||||
/** @return bool whether this question is currently flagged. */
|
||||
public function is_flagged() {
|
||||
return $this->flagged;
|
||||
}
|
||||
@@ -1548,7 +1556,7 @@ class question_attempt {
|
||||
/**
|
||||
* Get one of the steps in this attempt.
|
||||
* For internal/test code use only.
|
||||
* @param integer $i the step number.
|
||||
* @param int $i the step number.
|
||||
* @return question_attempt_step
|
||||
*/
|
||||
public function get_step($i) {
|
||||
@@ -1561,7 +1569,7 @@ class question_attempt {
|
||||
/**
|
||||
* Get the number of steps in this attempt.
|
||||
* For internal/test code use only.
|
||||
* @return integer the number of steps we currently have.
|
||||
* @return int the number of steps we currently have.
|
||||
*/
|
||||
public function get_num_steps() {
|
||||
return count($this->steps);
|
||||
@@ -1674,7 +1682,7 @@ class question_attempt {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean $showcorrectness Whether right/partial/wrong states should
|
||||
* @param bool $showcorrectness Whether right/partial/wrong states should
|
||||
* be distinguised.
|
||||
* @return string A brief textual description of the current state.
|
||||
*/
|
||||
@@ -1683,7 +1691,7 @@ class question_attempt {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer the timestamp of the most recent step in this question attempt.
|
||||
* @return int the timestamp of the most recent step in this question attempt.
|
||||
*/
|
||||
public function get_last_action_time() {
|
||||
return $this->get_last_step()->get_timecreated();
|
||||
@@ -1698,7 +1706,7 @@ class question_attempt {
|
||||
return $this->get_last_step()->get_fraction();
|
||||
}
|
||||
|
||||
/** @return boolean whether this question attempt has a non-zero maximum mark. */
|
||||
/** @return bool whether this question attempt has a non-zero maximum mark. */
|
||||
public function has_marks() {
|
||||
// Since grades are stored in the database as NUMBER(12,7).
|
||||
return $this->maxmark >= 0.00000005;
|
||||
@@ -1755,7 +1763,7 @@ class question_attempt {
|
||||
/**
|
||||
* The current mark, formatted to the stated number of decimal places. Uses
|
||||
* {@link format_float()} to format floats according to the current locale.
|
||||
* @param integer $dp number of decimal places.
|
||||
* @param int $dp number of decimal places.
|
||||
* @return string formatted mark.
|
||||
*/
|
||||
public function format_mark($dp) {
|
||||
@@ -1765,7 +1773,7 @@ class question_attempt {
|
||||
/**
|
||||
* The current mark, formatted to the stated number of decimal places. Uses
|
||||
* {@link format_float()} to format floats according to the current locale.
|
||||
* @param integer $dp number of decimal places.
|
||||
* @param int $dp number of decimal places.
|
||||
* @return string formatted mark.
|
||||
*/
|
||||
public function format_fraction_as_mark($fraction, $dp) {
|
||||
@@ -1776,7 +1784,7 @@ class question_attempt {
|
||||
* The maximum mark for this question attempt, formatted to the stated number
|
||||
* of decimal places. Uses {@link format_float()} to format floats according
|
||||
* to the current locale.
|
||||
* @param integer $dp number of decimal places.
|
||||
* @param int $dp number of decimal places.
|
||||
* @return string formatted maximum mark.
|
||||
*/
|
||||
public function format_max_mark($dp) {
|
||||
@@ -1806,7 +1814,7 @@ class question_attempt {
|
||||
* @param string $text the content to output.
|
||||
* @param string $component the component name (normally 'question' or 'qtype_...')
|
||||
* @param string $filearea the name of the file area.
|
||||
* @param integer $itemid the item id.
|
||||
* @param int $itemid the item id.
|
||||
*/
|
||||
public function rewrite_pluginfile_urls($text, $component, $filearea, $itemid) {
|
||||
return question_rewrite_question_urls($text,
|
||||
@@ -1843,7 +1851,7 @@ class question_attempt {
|
||||
* Like {@link render_question()} but displays the question at the past step
|
||||
* indicated by $seq, rather than showing the latest step.
|
||||
*
|
||||
* @param integer $seq the seq number of the past state to display.
|
||||
* @param int $seq the seq number of the past state to display.
|
||||
* @param question_display_options $options controls how the question is rendered.
|
||||
* @param string|null $number The question number to display. 'i' is a special
|
||||
* value that gets displayed as Information. Null means no number is displayed.
|
||||
@@ -1860,8 +1868,8 @@ class question_attempt {
|
||||
* @param string $component the name of the component we are serving files for.
|
||||
* @param string $filearea the name of the file area.
|
||||
* @param array $args the remaining bits of the file path.
|
||||
* @param boolean $forcedownload whether the user must be forced to download the file.
|
||||
* @return boolean true if the user can access this file.
|
||||
* @param bool $forcedownload whether the user must be forced to download the file.
|
||||
* @return bool true if the user can access this file.
|
||||
*/
|
||||
public function check_file_access($options, $component, $filearea, $args, $forcedownload) {
|
||||
return $this->behaviour->check_file_access($options, $component, $filearea, $args, $forcedownload);
|
||||
@@ -1943,7 +1951,7 @@ class question_attempt {
|
||||
* {@link optional_param()}, except that the results is returned without
|
||||
* slashes.
|
||||
* @param string $name the paramter name.
|
||||
* @param integer $type one of the PARAM_... constants.
|
||||
* @param int $type one of the PARAM_... constants.
|
||||
* @param array $postdata (optional, only inteded for testing use) take the
|
||||
* data from this array, instead of from $_POST.
|
||||
* @return mixed the requested value.
|
||||
@@ -2082,8 +2090,8 @@ class question_attempt {
|
||||
/**
|
||||
* Perform the action described by $submitteddata.
|
||||
* @param array $submitteddata the submitted data the determines the action.
|
||||
* @param integer $timestamp the time to record for the action. (If not given, use now.)
|
||||
* @param integer $userid the user to attribute the aciton to. (If not given, use the current user.)
|
||||
* @param int $timestamp the time to record for the action. (If not given, use now.)
|
||||
* @param int $userid the user to attribute the aciton to. (If not given, use the current user.)
|
||||
*/
|
||||
public function process_action($submitteddata, $timestamp = null, $userid = null) {
|
||||
$pendingstep = new question_attempt_pending_step($submitteddata, $timestamp, $userid);
|
||||
@@ -2101,8 +2109,8 @@ class question_attempt {
|
||||
* in the quiz, rather than using one of the controls that is part of the
|
||||
* question.
|
||||
*
|
||||
* @param integer $timestamp the time to record for the action. (If not given, use now.)
|
||||
* @param integer $userid the user to attribute the aciton to. (If not given, use the current user.)
|
||||
* @param int $timestamp the time to record for the action. (If not given, use now.)
|
||||
* @param int $userid the user to attribute the aciton to. (If not given, use the current user.)
|
||||
*/
|
||||
public function finish($timestamp = null, $userid = null) {
|
||||
$this->process_action(array('-finish' => 1), $timestamp, $userid);
|
||||
@@ -2112,7 +2120,7 @@ class question_attempt {
|
||||
* Perform a regrade. This replays all the actions from $oldqa into this
|
||||
* attempt.
|
||||
* @param question_attempt $oldqa the attempt to regrade.
|
||||
* @param boolean $finished whether the question attempt should be forced to be finished
|
||||
* @param bool $finished whether the question attempt should be forced to be finished
|
||||
* after the regrade, or whether it may still be in progress (default false).
|
||||
*/
|
||||
public function regrade(question_attempt $oldqa, $finished) {
|
||||
@@ -2136,8 +2144,8 @@ class question_attempt {
|
||||
* Perform a manual grading action on this attempt.
|
||||
* @param $comment the comment being added.
|
||||
* @param $mark the new mark. (Optional, if not given, then only a comment is added.)
|
||||
* @param integer $timestamp the time to record for the action. (If not given, use now.)
|
||||
* @param integer $userid the user to attribute the aciton to. (If not given, use the current user.)
|
||||
* @param int $timestamp the time to record for the action. (If not given, use now.)
|
||||
* @param int $userid the user to attribute the aciton to. (If not given, use the current user.)
|
||||
* @return unknown_type
|
||||
*/
|
||||
public function manual_grade($comment, $mark, $timestamp = null, $userid = null) {
|
||||
@@ -2149,7 +2157,7 @@ class question_attempt {
|
||||
$this->process_action($submitteddata, $timestamp, $userid);
|
||||
}
|
||||
|
||||
/** @return boolean Whether this question attempt has had a manual comment added. */
|
||||
/** @return bool Whether this question attempt has had a manual comment added. */
|
||||
public function has_manual_comment() {
|
||||
foreach ($this->steps as $step) {
|
||||
if ($step->has_behaviour_var('comment')) {
|
||||
@@ -2190,7 +2198,7 @@ class question_attempt {
|
||||
* For internal use only.
|
||||
*
|
||||
* @param array $records Raw records loaded from the database.
|
||||
* @param integer $questionattemptid The id of the question_attempt to extract.
|
||||
* @param int $questionattemptid The id of the question_attempt to extract.
|
||||
* @return question_attempt The newly constructed question_attempt_step.
|
||||
*/
|
||||
public static function load_from_records(&$records, $questionattemptid,
|
||||
@@ -2249,7 +2257,7 @@ class question_attempt {
|
||||
*
|
||||
* All methods that try to modify the question_attempt throw exceptions.
|
||||
*
|
||||
* @copyright 2010 The Open University
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class question_attempt_with_restricted_history extends question_attempt {
|
||||
@@ -2261,7 +2269,7 @@ class question_attempt_with_restricted_history extends question_attempt {
|
||||
/**
|
||||
* Create a question_attempt_with_restricted_history
|
||||
* @param question_attempt $baseqa The question_attempt to make a restricted version of.
|
||||
* @param integer $lastseq the index of the last step to include.
|
||||
* @param int $lastseq the index of the last step to include.
|
||||
* @param string $preferredbehaviour the preferred behaviour. It is slightly
|
||||
* annoyting that this needs to be passed, but unavoidable for now.
|
||||
*/
|
||||
@@ -2352,7 +2360,7 @@ class question_attempt_step_iterator implements Iterator, ArrayAccess {
|
||||
public function current() {
|
||||
return $this->offsetGet($this->i);
|
||||
}
|
||||
/** @return integer */
|
||||
/** @return int */
|
||||
public function key() {
|
||||
return $this->i;
|
||||
}
|
||||
@@ -2362,12 +2370,12 @@ class question_attempt_step_iterator implements Iterator, ArrayAccess {
|
||||
public function rewind() {
|
||||
$this->i = 0;
|
||||
}
|
||||
/** @return boolean */
|
||||
/** @return bool */
|
||||
public function valid() {
|
||||
return $this->offsetExists($this->i);
|
||||
}
|
||||
|
||||
/** @return boolean */
|
||||
/** @return bool */
|
||||
public function offsetExists($i) {
|
||||
return $i >= 0 && $i < $this->qa->get_num_steps();
|
||||
}
|
||||
@@ -2462,8 +2470,8 @@ class question_attempt_step {
|
||||
* normally created by {@link question_attempt} methods like
|
||||
* {@link question_attempt::process_action()}.
|
||||
* @param array $data the submitted data that defines this step.
|
||||
* @param integer $timestamp the time to record for the action. (If not given, use now.)
|
||||
* @param integer $userid the user to attribute the aciton to. (If not given, use the current user.)
|
||||
* @param int $timestamp the time to record for the action. (If not given, use now.)
|
||||
* @param int $userid the user to attribute the aciton to. (If not given, use the current user.)
|
||||
*/
|
||||
public function __construct($data = array(), $timecreated = null, $userid = null) {
|
||||
global $USER;
|
||||
@@ -2510,19 +2518,19 @@ class question_attempt_step {
|
||||
$this->fraction = $fraction;
|
||||
}
|
||||
|
||||
/** @return integer the id of the user resonsible for creating this step. */
|
||||
/** @return int the id of the user resonsible for creating this step. */
|
||||
public function get_user_id() {
|
||||
return $this->userid;
|
||||
}
|
||||
|
||||
/** @return integer the timestamp when this step was created. */
|
||||
/** @return int the timestamp when this step was created. */
|
||||
public function get_timecreated() {
|
||||
return $this->timecreated;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name the name of a question type variable to look for in the submitted data.
|
||||
* @return boolean whether a variable with this name exists in the question type data.
|
||||
* @return bool whether a variable with this name exists in the question type data.
|
||||
*/
|
||||
public function has_qt_var($name) {
|
||||
return array_key_exists($name, $this->data);
|
||||
@@ -2567,7 +2575,7 @@ class question_attempt_step {
|
||||
|
||||
/**
|
||||
* @param string $name the name of an behaviour variable to look for in the submitted data.
|
||||
* @return boolean whether a variable with this name exists in the question type data.
|
||||
* @return bool whether a variable with this name exists in the question type data.
|
||||
*/
|
||||
public function has_behaviour_var($name) {
|
||||
return array_key_exists('-' . $name, $this->data);
|
||||
@@ -2643,7 +2651,7 @@ class question_attempt_step {
|
||||
/**
|
||||
* Create a question_attempt_step from records loaded from the database.
|
||||
* @param array $records Raw records loaded from the database.
|
||||
* @param integer $stepid The id of the records to extract.
|
||||
* @param int $stepid The id of the records to extract.
|
||||
* @return question_attempt_step The newly constructed question_attempt_step.
|
||||
*/
|
||||
public static function load_from_records(&$records, $attemptstepid) {
|
||||
@@ -2677,7 +2685,7 @@ class question_attempt_step {
|
||||
/**
|
||||
* A subclass with a bit of additional funcitonality, for pending steps.
|
||||
*
|
||||
* @copyright 2010 The Open University
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class question_attempt_pending_step extends question_attempt_step {
|
||||
@@ -2828,7 +2836,7 @@ abstract class question_utils {
|
||||
* not have to be the same.
|
||||
* @param array $array1 the first array.
|
||||
* @param array $array2 the second array.
|
||||
* @return boolean whether the two arrays have the same keys with the same
|
||||
* @return bool whether the two arrays have the same keys with the same
|
||||
* corresponding values.
|
||||
*/
|
||||
public static function arrays_have_same_keys_and_values(array $array1, array $array2) {
|
||||
@@ -2855,7 +2863,7 @@ abstract class question_utils {
|
||||
* @param array $array1 the first array.
|
||||
* @param array $array2 the second array.
|
||||
* @param string $key an array key.
|
||||
* @return boolean whether the two arrays have the same value (or lack of
|
||||
* @return bool whether the two arrays have the same value (or lack of
|
||||
* one) for a given key.
|
||||
*/
|
||||
public static function arrays_same_at_key(array $array1, array $array2, $key) {
|
||||
@@ -2875,7 +2883,7 @@ abstract class question_utils {
|
||||
* @param array $array1 the first array.
|
||||
* @param array $array2 the second array.
|
||||
* @param string $key an array key.
|
||||
* @return boolean whether the two arrays have the same value (or lack of
|
||||
* @return bool whether the two arrays have the same value (or lack of
|
||||
* one) for a given key.
|
||||
*/
|
||||
public static function arrays_same_at_key_missing_is_blank(
|
||||
@@ -2900,7 +2908,7 @@ abstract class question_utils {
|
||||
* @param array $array1 the first array.
|
||||
* @param array $array2 the second array.
|
||||
* @param string $key an array key.
|
||||
* @return boolean whether the two arrays have the same value (or lack of
|
||||
* @return bool whether the two arrays have the same value (or lack of
|
||||
* one) for a given key.
|
||||
*/
|
||||
public static function arrays_same_at_key_integer(
|
||||
@@ -2925,7 +2933,7 @@ abstract class question_utils {
|
||||
|
||||
/**
|
||||
* Convert an integer to roman numerals.
|
||||
* @param integer $number an integer between 1 and 3999 inclusive. Anything else will throw an exception.
|
||||
* @param int $number an integer between 1 and 3999 inclusive. Anything else will throw an exception.
|
||||
* @return string the number converted to lower case roman numerals.
|
||||
*/
|
||||
public static function int_to_roman($number) {
|
||||
|
||||
@@ -193,7 +193,7 @@ class core_question_renderer extends plugin_renderer_base {
|
||||
* Render the question flag, assuming $flagsoption allows it.
|
||||
*
|
||||
* @param question_attempt $qa the question attempt to display.
|
||||
* @param integer $flagsoption the option that says whether flags should be displayed.
|
||||
* @param int $flagsoption the option that says whether flags should be displayed.
|
||||
*/
|
||||
protected function question_flag(question_attempt $qa, $flagsoption) {
|
||||
global $CFG;
|
||||
@@ -228,7 +228,7 @@ class core_question_renderer extends plugin_renderer_base {
|
||||
/**
|
||||
* Work out the actual img tag needed for the flag
|
||||
*
|
||||
* @param boolean $flagged whether the question is currently flagged.
|
||||
* @param bool $flagged whether the question is currently flagged.
|
||||
* @param string $id an id to be added as an attribute to the img (optional).
|
||||
* @return string the img tag.
|
||||
*/
|
||||
|
||||
+13
-14
@@ -37,7 +37,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @copyright 2009 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
abstract class question_state {
|
||||
/**#@+
|
||||
* Specific question_state instances.
|
||||
@@ -122,7 +121,7 @@ abstract class question_state {
|
||||
/**
|
||||
* Is this state one of the ones that mean the question attempt is in progress?
|
||||
* That is, started, but no finished.
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function is_active() {
|
||||
return false;
|
||||
@@ -131,7 +130,7 @@ abstract class question_state {
|
||||
/**
|
||||
* Is this state one of the ones that mean the question attempt is finished?
|
||||
* That is, no further interaction possible, apart from manual grading.
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function is_finished() {
|
||||
return true;
|
||||
@@ -139,7 +138,7 @@ abstract class question_state {
|
||||
|
||||
/**
|
||||
* Is this state one of the ones that mean the question attempt has been graded?
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function is_graded() {
|
||||
return false;
|
||||
@@ -147,7 +146,7 @@ abstract class question_state {
|
||||
|
||||
/**
|
||||
* Is this state one of the ones that mean the question attempt has been graded?
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function is_correct() {
|
||||
return false;
|
||||
@@ -155,7 +154,7 @@ abstract class question_state {
|
||||
|
||||
/**
|
||||
* Is this state one of the ones that mean the question attempt has been graded?
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function is_partially_correct() {
|
||||
return false;
|
||||
@@ -163,7 +162,7 @@ abstract class question_state {
|
||||
|
||||
/**
|
||||
* Is this state one of the ones that mean the question attempt has been graded?
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function is_incorrect() {
|
||||
return false;
|
||||
@@ -171,7 +170,7 @@ abstract class question_state {
|
||||
|
||||
/**
|
||||
* Is this state one of the ones that mean the question attempt has been graded?
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function is_gave_up() {
|
||||
return false;
|
||||
@@ -179,7 +178,7 @@ abstract class question_state {
|
||||
|
||||
/**
|
||||
* Is this state one of the ones that mean the question attempt has had a manual comment added?
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function is_commented() {
|
||||
return false;
|
||||
@@ -208,7 +207,7 @@ abstract class question_state {
|
||||
* Appropriate allowance is made for rounding float values.
|
||||
*
|
||||
* @param number $fraction the grade, on the fraction scale.
|
||||
* @return integer one of the state constants.
|
||||
* @return int one of the state constants.
|
||||
*/
|
||||
public static function graded_state_for_fraction($fraction) {
|
||||
if ($fraction < 0.000001) {
|
||||
@@ -226,7 +225,7 @@ abstract class question_state {
|
||||
* $manually_graded_partcorrect. Appropriate allowance is made for rounding float values.
|
||||
*
|
||||
* @param number $fraction the grade, on the fraction scale.
|
||||
* @return integer one of the state constants.
|
||||
* @return int one of the state constants.
|
||||
*/
|
||||
public static function manually_graded_state_for_fraction($fraction) {
|
||||
if (is_null($fraction)) {
|
||||
@@ -244,7 +243,7 @@ abstract class question_state {
|
||||
* Compute an appropriate state to move to after a manual comment has been
|
||||
* added to this state.
|
||||
* @param number $fraction the manual grade (if any) on the fraction scale.
|
||||
* @return integer the new state.
|
||||
* @return int the new state.
|
||||
*/
|
||||
public function corresponding_commented_state($fraction) {
|
||||
throw new Exception('Unexpected question state.');
|
||||
@@ -265,7 +264,7 @@ abstract class question_state {
|
||||
* {@link question_behaviour::get_state_string()}. However, behaviours
|
||||
* sometimes change this default string for soemthing more specific.
|
||||
*
|
||||
* @param boolean $showcorrectness Whether right/partial/wrong states should
|
||||
* @param bool $showcorrectness Whether right/partial/wrong states should
|
||||
* be distinguised, or just treated as 'complete'.
|
||||
* @return string the name of a string that can be looked up in the 'question'
|
||||
* lang pack, or used as a CSS class name, etc.
|
||||
@@ -275,7 +274,7 @@ abstract class question_state {
|
||||
/**
|
||||
* The result of doing get_string on the result of {@link get_state_class()}.
|
||||
*
|
||||
* @param boolean $showcorrectness Whether right/partial/wrong states should
|
||||
* @param bool $showcorrectness Whether right/partial/wrong states should
|
||||
* be distinguised.
|
||||
* @return string a string from the lang pack that can be used in the UI.
|
||||
*/
|
||||
|
||||
@@ -82,8 +82,8 @@ class question_engine_assumption_logger {
|
||||
* This class manages upgrading all the question attempts from the old database
|
||||
* structure to the new question engine.
|
||||
*
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class question_engine_attempt_upgrader {
|
||||
/** @var question_engine_upgrade_question_loader */
|
||||
@@ -495,8 +495,8 @@ class question_engine_attempt_upgrader {
|
||||
* This class deals with loading (and caching) question definitions during the
|
||||
* question engine upgrade.
|
||||
*
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class question_engine_upgrade_question_loader {
|
||||
private $cache = array();
|
||||
|
||||
+8
-8
@@ -58,12 +58,12 @@ class qformat_default {
|
||||
// functions to indicate import/export functionality
|
||||
// override to return true if implemented
|
||||
|
||||
/** @return boolean whether this plugin provides import functionality. */
|
||||
/** @return bool whether this plugin provides import functionality. */
|
||||
function provide_import() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @return boolean whether this plugin provides export functionality. */
|
||||
/** @return bool whether this plugin provides export functionality. */
|
||||
function provide_export() {
|
||||
return false;
|
||||
}
|
||||
@@ -190,7 +190,7 @@ class qformat_default {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean $canaccess Whether the current use can access the backup data folder. Determines
|
||||
* @param bool $canaccess Whether the current use can access the backup data folder. Determines
|
||||
* where export files are saved.
|
||||
*/
|
||||
function set_can_access_backupdata($canaccess) {
|
||||
@@ -260,7 +260,7 @@ class qformat_default {
|
||||
|
||||
/**
|
||||
* Perform any required pre-processing
|
||||
* @return boolean success
|
||||
* @return bool success
|
||||
*/
|
||||
function importpreprocess() {
|
||||
return true;
|
||||
@@ -270,7 +270,7 @@ class qformat_default {
|
||||
* Process the file
|
||||
* This method should not normally be overidden
|
||||
* @param object $category
|
||||
* @return boolean success
|
||||
* @return bool success
|
||||
*/
|
||||
function importprocess($category) {
|
||||
global $USER, $CFG, $DB, $OUTPUT, $QTYPES;
|
||||
@@ -606,7 +606,7 @@ class qformat_default {
|
||||
|
||||
/**
|
||||
* Override if any post-processing is required
|
||||
* @return boolean success
|
||||
* @return bool success
|
||||
*/
|
||||
function importpostprocess() {
|
||||
return true;
|
||||
@@ -645,7 +645,7 @@ class qformat_default {
|
||||
|
||||
/**
|
||||
* Do any pre-processing that may be required
|
||||
* @param boolean success
|
||||
* @param bool success
|
||||
*/
|
||||
function exportpreprocess() {
|
||||
return true;
|
||||
@@ -822,7 +822,7 @@ class qformat_default {
|
||||
|
||||
/**
|
||||
* Do an post-processing that may be required
|
||||
* @return boolean success
|
||||
* @return bool success
|
||||
*/
|
||||
function exportpostprocess() {
|
||||
return true;
|
||||
|
||||
@@ -571,7 +571,7 @@ class qformat_gift extends qformat_default {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $format one of the FORMAT_ constants.
|
||||
* @param int $format one of the FORMAT_ constants.
|
||||
* @return string the corresponding name.
|
||||
*/
|
||||
function format_const_to_name($format) {
|
||||
@@ -589,7 +589,7 @@ class qformat_gift extends qformat_default {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $format one of the FORMAT_ constants.
|
||||
* @param int $format one of the FORMAT_ constants.
|
||||
* @return string the corresponding name.
|
||||
*/
|
||||
function format_name_to_const($format) {
|
||||
|
||||
@@ -257,7 +257,7 @@ function handle_questions_media(&$questions, $path, $courseid) {
|
||||
* The parent class method was overridden because the IMS export consists of multiple files
|
||||
*
|
||||
* @param string $filename the directory name which will hold the exported files
|
||||
* @return boolean - or errors out
|
||||
* @return bool - or errors out
|
||||
*/
|
||||
function exportprocess() {
|
||||
|
||||
@@ -515,8 +515,8 @@ function xml_entitize(&$collection) {
|
||||
*
|
||||
* @todo handle in-line media (specified in the question/subquestion/answer text) for course-level exports
|
||||
* @param object $question
|
||||
* @param boolean $shuffleanswers whether or not to shuffle the answers
|
||||
* @param boolean $courselevel whether or not this is a course-level export
|
||||
* @param bool $shuffleanswers whether or not to shuffle the answers
|
||||
* @param bool $courselevel whether or not this is a course-level export
|
||||
* @param string $path provide the path to copy question media files to, if $courselevel == true
|
||||
* @return string containing export text
|
||||
*/
|
||||
@@ -824,7 +824,7 @@ function xml_entitize(&$collection) {
|
||||
* returns whether or not a given question is scoreable
|
||||
*
|
||||
* @param object $question
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
function get_qti_scoreable($question) {
|
||||
switch ($question->qtype) {
|
||||
@@ -841,7 +841,7 @@ function xml_entitize(&$collection) {
|
||||
* The results are based on whether or not Moodle stores answers for the given question type
|
||||
*
|
||||
* @param object $question
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
function get_qti_solution_available($question) {
|
||||
switch($question->qtype) {
|
||||
|
||||
@@ -55,7 +55,7 @@ throw new coding_exception('qti_two not converted to new fil api yet, sorry');
|
||||
* determines whether or not a file is an image, based on the file extension
|
||||
*
|
||||
* @param string $file the filename
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
function is_image_by_extension($file) {
|
||||
$extensionsregex = '/\.(gif|jpg|jpeg|jpe|png|tif|tiff|bmp|xbm|rgb|svf)$/';
|
||||
@@ -70,7 +70,7 @@ function is_image_by_extension($file) {
|
||||
* determines whether or not a file is a media file, based on the file extension
|
||||
*
|
||||
* @param string $file the filename
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
function is_media_by_extension($file) {
|
||||
$extensionsregex = '/\.(gif|jpg|jpeg|jpe|png|tif|tiff|bmp|xbm|rgb|svf|swf|mov|mpg|mpeg|wmf|avi|mpe|flv|mp3|ra|ram)$/';
|
||||
@@ -84,7 +84,7 @@ function is_media_by_extension($file) {
|
||||
* determines whether or not a file is a multimedia file, based on the file extension
|
||||
*
|
||||
* @param string $file the filename
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
function is_multimedia_by_extension($file) {
|
||||
$extensionsregex = '/\.(swf|mov|mpg|mpeg|wmf|avi|mpe|flv)$/';
|
||||
@@ -98,7 +98,7 @@ function is_multimedia_by_extension($file) {
|
||||
* determines whether or not a file is a multimedia file of a type php can get the dimension for, based on the file extension
|
||||
*
|
||||
* @param string $file the filename
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
function is_sizable_multimedia($file) {
|
||||
$extensionsregex = '/\.(swf)$/';
|
||||
|
||||
@@ -27,12 +27,10 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
|
||||
/**
|
||||
* Web CT question importer.
|
||||
*
|
||||
* @copyright 2004 ASP Consulting http://www.asp-consulting.net
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* Manipulate HTML editites in a string. Used by WebCT import.
|
||||
* @param string $string
|
||||
* @return string
|
||||
*/
|
||||
function unhtmlentities($string){
|
||||
$search = array ("'<script[?>]*?>.*?</script>'si", // remove javascript
|
||||
@@ -64,8 +62,10 @@ function unhtmlentities($string){
|
||||
return preg_replace ($search, $replace, $string);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Helper function for WebCT import.
|
||||
* @param unknown_type $formula
|
||||
*/
|
||||
function qformat_webct_convert_formula($formula) {
|
||||
|
||||
// Remove empty space, as it would cause problems otherwise:
|
||||
@@ -160,6 +160,13 @@ function qformat_webct_convert_formula($formula) {
|
||||
return $formula;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Web CT question importer.
|
||||
*
|
||||
* @copyright 2004 ASP Consulting http://www.asp-consulting.net
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class qformat_webct extends qformat_default {
|
||||
|
||||
function provide_import() {
|
||||
|
||||
@@ -59,7 +59,7 @@ class qformat_xml extends qformat_default {
|
||||
* Translate human readable format name
|
||||
* into internal Moodle code number
|
||||
* @param string name format name from xml file
|
||||
* @return integer Moodle format code
|
||||
* @return int Moodle format code
|
||||
*/
|
||||
function trans_format($name) {
|
||||
$name = trim($name);
|
||||
@@ -83,7 +83,7 @@ class qformat_xml extends qformat_default {
|
||||
* Translate human readable single answer option
|
||||
* to internal code number
|
||||
* @param string name true/false
|
||||
* @return integer internal code number
|
||||
* @return int internal code number
|
||||
*/
|
||||
function trans_single($name) {
|
||||
$name = trim($name);
|
||||
@@ -114,7 +114,7 @@ class qformat_xml extends qformat_default {
|
||||
* @param array xml data to read
|
||||
* @param array path path to node expressed as array
|
||||
* @param mixed default
|
||||
* @param boolean istext process as text
|
||||
* @param bool istext process as text
|
||||
* @param string error if set value must exist, return false and issue message if not
|
||||
* @return mixed value
|
||||
*/
|
||||
@@ -280,7 +280,7 @@ class qformat_xml extends qformat_default {
|
||||
* Import the common overall feedback fields.
|
||||
* @param object $question the part of the XML relating to this question.
|
||||
* @param object $qo the question data to add the fields to.
|
||||
* @param boolean $withshownumpartscorrect include the shownumcorrect field.
|
||||
* @param bool $withshownumpartscorrect include the shownumcorrect field.
|
||||
*/
|
||||
public function import_combined_feedback($qo, $questionxml, $withshownumpartscorrect = false) {
|
||||
foreach (array('correctfeedback', 'partiallycorrectfeedback', 'incorrectfeedback') as $field) {
|
||||
@@ -1049,7 +1049,7 @@ class qformat_xml extends qformat_default {
|
||||
* Generates <text></text> tags, processing raw text therein
|
||||
* @param string $raw the content to output.
|
||||
* @param int $indent the current indent level.
|
||||
* @param boolean $short stick it on one line.
|
||||
* @param bool $short stick it on one line.
|
||||
* @return string formatted text.
|
||||
*/
|
||||
function writetext($raw, $indent = 0, $short = true) {
|
||||
|
||||
+10
-10
@@ -33,8 +33,8 @@ require_once($CFG->libdir . '/formslib.php');
|
||||
/**
|
||||
* Settings form for the preview options.
|
||||
*
|
||||
* @copyright 2009 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2009 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class preview_options_form extends moodleform {
|
||||
public function definition() {
|
||||
@@ -83,8 +83,8 @@ class preview_options_form extends moodleform {
|
||||
* Displays question preview options as default and set the options
|
||||
* Setting default, getting and setting user preferences in question preview options.
|
||||
*
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class question_preview_options extends question_display_options {
|
||||
/** @var string the behaviour to use for this preview. */
|
||||
@@ -198,8 +198,8 @@ class question_preview_options extends question_display_options {
|
||||
* @param object $context context object
|
||||
* @param string $component the name of the component we are serving files for.
|
||||
* @param string $filearea the name of the file area.
|
||||
* @param integer $qubaid the question_usage this image belongs to.
|
||||
* @param integer $slot the relevant slot within the usage.
|
||||
* @param int $qubaid the question_usage this image belongs to.
|
||||
* @param int $slot the relevant slot within the usage.
|
||||
* @param array $args the remaining bits of the file path.
|
||||
* @param bool $forcedownload whether the user must be forced to download the file.
|
||||
* @return bool false if file not found, does not return if found - justsend the file
|
||||
@@ -242,8 +242,8 @@ function question_preview_question_pluginfile($course, $context, $component,
|
||||
|
||||
/**
|
||||
* The the URL to use for actions relating to this preview.
|
||||
* @param integer $questionid the question being previewed.
|
||||
* @param integer $qubaid the id of the question usage for this preview.
|
||||
* @param int $questionid the question being previewed.
|
||||
* @param int $qubaid the id of the question usage for this preview.
|
||||
* @param question_preview_options $options the options in use.
|
||||
*/
|
||||
function question_preview_action_url($questionid, $qubaid,
|
||||
@@ -255,8 +255,8 @@ function question_preview_action_url($questionid, $qubaid,
|
||||
|
||||
/**
|
||||
* Delete the current preview, if any, and redirect to start a new preview.
|
||||
* @param integer $previewid
|
||||
* @param integer $questionid
|
||||
* @param int $previewid
|
||||
* @param int $questionid
|
||||
* @param object $displayoptions
|
||||
*/
|
||||
function restart_preview($previewid, $questionid, $displayoptions) {
|
||||
|
||||
@@ -28,6 +28,9 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Provides the information to backup calculated questions
|
||||
*
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class backup_qtype_calculated_plugin extends backup_qtype_plugin {
|
||||
|
||||
|
||||
@@ -29,6 +29,9 @@ defined('MOODLE_INTERNAL') || die();
|
||||
/**
|
||||
* restore plugin class that provides the necessary information
|
||||
* needed to restore one calculated qtype plugin
|
||||
*
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class restore_qtype_calculated_plugin extends restore_qtype_plugin {
|
||||
|
||||
|
||||
+3
@@ -30,5 +30,8 @@ require_once($CFG->dirroot . '/question/type/calculated/backup/moodle2/backup_qt
|
||||
|
||||
/**
|
||||
* Provides the information to backup calculatedmulti questions
|
||||
*
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class backup_qtype_calculatedmulti_plugin extends backup_qtype_calculated_plugin {}
|
||||
|
||||
+4
-1
@@ -30,7 +30,10 @@ require_once($CFG->dirroot . '/question/type/calculated/backup/moodle2/restore_q
|
||||
|
||||
/**
|
||||
* restore plugin class that provides the necessary information
|
||||
* needed to restore one calculatedmulti qtype plugin
|
||||
* needed to restore one calculatedmulti qtype plugin.
|
||||
*
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class restore_qtype_calculatedmulti_plugin extends restore_qtype_calculated_plugin {
|
||||
|
||||
|
||||
+3
@@ -30,6 +30,9 @@ require_once($CFG->dirroot . '/question/type/calculated/backup/moodle2/backup_qt
|
||||
|
||||
/**
|
||||
* Provides the information to backup calculatedsimple questions
|
||||
*
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class backup_qtype_calculatedsimple_plugin extends backup_qtype_calculated_plugin {
|
||||
}
|
||||
|
||||
+3
@@ -31,6 +31,9 @@ require_once($CFG->dirroot . '/question/type/calculated/backup/moodle2/restore_q
|
||||
/**
|
||||
* restore plugin class that provides the necessary information
|
||||
* needed to restore one calculatedsimple qtype plugin
|
||||
*
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class restore_qtype_calculatedsimple_plugin extends restore_qtype_calculated_plugin {
|
||||
}
|
||||
|
||||
@@ -28,6 +28,9 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Provides the information to backup essay questions
|
||||
*
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class backup_qtype_essay_plugin extends backup_qtype_plugin {
|
||||
|
||||
|
||||
@@ -29,6 +29,9 @@ defined('MOODLE_INTERNAL') || die();
|
||||
/**
|
||||
* restore plugin class that provides the necessary information
|
||||
* needed to restore one essay qtype plugin
|
||||
*
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class restore_qtype_essay_plugin extends restore_qtype_plugin {
|
||||
|
||||
|
||||
@@ -44,8 +44,8 @@ class qtype_gapselect_question extends qtype_gapselect_question_base {
|
||||
/**
|
||||
* Represents one of the choices (select box option).
|
||||
*
|
||||
* @copyright 2009 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2009 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class qtype_gapselect_choice {
|
||||
public $text;
|
||||
|
||||
@@ -161,7 +161,7 @@ abstract class qtype_gapselect_question_base extends question_graded_automatical
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $key stem number
|
||||
* @param int $key stem number
|
||||
* @return string the question-type variable name.
|
||||
*/
|
||||
public function field($place) {
|
||||
|
||||
@@ -28,6 +28,9 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Provides the information to backup match questions
|
||||
*
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class backup_qtype_match_plugin extends backup_qtype_plugin {
|
||||
|
||||
|
||||
@@ -29,6 +29,9 @@ defined('MOODLE_INTERNAL') || die();
|
||||
/**
|
||||
* restore plugin class that provides the necessary information
|
||||
* needed to restore one match qtype plugin
|
||||
*
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class restore_qtype_match_plugin extends restore_qtype_plugin {
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ class qtype_match_question extends question_graded_automatically_with_countback
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $key stem number
|
||||
* @param int $key stem number
|
||||
* @return string the question-type variable name.
|
||||
*/
|
||||
protected function field($key) {
|
||||
|
||||
@@ -28,6 +28,9 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Provides the information to backup multianswer questions
|
||||
*
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class backup_qtype_multianswer_plugin extends backup_qtype_plugin {
|
||||
|
||||
|
||||
@@ -29,6 +29,9 @@ defined('MOODLE_INTERNAL') || die();
|
||||
/**
|
||||
* restore plugin class that provides the necessary information
|
||||
* needed to restore one multianswer qtype plugin
|
||||
*
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class restore_qtype_multianswer_plugin extends restore_qtype_plugin {
|
||||
|
||||
|
||||
@@ -28,6 +28,9 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Provides the information to backup multichoice questions
|
||||
*
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class backup_qtype_multichoice_plugin extends backup_qtype_plugin {
|
||||
|
||||
|
||||
@@ -29,6 +29,9 @@ defined('MOODLE_INTERNAL') || die();
|
||||
/**
|
||||
* restore plugin class that provides the necessary information
|
||||
* needed to restore one multichoice qtype plugin
|
||||
*
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class restore_qtype_multichoice_plugin extends restore_qtype_plugin {
|
||||
|
||||
|
||||
@@ -265,7 +265,7 @@ class qtype_multichoice_multi_question extends qtype_multichoice_base {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $key choice number
|
||||
* @param int $key choice number
|
||||
* @return string the question-type variable name.
|
||||
*/
|
||||
protected function field($key) {
|
||||
@@ -348,7 +348,7 @@ class qtype_multichoice_multi_question extends qtype_multichoice_base {
|
||||
|
||||
/**
|
||||
* @param array $response responses, as returned by {@link question_attempt_step::get_qt_data()}.
|
||||
* @return integer the number of choices that were selected. in this response.
|
||||
* @return int the number of choices that were selected. in this response.
|
||||
*/
|
||||
public function get_num_selected_choices(array $response) {
|
||||
$numselected = 0;
|
||||
@@ -361,7 +361,7 @@ class qtype_multichoice_multi_question extends qtype_multichoice_base {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer the number of choices that are correct.
|
||||
* @return int the number of choices that are correct.
|
||||
*/
|
||||
public function get_num_correct_choices() {
|
||||
$numcorrect = 0;
|
||||
|
||||
@@ -28,6 +28,9 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Provides the information to backup numerical questions
|
||||
*
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class backup_qtype_numerical_plugin extends backup_qtype_plugin {
|
||||
|
||||
|
||||
@@ -29,6 +29,9 @@ defined('MOODLE_INTERNAL') || die();
|
||||
/**
|
||||
* restore plugin class that provides the necessary information
|
||||
* needed to restore one numerical qtype plugin
|
||||
*
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class restore_qtype_numerical_plugin extends restore_qtype_plugin {
|
||||
|
||||
|
||||
@@ -40,7 +40,6 @@ require_once("$CFG->dirroot/question/type/shortanswer/questiontype.php");
|
||||
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
class question_numerical_qtype extends qtype_shortanswer {
|
||||
|
||||
public $virtualqtype = false;
|
||||
@@ -753,7 +752,7 @@ class question_numerical_qtype extends qtype_shortanswer {
|
||||
* when used in a multianswer (Cloze) question.
|
||||
* This function performs response processing and grading and updates
|
||||
* the state accordingly.
|
||||
* @return boolean Indicates success or failure.
|
||||
* @return bool Indicates success or failure.
|
||||
* @param object $question The question to be graded. Question type
|
||||
* specific information is included.
|
||||
* @param object $state The state of the question to grade. The current
|
||||
|
||||
@@ -70,7 +70,7 @@ function qtype_opaque_format_soap_fault($fault) {
|
||||
class qtype_opaque_engine_manager {
|
||||
/**
|
||||
* Load the definition of an engine from the database.
|
||||
* @param integer $engineid the id of the engine to load.
|
||||
* @param int $engineid the id of the engine to load.
|
||||
* @return mixed On success, and object with fields id, name, questionengines and questionbanks.
|
||||
* The last two fields are arrays of URLs. On an error, returns a string to look up in the
|
||||
* qtype_opaque language file as an error message.
|
||||
@@ -102,7 +102,7 @@ class qtype_opaque_engine_manager {
|
||||
* will be created if $engine->id is not set, and updated if it is.
|
||||
*
|
||||
* @param object $engine the definition to save.
|
||||
* @return integer the id of the saved definition.
|
||||
* @return int the id of the saved definition.
|
||||
*/
|
||||
public function save_engine_def($engine) {
|
||||
global $DB;
|
||||
@@ -141,8 +141,8 @@ class qtype_opaque_engine_manager {
|
||||
|
||||
/**
|
||||
* Delete the definition of an engine from the database.
|
||||
* @param integer $engineid the id of the engine to delete.
|
||||
* @return boolean whether the delete succeeded.
|
||||
* @param int $engineid the id of the engine to delete.
|
||||
* @return bool whether the delete succeeded.
|
||||
*/
|
||||
public function delete_engine_def($engineid) {
|
||||
global $DB;
|
||||
@@ -186,7 +186,7 @@ class qtype_opaque_engine_manager {
|
||||
* return the new engine id.
|
||||
*
|
||||
* @param object $engine the engine to ensure is in the databse.
|
||||
* @return integer its id.
|
||||
* @return int its id.
|
||||
*/
|
||||
public function find_or_create_engineid($engine) {
|
||||
$possibleengineids = $this->get_possibly_matching_engines($engine);
|
||||
@@ -210,7 +210,7 @@ class qtype_opaque_engine_manager {
|
||||
*
|
||||
* @param object $engine1 one engine definition.
|
||||
* @param object $engine2 another engine definition.
|
||||
* @return boolean whether they are the same.
|
||||
* @return bool whether they are the same.
|
||||
*/
|
||||
public function is_same_engine($engine1, $engine2) {
|
||||
// Same passkey.
|
||||
@@ -227,7 +227,7 @@ class qtype_opaque_engine_manager {
|
||||
|
||||
/**
|
||||
* Load the definition of an engine from the database.
|
||||
* @param integer $engineid the id of the engine to load.
|
||||
* @param int $engineid the id of the engine to load.
|
||||
* @return mixed On success, and object with fields id, name, questionengines and questionbanks.
|
||||
* The last two fields are arrays of URLs. On an error, returns a string to look up in the
|
||||
* qtype_opaque language file as an error message.
|
||||
@@ -242,7 +242,7 @@ function qtype_opaque_load_engine_def($engineid) {
|
||||
* will be created if $engine->id is not set, and updated if it is.
|
||||
*
|
||||
* @param object $engine the definition to save.
|
||||
* @return integer the id of the saved definition.
|
||||
* @return int the id of the saved definition.
|
||||
*/
|
||||
function qtype_opaque_save_engine_def($engine) {
|
||||
$manager = new qtype_opaque_engine_manager();
|
||||
@@ -251,8 +251,8 @@ function qtype_opaque_save_engine_def($engine) {
|
||||
|
||||
/**
|
||||
* Delete the definition of an engine from the database.
|
||||
* @param integer $engineid the id of the engine to delete.
|
||||
* @return boolean whether the delete succeeded.
|
||||
* @param int $engineid the id of the engine to delete.
|
||||
* @return bool whether the delete succeeded.
|
||||
*/
|
||||
function qtype_opaque_delete_engine_def($engineid) {
|
||||
$manager = new qtype_opaque_engine_manager();
|
||||
@@ -265,7 +265,7 @@ function qtype_opaque_delete_engine_def($engineid) {
|
||||
* return the new engine id.
|
||||
*
|
||||
* @param object $engine the engine to ensure is in the databse.
|
||||
* @return integer its id.
|
||||
* @return int its id.
|
||||
*/
|
||||
function qtype_opaque_find_or_create_engineid($engine) {
|
||||
$manager = new qtype_opaque_engine_manager();
|
||||
@@ -363,7 +363,7 @@ function qtype_opaque_stop_question_session($engine, $questionsessionid) {
|
||||
/**
|
||||
* Get a step from $qa, as if $pendingstep had already been added at the end
|
||||
* of the list, if it is not null.
|
||||
* @param integer $seq
|
||||
* @param int $seq
|
||||
* @param question_attempt $qa
|
||||
* @param question_attempt_step|null $pendingstep
|
||||
* @return question_attempt_step
|
||||
@@ -657,7 +657,7 @@ class qtype_opaque_resource_cache {
|
||||
|
||||
/**
|
||||
* Create a new qtype_opaque_resource_cache for a particular remote question.
|
||||
* @param integer $engineid the id of the question engine.
|
||||
* @param int $engineid the id of the question engine.
|
||||
* @param string $remoteid remote question id, as per Opaque spec.
|
||||
* @param string $remoteversion remote question version, as per Opaque spec.
|
||||
*/
|
||||
@@ -811,7 +811,7 @@ class qtype_opaque_resource_cache {
|
||||
* Safe to call even if folder already exists (checks)
|
||||
* @param string $folder Folder to create
|
||||
* @param int $mode Mode for creation (default 0755)
|
||||
* @return boolean True if folder (now) exists, false if there was a failure
|
||||
* @return bool True if folder (now) exists, false if there was a failure
|
||||
*/
|
||||
protected function mkdir_recursive($folder, $mode='') {
|
||||
if (is_dir($folder)) {
|
||||
|
||||
@@ -351,9 +351,9 @@ class qtype_oumultiresponse_hint extends question_hint_with_parts {
|
||||
/**
|
||||
* Constructor.
|
||||
* @param string $hint The hint text
|
||||
* @param boolean $shownumcorrect whether the number of right parts should be shown
|
||||
* @param boolean $clearwrong whether the wrong parts should be reset.
|
||||
* @param boolean $showchoicefeedback whether to show the feedback for each choice.
|
||||
* @param bool $shownumcorrect whether the number of right parts should be shown
|
||||
* @param bool $clearwrong whether the wrong parts should be reset.
|
||||
* @param bool $showchoicefeedback whether to show the feedback for each choice.
|
||||
*/
|
||||
public function __construct($id, $hint, $hintformat, $shownumcorrect, $clearwrong, $showchoicefeedback) {
|
||||
parent::__construct($id, $hint, $hintformat, $shownumcorrect, $clearwrong);
|
||||
|
||||
@@ -239,7 +239,7 @@ abstract class question_definition {
|
||||
* @param question_attempt $qa the question attempt.
|
||||
* @param string $component used for rewriting file area URLs.
|
||||
* @param string $filearea used for rewriting file area URLs.
|
||||
* @param boolean $clean Whether the HTML needs to be cleaned. Generally,
|
||||
* @param bool $clean Whether the HTML needs to be cleaned. Generally,
|
||||
* parts of the question do not need to be cleaned, and student input does.
|
||||
* @return string the text formatted for output by format_text.
|
||||
*/
|
||||
@@ -283,8 +283,8 @@ abstract class question_definition {
|
||||
* @param string $component the name of the component we are serving files for.
|
||||
* @param string $filearea the name of the file area.
|
||||
* @param array $args the remaining bits of the file path.
|
||||
* @param boolean $forcedownload whether the user must be forced to download the file.
|
||||
* @return boolean true if the user can access this file.
|
||||
* @param bool $forcedownload whether the user must be forced to download the file.
|
||||
* @return bool true if the user can access this file.
|
||||
*/
|
||||
public function check_file_access($qa, $options, $component, $filearea, $args, $forcedownload) {
|
||||
if ($component == 'question' && $filearea == 'questiontext') {
|
||||
@@ -350,7 +350,7 @@ interface question_manually_gradable {
|
||||
* should move to the COMPLETE or INCOMPLETE state.
|
||||
*
|
||||
* @param array $response responses, as returned by {@link question_attempt_step::get_qt_data()}.
|
||||
* @return boolean whether this response is a complete answer to this question.
|
||||
* @return bool whether this response is a complete answer to this question.
|
||||
*/
|
||||
public function is_complete_response(array $response);
|
||||
|
||||
@@ -362,7 +362,7 @@ interface question_manually_gradable {
|
||||
* @param array $prevresponse the responses previously recorded for this question,
|
||||
* as returned by {@link question_attempt_step::get_qt_data()}
|
||||
* @param array $newresponse the new responses, in the same format.
|
||||
* @return boolean whether the two sets of responses are the same - that is
|
||||
* @return bool whether the two sets of responses are the same - that is
|
||||
* whether the new set of responses can safely be discarded.
|
||||
*/
|
||||
public function is_same_response(array $prevresponse, array $newresponse);
|
||||
@@ -435,7 +435,7 @@ interface question_automatically_gradable extends question_manually_gradable {
|
||||
* or whether it must be considered aborted.
|
||||
*
|
||||
* @param array $response responses, as returned by {@link question_attempt_step::get_qt_data()}.
|
||||
* @return boolean whether this response can be graded.
|
||||
* @return bool whether this response can be graded.
|
||||
*/
|
||||
public function is_gradable_response(array $response);
|
||||
|
||||
@@ -459,7 +459,7 @@ interface question_automatically_gradable extends question_manually_gradable {
|
||||
* the question type wants to do something complex. For example, the
|
||||
* multiple choice with multiple responses question type will turn off most
|
||||
* of the hint options if the student has selected too many opitions.
|
||||
* @param integer $hintnumber Which hint to display. Indexed starting from 0
|
||||
* @param int $hintnumber Which hint to display. Indexed starting from 0
|
||||
* @param question_attempt $qa The question_attempt.
|
||||
*/
|
||||
public function get_hint($hintnumber, question_attempt $qa);
|
||||
@@ -489,7 +489,7 @@ interface question_automatically_gradable_with_countback extends question_automa
|
||||
* @param array $responses the response for each try. Each element of this
|
||||
* array is a response array, as would be passed to {@link grade_response()}.
|
||||
* There may be between 1 and $totaltries responses.
|
||||
* @param integer $totaltries The maximum number of tries allowed.
|
||||
* @param int $totaltries The maximum number of tries allowed.
|
||||
* @return numeric the fraction that should be awarded for this
|
||||
* sequence of response.
|
||||
*/
|
||||
@@ -540,7 +540,7 @@ abstract class question_graded_automatically extends question_with_responses
|
||||
* @param question_attempt $qa the question attempt being displayed.
|
||||
* @param question_display_options $options the options that control display of the question.
|
||||
* @param string $filearea the name of the file area.
|
||||
* @return boolean whether access to the file should be allowed.
|
||||
* @return bool whether access to the file should be allowed.
|
||||
*/
|
||||
protected function check_combined_feedback_file_access($qa, $options, $filearea) {
|
||||
$state = $qa->get_state();
|
||||
@@ -561,7 +561,7 @@ abstract class question_graded_automatically extends question_with_responses
|
||||
* @param question_attempt $qa the question attempt being displayed.
|
||||
* @param question_display_options $options the options that control display of the question.
|
||||
* @param array $args the remaining bits of the file path.
|
||||
* @return boolean whether access to the file should be allowed.
|
||||
* @return bool whether access to the file should be allowed.
|
||||
*/
|
||||
protected function check_hint_file_access($qa, $options, $args) {
|
||||
if (!$options->feedback) {
|
||||
@@ -729,9 +729,9 @@ class question_hint {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param integer the hint id from the database.
|
||||
* @param int the hint id from the database.
|
||||
* @param string $hint The hint text
|
||||
* @param integer the corresponding text FORMAT_... type.
|
||||
* @param int the corresponding text FORMAT_... type.
|
||||
*/
|
||||
public function __construct($id, $hint, $hintformat) {
|
||||
$this->id = $id;
|
||||
@@ -775,11 +775,11 @@ class question_hint_with_parts extends question_hint {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param integer the hint id from the database.
|
||||
* @param int the hint id from the database.
|
||||
* @param string $hint The hint text
|
||||
* @param integer the corresponding text FORMAT_... type.
|
||||
* @param boolean $shownumcorrect whether the number of right parts should be shown
|
||||
* @param boolean $clearwrong whether the wrong parts should be reset.
|
||||
* @param int the corresponding text FORMAT_... type.
|
||||
* @param bool $shownumcorrect whether the number of right parts should be shown
|
||||
* @param bool $clearwrong whether the wrong parts should be reset.
|
||||
*/
|
||||
public function __construct($id, $hint, $hintformat, $shownumcorrect, $clearwrong) {
|
||||
parent::__construct($id, $hint, $hintformat);
|
||||
@@ -846,7 +846,7 @@ interface question_response_answer_comparer {
|
||||
/**
|
||||
* @param array $response the response.
|
||||
* @param question_answer $answer an answer.
|
||||
* @return boolean whether the response matches the answer.
|
||||
* @return bool whether the response matches the answer.
|
||||
*/
|
||||
public function compare_response_with_answer(array $response, question_answer $answer);
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ class question_type {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean override this to return false if this is not really a
|
||||
* @return bool override this to return false if this is not really a
|
||||
* question type, for example the description question type is not
|
||||
* really a question type.
|
||||
*/
|
||||
@@ -114,7 +114,7 @@ class question_type {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean true if this question type sometimes requires manual grading.
|
||||
* @return bool true if this question type sometimes requires manual grading.
|
||||
*/
|
||||
public function is_manual_graded() {
|
||||
return false;
|
||||
@@ -123,14 +123,14 @@ class question_type {
|
||||
/**
|
||||
* @param object $question a question of this type.
|
||||
* @param string $otherquestionsinuse comma-separate list of other question ids in this attempt.
|
||||
* @return boolean true if a particular instance of this question requires manual grading.
|
||||
* @return bool true if a particular instance of this question requires manual grading.
|
||||
*/
|
||||
public function is_question_manual_graded($question, $otherquestionsinuse) {
|
||||
return $this->is_manual_graded();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean true if this question type can be used by the random question type.
|
||||
* @return bool true if this question type can be used by the random question type.
|
||||
*/
|
||||
public function is_usable_by_random() {
|
||||
return true;
|
||||
@@ -144,7 +144,7 @@ class question_type {
|
||||
* method, and the question_definition class must implement the
|
||||
* classify_response method.
|
||||
*
|
||||
* @return boolean whether this report can analyse all the student reponses
|
||||
* @return bool whether this report can analyse all the student reponses
|
||||
* for things like the quiz statistics report.
|
||||
*/
|
||||
public function can_analyse_responses() {
|
||||
@@ -532,7 +532,7 @@ class question_type {
|
||||
* @param object $options the $question->options object being built.
|
||||
* @param object $formdata the data from the form.
|
||||
* @param object $context the context the quetsion is being saved into.
|
||||
* @param boolean $withparts whether $options->shownumcorrect should be set.
|
||||
* @param bool $withparts whether $options->shownumcorrect should be set.
|
||||
*/
|
||||
protected function save_combined_feedback_helper($options, $formdata, $context, $withparts = false) {
|
||||
$options->correctfeedback = $this->import_or_save_files($formdata->correctfeedback,
|
||||
@@ -691,7 +691,7 @@ class question_type {
|
||||
* Initialise the combined feedback fields.
|
||||
* @param question_definition $question the question_definition we are creating.
|
||||
* @param object $questiondata the question data loaded from the database.
|
||||
* @param boolean $withparts whether to set the shownumcorrect field.
|
||||
* @param bool $withparts whether to set the shownumcorrect field.
|
||||
*/
|
||||
protected function initialise_combined_feedback(question_definition $question, $questiondata, $withparts = false) {
|
||||
$question->correctfeedback = $questiondata->options->correctfeedback;
|
||||
@@ -723,8 +723,8 @@ class question_type {
|
||||
|
||||
/**
|
||||
* Deletes the question-type specific data when a question is deleted.
|
||||
* @param integer $question the question being deleted.
|
||||
* @param integer $contextid the context this quesiotn belongs to.
|
||||
* @param int $question the question being deleted.
|
||||
* @param int $contextid the context this quesiotn belongs to.
|
||||
*/
|
||||
public function delete_question($questionid, $contextid) {
|
||||
global $DB;
|
||||
@@ -758,7 +758,7 @@ class question_type {
|
||||
* assigned one number. The 'description' type, however does not use up a
|
||||
* number and so has a length of zero. Other question types may wish to
|
||||
* handle a bundle of questions and hence return a number greater than one.
|
||||
* @return integer The number of question numbers which should be
|
||||
* @return int The number of question numbers which should be
|
||||
* assigned to the question.
|
||||
* @param object $question The question whose length is to be determined.
|
||||
* Question type specific information is included.
|
||||
@@ -854,7 +854,7 @@ class question_type {
|
||||
*
|
||||
* @param object $form The data submitted by the previous page.
|
||||
*
|
||||
* @return boolean Whether the wizard's last page was submitted or not.
|
||||
* @return bool Whether the wizard's last page was submitted or not.
|
||||
*/
|
||||
public function finished_edit_wizard($form) {
|
||||
//In the default case there is only one edit page.
|
||||
@@ -993,7 +993,7 @@ class question_type {
|
||||
* @param object $context the context the question is in.
|
||||
* @param string $component indentifies the file area question.
|
||||
* @param string $filearea indentifies the file area questiontext, generalfeedback,answerfeedback.
|
||||
* @param integer $itemid identifies the file area.
|
||||
* @param int $itemid identifies the file area.
|
||||
*
|
||||
* @return string the text for this field, after files have been processed.
|
||||
*/
|
||||
@@ -1014,9 +1014,9 @@ class question_type {
|
||||
|
||||
/**
|
||||
* Move all the files belonging to this question from one context to another.
|
||||
* @param integer $questionid the question being moved.
|
||||
* @param integer $oldcontextid the context it is moving from.
|
||||
* @param integer $newcontextid the context it is moving to.
|
||||
* @param int $questionid the question being moved.
|
||||
* @param int $oldcontextid the context it is moving from.
|
||||
* @param int $newcontextid the context it is moving to.
|
||||
*/
|
||||
public function move_files($questionid, $oldcontextid, $newcontextid) {
|
||||
$fs = get_file_storage();
|
||||
@@ -1029,10 +1029,10 @@ class question_type {
|
||||
/**
|
||||
* Move all the files belonging to this question's answers when the question
|
||||
* is moved from one context to another.
|
||||
* @param integer $questionid the question being moved.
|
||||
* @param integer $oldcontextid the context it is moving from.
|
||||
* @param integer $newcontextid the context it is moving to.
|
||||
* @param boolean $answerstoo whether there is an 'answer' question area,
|
||||
* @param int $questionid the question being moved.
|
||||
* @param int $oldcontextid the context it is moving from.
|
||||
* @param int $newcontextid the context it is moving to.
|
||||
* @param bool $answerstoo whether there is an 'answer' question area,
|
||||
* as well as an 'answerfeedback' one. Default false.
|
||||
*/
|
||||
protected function move_files_in_answers($questionid, $oldcontextid, $newcontextid, $answerstoo = false) {
|
||||
@@ -1053,8 +1053,8 @@ class question_type {
|
||||
|
||||
/**
|
||||
* Delete all the files belonging to this question.
|
||||
* @param integer $questionid the question being deleted.
|
||||
* @param integer $contextid the context the question is in.
|
||||
* @param int $questionid the question being deleted.
|
||||
* @param int $contextid the context the question is in.
|
||||
*/
|
||||
protected function delete_files($questionid, $contextid) {
|
||||
$fs = get_file_storage();
|
||||
@@ -1064,9 +1064,9 @@ class question_type {
|
||||
|
||||
/**
|
||||
* Delete all the files belonging to this question's answers.
|
||||
* @param integer $questionid the question being deleted.
|
||||
* @param integer $contextid the context the question is in.
|
||||
* @param boolean $answerstoo whether there is an 'answer' question area,
|
||||
* @param int $questionid the question being deleted.
|
||||
* @param int $contextid the context the question is in.
|
||||
* @param bool $answerstoo whether there is an 'answer' question area,
|
||||
* as well as an 'answerfeedback' one. Default false.
|
||||
*/
|
||||
protected function delete_files_in_answers($questionid, $contextid, $answerstoo = false) {
|
||||
|
||||
@@ -29,6 +29,9 @@ defined('MOODLE_INTERNAL') || die();
|
||||
/**
|
||||
* restore plugin class that provides the necessary information
|
||||
* needed to restore one random qtype plugin
|
||||
*
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class restore_qtype_random_plugin extends restore_qtype_plugin {
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ class qtype_random extends question_type {
|
||||
* Random questions always get a question name that is Random (cateogryname).
|
||||
* This function is a centralised place to calculate that, given the category.
|
||||
* @param object $category the category this question picks from. (Only $category->name is used.)
|
||||
* @param boolean $includesubcategories whether this question also picks from subcategories.
|
||||
* @param bool $includesubcategories whether this question also picks from subcategories.
|
||||
* @return string the name this question should have.
|
||||
*/
|
||||
public function question_name($category, $includesubcategories) {
|
||||
@@ -172,8 +172,8 @@ class qtype_random extends question_type {
|
||||
/**
|
||||
* Get all the usable questions from a particular question category.
|
||||
*
|
||||
* @param integer $categoryid the id of a question category.
|
||||
* @param boolean whether to include questions from subcategories.
|
||||
* @param int $categoryid the id of a question category.
|
||||
* @param bool whether to include questions from subcategories.
|
||||
* @param string $questionsinuse comma-separated list of question ids to exclude from consideration.
|
||||
* @return array of question records.
|
||||
*/
|
||||
@@ -203,7 +203,7 @@ class qtype_random extends question_type {
|
||||
* Load the definition of another question picked randomly by this question.
|
||||
* @param object $questiondata the data defining a random question.
|
||||
* @param array $excludedquestions of question ids. We will no pick any question whose id is in this list.
|
||||
* @param boolean $allowshuffle if false, then any shuffle option on the selected quetsion is disabled.
|
||||
* @param bool $allowshuffle if false, then any shuffle option on the selected quetsion is disabled.
|
||||
* @return question_definition|null the definition of the question that was
|
||||
* selected, or null if no suitable question could be found.
|
||||
*/
|
||||
|
||||
@@ -28,6 +28,9 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Provides the information to backup randomsamatch questions
|
||||
*
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class backup_qtype_randomsamatch_plugin extends backup_qtype_plugin {
|
||||
|
||||
|
||||
+3
@@ -29,6 +29,9 @@ defined('MOODLE_INTERNAL') || die();
|
||||
/**
|
||||
* restore plugin class that provides the necessary information
|
||||
* needed to restore one randomsamatch qtype plugin
|
||||
*
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class restore_qtype_randomsamatch_plugin extends restore_qtype_plugin {
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ abstract class qtype_renderer extends plugin_renderer_base {
|
||||
/**
|
||||
* Return an appropriate icon (green tick, red cross, etc.) for a grade.
|
||||
* @param float $fraction grade on a scale 0..1.
|
||||
* @param boolean $selected whether to show a big or small icon. (Deprecated)
|
||||
* @param bool $selected whether to show a big or small icon. (Deprecated)
|
||||
* @return string html fragment.
|
||||
*/
|
||||
function feedback_image($fraction, $selected = true) {
|
||||
|
||||
@@ -28,6 +28,9 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Provides the information to backup shortanswer questions
|
||||
*
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class backup_qtype_shortanswer_plugin extends backup_qtype_plugin {
|
||||
|
||||
|
||||
@@ -29,6 +29,9 @@ defined('MOODLE_INTERNAL') || die();
|
||||
/**
|
||||
* restore plugin class that provides the necessary information
|
||||
* needed to restore one shortanswer qtype plugin
|
||||
*
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class restore_qtype_shortanswer_plugin extends restore_qtype_plugin {
|
||||
|
||||
|
||||
@@ -55,8 +55,8 @@ class test_response_answer_comparer implements question_response_answer_comparer
|
||||
/**
|
||||
* Tests for {@link question_first_matching_answer_grading_strategy}.
|
||||
*
|
||||
* @copyright 2008 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2008 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class question_first_matching_answer_grading_strategy_test extends UnitTestCase {
|
||||
public function setUp() {
|
||||
@@ -99,8 +99,8 @@ class question_first_matching_answer_grading_strategy_test extends UnitTestCase
|
||||
/**
|
||||
* Test for question_hint and subclasses.
|
||||
*
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @copyright 2010 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class question_hint_test extends UnitTestCase {
|
||||
public function test_basic() {
|
||||
|
||||
@@ -28,6 +28,9 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Provides the information to backup truefalse questions
|
||||
*
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class backup_qtype_truefalse_plugin extends backup_qtype_plugin {
|
||||
|
||||
|
||||
@@ -29,6 +29,9 @@ defined('MOODLE_INTERNAL') || die();
|
||||
/**
|
||||
* restore plugin class that provides the necessary information
|
||||
* needed to restore one truefalse qtype plugin
|
||||
*
|
||||
* @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class restore_qtype_truefalse_plugin extends restore_qtype_plugin {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user