Skip to content

Commit

Permalink
MDL-24321 switching to stdClass in /c*/
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Sep 21, 2010
1 parent e463f50 commit fbaea88
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion cohort/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
if ($context->contextlevel != CONTEXT_COURSECAT and $context->contextlevel != CONTEXT_SYSTEM) {
print_error('invalidcontext');
}
$cohort = new object();
$cohort = new stdClass();
$cohort->id = 0;
$cohort->contextid = $context->id;
$cohort->name = '';
Expand Down
2 changes: 1 addition & 1 deletion cohort/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function cohort_delete_category($category) {
*/
function cohort_add_member($cohortid, $userid) {
global $DB;
$record = new object();
$record = new stdClass();
$record->cohortid = $cohortid;
$record->userid = $userid;
$record->timeadded = time();
Expand Down
2 changes: 1 addition & 1 deletion comment/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ public function get_comments($page = '') {
$candelete = has_capability('moodle/comment:delete', $this->context);
$rs = $DB->get_recordset_sql($sql, $params, $start, $CFG->commentsperpage);
foreach ($rs as $u) {
$c = new object();
$c = new stdClass();
$c->id = $u->cid;
$c->content = $u->ccontent;
$c->format = $u->cformat;
Expand Down
4 changes: 2 additions & 2 deletions course/format/topics/format.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@

$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
$summarytext = file_rewrite_pluginfile_urls($thissection->summary, 'pluginfile.php', $coursecontext->id, 'course', 'section', $thissection->id);
$summaryformatoptions = new object();
$summaryformatoptions = new stdClass();
$summaryformatoptions->noclean = true;
echo format_text($summarytext, $thissection->summaryformat, $summaryformatoptions);

Expand Down Expand Up @@ -225,7 +225,7 @@
if ($thissection->summary) {
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
$summarytext = file_rewrite_pluginfile_urls($thissection->summary, 'pluginfile.php', $coursecontext->id, 'course', 'section', $thissection->id);
$summaryformatoptions = new object();
$summaryformatoptions = new stdClass();
$summaryformatoptions->noclean = true;
echo format_text($summarytext, $thissection->summaryformat, $summaryformatoptions);
} else {
Expand Down
4 changes: 2 additions & 2 deletions course/format/weeks/format.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@

$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
$summarytext = file_rewrite_pluginfile_urls($thissection->summary, 'pluginfile.php', $coursecontext->id, 'course', 'section', $thissection->id);
$summaryformatoptions = new object();
$summaryformatoptions = new stdClass();
$summaryformatoptions->noclean = true;
echo format_text($summarytext, $thissection->summaryformat, $summaryformatoptions);

Expand Down Expand Up @@ -227,7 +227,7 @@
echo '<div class="summary">';
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
$summarytext = file_rewrite_pluginfile_urls($thissection->summary, 'pluginfile.php', $coursecontext->id, 'course', 'section', $thissection->id);
$summaryformatoptions = new object();
$summaryformatoptions = new stdClass();
$summaryformatoptions->noclean = true;
echo format_text($summarytext, $thissection->summaryformat, $summaryformatoptions);

Expand Down
2 changes: 1 addition & 1 deletion course/import/groups/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@

while (!feof ($fp)) {

$newgroup = new object();//to make Martin happy
$newgroup = new stdClass();//to make Martin happy
foreach ($optionalDefaults as $key => $value) {
$newgroup->$key = current_language(); //defaults to current language
}
Expand Down
2 changes: 1 addition & 1 deletion course/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
/// Create a default category if necessary
if (!$categories = get_categories()) { /// No category yet!
// Try and make one
$tempcat = new object();
$tempcat = new stdClass();
$tempcat->name = get_string('miscellaneous');
$tempcat->id = $DB->insert_record('course_categories', $tempcat);
$tempcat->context = get_context_instance(CONTEXT_COURSECAT, $tempcat->id);
Expand Down
14 changes: 7 additions & 7 deletions course/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,7 @@ function course_set_display($courseid, $display=0) {
} else if ($DB->record_exists("course_display", array("userid" => $USER->id, "course"=>$courseid))) {
$DB->set_field("course_display", "display", $display, array("userid"=>$USER->id, "course"=>$courseid));
} else {
$record = new object();
$record = new stdClass();
$record->userid = $USER->id;
$record->course = $courseid;
$record->display = $display;
Expand Down Expand Up @@ -1270,7 +1270,7 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
$initialised = true;
}

$labelformatoptions = new object();
$labelformatoptions = new stdClass();
$labelformatoptions->noclean = true;

/// Casting $course->modinfo to string prevents one notice when the field is null
Expand Down Expand Up @@ -2514,7 +2514,7 @@ function get_course_section($section, $courseid) {
if ($cw = $DB->get_record("course_sections", array("section"=>$section, "course"=>$courseid))) {
return $cw;
}
$cw = new object();
$cw = new stdClass();
$cw->course = $courseid;
$cw->section = $section;
$cw->summary = "";
Expand Down Expand Up @@ -3062,7 +3062,7 @@ function update_restricted_mods($course, $mods) {
if ($mod == 0) {
continue; // this is the 'allow none' option
}
$am = new object();
$am = new stdClass();
$am->course = $course->id;
$am->module = $mod;
$DB->insert_record('course_allowed_modules',$am);
Expand Down Expand Up @@ -3519,7 +3519,7 @@ function create_course($data, $editoroptions = NULL) {
// Setup the blocks
blocks_add_default_course_blocks($course);

$section = new object();
$section = new stdClass();
$section->course = $course->id; // Create a default section.
$section->section = 0;
$section->summaryformat = FORMAT_HTML;
Expand Down Expand Up @@ -3920,7 +3920,7 @@ public function approve() {

$this->delete();

$a = new object();
$a = new stdClass();
$a->name = $course->fullname;
$a->url = $CFG->wwwroot.'/course/view.php?id=' . $course->id;
$this->notify($user, $USER, 'courserequestapproved', get_string('courseapprovedsubject'), get_string('courseapprovedemail2', 'moodle', $a));
Expand Down Expand Up @@ -3961,7 +3961,7 @@ public function delete() {
* @param string $message
*/
protected function notify($touser, $fromuser, $name='courserequested', $subject, $message) {
$eventdata = new object();
$eventdata = new stdClass();
$eventdata->modulename = 'moodle';
$eventdata->component = 'course';
$eventdata->name = $name;
Expand Down
2 changes: 1 addition & 1 deletion course/mod.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
}

// Trigger a mod_deleted event with information about this module.
$eventdata = new object();
$eventdata = new stdClass();
$eventdata->modulename = $cm->modname;
$eventdata->cmid = $cm->id;
$eventdata->courseid = $course->id;
Expand Down
12 changes: 6 additions & 6 deletions course/modedit.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

$cm = null;

$data = new object();
$data = new stdClass();
$data->section = $section; // The section number itself - relative!!! (section column in course_sections)
$data->visible = $cw->visible;
$data->course = $course->id;
Expand Down Expand Up @@ -92,7 +92,7 @@
$fullmodulename = get_string('modulename', $module->name);

if ($data->section && $course->format != 'site') {
$heading = new object();
$heading = new stdClass();
$heading->what = $fullmodulename;
$heading->to = $sectionname;
$pageheading = get_string('addinganewto', 'moodle', $heading);
Expand Down Expand Up @@ -177,7 +177,7 @@
$fullmodulename = get_string('modulename', $module->name);

if ($data->section && $course->format != 'site') {
$heading = new object();
$heading = new stdClass();
$heading->what = $fullmodulename;
$heading->in = $sectionname;
$pageheading = get_string('updatingain', 'moodle', $heading);
Expand Down Expand Up @@ -341,7 +341,7 @@
}

// Trigger mod_updated event with information about this module.
$eventdata = new object();
$eventdata = new stdClass();
$eventdata->modulename = $fromform->modulename;
$eventdata->name = $fromform->name;
$eventdata->cmid = $fromform->coursemodule;
Expand All @@ -367,7 +367,7 @@
}

// first add course_module record because we need the context
$newcm = new object();
$newcm = new stdClass();
$newcm->course = $course->id;
$newcm->module = $fromform->module;
$newcm->instance = 0; // not known yet, will be updated later (this is similar to restore code)
Expand Down Expand Up @@ -453,7 +453,7 @@
}

// Trigger mod_created event with information about this module.
$eventdata = new object();
$eventdata = new stdClass();
$eventdata->modulename = $fromform->modulename;
$eventdata->name = $fromform->name;
$eventdata->cmid = $fromform->coursemodule;
Expand Down
2 changes: 1 addition & 1 deletion course/moodleform_mod.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function moodleform_mod($current, $section, $cm, $course) {
protected function init_features() {
global $CFG;

$this->_features = new object();
$this->_features = new stdClass();
$this->_features->groups = plugin_supports('mod', $this->_modname, FEATURE_GROUPS, true);
$this->_features->groupings = plugin_supports('mod', $this->_modname, FEATURE_GROUPINGS, false);
$this->_features->groupmembersonly = (!empty($CFG->enablegroupmembersonly) and plugin_supports('mod', $this->_modname, FEATURE_GROUPMEMBERSONLY, false));
Expand Down
6 changes: 3 additions & 3 deletions course/recent.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
}
}

$param = new object();
$param = new stdClass();
$param->user = 0;
$param->modid = 'all';
$param->group = 0;
Expand Down Expand Up @@ -130,7 +130,7 @@

foreach ($sections as $section) {

$activity = new object();
$activity = new stdClass();
$activity->type = 'section';
if ($section->section > 0) {
$activity->name = get_section_name($course, $section);
Expand Down Expand Up @@ -169,7 +169,7 @@
$get_recent_mod_activity = $cm->modname."_get_recent_mod_activity";

if (function_exists($get_recent_mod_activity)) {
$activity = new object();
$activity = new stdClass();
$activity->type = 'activity';
$activity->cmid = $cmid;
$activities[$index++] = $activity;
Expand Down
2 changes: 1 addition & 1 deletion course/report/completion/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ function csv_quote($value) {

$describe = get_string('completion-alt-auto-'.$completiontype, 'completion');

$a = new Object();
$a = new stdClass();
$a->state = $describe;
$a->date = $is_complete ? userdate($criteria_completion->timecompleted) : '';
$a->user = fullname($user);
Expand Down
6 changes: 3 additions & 3 deletions course/report/log/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ function print_mnet_log_selector_form($hostid, $course, $selecteduser=0, $select
$courses[$course->id] = $course->fullname . ((empty($course->category)) ? ' ('.get_string('site').') ' : '');
echo html_writer::select($courses,"id",$course->id, false);
if (has_capability('coursereport/log:view', $sitecontext)) {
$a = new object();
$a = new stdClass();
$a->url = "$CFG->wwwroot/course/report/log/index.php?chooselog=0&group=$selectedgroup&user=$selecteduser"
."&id=$course->id&date=$selecteddate&modid=$selectedactivity&showcourses=1&showusers=$showusers";
print_string('logtoomanycourses','moodle',$a);
Expand Down Expand Up @@ -470,7 +470,7 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate='today'
$courses[$course->id] = $course->fullname . (($course->id == SITEID) ? ' ('.get_string('site').') ' : '');
echo html_writer::select($courses,"id",$course->id, false);
if (has_capability('coursereport/log:view', $sitecontext)) {
$a = new object();
$a = new stdClass();
$a->url = "$CFG->wwwroot/course/report/log/index.php?chooselog=0&group=$selectedgroup&user=$selecteduser"
."&id=$course->id&date=$selecteddate&modid=$selectedactivity&showcourses=1&showusers=$showusers";
print_string('logtoomanycourses','moodle',$a);
Expand Down Expand Up @@ -502,7 +502,7 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate='today'
$users[0] = get_string('allparticipants');
}
echo html_writer::select($users, "user", $selecteduser, false);
$a = new object();
$a = new stdClass();
$a->url = "$CFG->wwwroot/course/report/log/index.php?chooselog=0&group=$selectedgroup&user=$selecteduser"
."&id=$course->id&date=$selecteddate&modid=$selectedactivity&showusers=1&showcourses=$showcourses";
print_string('logtoomanyusers','moodle',$a);
Expand Down
2 changes: 1 addition & 1 deletion course/rest.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
case 'course':
switch($field) {
case 'marker':
$newcourse = new object;
$newcourse = new stdClass();
$newcourse->id = $course->id;
$newcourse->marker = $value;
$DB->update_record('course', $newcourse);
Expand Down

0 comments on commit fbaea88

Please sign in to comment.