From 65ba104c5dcea20c70ded81b37b3b057a90c0dae Mon Sep 17 00:00:00 2001 From: David Mudrak Date: Mon, 4 Jan 2010 17:55:02 +0000 Subject: [PATCH] Reverting Petr's suggestion - using stdClass instead of object again I do not agree with using object() class for no real reason. --- mod/workshop/allocation/lib.php | 2 +- mod/workshop/allocation/manual/allocator.php | 6 +-- mod/workshop/allocation/manual/renderer.php | 14 ++--- mod/workshop/allocation/random/allocator.php | 6 +-- .../random/simpletest/testallocator.php | 12 ++--- mod/workshop/assessment.php | 4 +- mod/workshop/develtools.php | 2 +- .../grading/accumulative/strategy.php | 28 +++++----- mod/workshop/grading/assessment_form.php | 2 +- mod/workshop/grading/edit_form.php | 2 +- mod/workshop/grading/lib.php | 8 +-- mod/workshop/grading/noerrors/strategy.php | 26 ++++----- mod/workshop/lib.php | 42 +++++++-------- mod/workshop/locallib.php | 54 +++++++++---------- mod/workshop/renderer.php | 6 +-- mod/workshop/submission.php | 2 +- 16 files changed, 108 insertions(+), 108 deletions(-) diff --git a/mod/workshop/allocation/lib.php b/mod/workshop/allocation/lib.php index 706f636214..7b429c02cd 100644 --- a/mod/workshop/allocation/lib.php +++ b/mod/workshop/allocation/lib.php @@ -57,7 +57,7 @@ interface workshop_allocator { * be used there. This should be changed once we make quickforms deprecated and then, * this method will just return the required HTML code. * - * @param object $wsoutput workshop module renderer can be used + * @param stdClass $wsoutput workshop module renderer can be used * @return void */ public function ui(moodle_mod_workshop_renderer $wsoutput); diff --git a/mod/workshop/allocation/manual/allocator.php b/mod/workshop/allocation/manual/allocator.php index 36949097c5..c10dbbc939 100644 --- a/mod/workshop/allocation/manual/allocator.php +++ b/mod/workshop/allocation/manual/allocator.php @@ -136,9 +136,9 @@ class workshop_manual_allocator implements workshop_allocator { $hlauthorid = -1; // highlight this author $hlreviewerid = -1; // highlight this reviewer - $msg = new object(); // message to render + $msg = new stdClass(); // message to render - $m = optional_param('m', '', PARAM_ALPHANUMEXT); // message object + $m = optional_param('m', '', PARAM_ALPHANUMEXT); // message stdClass if ($m) { $m = explode('-', $m); // unserialize switch ($m[0]) { @@ -195,7 +195,7 @@ class workshop_manual_allocator implements workshop_allocator { foreach ($rs as $allocation) { $currentuserid = $allocation->authorid; if (!isset($peer[$currentuserid])) { - $peer[$currentuserid] = new object(); + $peer[$currentuserid] = new stdClass(); $peer[$currentuserid]->id = $allocation->authorid; $peer[$currentuserid]->firstname = $allocation->authorfirstname; $peer[$currentuserid]->lastname = $allocation->authorlastname; diff --git a/mod/workshop/allocation/manual/renderer.php b/mod/workshop/allocation/manual/renderer.php index 722f47a922..4205551cc5 100644 --- a/mod/workshop/allocation/manual/renderer.php +++ b/mod/workshop/allocation/manual/renderer.php @@ -55,7 +55,7 @@ class moodle_mod_workshop_allocation_manual_renderer extends moodle_renderer_bas * @param array $peers prepared array of all allocations * @param int $hlauthorid highlight this author * @param int $hlreviewerid highlight this reviewer - * @param object message to display + * @param stdClass $msg message to display * @return string html code */ public function display_allocations(workshop $workshop, $peers, $hlauthorid=null, $hlreviewerid=null, $msg=null) { @@ -95,10 +95,10 @@ class moodle_mod_workshop_allocation_manual_renderer extends moodle_renderer_bas /** * Returns information about the workshop participant * - * @param object $user participant data + * @param stdClass $user participant data * @return string HTML code */ - protected function participant(object $user) { + protected function participant(stdClass $user) { $o = $this->output->user_picture($user, $this->page->course->id); $o .= fullname($user); $o .= $this->output->container_start(array('submission')); @@ -120,12 +120,12 @@ class moodle_mod_workshop_allocation_manual_renderer extends moodle_renderer_bas /** * Returns information about the current reviewers of the given participant and a selector do add new one * - * @param object $user participant data + * @param stdClass $user participant data * @param workshop $workshop workshop record * @param array $peers objects with properties to display picture and fullname * @return string html code */ - protected function reviewers_of_participant(object $user, workshop $workshop, $peers) { + protected function reviewers_of_participant(stdClass $user, workshop $workshop, $peers) { $o = ''; if (is_null($user->submissionid)) { $o .= $this->output->output_tag('span', array('class' => 'info'), get_string('nothingtoreview', 'workshop')); @@ -166,12 +166,12 @@ class moodle_mod_workshop_allocation_manual_renderer extends moodle_renderer_bas /** * Returns information about the current reviewees of the given participant and a selector do add new one * - * @param object $user participant data + * @param stdClass $user participant data * @param workshop $workshop workshop record * @param array $peers objects with properties to display picture and fullname * @return string html code */ - protected function reviewees_of_participant(object $user, workshop $workshop, $peers) { + protected function reviewees_of_participant(stdClass $user, workshop $workshop, $peers) { $o = ''; if (is_null($user->submissionid)) { $o .= $this->output->container(get_string('withoutsubmission', 'workshop'), 'info'); diff --git a/mod/workshop/allocation/random/allocator.php b/mod/workshop/allocation/random/allocator.php index 8a1bb015b9..db8dada198 100644 --- a/mod/workshop/allocation/random/allocator.php +++ b/mod/workshop/allocation/random/allocator.php @@ -117,7 +117,7 @@ class workshop_random_allocator implements workshop_allocator { $this->add_new_allocations($newallocations, $authors, $reviewers); foreach ($newallocations as $newallocation) { list($reviewerid, $authorid) = each($newallocation); - $a = new object(); + $a = new stdClass(); $a->reviewername = fullname($reviewers[0][$reviewerid]); $a->authorname = fullname($authors[0][$authorid]); $o[] = 'ok::indent::' . get_string('allocationaddeddetail', 'workshop', $a); @@ -129,7 +129,7 @@ class workshop_random_allocator implements workshop_allocator { // by reviewer $o[] = 'info::' . get_string('numofdeallocatedassessment', 'workshop', count($delassessments)); foreach ($delassessments as $delassessmentkey => $delassessmentid) { - $a = new object(); + $a = new stdClass(); $a->authorname = fullname((object)array( 'lastname' => $assessments[$delassessmentid]->authorlastname, 'firstname' => $assessments[$delassessmentid]->authorfirstname)); @@ -160,7 +160,7 @@ class workshop_random_allocator implements workshop_allocator { global $OUTPUT; $m = optional_param('m', null, PARAM_INT); // status message code - $msg = new object(); + $msg = new stdClass(); if ($m == WORKSHOP_ALLOCATION_RANDOM_MSG_SUCCESS) { $msg = (object)array('text' => get_string('randomallocationdone', 'workshop'), 'sty' => 'ok'); } diff --git a/mod/workshop/allocation/random/simpletest/testallocator.php b/mod/workshop/allocation/random/simpletest/testallocator.php index 0a73e3228d..894a6a9e6b 100644 --- a/mod/workshop/allocation/random/simpletest/testallocator.php +++ b/mod/workshop/allocation/random/simpletest/testallocator.php @@ -86,8 +86,8 @@ class workshop_allocation_random_test extends UnitTestCase { public function test_self_allocation_equal_user_groups() { // fixture setup - $authors = array(0 => array_fill_keys(array(4, 6, 10), new object())); - $reviewers = array(0 => array_fill_keys(array(4, 6, 10), new object())); + $authors = array(0 => array_fill_keys(array(4, 6, 10), new stdClass())); + $reviewers = array(0 => array_fill_keys(array(4, 6, 10), new stdClass())); // exercise SUT $newallocations = $this->allocator->self_allocation($authors, $reviewers); // verify @@ -96,8 +96,8 @@ class workshop_allocation_random_test extends UnitTestCase { public function test_self_allocation_different_user_groups() { // fixture setup - $authors = array(0 => array_fill_keys(array(1, 4, 5, 10, 13), new object())); - $reviewers = array(0 => array_fill_keys(array(4, 7, 10), new object())); + $authors = array(0 => array_fill_keys(array(1, 4, 5, 10, 13), new stdClass())); + $reviewers = array(0 => array_fill_keys(array(4, 7, 10), new stdClass())); // exercise SUT $newallocations = $this->allocator->self_allocation($authors, $reviewers); // verify @@ -106,8 +106,8 @@ class workshop_allocation_random_test extends UnitTestCase { public function test_self_allocation_skip_existing() { // fixture setup - $authors = array(0 => array_fill_keys(array(3, 4, 10), new object())); - $reviewers = array(0 => array_fill_keys(array(3, 4, 10), new object())); + $authors = array(0 => array_fill_keys(array(3, 4, 10), new stdClass())); + $reviewers = array(0 => array_fill_keys(array(3, 4, 10), new stdClass())); $assessments = array(23 => (object)array('authorid' => 3, 'reviewerid' => 3)); // exercise SUT $newallocations = $this->allocator->self_allocation($authors, $reviewers, $assessments); diff --git a/mod/workshop/assessment.php b/mod/workshop/assessment.php index 6e292b5737..cc7072b3fe 100644 --- a/mod/workshop/assessment.php +++ b/mod/workshop/assessment.php @@ -34,8 +34,8 @@ if ($preview = optional_param('preview', 0, PARAM_INT)) { $cm = get_coursemodule_from_id('workshop', $preview, 0, false, MUST_EXIST); $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); $workshop = $DB->get_record('workshop', array('id' => $cm->instance), '*', MUST_EXIST); - $submission = new object(); - $assessment = new object(); + $submission = new stdClass(); + $assessment = new stdClass(); } else { $mode = 'assessment'; diff --git a/mod/workshop/develtools.php b/mod/workshop/develtools.php index 57347f5169..010e69298d 100644 --- a/mod/workshop/develtools.php +++ b/mod/workshop/develtools.php @@ -62,7 +62,7 @@ case 'mksubmissions': $c = 0; // counter foreach ($authors as $authorid => $author) { $timenow = time() - rand(0, 60 * 60 * 24 * 7); // submitted sometimes during last week - $submission = new object(); + $submission = new stdClass(); $submission->workshopid = $workshop->id; $submission->example = 0; $submission->userid = $authorid; diff --git a/mod/workshop/grading/accumulative/strategy.php b/mod/workshop/grading/accumulative/strategy.php index 26e4be99ef..6aab51dddd 100644 --- a/mod/workshop/grading/accumulative/strategy.php +++ b/mod/workshop/grading/accumulative/strategy.php @@ -161,7 +161,7 @@ class workshop_accumulative_strategy implements workshop_strategy { * @param moodle_url $actionurl URL of form handler, defaults to auto detect the current url * @param string $mode Mode to open the form in: preview/assessment */ - public function get_assessment_form(moodle_url $actionurl=null, $mode='preview', object $assessment=null) { + public function get_assessment_form(moodle_url $actionurl=null, $mode='preview', stdClass $assessment=null) { global $CFG; // needed because the included files use it global $PAGE; global $DB; @@ -179,7 +179,7 @@ class workshop_accumulative_strategy implements workshop_strategy { if ('assessment' === $mode and !empty($assessment)) { // load the previously saved assessment data $grades = $this->reindex_grades_by_dimension($this->get_current_assessment_data($assessment)); - $current = new object(); + $current = new stdClass(); for ($i = 0; $i < $nodimensions; $i++) { $dimid = $fields->{'dimensionid__idx_'.$i}; if (isset($grades[$dimid])) { @@ -208,11 +208,11 @@ class workshop_accumulative_strategy implements workshop_strategy { * * This method processes data submitted using the form returned by {@link get_assessment_form()} * - * @param object $assessment Assessment being filled - * @param object $data Raw data as returned by the assessment form + * @param stdClass $assessment Assessment being filled + * @param stdClass $data Raw data as returned by the assessment form * @return float|null Percentual grade for submission as suggested by the peer */ - public function save_assessment(object $assessment, object $data) { + public function save_assessment(stdClass $assessment, stdClass $data) { global $DB; if (!isset($data->strategyname) || ($data->strategyname != $this->name())) { @@ -223,7 +223,7 @@ class workshop_accumulative_strategy implements workshop_strategy { throw coding_expection('You did not send me the number of assessment dimensions to process'); } for ($i = 0; $i < $data->nodims; $i++) { - $grade = new object(); + $grade = new stdClass(); $grade->id = $data->{'gradeid__idx_' . $i}; $grade->assessmentid = $assessment->id; $grade->dimensionid = $data->{'dimensionid__idx_' . $i}; @@ -269,7 +269,7 @@ class workshop_accumulative_strategy implements workshop_strategy { */ protected function prepare_form_fields(array $raw) { - $formdata = new object(); + $formdata = new stdClass(); $key = 0; foreach ($raw as $dimension) { $formdata->{'dimensionid__idx_' . $key} = $dimension->id; // master id, not the local one! @@ -320,18 +320,18 @@ class workshop_accumulative_strategy implements workshop_strategy { protected function prepare_database_fields(stdClass $raw) { global $PAGE; - $cook = new object(); // to be returned + $cook = new stdClass(); // to be returned $cook->forms = array(); // to be stored in {workshop_forms} $cook->accumulative = array(); // to be stored in {workshop_forms_accumulative} for ($i = 0; $i < $raw->norepeats; $i++) { - $cook->forms[$i] = new object(); + $cook->forms[$i] = new stdClass(); $cook->forms[$i]->id = $raw->{'dimensionid__idx_'.$i}; $cook->forms[$i]->workshopid = $this->workshop->id; $cook->forms[$i]->sort = $i + 1; $cook->forms[$i]->strategy = 'accumulative'; - $cook->accumulative[$i] = new object(); + $cook->accumulative[$i] = new stdClass(); $cook->accumulative[$i]->description_editor = $raw->{'description__idx_'.$i.'_editor'}; $cook->accumulative[$i]->grade = $raw->{'grade__idx_'.$i}; $cook->accumulative[$i]->weight = $raw->{'weight__idx_'.$i}; @@ -342,10 +342,10 @@ class workshop_accumulative_strategy implements workshop_strategy { /** * Returns the list of current grades filled by the reviewer * - * @param object $assessment Assessment record + * @param stdClass $assessment Assessment record * @return array of filtered records from the table workshop_grades */ - protected function get_current_assessment_data(object $assessment) { + protected function get_current_assessment_data(stdClass $assessment) { global $DB; // fetch all grades accociated with this assessment @@ -377,10 +377,10 @@ class workshop_accumulative_strategy implements workshop_strategy { /** * Aggregates the assessment form data and sets the grade for the submission given by the peer * - * @param object $assessment Assessment record + * @param stdClass $assessment Assessment record * @return float|null Percentual grade for submission as suggested by the peer */ - protected function update_peer_grade(object $assessment) { + protected function update_peer_grade(stdClass $assessment) { $grades = $this->get_current_assessment_data($assessment); $suggested = $this->calculate_peer_grade($grades); if (!is_null($suggested)) { diff --git a/mod/workshop/grading/assessment_form.php b/mod/workshop/grading/assessment_form.php index 75dff9836d..3db9fd2c7d 100644 --- a/mod/workshop/grading/assessment_form.php +++ b/mod/workshop/grading/assessment_form.php @@ -76,7 +76,7 @@ class workshop_assessment_form extends moodleform { /** * Add any strategy specific form fields. * - * @param object $mform the form being built. + * @param stdClass $mform the form being built. */ protected function definition_inner(&$mform) { // By default, do nothing. diff --git a/mod/workshop/grading/edit_form.php b/mod/workshop/grading/edit_form.php index daa75f3d1e..ecd5d0b17f 100644 --- a/mod/workshop/grading/edit_form.php +++ b/mod/workshop/grading/edit_form.php @@ -81,7 +81,7 @@ class workshop_edit_strategy_form extends moodleform { /** * Add any strategy specific form fields. * - * @param object $mform the form being built. + * @param stdClass $mform the form being built. */ protected function definition_inner(&$mform) { // By default, do nothing. diff --git a/mod/workshop/grading/lib.php b/mod/workshop/grading/lib.php index 9d4355b727..f896bf1aac 100644 --- a/mod/workshop/grading/lib.php +++ b/mod/workshop/grading/lib.php @@ -46,7 +46,7 @@ interface workshop_strategy { * Factory method returning a form that is used to define the assessment form * * @param string $actionurl URL of the action handler script, defaults to auto detect - * @return object The instance of the assessment form editor class + * @return stdClass The instance of the assessment form editor class */ public function get_edit_strategy_form($actionurl=null); @@ -75,9 +75,9 @@ interface workshop_strategy { * * This method processes data submitted using the form returned by {@link get_assessment_form()} * - * @param object $assessment Assessment being filled - * @param object $data Raw data as returned by the assessment form + * @param stdClass $assessment Assessment being filled + * @param stdClass $data Raw data as returned by the assessment form * @return float|float Percentual grade for submission as suggested by the peer or null if impossible to count */ - public function save_assessment(object $assessment, object $data); + public function save_assessment(stdClass $assessment, stdClass $data); } diff --git a/mod/workshop/grading/noerrors/strategy.php b/mod/workshop/grading/noerrors/strategy.php index e83da7c301..fd1a76dc3f 100644 --- a/mod/workshop/grading/noerrors/strategy.php +++ b/mod/workshop/grading/noerrors/strategy.php @@ -208,7 +208,7 @@ class workshop_noerrors_strategy implements workshop_strategy { * @param moodle_url $actionurl URL of form handler, defaults to auto detect the current url * @param string $mode Mode to open the form in: preview/assessment */ - public function get_assessment_form(moodle_url $actionurl=null, $mode='preview', object $assessment=null) { + public function get_assessment_form(moodle_url $actionurl=null, $mode='preview', stdClass $assessment=null) { global $CFG; // needed because the included files use it global $PAGE; global $DB; @@ -226,7 +226,7 @@ class workshop_noerrors_strategy implements workshop_strategy { if ('assessment' === $mode and !empty($assessment)) { // load the previously saved assessment data $grades = $this->reindex_grades_by_dimension($this->get_current_assessment_data($assessment)); - $current = new object(); + $current = new stdClass(); for ($i = 0; $i < $nodimensions; $i++) { $dimid = $fields->{'dimensionid__idx_'.$i}; if (isset($grades[$dimid])) { @@ -255,11 +255,11 @@ class workshop_noerrors_strategy implements workshop_strategy { * * This method processes data submitted using the form returned by {@link get_assessment_form()} * - * @param object $assessment Assessment being filled - * @param object $data Raw data as returned by the assessment form + * @param stdClass $assessment Assessment being filled + * @param stdClass $data Raw data as returned by the assessment form * @return float|null Percentual grade for submission as suggested by the peer */ - public function save_assessment(object $assessment, object $data) { + public function save_assessment(stdClass $assessment, stdClass $data) { global $DB; if (!isset($data->strategyname) || ($data->strategyname != $this->name())) { @@ -270,7 +270,7 @@ class workshop_noerrors_strategy implements workshop_strategy { throw coding_expection('You did not send me the number of assessment dimensions to process'); } for ($i = 0; $i < $data->nodims; $i++) { - $grade = new object(); + $grade = new stdClass(); $grade->id = $data->{'gradeid__idx_' . $i}; $grade->assessmentid = $assessment->id; $grade->dimensionid = $data->{'dimensionid__idx_' . $i}; @@ -295,10 +295,10 @@ class workshop_noerrors_strategy implements workshop_strategy { * number of errors to a grade are saved into workshop_forms_noerrors_map. * * @uses $DB - * @param object $data Raw data returned by the dimension editor form + * @param stdClass $data Raw data returned by the dimension editor form * @return void */ - public function save_form(object $data) { + public function save_form(stdClass $data) { global $DB; if (!isset($data->strategyname) || ($data->strategyname != $this->name())) { @@ -370,7 +370,7 @@ class workshop_noerrors_strategy implements workshop_strategy { */ protected function prepare_form_fields(array $dims, array $maps) { - $formdata = new object(); + $formdata = new stdClass(); $key = 0; foreach ($dims as $dimension) { $formdata->{'dimensionid__idx_' . $key} = $dimension->id; // master id, not the local one! @@ -428,19 +428,19 @@ class workshop_noerrors_strategy implements workshop_strategy { protected function prepare_database_fields(stdClass $raw) { global $PAGE; - $cook = new object(); // to be returned + $cook = new stdClass(); // to be returned $cook->forms = array(); // to be stored in {workshop_forms} $cook->noerrors = array(); // to be stored in {workshop_forms_noerrors} $cook->mappings = array(); // to be stored in {workshop_forms_noerrors_map} for ($i = 0; $i < $raw->norepeats; $i++) { - $cook->forms[$i] = new object(); + $cook->forms[$i] = new stdClass(); $cook->forms[$i]->id = $raw->{'dimensionid__idx_'.$i}; $cook->forms[$i]->workshopid = $this->workshop->id; $cook->forms[$i]->sort = $i + 1; $cook->forms[$i]->strategy = 'noerrors'; - $cook->noerrors[$i] = new object(); + $cook->noerrors[$i] = new stdClass(); $cook->noerrors[$i]->description_editor = $raw->{'description__idx_'.$i.'_editor'}; $cook->noerrors[$i]->grade0 = $raw->{'grade0__idx_'.$i}; $cook->noerrors[$i]->grade1 = $raw->{'grade1__idx_'.$i}; @@ -449,7 +449,7 @@ class workshop_noerrors_strategy implements workshop_strategy { if (empty($raw->{'map__idx_'.$i})) { $cook->mappings[$i] = null; } else { - $cook->mappings[$i] = new object(); + $cook->mappings[$i] = new stdClass(); $cook->mappings[$i]->grade = $raw->{'map__idx_'.$i}; } } diff --git a/mod/workshop/lib.php b/mod/workshop/lib.php index 7e98cea2a7..ed4cbd9115 100644 --- a/mod/workshop/lib.php +++ b/mod/workshop/lib.php @@ -55,7 +55,7 @@ define('WORKSHOP_COMPARISON_VERYHIGH', 4); /* f = 5.00 */ * will save a new instance and return the id number * of the new instance. * - * @param object $data An object from the form in mod_form.php + * @param stdClass $data An object from the form in mod_form.php * @return int The id of the newly inserted workshop record */ function workshop_add_instance($data) { @@ -72,7 +72,7 @@ function workshop_add_instance($data) { * (defined by the form in mod_form.php) this function * will update an existing instance with new data. * - * @param object $workshop An object from the form in mod_form.php + * @param stdClass $workshop An object from the form in mod_form.php * @return boolean Success/Fail */ function workshop_update_instance($workshop) { @@ -121,7 +121,7 @@ function workshop_delete_instance($id) { * @todo Finish documenting this function */ function workshop_user_outline($course, $user, $mod, $workshop) { - $return = new object(); + $return = new stdClass(); $return->time = 0; $return->info = ''; return $return; @@ -271,9 +271,9 @@ function workshop_get_extra_capabilities() { * The file area workshop_intro for the activity introduction field is added automatically * by {@link file_browser::get_file_info_module()} * - * @param object $course - * @param object $cm - * @param object $context + * @param stdClass $course + * @param stdClass $cm + * @param stdClass $context * @return array of [(string)filearea] => (string)description */ function workshop_get_file_areas($course, $cm, $context) { @@ -295,9 +295,9 @@ function workshop_get_file_areas($course, $cm, $context) { * The access rights to the files are checked here. The user must be either a peer-reviewer * of the submission or have capability ... (todo) to access the submission files. * - * @param object $course - * @param object $cminfo - * @param object $context + * @param stdClass $course + * @param stdClass $cminfo + * @param stdClass $context * @param string $filearea * @param array $args * @param bool $forcedownload @@ -364,16 +364,16 @@ function workshop_pluginfile($course, $cminfo, $context, $filearea, $args, $forc /** * File browsing support for workshop file areas * - * @param object $browser - * @param object $areas - * @param object $course - * @param object $cm - * @param object $context + * @param stdClass $browser + * @param stdClass $areas + * @param stdClass $course + * @param stdClass $cm + * @param stdClass $context * @param string $filearea * @param int $itemid * @param string $filepath * @param string $filename - * @return object file_info instance or null if not found + * @return stdClass file_info instance or null if not found */ function workshop_get_file_info($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename) { global $CFG, $DB; @@ -542,7 +542,7 @@ function workshop_get_example_modes() { * Each object in the returned array provides information about the name of the level * and the value of the factor to be used in the calculation. * The structure of the returned array is - * array[code int] of object ( + * array[code int] of stdClass ( * ->name string, * ->value number, * ) @@ -553,23 +553,23 @@ function workshop_get_example_modes() { function workshop_get_comparison_levels() { $levels = array(); - $levels[WORKSHOP_COMPARISON_VERYHIGH] = new object(); + $levels[WORKSHOP_COMPARISON_VERYHIGH] = new stdClass(); $levels[WORKSHOP_COMPARISON_VERYHIGH]->name = get_string('comparisonveryhigh', 'workshop'); $levels[WORKSHOP_COMPARISON_VERYHIGH]->value = 5.00; - $levels[WORKSHOP_COMPARISON_HIGH] = new object(); + $levels[WORKSHOP_COMPARISON_HIGH] = new stdClass(); $levels[WORKSHOP_COMPARISON_HIGH]->name = get_string('comparisonhigh', 'workshop'); $levels[WORKSHOP_COMPARISON_HIGH]->value = 3.00; - $levels[WORKSHOP_COMPARISON_NORMAL] = new object(); + $levels[WORKSHOP_COMPARISON_NORMAL] = new stdClass(); $levels[WORKSHOP_COMPARISON_NORMAL]->name = get_string('comparisonnormal', 'workshop'); $levels[WORKSHOP_COMPARISON_NORMAL]->value = 2.50; - $levels[WORKSHOP_COMPARISON_LOW] = new object(); + $levels[WORKSHOP_COMPARISON_LOW] = new stdClass(); $levels[WORKSHOP_COMPARISON_LOW]->name = get_string('comparisonlow', 'workshop'); $levels[WORKSHOP_COMPARISON_LOW]->value = 1.67; - $levels[WORKSHOP_COMPARISON_VERYLOW] = new object(); + $levels[WORKSHOP_COMPARISON_VERYLOW] = new stdClass(); $levels[WORKSHOP_COMPARISON_VERYLOW]->name = get_string('comparisonverylow', 'workshop'); $levels[WORKSHOP_COMPARISON_VERYLOW]->value = 1.00; diff --git a/mod/workshop/locallib.php b/mod/workshop/locallib.php index 26aa32bb40..d9746eb31f 100644 --- a/mod/workshop/locallib.php +++ b/mod/workshop/locallib.php @@ -43,17 +43,17 @@ define('WORKSHOP_ALLOCATION_EXISTS', -1); // return status of {@link a */ class workshop { - /** @var object course module record */ + /** @var stdClass course module record */ public $cm = null; - /** @var object course record */ + /** @var stdClass course record */ public $course = null; /** grading strategy instance */ private $strategyinstance = null; /** - * Initializes the object using the data from DB + * Initializes the workshop API instance using the data from DB * * Makes deep copy of all passed records properties. Replaces integer $course attribute * with a full database record (course should not be stored in instances table anyway). @@ -81,7 +81,7 @@ class workshop { * The returned objects contain id, lastname and firstname properties and are ordered by lastname,firstname * * @param bool $musthavesubmission If true, return only users who have already submitted. All possible authors otherwise. - * @return array array[userid] => object{->id ->lastname ->firstname} + * @return array array[userid] => stdClass{->id ->lastname ->firstname} */ public function get_peer_authors($musthavesubmission=true) { global $DB; @@ -114,7 +114,7 @@ class workshop { * * @param bool $musthavesubmission If true, return only users who have already submitted. All possible users otherwise. * @see get_super_reviewers() - * @return array array[userid] => object{->id ->lastname ->firstname} + * @return array array[userid] => stdClass{->id ->lastname ->firstname} */ public function get_peer_reviewers($musthavesubmission=false) { global $DB; @@ -147,7 +147,7 @@ class workshop { * * @param bool $musthavesubmission If true, return only users who have already submitted. All possible users otherwise. * @see get_peer_reviewers() - * @return array array[userid] => object{->id ->lastname ->firstname} + * @return array array[userid] => stdClass{->id ->lastname ->firstname} */ public function get_super_reviewers() { global $DB; @@ -166,8 +166,8 @@ class workshop { * is set, returns only groups withing the course module grouping. Always returns group [0] with * all the given users. * - * @param array $users array[userid] => object{->id ->lastname ->firstname} - * @return array array[groupid][userid] => object{->id ->lastname ->firstname} + * @param array $users array[userid] => stdClass{->id ->lastname ->firstname} + * @return array array[groupid][userid] => stdClass{->id ->lastname ->firstname} */ public function get_grouped($users) { global $DB; @@ -211,7 +211,7 @@ class workshop { * * @param mixed $userid int|array|'all' If set to [array of] integer, return submission[s] of the given user[s] only * @param mixed $examples false|true|'all' Only regular submissions, only examples, all submissions - * @return object moodle_recordset + * @return stdClass moodle_recordset */ public function get_submissions_recordset($userid='all', $examples=false) { global $DB; @@ -250,7 +250,7 @@ class workshop { * include text fields (to prevent possible memory-lack issues). * * @param mixed $id integer|array author ID or IDs - * @return mixed false if not found, object if $id is int, array if $id is array + * @return mixed false if not found, stdClass if $id is int, array if $id is array */ public function get_submission_by_author($id) { if (empty($id)) { @@ -260,7 +260,7 @@ class workshop { if (is_array($id)) { $submissions = array(); foreach ($rs as $submission) { - $submissions[$submission->id] = new object(); + $submissions[$submission->id] = new stdClass(); foreach ($submission as $property => $value) { // we do not want text fields here to prevent possible memory issues if (in_array($property, array('id', 'workshopid', 'example', 'userid', 'authorlastname', 'authorfirstname', @@ -289,7 +289,7 @@ class workshop { * * @param mixed $reviewerid 'all'|int|array User ID of the reviewer * @param mixed $id 'all'|int Assessment ID - * @return object moodle_recordset + * @return stdClass moodle_recordset */ public function get_assessments_recordset($reviewerid='all', $id='all') { global $DB; @@ -335,7 +335,7 @@ class workshop { * * @param mixed $reviewerid 'all'|int|array User ID of the reviewer * @param mixed $id 'all'|int Assessment ID - * @return array [assessmentid] => assessment object + * @return array [assessmentid] => assessment stdClass * @see workshop::get_assessments_recordset() for the structure of returned objects */ public function get_assessments($reviewerid='all', $id='all') { @@ -344,7 +344,7 @@ class workshop { foreach ($rs as $assessment) { // copy selected properties into the array to be returned. This is here mainly in order not // to include text comments. - $assessments[$assessment->id] = new object(); + $assessments[$assessment->id] = new stdClass(); foreach ($assessment as $property => $value) { if (in_array($property, array('id', 'submissionid', 'userid', 'timecreated', 'timemodified', 'timeagreed', 'grade', 'gradinggrade', 'gradinggradeover', 'gradinggradeoverby', @@ -363,7 +363,7 @@ class workshop { * * @param int $id Assessment ID * @see workshop::get_assessments_recordset() for the structure of data returned - * @return mixed false if not found, object otherwise + * @return mixed false if not found, stdClass otherwise */ public function get_assessment_by_id($id) { $rs = $this->get_assessments_recordset('all', $id); @@ -412,7 +412,7 @@ class workshop { * Note that the returned recordset includes participants without submission as well as those * without any review allocated yet. * - * @return object moodle_recordset + * @return stdClass moodle_recordset */ public function get_allocations_recordset() { global $DB; @@ -443,12 +443,12 @@ class workshop { /** * Allocate a submission to a user for review * - * @param object $submission Submission record + * @param stdClass $submission Submission record * @param int $reviewerid User ID * @param bool $bulk repeated inserts into DB expected * @return int ID of the new assessment or an error code */ - public function add_allocation(object $submission, $reviewerid, $bulk=false) { + public function add_allocation(stdClass $submission, $reviewerid, $bulk=false) { global $DB; if ($DB->record_exists('workshop_assessments', array('submissionid' => $submission->id, 'userid' => $reviewerid))) { @@ -456,7 +456,7 @@ class workshop { } $now = time(); - $assessment = new object(); + $assessment = new stdClass(); $assessment->submissionid = $submission->id; $assessment->userid = $reviewerid; $assessment->timecreated = $now; @@ -486,7 +486,7 @@ class workshop { /** * Returns instance of grading strategy class * - * @return object Instance of a grading strategy + * @return stdClass Instance of a grading strategy */ public function grading_strategy_instance() { global $CFG; // because we require other libs here @@ -530,8 +530,8 @@ class workshop { /** * Returns instance of submissions allocator * - * @param object $method The name of the allocation method, must be PARAM_ALPHA - * @return object Instance of submissions allocator + * @param stdClass $method The name of the allocation method, must be PARAM_ALPHA + * @return stdClass Instance of submissions allocator */ public function allocator_instance($method) { global $CFG; // because we require other libs here @@ -547,7 +547,7 @@ class workshop { } /** - * @return object {@link moodle_url} the URL of this workshop's view page + * @return stdClass {@link moodle_url} the URL of this workshop's view page */ public function view_url() { global $CFG; @@ -555,7 +555,7 @@ class workshop { } /** - * @return object {@link moodle_url} the URL of the page for editing this workshop's grading form + * @return stdClass {@link moodle_url} the URL of the page for editing this workshop's grading form */ public function editform_url() { global $CFG; @@ -563,7 +563,7 @@ class workshop { } /** - * @return object {@link moodle_url} the URL of the page for previewing this workshop's grading form + * @return stdClass {@link moodle_url} the URL of the page for previewing this workshop's grading form */ public function previewform_url() { global $CFG; @@ -572,7 +572,7 @@ class workshop { /** * @param int $assessmentid The ID of assessment record - * @return object {@link moodle_url} the URL of the assessment page + * @return stdClass {@link moodle_url} the URL of the assessment page */ public function assess_url($assessmentid) { global $CFG; @@ -583,7 +583,7 @@ class workshop { * Returns an object containing all data to display the user's full name and picture * * @param int $id optional user id, defaults to the current user - * @return object containing properties lastname, firstname, picture and imagealt + * @return stdClass containing properties lastname, firstname, picture and imagealt */ public function user_info($id=null) { global $USER, $DB; diff --git a/mod/workshop/renderer.php b/mod/workshop/renderer.php index 3f9b3d2d22..6ee7ac3ea6 100644 --- a/mod/workshop/renderer.php +++ b/mod/workshop/renderer.php @@ -59,7 +59,7 @@ class moodle_mod_workshop_renderer extends moodle_renderer_base { * @param string $message to display * @return string html */ - public function status_message(object $message) { + public function status_message(stdClass $message) { if (empty($message->text)) { return ''; } @@ -86,7 +86,7 @@ class moodle_mod_workshop_renderer extends moodle_renderer_base { * @return string html to be echoed */ public function allocation_init_result($result='') { - $msg = new object(); + $msg = new stdClass(); if ($result === 'WORKSHOP_ALLOCATION_RANDOM_ERROR') { $msg = (object)array('text' => get_string('randomallocationerror', 'workshop'), 'sty' => 'error'); } else { @@ -142,7 +142,7 @@ class moodle_mod_workshop_renderer extends moodle_renderer_base { $userpic = $this->output->user_picture($userpic); $userurl = new moodle_url($CFG->wwwroot . '/user/view.php', array('id' => $author->id, 'course' => $this->page->course->id)); - $a = new object(); + $a = new stdClass(); $a->name = fullname($author); $a->url = $userurl->out(); $byfullname = get_string('byfullname', 'workshop', $a); diff --git a/mod/workshop/submission.php b/mod/workshop/submission.php index fb1780f622..e5f2f7bffa 100644 --- a/mod/workshop/submission.php +++ b/mod/workshop/submission.php @@ -48,7 +48,7 @@ if ($id) { // submission is specified $submission = $DB->get_record('workshop_submissions', array('id' => $id, 'workshopid' => $workshop->id), '*', MUST_EXIST); } else { // no submission specified if (!$submission = $workshop->get_submission_by_author($USER->id)) { - $submission = new object(); + $submission = new stdClass(); $submission->id = null; $submission->userid = $USER->id; } -- 2.39.5