Permalink
Browse files

MDL-20636 Add lots of missing public/protected/private.

  • Loading branch information...
1 parent c73c983 commit c7df5006b9e3c7d0ae3a316572b57967e6a96f36 @timhunt timhunt committed Mar 23, 2011
Showing with 663 additions and 695 deletions.
  1. +2 −2 mod/quiz/addrandomform.php
  2. +9 −9 mod/quiz/attemptlib.php
  3. +1 −1 mod/quiz/backup/moodle2/backup_quiz_activity_task.class.php
  4. +4 −4 mod/quiz/backup/moodle2/restore_quiz_activity_task.class.php
  5. +3 −3 mod/quiz/mod_form.php
  6. +1 −1 mod/quiz/override_form.php
  7. +3 −3 mod/quiz/report/attemptsreport.php
  8. +4 −7 mod/quiz/report/default.php
  9. +1 −1 mod/quiz/report/grading/gradingsettings_form.php
  10. +2 −2 mod/quiz/report/grading/report.php
  11. +1 −1 mod/quiz/report/overview/overviewsettings_form.php
  12. +1 −1 mod/quiz/report/overview/report.php
  13. +1 −1 mod/quiz/report/responses/report.php
  14. +1 −1 mod/quiz/report/responses/responses_table.php
  15. +1 −1 mod/quiz/report/responses/responsessettings_form.php
  16. +2 −2 mod/quiz/report/simpletest/testreportlib.php
  17. +5 −4 mod/quiz/report/statistics/simpletest/test_qstats.php
  18. +1 −1 mod/quiz/report/statistics/statistics_form.php
  19. +2 −2 mod/quiz/report/statistics/statistics_table.php
  20. +14 −14 mod/quiz/simpletest/testaccessrules.php
  21. +5 −6 mod/quiz/simpletest/testeditlib.php
  22. +3 −3 mod/quiz/simpletest/testlib.php
  23. +5 −5 mod/quiz/simpletest/testlocallib.php
  24. +1 −1 mod/quiz/simpletest/testquizdisplayoptions.php
  25. +1 −1 question/behaviour/behaviourbase.php
  26. +1 −1 question/category_form.php
  27. +3 −3 question/editlib.php
  28. +2 −2 question/engine/lib.php
  29. +1 −1 question/engine/simpletest/testquestionbank.php
  30. +1 −1 question/export_form.php
  31. +37 −37 question/format.php
  32. +5 −5 question/format/aiken/format.php
  33. +263 −271 question/format/blackboard/format.php
  34. +14 −14 question/format/gift/format.php
  35. +2 −2 question/format/multianswer/format.php
  36. +13 −13 question/format/qti_two/format.php
  37. +124 −126 question/format/xhtml/format.php
  38. +27 −27 question/format/xml/format.php
  39. +1 −1 question/import_form.php
  40. +1 −1 question/move_form.php
  41. +2 −1 question/type/calculated/datasetdefinitions_form.php
  42. +1 −1 question/type/calculated/datasetitems_form.php
  43. +1 −1 question/type/calculated/edit_calculated_form.php
  44. +1 −1 question/type/calculatedmulti/edit_calculatedmulti_form.php
  45. +1 −1 question/type/calculatedsimple/edit_calculatedsimple_form.php
  46. +1 −1 question/type/ddwtos/backup/moodle2/restore_qtype_ddwtos_plugin.class.php
  47. +1 −1 question/type/ddwtos/edit_ddwtos_form.php
  48. +1 −1 question/type/ddwtos/questiontype.php
  49. +2 −2 question/type/edit_question_form.php
  50. +1 −1 question/type/essay/questiontype.php
  51. +1 −1 question/type/gapselect/backup/moodle2/restore_qtype_gapselect_plugin.class.php
  52. +2 −2 question/type/gapselect/edit_form_base.php
  53. +1 −1 question/type/gapselect/edit_gapselect_form.php
  54. +2 −2 question/type/gapselect/questiontype.php
  55. +1 −1 question/type/gapselect/questiontypebase.php
  56. +1 −1 question/type/match/backup/moodle2/restore_qtype_match_plugin.class.php
  57. +3 −3 question/type/match/edit_match_form.php
  58. +5 −5 question/type/match/questiontype.php
  59. +1 −1 question/type/missingtype/questiontype.php
  60. +1 −1 question/type/multianswer/edit_multianswer_form.php
  61. +1 −1 question/type/multichoice/backup/moodle2/restore_qtype_multichoice_plugin.class.php
  62. +1 −1 question/type/multichoice/edit_multichoice_form.php
  63. +2 −2 question/type/multichoice/question.php
  64. +2 −2 question/type/multichoice/questiontype.php
  65. +6 −6 question/type/multichoice/renderer.php
  66. +6 −12 question/type/numerical/edit_numerical_form.php
  67. +2 −2 question/type/numerical/questiontype.php
  68. +5 −15 question/type/numerical/simpletest/testquestiontype.php
  69. +1 −1 question/type/opaque/edit_engine_form.php
  70. +5 −5 question/type/opaque/edit_opaque_form.php
  71. +4 −4 question/type/opaque/questiontype.php
  72. +1 −1 question/type/opaque/simpletest/testlocallib.php
  73. +1 −1 question/type/oumultiresponse/backup/moodle2/restore_qtype_oumultiresponse_plugin.class.php
  74. +2 −2 question/type/oumultiresponse/edit_oumultiresponse_form.php
  75. +1 −1 question/type/oumultiresponse/question.php
  76. +1 −1 question/type/oumultiresponse/questiontype.php
  77. +2 −2 question/type/oumultiresponse/simpletest/testquestion.php
  78. +1 −1 question/type/questionbase.php
  79. +6 −6 question/type/questiontype.php
  80. +1 −1 question/type/random/edit_random_form.php
  81. +2 −2 question/type/random/questiontype.php
  82. +3 −3 question/type/randomsamatch/edit_randomsamatch_form.php
  83. +1 −1 question/type/rendererbase.php
  84. +2 −6 question/type/shortanswer/edit_shortanswer_form.php
  85. +1 −1 question/type/shortanswer/questiontype.php
  86. +4 −4 question/type/truefalse/questiontype.php
