MDL-24321 switching to stdClass in /c*/

This commit is contained in:
Petr Skoda 2010-09-21 08:13:11 +00:00
parent e463f508cb
commit fbaea88faa
15 changed files with 32 additions and 32 deletions

View File

@ -46,7 +46,7 @@ if ($id) {
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 = '';

View File

@ -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();

View File

@ -412,7 +412,7 @@ EOD;
$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;

View File

@ -103,7 +103,7 @@ if ($thissection->summary or $thissection->sequence or $PAGE->user_is_editing())
$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);
@ -225,7 +225,7 @@ while ($section <= $course->numsections) {
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 {

View File

@ -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);
@ -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);

View File

@ -128,7 +128,7 @@ die;
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
}

View File

@ -171,7 +171,7 @@ if (!empty($delete) and confirm_sesskey()) {
/// 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);

View File

@ -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;
@ -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
@ -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 = "";
@ -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);
@ -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;
@ -3920,7 +3920,7 @@ class course_request {
$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));
@ -3961,7 +3961,7 @@ class course_request {
* @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;

View File

@ -148,7 +148,7 @@ if (!empty($add)) {
}
// 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;

View File

@ -63,7 +63,7 @@ if (!empty($add)) {
$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;
@ -92,7 +92,7 @@ if (!empty($add)) {
$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);
@ -177,7 +177,7 @@ if (!empty($add)) {
$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);
@ -341,7 +341,7 @@ if ($mform->is_cancelled()) {
}
// 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;
@ -367,7 +367,7 @@ if ($mform->is_cancelled()) {
}
// 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)
@ -453,7 +453,7 @@ if ($mform->is_cancelled()) {
}
// 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;

View File

@ -76,7 +76,7 @@ abstract class moodleform_mod extends moodleform {
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));

View File

@ -48,7 +48,7 @@ if (!isguestuser() and !empty($USER->lastcourseaccess[$COURSE->id])) {
}
}
$param = new object();
$param = new stdClass();
$param->user = 0;
$param->modid = 'all';
$param->group = 0;
@ -130,7 +130,7 @@ $index = 0;
foreach ($sections as $section) {
$activity = new object();
$activity = new stdClass();
$activity->type = 'section';
if ($section->section > 0) {
$activity->name = get_section_name($course, $section);
@ -169,7 +169,7 @@ foreach ($sections as $section) {
$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;

View File

@ -617,7 +617,7 @@ foreach ($progress as $user) {
$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);

View File

@ -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);
@ -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);
@ -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);

View File

@ -158,7 +158,7 @@ switch($requestmethod) {
case 'course':
switch($field) {
case 'marker':
$newcourse = new object;
$newcourse = new stdClass();
$newcourse->id = $course->id;
$newcourse->marker = $value;
$DB->update_record('course', $newcourse);