Skip to content

Commit

Permalink
MDL-24321 switching to stdClass in /g*/
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Sep 21, 2010
1 parent 8be3250 commit ace9051
Show file tree
Hide file tree
Showing 19 changed files with 44 additions and 44 deletions.
4 changes: 2 additions & 2 deletions grade/edit/letter/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
} else { //else we're editing
require_once('edit_form.php');

$data = new object();
$data = new stdClass();
$data->id = $context->id;

$i = 1;
Expand Down Expand Up @@ -158,7 +158,7 @@
}

foreach($letters as $boundary=>$letter) {
$record = new object();
$record = new stdClass();
$record->letter = $letter;
$record->lowerboundary = $boundary;
$record->contextid = $context->id;
Expand Down
6 changes: 3 additions & 3 deletions grade/edit/outcome/course.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
foreach($co_custom as $oid=>$outcome) {
if (!in_array($oid, $courseused)) {
$courseused[$oid] = $oid;
$goc = new object();
$goc = new stdClass();
$goc->courseid = $courseid;
$goc->outcomeid = $oid;
$DB->insert_record('grade_outcomes_courses', $goc);
Expand All @@ -78,7 +78,7 @@

if (!in_array($oid, $courseused)) {
$courseused[$oid] = $oid;
$goc = new object();
$goc = new stdClass();
$goc->courseid = $courseid;
$goc->outcomeid = $oid;
$DB->insert_record('grade_outcomes_courses', $goc);
Expand Down Expand Up @@ -106,7 +106,7 @@
if (!array_key_exists($add, $standardoutcomes)) {
continue;
}
$goc = new object();
$goc = new stdClass();
$goc->courseid = $courseid;
$goc->outcomeid = $add;
$DB->insert_record('grade_outcomes_courses', $goc);
Expand Down
4 changes: 2 additions & 2 deletions grade/edit/outcome/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@
require_capability('moodle/grade:manage', $context);
navigation_node::override_active_url(new moodle_url('/grade/edit/outcome/course.php', array('id'=>$courseid)));

$outcome_rec = new object();
$outcome_rec = new stdClass();
$outcome_rec->standard = 0;
$outcome_rec->courseid = $courseid;
} else {
require_login();
require_capability('moodle/grade:manage', $systemcontext);

/// adding new outcome from admin section
$outcome_rec = new object();
$outcome_rec = new stdClass();
$outcome_rec->standard = 1;
$outcome_rec->courseid = 0;
}
Expand Down
4 changes: 2 additions & 2 deletions grade/edit/scale/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
if (!$course = $DB->get_record('course', array('id' => $courseid))) {
print_error('nocourseid');
}
$scale_rec = new object();
$scale_rec = new stdClass();
$scale_rec->standard = 0;
$scale_rec->courseid = $courseid;
require_login($course);
Expand All @@ -73,7 +73,7 @@

} else {
/// adding new scale from admin section
$scale_rec = new object();
$scale_rec = new stdClass();
$scale_rec->standard = 1;
$scale_rec->courseid = 0;
require_login();
Expand Down
2 changes: 1 addition & 1 deletion grade/edit/tree/grade.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
if (empty($grade->feedback)) {
$grade->feedback = '';
} else {
$options = new object();
$options = new stdClass();
$options->smiley = false;
$options->filter = false;
$options->noclean = false;
Expand Down
2 changes: 1 addition & 1 deletion grade/edit/tree/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
print_error('invalidcategoryid');
}

$data = new object();
$data = new stdClass();
$data->aggregation = $aggregationtype;
grade_category::set_properties($grade_category, $data);
$grade_category->update();
Expand Down
4 changes: 2 additions & 2 deletions grade/export/key.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
if (!$course = $DB->get_record('course', array('id'=>$courseid))) {
print_error('invalidcourseid');
}
$key = new object();
$key = new stdClass();
}

$key->courseid = $course->id;
Expand Down Expand Up @@ -98,7 +98,7 @@
} elseif ($data = $editform->get_data()) {

if ($data->id) {
$record = new object();
$record = new stdClass();
$record->id = $data->id;
$record->iprestriction = $data->iprestriction;
$record->validuntil = $data->validuntil;
Expand Down
8 changes: 4 additions & 4 deletions grade/import/csv/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@

if (empty($newgradeitems[$key])) {

$newgradeitem = new object();
$newgradeitem = new stdClass();
$newgradeitem->itemname = $header[$key];
$newgradeitem->importcode = $importcode;
$newgradeitem->importer = $USER->id;
Expand All @@ -314,7 +314,7 @@
// add this to grade_import_newitem table
// add the new id to $newgradeitem[$key]
}
$newgrade = new object();
$newgrade = new stdClass();
$newgrade->newgradeitem = $newgradeitems[$key];
$newgrade->finalgrade = $value;
$newgrades[] = $newgrade;
Expand All @@ -336,7 +336,7 @@
}

// t1 is the id of the grade item
$feedback = new object();
$feedback = new stdClass();
$feedback->itemid = $t1;
$feedback->feedback = $value;
$newfeedbacks[] = $feedback;
Expand Down Expand Up @@ -364,7 +364,7 @@
break 3;
}

$newgrade = new object();
$newgrade = new stdClass();
$newgrade->itemid = $gradeitem->id;
if ($gradeitem->gradetype == GRADE_TYPE_SCALE and $verbosescales) {
if ($value === '' or $value == '-') {
Expand Down
4 changes: 2 additions & 2 deletions grade/import/key.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
if (!$course = $DB->get_record('course', array('id' => $courseid))) {
print_error('invalidcourseid');
}
$key = new object();
$key = new stdClass();
}

$key->courseid = $course->id;
Expand Down Expand Up @@ -98,7 +98,7 @@
} elseif ($data = $editform->get_data()) {

if ($data->id) {
$record = new object();
$record = new stdClass();
$record->id = $data->id;
$record->iprestriction = $data->iprestriction;
$record->validuntil = $data->validuntil;
Expand Down
2 changes: 1 addition & 1 deletion grade/import/xml/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function import_xml_grades($text, $course, &$error) {
}
}

$newgrade = new object();
$newgrade = new stdClass();
$newgrade->itemid = $grade_item->id;
$newgrade->userid = $user->id;
$newgrade->importcode = $importcode;
Expand Down
4 changes: 2 additions & 2 deletions grade/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ function next_user() {
}
}

$result = new object();
$result = new stdClass();
$result->user = $user;
$result->grades = $grades;
$result->feedbacks = $feedbacks;
Expand Down Expand Up @@ -1096,7 +1096,7 @@ public function get_element_header(&$element, $withlink=false, $icon=true, $spac
if ($withlink and $itemtype=='mod' and $iteminstance and $itemmodule) {
if ($cm = get_coursemodule_from_instance($itemmodule, $iteminstance, $this->courseid)) {

$a = new object();
$a = new stdClass();
$a->name = get_string('modulename', $element['object']->itemmodule);
$title = get_string('linktoactivity', 'grades', $a);
$dir = $CFG->dirroot.'/mod/'.$itemmodule;
Expand Down
12 changes: 6 additions & 6 deletions grade/querylib.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function grade_get_course_grades($courseid, $userid_or_ids=null) {
grade_regrade_final_grades($courseid);
}

$item = new object();
$item = new stdClass();
$item->scaleid = $grade_item->scaleid;
$item->name = $grade_item->get_name();
$item->grademin = $grade_item->grademin;
Expand Down Expand Up @@ -71,7 +71,7 @@ function grade_get_course_grades($courseid, $userid_or_ids=null) {
foreach ($userids as $userid) {
$grade_grades[$userid]->grade_item =& $grade_item;

$grade = new object();
$grade = new stdClass();
$grade->grade = $grade_grades[$userid]->finalgrade;
$grade->locked = $grade_grades[$userid]->is_locked();
$grade->hidden = $grade_grades[$userid]->is_hidden();
Expand All @@ -96,7 +96,7 @@ function grade_get_course_grades($courseid, $userid_or_ids=null) {
if ($grade_item->gradetype == GRADE_TYPE_SCALE or $grade_item->get_displaytype() != GRADE_DISPLAY_TYPE_REAL) {
$grade->str_long_grade = $grade->str_grade;
} else {
$a = new object();
$a = new stdClass();
$a->grade = $grade->str_grade;
$a->max = grade_format_gradevalue($grade_item->grademax, $grade_item);
$grade->str_long_grade = get_string('gradelong', 'grades', $a);
Expand Down Expand Up @@ -157,7 +157,7 @@ function grade_get_course_grade($userid, $courseid_or_ids=null) {
grade_regrade_final_grades($courseid);
}

$item = new object();
$item = new stdClass();
$item->scaleid = $grade_item->scaleid;
$item->name = $grade_item->get_name();
$item->grademin = $grade_item->grademin;
Expand All @@ -184,7 +184,7 @@ function grade_get_course_grade($userid, $courseid_or_ids=null) {
$grade_grade = new grade_grade(array('userid'=>$userid, 'itemid'=>$grade_item->id));
$grade_grade->grade_item =& $grade_item;

$grade = new object();
$grade = new stdClass();
$grade->grade = $grade_grade->finalgrade;
$grade->locked = $grade_grade->is_locked();
$grade->hidden = $grade_grade->is_hidden();
Expand All @@ -210,7 +210,7 @@ function grade_get_course_grade($userid, $courseid_or_ids=null) {
if ($grade_item->gradetype == GRADE_TYPE_SCALE or $grade_item->get_displaytype() != GRADE_DISPLAY_TYPE_REAL) {
$grade->str_long_grade = $grade->str_grade;
} else {
$a = new object();
$a = new stdClass();
$a->grade = $grade->str_grade;
$a->max = grade_format_gradevalue($grade_item->grademax, $grade_item);
$grade->str_long_grade = get_string('gradelong', 'grades', $a);
Expand Down
2 changes: 1 addition & 1 deletion grade/report/grader/ajax_callbacks.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@

if ($errorstr) {
$user = $DB->get_record('user', array('id' => $userid), 'id, firstname, lastname');
$gradestr = new object();
$gradestr = new stdClass();
$gradestr->username = fullname($user);
$gradestr->itemname = $grade_item->get_name();
$json_object->message = get_string($errorstr, 'grades', $gradestr);
Expand Down
4 changes: 2 additions & 2 deletions grade/report/grader/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public function process_data($data) {
}
if ($errorstr) {
$user = $DB->get_record('user', array('id' => $userid), 'id, firstname, lastname');
$gradestr = new object();
$gradestr = new stdClass();
$gradestr->username = fullname($user);
$gradestr->itemname = $gradeitem->get_name();
$warnings[] = get_string($errorstr, 'grades', $gradestr);
Expand Down Expand Up @@ -617,7 +617,7 @@ public function get_left_rows() {
$userreportcell = new html_table_cell();
$userreportcell->attributes['class'] = 'userreport';
$userreportcell->header = true;
$a = new object();
$a = new stdClass();
$a->user = fullname($user);
$strgradesforuser = get_string('gradesforuser', 'grades', $a);
$url = new moodle_url('/grade/report/'.$CFG->grade_profilereport.'/index.php', array('userid' => $user->id, 'id' => $this->course->id));
Expand Down
4 changes: 2 additions & 2 deletions group/autogroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
if (!empty($data->grouping)) {
$groupingname = trim($data->groupingname);
if ($data->grouping < 0) {
$grouping = new object();
$grouping = new stdClass();
$grouping->courseid = $COURSE->id;
$grouping->name = $groupingname;
$grouping->id = groups_create_grouping($grouping);
Expand All @@ -191,7 +191,7 @@
$failed = true;
break;
}
$newgroup = new object();
$newgroup = new stdClass();
$newgroup->courseid = $data->courseid;
$newgroup->name = $group['name'];
$groupid = groups_create_group($newgroup);
Expand Down
2 changes: 1 addition & 1 deletion group/group.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
if (!$course = $DB->get_record('course', array('id'=>$courseid))) {
print_error('invalidcourseid');
}
$group = new object();
$group = new stdClass();
$group->courseid = $course->id;
}

Expand Down
2 changes: 1 addition & 1 deletion group/grouping.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
if (!$course = $DB->get_record('course', array('id'=>$courseid))) {
print_error('invalidcourseid');
}
$grouping = new object();
$grouping = new stdClass();
$grouping->courseid = $course->id;
}

Expand Down
16 changes: 8 additions & 8 deletions group/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function groups_add_member($grouporid, $userorid) {
return true;
}

$member = new object();
$member = new stdClass();
$member->groupid = $groupid;
$member->userid = $userid;
$member->timeadded = time();
Expand All @@ -59,7 +59,7 @@ function groups_add_member($grouporid, $userorid) {
$DB->set_field('groups', 'timemodified', $member->timeadded, array('id'=>$groupid));

//trigger groups events
$eventdata = new object();
$eventdata = new stdClass();
$eventdata->groupid = $groupid;
$eventdata->userid = $userid;
events_trigger('groups_member_added', $eventdata);
Expand Down Expand Up @@ -102,7 +102,7 @@ function groups_remove_member($grouporid, $userorid) {
$DB->set_field('groups', 'timemodified', time(), array('id'=>$groupid));

//trigger groups events
$eventdata = new object();
$eventdata = new stdClass();
$eventdata->groupid = $groupid;
$eventdata->userid = $userid;
events_trigger('groups_member_removed', $eventdata);
Expand Down Expand Up @@ -137,7 +137,7 @@ function groups_create_group($data, $editform = false, $editoroptions = false) {
if ($editform and $editoroptions) {
// Update description from editor with fixed files
$data = file_postupdate_standard_editor($data, 'description', $editoroptions, $context, 'group', 'description', $data->id);
$upd = new object();
$upd = new stdClass();
$upd->id = $data->id;
$upd->description = $data->description;
$upd->descriptionformat = $data->descriptionformat;
Expand Down Expand Up @@ -383,7 +383,7 @@ function groups_delete_group_members($courseid, $userid=0, $showfeedback=false)
$DB->delete_records_select('groups_members', "groupid IN ($groupssql) $usersql", $params);

//trigger groups events
$eventdata = new object();
$eventdata = new stdClass();
$eventdata->courseid = $courseid;
$eventdata->userid = $userid;
events_trigger('groups_members_removed', $eventdata);
Expand Down Expand Up @@ -590,7 +590,7 @@ function groups_assign_grouping($groupingid, $groupid) {
if ($DB->record_exists('groupings_groups', array('groupingid'=>$groupingid, 'groupid'=>$groupid))) {
return true;
}
$assign = new object();
$assign = new stdClass();
$assign->groupingid = $groupingid;
$assign->groupid = $groupid;
$assign->timeadded = time();
Expand Down Expand Up @@ -702,7 +702,7 @@ function groups_calculate_role_people($rs, $context) {
if (!is_null($rec->roleid)) {
// Create information about role if this is a new one
if (!array_key_exists($rec->roleid,$roles)) {
$roledata = new object();
$roledata = new stdClass();
$roledata->id = $rec->roleid;
$roledata->shortname = $rec->roleshortname;
if (array_key_exists($rec->roleid, $aliasnames)) {
Expand All @@ -725,7 +725,7 @@ function groups_calculate_role_people($rs, $context) {
}

// Add pseudo-role for multiple roles
$roledata = new object();
$roledata = new stdClass();
$roledata->name = get_string('multipleroles','role');
$roledata->users = array();
$roles['*'] = $roledata;
Expand Down
2 changes: 1 addition & 1 deletion group/overview.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@

if ($rs = $DB->get_recordset_sql($sql, $params)) {
foreach ($rs as $row) {
$user = new object();
$user = new stdClass();
$user->id = $row->userid;
$user->firstname = $row->firstname;
$user->lastname = $row->lastname;
Expand Down

0 comments on commit ace9051

Please sign in to comment.