@@ -38,7 +38,7 @@
*/
class quiz_add_random_form extends moodleform {
- function definition() {
+ protected function definition() {
global $CFG, $DB;
$mform =& $this->_form;
@@ -78,7 +78,7 @@ function definition() {
$mform->setType('returnurl', PARAM_LOCALURL);
}
- function validation($fromform, $files) {
+ public function validation($fromform, $files) {
$errors = parent::validation($fromform, $files);
if (!empty($fromform['newcategory']) && trim($fromform['name']) == '') {
View
@@ -40,7 +40,7 @@
* @since Moodle 2.0
*/
class moodle_quiz_exception extends moodle_exception {
- function __construct($quizobj, $errorcode, $a = NULL, $link = '', $debuginfo = null) {
+ public function __construct($quizobj, $errorcode, $a = NULL, $link = '', $debuginfo = null) {
if (!$link) {
$link = $quizobj->view_url();
}
@@ -83,7 +83,7 @@ class quiz {
* @param object $course the row from the course table for the course we belong to.
* @param bool $getcontext intended for testing - stops the constructor getting the context.
*/
- function __construct($quiz, $cm, $course, $getcontext = true) {
+ public function __construct($quiz, $cm, $course, $getcontext = true) {
$this->quiz = $quiz;
$this->cm = $cm;
$this->quiz->cmid = $this->cm->id;
@@ -101,7 +101,7 @@ function __construct($quiz, $cm, $course, $getcontext = true) {
* @param int $userid the the userid.
* @return quiz the new quiz object
*/
- static public function create($quizid, $userid) {
+ public static function create($quizid, $userid) {
global $DB;
$quiz = $DB->get_record('quiz', array('id' => $quizid), '*', MUST_EXIST);
@@ -358,7 +358,7 @@ class quiz_attempt {
* @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.
*/
- function __construct($attempt, $quiz, $cm, $course) {
+ public function __construct($attempt, $quiz, $cm, $course) {
$this->attempt = $attempt;
$this->quizobj = new quiz($quiz, $cm, $course);
$this->quba = question_engine::load_questions_usage_by_activity($this->attempt->uniqueid);
@@ -370,7 +370,7 @@ function __construct($attempt, $quiz, $cm, $course) {
* Used by {create()} and {create_from_usage_id()}.
* @param array $conditions passed to $DB->get_record('quiz_attempts', $conditions).
*/
- static protected function create_helper($conditions) {
+ protected static function create_helper($conditions) {
global $DB;
// TODO deal with the issue that makes this necessary.
@@ -396,7 +396,7 @@ static protected function create_helper($conditions) {
* @param int $attemptid the attempt id.
* @return quiz_attempt the new quiz_attempt object
*/
- static public function create($attemptid) {
+ public static function create($attemptid) {
return self::create_helper(array('id' => $attemptid));
}
@@ -406,7 +406,7 @@ static public function create($attemptid) {
* @param int $usageid the attempt usage id.
* @return quiz_attempt the new quiz_attempt object
*/
- static public function create_from_usage_id($usageid) {
+ public static function create_from_usage_id($usageid) {
return self::create_helper(array('uniqueid' => $usageid));
}
@@ -1200,9 +1200,9 @@ protected function get_before_button_bits() {
return '';
}
- abstract protected function get_end_bits();
+ protected abstract function get_end_bits();
- abstract protected function get_question_url($slot);
+ protected abstract function get_question_url($slot);
protected function get_user_picture() {
global $DB, $OUTPUT;
@@ -71,7 +71,7 @@ protected function define_my_steps() {
* Code the transformations to perform in the activity in
* order to get transportable (encoded) links
*/
- static public function encode_content_links($content) {
+ public static function encode_content_links($content) {
global $CFG;
$base = preg_quote($CFG->wwwroot,"/");
@@ -56,7 +56,7 @@ protected function define_my_steps() {
* Define the contents in the activity that must be
* processed by the link decoder
*/
- static public function define_decode_contents() {
+ public static function define_decode_contents() {
$contents = array();
$contents[] = new restore_decode_content('quiz', array('intro'), 'quiz');
@@ -69,7 +69,7 @@ static public function define_decode_contents() {
* Define the decoding rules for links belonging
* to the activity to be executed by the link decoder
*/
- static public function define_decode_rules() {
+ public static function define_decode_rules() {
$rules = array();
$rules[] = new restore_decode_rule('QUIZVIEWBYID', '/mod/quiz/view.php?id=$1', 'course_module');
@@ -86,7 +86,7 @@ static public function define_decode_rules() {
* quiz logs. It must return one array
* of {@link restore_log_rule} objects
*/
- static public function define_restore_log_rules() {
+ public static function define_restore_log_rules() {
$rules = array();
$rules[] = new restore_log_rule('quiz', 'add', 'view.php?id={course_module}', '{quiz}');
@@ -148,7 +148,7 @@ static public function define_restore_log_rules() {
* by the restore final task, but are defined here at
* activity level. All them are rules not linked to any module instance (cmid = 0)
*/
- static public function define_restore_log_rules_for_course() {
+ public static function define_restore_log_rules_for_course() {
$rules = array();
$rules[] = new restore_log_rule('quiz', 'view all', 'index.php?id={course}', null);
View
@@ -54,7 +54,7 @@ public function __construct($current, $section, $cm, $course) {
parent::__construct($current, $section, $cm, $course);
}
- function definition() {
+ protected function definition() {
global $COURSE, $CFG, $DB, $PAGE;
$quizconfig = get_config('quiz');
$mform = $this->_form;
@@ -353,7 +353,7 @@ protected function preprocessing_review_settings(&$toform, $whenname, $when) {
}
}
- function data_preprocessing(&$toform) {
+ protected function data_preprocessing(&$toform) {
if (isset($toform['grade'])) {
$toform['grade'] = $toform['grade'] + 0; // Convert to a real number, so we don't get 0.0000.
}
@@ -409,7 +409,7 @@ function data_preprocessing(&$toform) {
}
}
- function validation($data, $files) {
+ public function validation($data, $files) {
$errors = parent::validation($data, $files);
// Check open and close times are consistent.
@@ -58,7 +58,7 @@ public function quiz_override_form($submiturl, $cm, $quiz, $context, $groupmode,
}
- public function definition() {
+ protected function definition() {
global $CFG, $USER, $DB;
$cm = $this->cm;
@@ -475,7 +475,7 @@ public function col_feedbacktext($attempt) {
}
}
- function get_row_class($attempt) {
+ protected function get_row_class($attempt) {
if ($this->qmsubselect && $attempt->gradedattempt) {
return 'gradedattempt';
} else {
@@ -525,7 +525,7 @@ public function make_review_link($data, $attempt, $slot) {
* @param float $fraction grade on a scale 0..1.
* @return string html fragment.
*/
- function icon_for_fraction($fraction) {
+ protected function icon_for_fraction($fraction) {
global $OUTPUT;
$state = question_state::graded_state_for_fraction($fraction);
@@ -551,7 +551,7 @@ function icon_for_fraction($fraction) {
* @param array $slots A list of slots for the questions you want to konw about.
* @return array of records. See the SQL in this function to see the fields available.
*/
- function load_question_latest_steps(qubaid_condition $qubaids) {
+ protected function load_question_latest_steps(qubaid_condition $qubaids) {
$dm = new question_engine_data_mapper();
$latesstepdata = $dm->load_questions_usages_latest_steps(
$qubaids, array_keys($this->questions));
@@ -50,17 +50,14 @@
* @param $course the coures we are in.
* @param $quiz this quiz.
*/
- abstract function display($cm, $course, $quiz);
+ public abstract function display($cm, $course, $quiz);
- function print_header_and_tabs($cm, $course, $quiz, $reportmode = "overview") {
+ public function print_header_and_tabs($cm, $course, $quiz, $reportmode = 'overview') {
global $PAGE, $OUTPUT;
- /// Define some strings
- $strquizzes = get_string("modulenameplural", "quiz");
- $strquiz = get_string("modulename", "quiz");
- /// Print the page header
+
+ // Print the page header
$PAGE->set_title(format_string($quiz->name));
$PAGE->set_heading($course->fullname);
echo $OUTPUT->header();
- $course_context = get_context_instance(CONTEXT_COURSE, $course->id);
}
}
@@ -53,7 +53,7 @@ public function __construct($hidden, $counts, $shownames, $showidnumbers) {
parent::__construct($CFG->wwwroot . '/mod/quiz/report.php', null, 'get');
}
- public function definition() {
+ protected function definition() {
$mform =& $this->_form;
$mform->addElement('header', 'options', get_string('options', 'quiz_grading'));
@@ -52,7 +52,7 @@ class quiz_grading_report extends quiz_default_report {
protected $quiz;
protected $context;
- function display($quiz, $cm, $course) {
+ public function display($quiz, $cm, $course) {
global $CFG, $DB, $PAGE;
$this->quiz = $quiz;
@@ -519,7 +519,7 @@ protected function get_question_state_summary($slots) {
* Ignored if $orderby = random or $pagesize is null.
* @param int $pagesize implements paging of the results. null = all.
*/
- function get_usage_ids_where_question_in_state($summarystate, $slot,
+ protected function get_usage_ids_where_question_in_state($summarystate, $slot,
$questionid = null, $orderby = 'random', $page = 0, $pagesize = null) {
global $CFG;
$dm = new question_engine_data_mapper();
@@ -38,7 +38,7 @@
*/
class mod_quiz_report_overview_settings extends moodleform {
- public function definition() {
+ protected function definition() {
$mform = $this->_form;
$mform->addElement('header', 'preferencespage', get_string('preferencespage', 'quiz_overview'));
@@ -40,7 +40,7 @@
*/
class quiz_overview_report extends quiz_attempt_report {
- function display($quiz, $cm, $course) {
+ public function display($quiz, $cm, $course) {
global $CFG, $COURSE, $DB, $OUTPUT;
$this->context = get_context_instance(CONTEXT_MODULE, $cm->id);
@@ -48,7 +48,7 @@
*/
class quiz_responses_report extends quiz_attempt_report {
- function display($quiz, $cm, $course) {
+ public function display($quiz, $cm, $course) {
global $CFG, $COURSE, $DB, $PAGE, $OUTPUT;
$this->context = get_context_instance(CONTEXT_MODULE, $cm->id);
@@ -50,7 +50,7 @@ public function build_table() {
}
}
- function wrap_html_start() {
+ public function wrap_html_start() {
global $PAGE;
if ($this->is_downloading() || !$this->candelete) {
return;
@@ -38,7 +38,7 @@
*/
class mod_quiz_report_responses_settings extends moodleform {
- public function definition() {
+ protected function definition() {
$mform = $this->_form;
$mform->addElement('header', 'preferencespage', get_string('preferencespage', 'quiz_overview'));
@@ -43,7 +43,7 @@
class question_reportlib_test extends UnitTestCase {
public static $includecoverage = array('mod/quiz/report/reportlib.php');
- function test_quiz_report_index_by_keys() {
+ public function test_quiz_report_index_by_keys() {
$datum = array();
$object = new stdClass();
$object->qid = 3;
@@ -67,7 +67,7 @@ function test_quiz_report_index_by_keys() {
$this->assertEqual($indexed[101][3][0]->grade, 3);
}
- function test_quiz_report_scale_summarks_as_percentage() {
+ public function test_quiz_report_scale_summarks_as_percentage() {
$quiz = new stdClass();
$quiz->sumgrades = 10;
$quiz->decimalpoints = 2;
@@ -43,6 +43,7 @@ class testable_quiz_statistics_question_stats extends quiz_statistics_question_s
public function set_step_data($states) {
$this->lateststeps = $states;
}
+
protected function get_random_guess_score($questiondata) {
return 0;
}
@@ -61,7 +62,7 @@ class quiz_statistics_question_stats_test extends UnitTestCase {
/** @var qstats object created to test class. */
protected $qstats;
- function test_qstats() {
+ public function test_qstats() {
global $CFG;
//data is taken from randomly generated attempts data generated by contrib/tools/generators/qagenerator/
$steps = $this->get_records_from_csv($CFG->dirroot.'/mod/quiz/report/statistics/simpletest/mdl_question_states.csv');
@@ -84,7 +85,7 @@ function test_qstats() {
$this->qstats_q_fields('discriminativeefficiency', $discriminativeefficiency);
}
- function qstats_q_fields($fieldname, $values, $multiplier=1) {
+ public function qstats_q_fields($fieldname, $values, $multiplier=1) {
foreach ($this->qstats->questions as $question) {
$value = array_shift($values);
if ($value !== null) {
@@ -95,7 +96,7 @@ function qstats_q_fields($fieldname, $values, $multiplier=1) {
}
}
- function get_fields_from_csv($line) {
+ public function get_fields_from_csv($line) {
$line = trim($line);
$items = preg_split('!,!', $line);
while (list($key) = each($items)) {
@@ -116,7 +117,7 @@ function get_fields_from_csv($line) {
return $items;
}
- function get_records_from_csv($filename) {
+ public function get_records_from_csv($filename) {
$filecontents = file($filename, FILE_IGNORE_NEW_LINES);
$records = array();
$keys = $this->get_fields_from_csv(array_shift($filecontents));//first line is field names
@@ -37,7 +37,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class quiz_statistics_statistics_settings_form extends moodleform {
- function definition() {
+ protected function definition() {
$mform = $this->_form;
$mform->addElement('header', 'preferencespage', get_string('preferencespage', 'quiz_overview'));
@@ -47,7 +47,7 @@ class quiz_report_statistics_table extends flexible_table {
/**
* Constructor.
*/
- function __construct() {
+ public function __construct() {
parent::__construct('mod-quiz-report-statistics-report');
}
@@ -60,7 +60,7 @@ function __construct() {
* @param moodle_url $reporturl the URL to redisplay this report.
* @param int $s number of attempts included in the statistics.
*/
- function setup($quiz, $cmid, $reporturl, $s) {
+ public function setup($quiz, $cmid, $reporturl, $s) {
$this->quiz = $quiz;
$this->cmid = $cmid;
Oops, something went wrong.

0 comments on commit c7df500

Please sign in to comment.