diff --git a/lib/questionlib.php b/lib/questionlib.php index 2124f8ea420..c640da23c7e 100644 --- a/lib/questionlib.php +++ b/lib/questionlib.php @@ -336,7 +336,7 @@ function get_grade_options() { arsort($gradeoptionsfull, SORT_NUMERIC); // construct return object - $grades = new stdClass; + $grades = new stdClass(); $grades->gradeoptions = $gradeoptions; $grades->gradeoptionsfull = $gradeoptionsfull; @@ -593,7 +593,7 @@ function question_delete_course_category($category, $newcategory, $feedback=true } $DB->set_field('question_categories', 'contextid', $newcontext->id, array('contextid'=>$context->id)); if ($feedback) { - $a = new stdClass; + $a = new stdClass(); $a->oldplace = print_context_name($context); $a->newplace = print_context_name($newcontext); echo $OUTPUT->notification(get_string('movedquestionsandcategories', 'question', $a), 'notifysuccess'); @@ -1112,7 +1112,7 @@ function question_make_default_categories($contexts) { foreach ($contexts as $key => $context) { if (!$exists = $DB->record_exists("question_categories", array('contextid'=>$context->id))) { // Otherwise, we need to make one - $category = new stdClass; + $category = new stdClass(); $contextname = print_context_name($context, false, true); $category->name = get_string('defaultfor', 'question', $contextname); $category->info = get_string('defaultinfofor', 'question', $contextname); @@ -1296,7 +1296,7 @@ function get_import_export_formats($type) { */ function question_default_export_filename($course, $category) { // We build a string that is an appropriate name (questions) from the lang pack, - // then the corse shortname, then the question category name, then a timestamp. + // then the corse shortname, then the question category name, then a timestamp. $base = clean_filename(get_string('exportfilename', 'question')); @@ -1484,7 +1484,7 @@ function question_edit_url($context) { * Adds question bank setting links to the given navigation node if caps are met. * * @param navigation_node $navigationnode The navigation node to add the question branch to - * @param stdClass $context + * @param object $context * @return navigation_node Returns the question branch that was added */ function question_extend_settings_navigation(navigation_node $navigationnode, $context) { diff --git a/mod/quiz/attemptlib.php b/mod/quiz/attemptlib.php index 41e731bfcc4..7ef1a1d3461 100644 --- a/mod/quiz/attemptlib.php +++ b/mod/quiz/attemptlib.php @@ -1164,7 +1164,7 @@ abstract class quiz_nav_panel_base { $qnostring = 'questionnonavinfo'; } - $a = new stdClass; + $a = new stdClass(); $a->number = $number; $a->attributes = implode(' ', $attributes); diff --git a/mod/quiz/edit.php b/mod/quiz/edit.php index 366b7b5efec..e6510535468 100644 --- a/mod/quiz/edit.php +++ b/mod/quiz/edit.php @@ -400,7 +400,7 @@ if ($node) { echo $OUTPUT->header(); // Initialise the JavaScript. -$quizeditconfig = new stdClass; +$quizeditconfig = new stdClass(); $quizeditconfig->url = $thispageurl->out(true, array('qbanktool' => '0')); $quizeditconfig->dialoglisteners = array(); $numberoflisteners = max(quiz_number_of_pages($quiz->questions), 1); diff --git a/mod/quiz/editlib.php b/mod/quiz/editlib.php index b7a9d5119e8..7d2011aff57 100644 --- a/mod/quiz/editlib.php +++ b/mod/quiz/editlib.php @@ -143,7 +143,7 @@ function quiz_add_quiz_question($id, $quiz, $page = 0) { $DB->set_field('quiz', 'questions', $quiz->questions, array('id' => $quiz->id)); // Add the new question instance. - $instance = new stdClass; + $instance = new stdClass(); $instance->quiz = $quiz->id; $instance->question = $id; $instance->grade = $DB->get_field('question', 'defaultmark', array('id' => $id)); @@ -189,7 +189,7 @@ function quiz_add_random_questions($quiz, $addonpage, $categoryid, $number, $inc $form->defaultmark = 1; $form->hidden = 1; $form->stamp = make_unique_id_code(); // Set the unique code (not to be changed) - $question = new stdClass; + $question = new stdClass(); $question->qtype = 'random'; $question = question_bank::get_qtype('random')->save_question($question, $form); if (!isset($question->id)) { @@ -777,7 +777,7 @@ function quiz_print_randomquestion(&$question, &$pageurl, &$quiz, $quiz_qbanktoo print_random_option_icon($question); echo ' ' . get_string('randomfromcategory', 'quiz') . ''; - $a = new stdClass; + $a = new stdClass(); $a->arrow = $OUTPUT->rarrow(); $strshowcategorycontents = get_string('showcategorycontents', 'quiz', $a); @@ -803,7 +803,7 @@ function quiz_print_randomquestion(&$question, &$pageurl, &$quiz, $quiz_qbanktoo echo '
'; // Embed the link into the string with instructions - $a = new stdClass; + $a = new stdClass(); $a->catname = '' . $category->name . ''; $a->link = $linkcategorycontents; echo get_string('addnewquestionsqbank', 'quiz', $a); @@ -943,7 +943,7 @@ function quiz_question_tostring(&$question, $showicon = false, $showquestiontext } $result .= shorten_text(format_string($question->name), 200) . ''; if ($showquestiontext) { - $formatoptions = new stdClass; + $formatoptions = new stdClass(); $formatoptions->noclean = true; $formatoptions->para = false; $questiontext = strip_tags(format_text($question->questiontext, @@ -1107,7 +1107,7 @@ class quiz_question_bank_view extends question_bank_view { } protected function print_category_info($category) { - $formatoptions = new stdClass; + $formatoptions = new stdClass(); $formatoptions->noclean = true; $strcategory = get_string('category', 'quiz'); echo '
' . diff --git a/mod/quiz/index.php b/mod/quiz/index.php index bfe542514f6..b679a885fcb 100644 --- a/mod/quiz/index.php +++ b/mod/quiz/index.php @@ -169,7 +169,7 @@ foreach ($quizzes as $quiz) { $feedback = ''; if ($quiz->grade && array_key_exists($quiz->id, grades)) { if ($alloptions->marks) { - $a = new stdClass; + $a = new stdClass(); $a->grade = quiz_format_grade($quiz, $grades[$quiz->id]); $a->maxgrade = quiz_format_grade($quiz, $quiz->grade); $grade = get_string('outofshort', 'quiz', $a); diff --git a/mod/quiz/lib.php b/mod/quiz/lib.php index 0fd03e8ceb2..9f6c807f937 100644 --- a/mod/quiz/lib.php +++ b/mod/quiz/lib.php @@ -300,8 +300,6 @@ function quiz_update_effective_access($quiz, $userid) { /** * Delete all the attempts belonging to a quiz. * - * @global stdClass - * @global object * @param object $quiz The quiz object. */ function quiz_delete_all_attempts($quiz) { @@ -370,7 +368,7 @@ function quiz_user_outline($course, $user, $mod, $quiz) { $grade = reset($grades->items[0]->grades); } - $result = new stdClass; + $result = new stdClass(); $result->info = get_string('grade') . ': ' . $grade->str_long_grade; $result->time = $grade->dategraded; return $result; @@ -802,7 +800,7 @@ function quiz_get_recent_mod_activity(&$activities, &$index, $timestart, $options = quiz_get_review_options($quiz, $attempt, $context); - $tmpactivity = new stdClass; + $tmpactivity = new stdClass(); $tmpactivity->type = 'quiz'; $tmpactivity->cmid = $cm->id; @@ -1003,7 +1001,7 @@ function quiz_after_add_or_update($quiz) { $DB->delete_records('quiz_feedback', array('quizid' => $quiz->id)); for ($i = 0; $i <= $quiz->feedbackboundarycount; $i++) { - $feedback = new stdClass; + $feedback = new stdClass(); $feedback->quizid = $quiz->id; $feedback->feedbacktext = $quiz->feedbacktext[$i]['text']; $feedback->feedbacktextformat = $quiz->feedbacktext[$i]['format']; @@ -1049,7 +1047,7 @@ function quiz_update_events($quiz, $override = null) { // need to add all the overrides $overrides = $DB->get_records('quiz_overrides', array('quiz' => $quiz->id)); // as well as the original quiz (empty override) - $overrides[] = new stdClass; + $overrides[] = new stdClass(); } else { // Just do the one override @@ -1066,7 +1064,7 @@ function quiz_update_events($quiz, $override = null) { $addopen = empty($current->id) || !empty($current->timeopen); $addclose = empty($current->id) || !empty($current->timeclose); - $event = new stdClass; + $event = new stdClass(); $event->description = $quiz->intro; $event->courseid = ($userid) ? 0 : $quiz->course; // Events module won't show user events when the courseid is nonzero $event->groupid = $groupid; @@ -1080,7 +1078,7 @@ function quiz_update_events($quiz, $override = null) { // Determine the event name if ($groupid) { - $params = new stdClass; + $params = new stdClass(); $params->quiz = $quiz->name; $params->group = groups_get_group_name($groupid); if ($params->group === false) { @@ -1090,7 +1088,7 @@ function quiz_update_events($quiz, $override = null) { $eventname = get_string('overridegroupeventname', 'quiz', $params); } else if ($userid) { - $params = new stdClass; + $params = new stdClass(); $params->quiz = $quiz->name; $eventname = get_string('overrideusereventname', 'quiz', $params); } else { @@ -1460,8 +1458,6 @@ function quiz_supports($feature) { } /** - * @global object - * @global stdClass * @return array all other caps used in module */ function quiz_get_extra_capabilities() { @@ -1479,9 +1475,9 @@ function quiz_get_extra_capabilities() { * available * * @param navigation_node $quiznode The quiz node within the global navigation - * @param stdClass $course The course object returned from the DB - * @param stdClass $module The module object returned from the DB - * @param stdClass $cm The course module instance returned from the DB + * @param object $course The course object returned from the DB + * @param object $module The module object returned from the DB + * @param object $cm The course module instance returned from the DB */ function quiz_extend_navigation($quiznode, $course, $module, $cm) { global $CFG; diff --git a/mod/quiz/locallib.php b/mod/quiz/locallib.php index 45ef5ec66dd..824da5d3858 100644 --- a/mod/quiz/locallib.php +++ b/mod/quiz/locallib.php @@ -85,7 +85,7 @@ function quiz_create_attempt($quiz, $attemptnumber, $lastattempt, $timenow, $isp if ($attemptnumber == 1 || !$quiz->attemptonlast) { /// We are not building on last attempt so create a new attempt. - $attempt = new stdClass; + $attempt = new stdClass(); $attempt->quiz = $quiz->id; $attempt->userid = $USER->id; $attempt->preview = 0; @@ -424,7 +424,7 @@ function quiz_feedback_for_grade($grade, $quiz, $context) { } // Clean the text, ready for display. - $formatoptions = new stdClass; + $formatoptions = new stdClass(); $formatoptions->noclean = true; $feedbacktext = file_rewrite_pluginfile_urls($feedback->feedbacktext, 'pluginfile.php', $context->id, 'mod_quiz', 'feedback', $feedback->id); $feedbacktext = format_text($feedbacktext, $feedback->feedbacktextformat, $formatoptions); @@ -761,7 +761,7 @@ function quiz_update_all_final_grades($quiz) { $todelete[] = $changedgrade->userid; } else if (is_null($changedgrade->grade)) { - $toinsert = new stdClass; + $toinsert = new stdClass(); $toinsert->quiz = $quiz->id; $toinsert->userid = $changedgrade->userid; $toinsert->timemodified = $timenow; @@ -769,7 +769,7 @@ function quiz_update_all_final_grades($quiz) { $DB->insert_record('quiz_grades', $toinsert); } else { - $toupdate = new stdClass; + $toupdate = new stdClass(); $toupdate->id = $changedgrade->id; $toupdate->grade = $changedgrade->newgrade; $toupdate->timemodified = $timenow; @@ -868,7 +868,7 @@ function quiz_upgrade_states($attempt) { // Actually we only do this for states whose question is actually listed in $attempt->layout. // We do not do it for states associated to wrapped questions like for example the questions // used by a RANDOM question - $session = new stdClass; + $session = new stdClass(); $session->attemptid = $attempt->uniqueid; $questionlist = quiz_questions_in_quiz($attempt->layout); $params = array($attempt->uniqueid); @@ -1075,8 +1075,8 @@ function quiz_get_review_options($quiz, $attempt, $context) { */ function quiz_get_combined_reviewoptions($quiz, $attempts) { $fields = array('marks', 'feedback', 'generalfeedback', 'rightanswer', 'overallfeedback'); - $someoptions = new stdClass; - $alloptions = new stdClass; + $someoptions = new stdClass(); + $alloptions = new stdClass(); foreach ($fields as $field) { $someoptions->$field = false; $alloptions->$field = true; @@ -1164,7 +1164,7 @@ function quiz_get_slot_for_question($quiz, $questionid) { /** * Sends confirmation email to the student taking the course * - * @param stdClass $a associative array of replaceable fields for the templates + * @param object $a associative array of replaceable fields for the templates * * @return bool|string result of events_triger */ @@ -1205,7 +1205,7 @@ function quiz_send_confirmation($a) { * Sends notification messages to the interested parties that assign the role capability * * @param object $recipient user object of the intended recipient - * @param stdClass $a associative array of replaceable fields for the templates + * @param object $a associative array of replaceable fields for the templates * * @return bool|string result of events_triger() */ @@ -1293,7 +1293,7 @@ function quiz_send_notification_emails($course, $quiz, $attempt, $context, $cm) // if something to send, then build $a if (! empty($userstonotify) or $sendconfirm) { - $a = new stdClass; + $a = new stdClass(); // course info $a->coursename = $course->fullname; $a->courseshortname = $course->shortname; @@ -1407,7 +1407,7 @@ class mod_quiz_display_options extends question_display_options { /** * Set up the various options from the quiz settings, and a time constant. - * @param stdClass $quiz the quiz settings. + * @param object $quiz the quiz settings. * @param integer $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. diff --git a/mod/quiz/report/grading/report.php b/mod/quiz/report/grading/report.php index 23d6c349205..8c6a5eb28bf 100644 --- a/mod/quiz/report/grading/report.php +++ b/mod/quiz/report/grading/report.php @@ -346,7 +346,7 @@ class quiz_grading_report extends quiz_default_report { $mform = new quiz_grading_settings($hidden, $counts, $shownames, $showidnumbers); // Tell the form the current settings. - $settings = new stdClass; + $settings = new stdClass(); $settings->grade = $grade; $settings->pagesize = $pagesize; $settings->order = $order; @@ -355,7 +355,7 @@ class quiz_grading_report extends quiz_default_report { // Print the heading and form. echo question_engine::initialise_js(); - $a = new stdClass; + $a = new stdClass(); $a->number = $this->questions[$slot]->number; $a->questionname = format_string($counts->name); echo $OUTPUT->heading(get_string('gradingquestionx', 'quiz_grading', $a)); @@ -366,7 +366,7 @@ class quiz_grading_report extends quiz_default_report { $mform->display(); // Paging info. - $a = new stdClass; + $a = new stdClass(); $a->from = $page * $pagesize + 1; $a->to = min(($page + 1) * $pagesize, $count); $a->of = $count; @@ -410,7 +410,7 @@ class quiz_grading_report extends quiz_default_report { } protected function get_question_heading($attempt, $shownames, $showidnumbers) { - $a = new stdClass; + $a = new stdClass(); $a->attempt = $attempt->attempt; $a->fullname = fullname($attempt); $a->idnumber = $attempt->idnumber; diff --git a/mod/quiz/report/overview/overview_table.php b/mod/quiz/report/overview/overview_table.php index bfe097256a6..197eb9a0e71 100644 --- a/mod/quiz/report/overview/overview_table.php +++ b/mod/quiz/report/overview/overview_table.php @@ -105,7 +105,7 @@ class quiz_report_overview_table extends quiz_attempt_report_table { $record = $gradeaverages[$question->slot]; $record->grade = quiz_rescale_grade($record->averagefraction * $question->maxmark, $this->quiz, false); } else { - $record = new stdClass; + $record = new stdClass(); $record->grade = null; $record->numaveraged = null; } diff --git a/mod/quiz/report/overview/report.php b/mod/quiz/report/overview/report.php index b28f92fd14f..924261ac7cd 100644 --- a/mod/quiz/report/overview/report.php +++ b/mod/quiz/report/overview/report.php @@ -353,7 +353,7 @@ class quiz_overview_report extends quiz_attempt_report { $finished = $attempt->timefinish > 0; foreach ($slots as $slot) { - $qqr = new stdClass; + $qqr = new stdClass(); $qqr->oldfraction = $quba->get_question_fraction($slot); $quba->regrade_question($slot, $finished); diff --git a/mod/quiz/report/reportlib.php b/mod/quiz/report/reportlib.php index 31389d466ec..bb3dc966527 100644 --- a/mod/quiz/report/reportlib.php +++ b/mod/quiz/report/reportlib.php @@ -86,7 +86,7 @@ function quiz_report_unindex($datum) { /** * Get the slots of real questions (not descriptions) in this quiz, in order. * @param object $quiz the quiz. - * @return array of slot => $question object with fields ->slot, ->id, ->maxmark, ->number, ->length. + * @return array of slot => $question object with fields ->slot, ->id, ->maxmark, ->number, ->length. */ function quiz_report_get_significant_questions($quiz) { global $DB; @@ -275,7 +275,7 @@ function quiz_report_feedback_for_grade($grade, $quizid, $context) { } // Clean the text, ready for display. - $formatoptions = new stdClass; + $formatoptions = new stdClass(); $formatoptions->noclean = true; $feedbacktext = file_rewrite_pluginfile_urls($feedbacktext, 'pluginfile.php', $context->id, 'mod_quiz', 'feedback', $feedbackid); $feedbacktext = format_text($feedbacktext, $feedbacktextformat, $formatoptions); diff --git a/mod/quiz/report/simpletest/testreportlib.php b/mod/quiz/report/simpletest/testreportlib.php index 41066942ac4..d7f15cf3cb8 100644 --- a/mod/quiz/report/simpletest/testreportlib.php +++ b/mod/quiz/report/simpletest/testreportlib.php @@ -66,7 +66,7 @@ class question_reportlib_test extends UnitTestCase { } function test_quiz_report_scale_summarks_as_percentage() { - $quiz = new stdClass; + $quiz = new stdClass(); $quiz->sumgrades = 10; $quiz->decimalpoints = 2; diff --git a/mod/quiz/report/statistics/qstats.php b/mod/quiz/report/statistics/qstats.php index e0a7dc0580b..893ec536d12 100644 --- a/mod/quiz/report/statistics/qstats.php +++ b/mod/quiz/report/statistics/qstats.php @@ -68,7 +68,7 @@ class quiz_statistics_question_stats { * @return object ready to hold all the question statistics. */ protected function make_blank_question_stats() { - $stats = new stdClass; + $stats = new stdClass(); $stats->slot = null; $stats->s = 0; $stats->totalmarks = 0; diff --git a/mod/quiz/report/statistics/report.php b/mod/quiz/report/statistics/report.php index 97efa62faa0..07863c841f3 100644 --- a/mod/quiz/report/statistics/report.php +++ b/mod/quiz/report/statistics/report.php @@ -349,7 +349,7 @@ class quiz_statistics_report extends quiz_default_report { } foreach ($responesstats->responseclasses as $partid => $partclasses) { - $rowdata = new stdClass; + $rowdata = new stdClass(); $rowdata->part = $partid; foreach ($partclasses as $responseclassid => $responseclass) { $rowdata->responseclass = $responseclass->responseclass; @@ -556,11 +556,11 @@ class quiz_statistics_report extends quiz_default_report { */ protected function get_emtpy_stats($questions, $firstattemptscount = 0, $allattemptscount = 0) { - $quizstats = new stdClass; + $quizstats = new stdClass(); $quizstats->firstattemptscount = $firstattemptscount; $quizstats->allattemptscount = $allattemptscount; - $qstats = new stdClass; + $qstats = new stdClass(); $qstats->questions = $questions; $qstats->subquestions = array(); $qstats->responses = array(); @@ -612,13 +612,13 @@ class quiz_statistics_report extends quiz_default_report { $firstattempts = $attempttotals[1]; $firstattempts->average = $firstattempts->total / $firstattempts->countrecs; } else { - $firstattempts = new stdClass; + $firstattempts = new stdClass(); $firstattempts->countrecs = 0; $firstattempts->total = 0; $firstattempts->average = '-'; } - $allattempts = new stdClass; + $allattempts = new stdClass(); if (isset($attempttotals[0])) { $allattempts->countrecs = $firstattempts->countrecs + $attempttotals[0]->countrecs; $allattempts->total = $firstattempts->total + $attempttotals[0]->total; @@ -642,7 +642,7 @@ class quiz_statistics_report extends quiz_default_report { } $summarksavg = $usingattempts->total / $usingattempts->countrecs; - $quizstats = new stdClass; + $quizstats = new stdClass(); $quizstats->allattempts = $useallattempts; $quizstats->firstattemptscount = $firstattempts->countrecs; $quizstats->allattemptscount = $allattempts->countrecs; @@ -674,7 +674,7 @@ class quiz_statistics_report extends quiz_default_report { //fetch sum of squared, cubed and power 4d //differences between marks and mean mark $mean = $usingattempts->total / $s; - $sql = "SELECT + $sql = "SELECT SUM(POWER((quiza.sumgrades - $mean),2)) AS power2, SUM(POWER((quiza.sumgrades - $mean),3)) AS power3, SUM(POWER((quiza.sumgrades - $mean),4)) AS power4 @@ -953,7 +953,7 @@ class quiz_statistics_report extends quiz_default_report { } // Generate the output. - $a = new stdClass; + $a = new stdClass(); $a->lastcalculated = format_time(time() - $quizstats->timemodified); $a->count = $count; diff --git a/mod/quiz/report/statistics/responseanalysis.php b/mod/quiz/report/statistics/responseanalysis.php index 4359789c58b..c2c39cae8f1 100644 --- a/mod/quiz/report/statistics/responseanalysis.php +++ b/mod/quiz/report/statistics/responseanalysis.php @@ -51,9 +51,8 @@ class quiz_statistics_response_analyser { public $responses = array(); /** - * @var array An array of - * $this->fractions[$subpartid][$responseclassid] is an object with two - * fields, ->responseclass and ->fraction. + * @var array $this->fractions[$subpartid][$responseclassid] is an object + * with two fields, ->responseclass and ->fraction. */ public $responseclasses = array(); @@ -137,7 +136,7 @@ class quiz_statistics_response_analyser { $partresponses = $qa->classify_response(); foreach ($partresponses as $subpartid => $partresponse) { if (!isset($this->responses[$subpartid][$partresponse->responseclassid][$partresponse->response])) { - $resp = new stdClass; + $resp = new stdClass(); $resp->count = 0; if (!is_null($partresponse->fraction)) { $resp->fraction = $partresponse->fraction; @@ -195,7 +194,7 @@ class quiz_statistics_response_analyser { foreach ($this->responses as $subpartid => $partdata) { foreach ($partdata as $responseclassid => $classdata) { foreach ($classdata as $response => $data) { - $row = new stdClass; + $row = new stdClass(); $row->quizstatisticsid = $quizstatisticsid; $row->questionid = $this->questiondata->id; $row->subqid = $subpartid; diff --git a/mod/quiz/review.php b/mod/quiz/review.php index 585883569ec..fa01ca7c9aa 100644 --- a/mod/quiz/review.php +++ b/mod/quiz/review.php @@ -194,7 +194,7 @@ if ($options->marks && quiz_has_grades($quiz)) { } else { // Show raw marks only if they are different from the grade (like on the view page). if ($quiz->grade != $quiz->sumgrades) { - $a = new stdClass; + $a = new stdClass(); $a->grade = quiz_format_grade($quiz, $attempt->sumgrades); $a->maxgrade = quiz_format_grade($quiz, $quiz->sumgrades); $rows[] = '' . get_string('marks', 'quiz') . '' . @@ -202,7 +202,7 @@ if ($options->marks && quiz_has_grades($quiz)) { } // Now the scaled grade. - $a = new stdClass; + $a = new stdClass(); $a->grade = '' . quiz_format_grade($quiz, $grade) . ''; $a->maxgrade = quiz_format_grade($quiz, $quiz->grade); if ($quiz->grade != 100) { diff --git a/mod/quiz/simpletest/testaccessrules.php b/mod/quiz/simpletest/testaccessrules.php index c4d2083d835..b92592417f5 100644 --- a/mod/quiz/simpletest/testaccessrules.php +++ b/mod/quiz/simpletest/testaccessrules.php @@ -40,14 +40,14 @@ require_once($CFG->dirroot . '/mod/quiz/locallib.php'); class simple_rules_test extends UnitTestCase { public static $includecoverage = array('mod/quiz/locallib.php'); function test_num_attempts_access_rule() { - $quiz = new stdClass; + $quiz = new stdClass(); $quiz->attempts = 3; $quiz->questions = ''; - $cm = new stdClass; + $cm = new stdClass(); $cm->id = 0; $quizobj = new quiz($quiz, $cm, null); $rule = new num_attempts_access_rule($quizobj, 0); - $attempt = new stdClass; + $attempt = new stdClass(); $this->assertEqual($rule->description(), get_string('attemptsallowedn', 'quiz', 3)); @@ -66,9 +66,9 @@ class simple_rules_test extends UnitTestCase { } function test_ipaddress_access_rule() { - $quiz = new stdClass; - $attempt = new stdClass; - $cm = new stdClass; + $quiz = new stdClass(); + $attempt = new stdClass(); + $cm = new stdClass(); $cm->id = 0; // Test the allowed case by getting the user's IP address. However, this @@ -97,14 +97,14 @@ class simple_rules_test extends UnitTestCase { } function test_time_limit_access_rule() { - $quiz = new stdClass; + $quiz = new stdClass(); $quiz->timelimit = 3600; $quiz->questions = ''; - $cm = new stdClass; + $cm = new stdClass(); $cm->id = 0; $quizobj = new quiz($quiz, $cm, null); $rule = new time_limit_access_rule($quizobj, 10000); - $attempt = new stdClass; + $attempt = new stdClass(); $this->assertEqual($rule->description(), get_string('quiztimelimit', 'quiz', format_time(3600))); @@ -126,14 +126,14 @@ class simple_rules_test extends UnitTestCase { */ class open_close_date_access_rule_test extends UnitTestCase { function test_no_dates() { - $quiz = new stdClass; + $quiz = new stdClass(); $quiz->timeopen = 0; $quiz->timeclose = 0; $quiz->questions = ''; - $cm = new stdClass; + $cm = new stdClass(); $cm->id = 0; $quizobj = new quiz($quiz, $cm, null); - $attempt = new stdClass; + $attempt = new stdClass(); $attempt->preview = 0; $rule = new open_close_date_access_rule($quizobj, 10000); @@ -153,14 +153,14 @@ class open_close_date_access_rule_test extends UnitTestCase { } function test_start_date() { - $quiz = new stdClass; + $quiz = new stdClass(); $quiz->timeopen = 10000; $quiz->timeclose = 0; $quiz->questions = ''; - $cm = new stdClass; + $cm = new stdClass(); $cm->id = 0; $quizobj = new quiz($quiz, $cm, null); - $attempt = new stdClass; + $attempt = new stdClass(); $attempt->preview = 0; $rule = new open_close_date_access_rule($quizobj, 9999); @@ -179,14 +179,14 @@ class open_close_date_access_rule_test extends UnitTestCase { } function test_close_date() { - $quiz = new stdClass; + $quiz = new stdClass(); $quiz->timeopen = 0; $quiz->timeclose = 20000; $quiz->questions = ''; - $cm = new stdClass; + $cm = new stdClass(); $cm->id = 0; $quizobj = new quiz($quiz, $cm, null); - $attempt = new stdClass; + $attempt = new stdClass(); $attempt->preview = 0; $rule = new open_close_date_access_rule($quizobj, 20000); @@ -211,14 +211,14 @@ class open_close_date_access_rule_test extends UnitTestCase { } function test_both_dates() { - $quiz = new stdClass; + $quiz = new stdClass(); $quiz->timeopen = 10000; $quiz->timeclose = 20000; $quiz->questions = ''; - $cm = new stdClass; + $cm = new stdClass(); $cm->id = 0; $quizobj = new quiz($quiz, $cm, null); - $attempt = new stdClass; + $attempt = new stdClass(); $attempt->preview = 0; $rule = new open_close_date_access_rule($quizobj, 9999); @@ -261,17 +261,17 @@ class open_close_date_access_rule_test extends UnitTestCase { */ class inter_attempt_delay_access_rule_test extends UnitTestCase { function test_just_first_delay() { - $quiz = new stdClass; + $quiz = new stdClass(); $quiz->attempts = 3; $quiz->timelimit = 0; $quiz->delay1 = 1000; $quiz->delay2 = 0; $quiz->timeclose = 0; $quiz->questions = ''; - $cm = new stdClass; + $cm = new stdClass(); $cm->id = 0; $quizobj = new quiz($quiz, $cm, null); - $attempt = new stdClass; + $attempt = new stdClass(); $attempt->timefinish = 10000; $rule = new inter_attempt_delay_access_rule($quizobj, 10000); @@ -293,17 +293,17 @@ class inter_attempt_delay_access_rule_test extends UnitTestCase { } function test_just_second_delay() { - $quiz = new stdClass; + $quiz = new stdClass(); $quiz->attempts = 5; $quiz->timelimit = 0; $quiz->delay1 = 0; $quiz->delay2 = 1000; $quiz->timeclose = 0; $quiz->questions = ''; - $cm = new stdClass; + $cm = new stdClass(); $cm->id = 0; $quizobj = new quiz($quiz, $cm, null); - $attempt = new stdClass; + $attempt = new stdClass(); $attempt->timefinish = 10000; $rule = new inter_attempt_delay_access_rule($quizobj, 10000); @@ -328,17 +328,17 @@ class inter_attempt_delay_access_rule_test extends UnitTestCase { } function test_just_both_delays() { - $quiz = new stdClass; + $quiz = new stdClass(); $quiz->attempts = 5; $quiz->timelimit = 0; $quiz->delay1 = 2000; $quiz->delay2 = 1000; $quiz->timeclose = 0; $quiz->questions = ''; - $cm = new stdClass; + $cm = new stdClass(); $cm->id = 0; $quizobj = new quiz($quiz, $cm, null); - $attempt = new stdClass; + $attempt = new stdClass(); $attempt->timefinish = 10000; $rule = new inter_attempt_delay_access_rule($quizobj, 10000); @@ -371,17 +371,17 @@ class inter_attempt_delay_access_rule_test extends UnitTestCase { } function test_with_close_date() { - $quiz = new stdClass; + $quiz = new stdClass(); $quiz->attempts = 5; $quiz->timelimit = 0; $quiz->delay1 = 2000; $quiz->delay2 = 1000; $quiz->timeclose = 15000; $quiz->questions = ''; - $cm = new stdClass; + $cm = new stdClass(); $cm->id = 0; $quizobj = new quiz($quiz, $cm, null); - $attempt = new stdClass; + $attempt = new stdClass(); $attempt->timefinish = 13000; $rule = new inter_attempt_delay_access_rule($quizobj, 10000); @@ -421,17 +421,17 @@ class inter_attempt_delay_access_rule_test extends UnitTestCase { } function test_time_limit_and_overdue() { - $quiz = new stdClass; + $quiz = new stdClass(); $quiz->attempts = 5; $quiz->timelimit = 100; $quiz->delay1 = 2000; $quiz->delay2 = 1000; $quiz->timeclose = 0; $quiz->questions = ''; - $cm = new stdClass; + $cm = new stdClass(); $cm->id = 0; $quizobj = new quiz($quiz, $cm, null); - $attempt = new stdClass; + $attempt = new stdClass(); $attempt->timestart = 9900; $attempt->timefinish = 10100; @@ -486,14 +486,14 @@ class inter_attempt_delay_access_rule_test extends UnitTestCase { */ class password_access_rule_test extends UnitTestCase { function test_password_access_rule() { - $quiz = new stdClass; + $quiz = new stdClass(); $quiz->password = 'frog'; $quiz->questions = ''; - $cm = new stdClass; + $cm = new stdClass(); $cm->id = 0; $quizobj = new quiz($quiz, $cm, null); $rule = new password_access_rule($quizobj, 0); - $attempt = new stdClass; + $attempt = new stdClass(); $this->assertFalse($rule->prevent_access()); $this->assertEqual($rule->description(), get_string('requirepasswordmessage', 'quiz')); @@ -512,14 +512,14 @@ class securewindow_access_rule_test extends UnitTestCase { // Nothing very testable in this class, just test that it obeys the general access rule contact. function test_securewindow_access_rule() { - $quiz = new stdClass; + $quiz = new stdClass(); $quiz->popup = 1; $quiz->questions = ''; - $cm = new stdClass; + $cm = new stdClass(); $cm->id = 0; $quizobj = new quiz($quiz, $cm, null); $rule = new securewindow_access_rule($quizobj, 0); - $attempt = new stdClass; + $attempt = new stdClass(); $this->assertFalse($rule->prevent_access()); $this->assertFalse($rule->description()); @@ -536,16 +536,16 @@ class securewindow_access_rule_test extends UnitTestCase { */ class quiz_access_manager_test extends UnitTestCase { public function test_cannot_review_message() { - $quiz = new stdClass; + $quiz = new stdClass(); $quiz->reviewattempt = 0x10010; $quiz->timeclose = 0; $quiz->attempts = 0; $quiz->questions = '1,2,0,3,4,0'; - $cm = new stdClass; + $cm = new stdClass(); $cm->id = 123; - $quizobj = new quiz($quiz, $cm, new stdClass, false); + $quizobj = new quiz($quiz, $cm, new stdClass(), false); $am = new quiz_access_manager($quizobj, time(), false); @@ -556,7 +556,7 @@ class quiz_access_manager_test extends UnitTestCase { $closetime = time() + 10000; $quiz->timeclose = $closetime; - $quizobj = new quiz($quiz, $cm, new stdClass, false); + $quizobj = new quiz($quiz, $cm, new stdClass(), false); $am = new quiz_access_manager($quizobj, time(), false); $this->assertEqual(get_string('noreviewuntil', 'quiz', userdate($closetime)), diff --git a/mod/quiz/simpletest/testlib.php b/mod/quiz/simpletest/testlib.php index 83cda8a9b7c..9463245948b 100644 --- a/mod/quiz/simpletest/testlib.php +++ b/mod/quiz/simpletest/testlib.php @@ -39,7 +39,7 @@ require_once($CFG->dirroot . '/mod/quiz/lib.php'); class quiz_lib_test extends UnitTestCase { public static $includecoverage = array('mod/quiz/lib.php'); function test_quiz_has_grades() { - $quiz = new stdClass; + $quiz = new stdClass(); $quiz->grade = '100.0000'; $quiz->sumgrades = '100.0000'; $this->assertTrue(quiz_has_grades($quiz)); @@ -52,7 +52,7 @@ class quiz_lib_test extends UnitTestCase { } function test_quiz_format_grade() { - $quiz = new stdClass; + $quiz = new stdClass(); $quiz->decimalpoints = 2; $this->assertEqual(quiz_format_grade($quiz, 0.12345678), format_float(0.12, 2)); $this->assertEqual(quiz_format_grade($quiz, 0), format_float(0, 2)); @@ -62,7 +62,7 @@ class quiz_lib_test extends UnitTestCase { } function test_quiz_format_question_grade() { - $quiz = new stdClass; + $quiz = new stdClass(); $quiz->decimalpoints = 2; $quiz->questiondecimalpoints = 2; $this->assertEqual(quiz_format_question_grade($quiz, 0.12345678), format_float(0.12, 2)); diff --git a/mod/quiz/simpletest/testlocallib.php b/mod/quiz/simpletest/testlocallib.php index 4887923d330..81427934518 100644 --- a/mod/quiz/simpletest/testlocallib.php +++ b/mod/quiz/simpletest/testlocallib.php @@ -100,7 +100,7 @@ class quiz_locallib_test extends UnitTestCase { } function test_quiz_rescale_grade() { - $quiz = new stdClass; + $quiz = new stdClass(); $quiz->decimalpoints = 2; $quiz->questiondecimalpoints = 3; $quiz->grade = 10; @@ -115,7 +115,7 @@ class quiz_locallib_test extends UnitTestCase { } public function test_quiz_get_slot_for_question() { - $quiz = new stdClass; + $quiz = new stdClass(); $quiz->questions = '1,2,0,7,0'; $this->assertEqual(1, quiz_get_slot_for_question($quiz, 1)); $this->assertEqual(3, quiz_get_slot_for_question($quiz, 7)); diff --git a/mod/quiz/simpletest/testquizdisplayoptions.php b/mod/quiz/simpletest/testquizdisplayoptions.php index a7e11b8cfa0..27a4267f26e 100644 --- a/mod/quiz/simpletest/testquizdisplayoptions.php +++ b/mod/quiz/simpletest/testquizdisplayoptions.php @@ -40,7 +40,7 @@ require_once($CFG->dirroot . '/mod/quiz/locallib.php'); */ class mod_quiz_display_options_test extends UnitTestCase { function test_num_attempts_access_rule() { - $quiz = new stdClass; + $quiz = new stdClass(); $quiz->decimalpoints = 2; $quiz->questiondecimalpoints = -1; $quiz->reviewattempt = 0x11110; diff --git a/mod/quiz/view.php b/mod/quiz/view.php index b420f2393e3..2dc79afb191 100644 --- a/mod/quiz/view.php +++ b/mod/quiz/view.php @@ -310,13 +310,13 @@ if ($numattempts && $gradecolumn && !is_null($mygrade)) { if ($overallstats) { if ($moreattempts) { - $a = new stdClass; + $a = new stdClass(); $a->method = quiz_get_grading_option_name($quiz->grademethod); $a->mygrade = quiz_format_grade($quiz, $mygrade); $a->quizgrade = quiz_format_grade($quiz, $quiz->grade); $resultinfo .= $OUTPUT->heading(get_string('gradesofar', 'quiz', $a), 2, 'main'); } else { - $a = new stdClass; + $a = new stdClass(); $a->grade = quiz_format_grade($quiz, $mygrade); $a->maxgrade = quiz_format_grade($quiz, $quiz->grade); $a = get_string('outofshort', 'quiz', $a); diff --git a/question/behaviour/adaptive/renderer.php b/question/behaviour/adaptive/renderer.php index 7393d634826..547426224ef 100644 --- a/question/behaviour/adaptive/renderer.php +++ b/question/behaviour/adaptive/renderer.php @@ -47,7 +47,7 @@ class qbehaviour_adaptive_renderer extends qbehaviour_renderer { } // Display the grading details from the last graded state - $mark = new stdClass; + $mark = new stdClass(); $mark->max = $qa->format_max_mark($options->markdp); $actualmark = $gradedstep->get_fraction() * $qa->get_max_mark(); diff --git a/question/behaviour/behaviourbase.php b/question/behaviour/behaviourbase.php index 9605af38c2c..eaaa5947d9c 100644 --- a/question/behaviour/behaviourbase.php +++ b/question/behaviour/behaviourbase.php @@ -450,7 +450,7 @@ abstract class question_behaviour { * @return string the comment, ready to be output. */ public function format_comment($comment = null, $commentformat = null) { - $formatoptions = new stdClass; + $formatoptions = new stdClass(); $formatoptions->noclean = true; $formatoptions->para = false; @@ -466,7 +466,7 @@ abstract class question_behaviour { * @param unknown_type $step */ protected function summarise_manual_comment($step) { - $a = new stdClass; + $a = new stdClass(); if ($step->has_behaviour_var('comment')) { $a->comment = shorten_text(html_to_text($this->format_comment( $step->get_behaviour_var('comment')), 0, false), 200); diff --git a/question/behaviour/rendererbase.php b/question/behaviour/rendererbase.php index a4b9c22ff90..caa146c0567 100644 --- a/question/behaviour/rendererbase.php +++ b/question/behaviour/rendererbase.php @@ -95,7 +95,7 @@ abstract class qbehaviour_renderer extends plugin_renderer_base { if (!is_null($currentmark)) { $attributes['value'] = $qa->format_fraction_as_mark($currentmark / $maxmark, $options->markdp); } - $a = new stdClass; + $a = new stdClass(); $a->max = $qa->format_max_mark($options->markdp); $a->mark = html_writer::empty_tag('input', $attributes); diff --git a/question/category_class.php b/question/category_class.php index c007038cf68..e40a7d50827 100644 --- a/question/category_class.php +++ b/question/category_class.php @@ -323,7 +323,7 @@ class question_category_object { public function display_move_form($questionsincategory, $category){ global $OUTPUT; - $vars = new stdClass; + $vars = new stdClass(); $vars->name = $category->name; $vars->count = $questionsincategory; echo $OUTPUT->box(get_string('categorymove', 'quiz', $vars), 'generalbox boxaligncenter'); diff --git a/question/editlib.php b/question/editlib.php index 72c1dcf428e..87f6ec37c35 100644 --- a/question/editlib.php +++ b/question/editlib.php @@ -497,7 +497,7 @@ class question_bank_creator_name_column extends question_bank_column_base { protected function display_content($question, $rowclasses) { if (!empty($question->creatorfirstname) && !empty($question->creatorlastname)) { - $u = new stdClass; + $u = new stdClass(); $u->firstname = $question->creatorfirstname; $u->lastname = $question->creatorlastname; echo fullname($u); @@ -534,7 +534,7 @@ class question_bank_modifier_name_column extends question_bank_column_base { protected function display_content($question, $rowclasses) { if (!empty($question->modifierfirstname) && !empty($question->modifierlastname)) { - $u = new stdClass; + $u = new stdClass(); $u->firstname = $question->modifierfirstname; $u->lastname = $question->modifierlastname; echo fullname($u); @@ -718,7 +718,7 @@ class question_bank_question_text_row extends question_bank_row_base { protected $formatoptions; protected function init() { - $this->formatoptions = new stdClass; + $this->formatoptions = new stdClass(); $this->formatoptions->noclean = true; $this->formatoptions->para = false; } @@ -1152,7 +1152,7 @@ class question_bank_view { } protected function print_category_info($category) { - $formatoptions = new stdClass; + $formatoptions = new stdClass(); $formatoptions->noclean = true; $formatoptions->overflowdiv = true; echo '
'; @@ -1233,7 +1233,7 @@ class question_bank_view { $category = $this->get_current_category($categoryandcontext); - $cmoptions = new stdClass; + $cmoptions = new stdClass(); $cmoptions->hasattempts = !empty($this->quizhasattempts); $strselectall = get_string("selectall", "quiz"); @@ -1723,7 +1723,7 @@ function print_qtype_to_add_option($qtype) { echo '