workshop coding style - use stdclass instead of stdClass

This commit is contained in:
David Mudrak
2010-01-04 18:30:57 +00:00
parent a8b6fc0e70
commit 7a789aa8cc
27 changed files with 300 additions and 300 deletions
+1 -1
View File
@@ -55,7 +55,7 @@ interface workshop_allocator {
*
* If a form is part of the UI, the caller should have called $PAGE->set_url(...)
*
* @param stdClass $wsoutput workshop module renderer can be used
* @param stdclass $wsoutput workshop module renderer can be used
* @return string HTML code to be echoed
*/
public function ui();
+6 -6
View File
@@ -136,7 +136,7 @@ class workshop_manual_allocator implements workshop_allocator {
$hlauthorid = -1; // highlight this author
$hlreviewerid = -1; // highlight this reviewer
$msg = new stdClass(); // message to render
$msg = new stdclass(); // message to render
$m = optional_param('m', '', PARAM_ALPHANUMEXT); // message code
if ($m) {
@@ -214,7 +214,7 @@ class workshop_manual_allocator implements workshop_allocator {
$submissions = $this->workshop->get_submissions(array_keys($participants));
foreach ($submissions as $submission) {
if (!isset($userinfo[$submission->authorid])) {
$userinfo[$submission->authorid] = new stdClass();
$userinfo[$submission->authorid] = new stdclass();
$userinfo[$submission->authorid]->id = $submission->authorid;
$userinfo[$submission->authorid]->firstname = $submission->authorfirstname;
$userinfo[$submission->authorid]->lastname = $submission->authorlastname;
@@ -237,7 +237,7 @@ class workshop_manual_allocator implements workshop_allocator {
$reviewers = $DB->get_records_sql($sql, $params);
foreach ($reviewers as $reviewer) {
if (!isset($userinfo[$reviewer->reviewerid])) {
$userinfo[$reviewer->reviewerid] = new stdClass();
$userinfo[$reviewer->reviewerid] = new stdclass();
$userinfo[$reviewer->reviewerid]->id = $reviewer->reviewerid;
$userinfo[$reviewer->reviewerid]->firstname = $reviewer->firstname;
$userinfo[$reviewer->reviewerid]->lastname = $reviewer->lastname;
@@ -264,7 +264,7 @@ class workshop_manual_allocator implements workshop_allocator {
$reviewees = $DB->get_records_sql($sql, $params);
foreach ($reviewees as $reviewee) {
if (!isset($userinfo[$reviewee->revieweeid])) {
$userinfo[$reviewee->revieweeid] = new stdClass();
$userinfo[$reviewee->revieweeid] = new stdclass();
$userinfo[$reviewee->revieweeid]->id = $reviewee->revieweeid;
$userinfo[$reviewee->revieweeid]->firstname = $reviewee->firstname;
$userinfo[$reviewee->revieweeid]->lastname = $reviewee->lastname;
@@ -278,7 +278,7 @@ class workshop_manual_allocator implements workshop_allocator {
$allocations = array();
foreach ($participants as $participant) {
$allocations[$participant->id] = new stdClass;
$allocations[$participant->id] = new stdclass;
$allocations[$participant->id]->userid = $participant->id;
$allocations[$participant->id]->submissionid = null;
$allocations[$participant->id]->reviewedby = array();
@@ -302,7 +302,7 @@ class workshop_manual_allocator implements workshop_allocator {
unset($reviewees);
// prepare data to be displayed
$data = new stdClass();
$data = new stdclass();
$data->allocations = $allocations;
$data->userinfo = $userinfo;
$data->authors = $this->workshop->get_potential_authors();
+5 -5
View File
@@ -33,10 +33,10 @@ class workshopallocation_manual_renderer extends plugin_renderer_base {
/**
* Display the table of all current allocations and widgets to modify them
*
* @param stdClass $data to be displayed - see the top of the function for the list of needed properties
* @param stdclass $data to be displayed - see the top of the function for the list of needed properties
* @return string html code
*/
public function display_allocations(stdClass $data) {
public function display_allocations(stdclass $data) {
$allocations = $data->allocations; // array prepared array of all allocations data
$userinfo = $data->userinfo; // names and pictures of all required users
$authors = $data->authors; // array potential reviewees
@@ -85,7 +85,7 @@ class workshopallocation_manual_renderer extends plugin_renderer_base {
*
* @return string HTML code
*/
protected function participant(stdClass $allocation, array $userinfo) {
protected function participant(stdclass $allocation, array $userinfo) {
$o = $this->output->user_picture($userinfo[$allocation->userid], $this->page->course->id);
$o .= fullname($userinfo[$allocation->userid]);
$o .= $this->output->container_start(array('submission'));
@@ -108,7 +108,7 @@ class workshopallocation_manual_renderer extends plugin_renderer_base {
*
* @return string html code
*/
protected function reviewers_of_participant(stdClass $allocation, array $userinfo, array $reviewers, $selfassessment) {
protected function reviewers_of_participant(stdclass $allocation, array $userinfo, array $reviewers, $selfassessment) {
$o = '';
if (is_null($allocation->submissionid)) {
$o .= $this->output->container(get_string('nothingtoreview', 'workshop'), 'info');
@@ -154,7 +154,7 @@ class workshopallocation_manual_renderer extends plugin_renderer_base {
*
* @return string html code
*/
protected function reviewees_of_participant(stdClass $allocation, array $userinfo, array $authors, $selfassessment) {
protected function reviewees_of_participant(stdclass $allocation, array $userinfo, array $authors, $selfassessment) {
$o = '';
if (is_null($allocation->submissionid)) {
$o .= $this->output->container(get_string('withoutsubmission', 'workshop'), 'info');
+3 -3
View File
@@ -116,7 +116,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 stdClass();
$a = new stdclass();
$a->reviewername = fullname($reviewers[0][$reviewerid]);
$a->authorname = fullname($authors[0][$authorid]);
$o[] = 'ok::indent::' . get_string('allocationaddeddetail', 'workshopallocation_random', $a);
@@ -128,7 +128,7 @@ class workshop_random_allocator implements workshop_allocator {
// by reviewer
$o[] = 'info::' . get_string('numofdeallocatedassessment', 'workshopallocation_random', count($delassessments));
foreach ($delassessments as $delassessmentkey => $delassessmentid) {
$a = new stdClass();
$a = new stdclass();
$a->authorname = fullname((object)array(
'lastname' => $assessments[$delassessmentid]->authorlastname,
'firstname' => $assessments[$delassessmentid]->authorfirstname));
@@ -159,7 +159,7 @@ class workshop_random_allocator implements workshop_allocator {
global $OUTPUT, $PAGE;
$m = optional_param('m', null, PARAM_INT); // status message code
$msg = new stdClass();
$msg = new stdclass();
if ($m == self::MSG_SUCCESS) {
$msg = (object)array('text' => get_string('randomallocationdone', 'workshopallocation_random'), 'sty' => 'ok');
}
@@ -68,9 +68,9 @@ class workshop_allocation_random_test extends UnitTestCase {
protected $allocator;
public function setUp() {
$cm = new stdClass();
$course = new stdClass();
$context = new stdClass();
$cm = new stdclass();
$course = new stdclass();
$context = new stdclass();
$workshop = (object)array('id' => 42);
$this->workshop = new workshop($workshop, $cm, $course, $context);
$this->allocator = new testable_workshop_random_allocator($this->workshop);
@@ -88,8 +88,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 stdClass()));
$reviewers = array(0 => array_fill_keys(array(4, 6, 10), new stdClass()));
$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
@@ -98,8 +98,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 stdClass()));
$reviewers = array(0 => array_fill_keys(array(4, 7, 10), new stdClass()));
$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
@@ -108,8 +108,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 stdClass()));
$reviewers = array(0 => array_fill_keys(array(3, 4, 10), new stdClass()));
$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);