From 4fb35be36a4f911be2a3520007dae0febd48f7d7 Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Fri, 17 Sep 2010 11:30:10 +0000 Subject: [PATCH] fixed object initialization --- blog/edit_form.php | 4 ++++ blog/lib.php | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/blog/edit_form.php b/blog/edit_form.php index 6318996d354..857f519317e 100644 --- a/blog/edit_form.php +++ b/blog/edit_form.php @@ -75,10 +75,12 @@ class blog_edit_form extends moodleform { $course = $DB->get_record('course', array('id' => $courseid)); $mform->addElement('header', 'assochdr', get_string('associations', 'blog')); $context = get_context_instance(CONTEXT_COURSE, $courseid); + $a = new object(); $a->coursename = $course->fullname; $contextid = $context->id; } else { $sql = 'SELECT fullname FROM {course} cr LEFT JOIN {context} ct ON ct.instanceid = cr.id WHERE ct.id = ?'; + $a = new object(); $a->coursename = $DB->get_field_sql($sql, array($entry->courseassoc)); $contextid = $entry->courseassoc; } @@ -88,12 +90,14 @@ class blog_edit_form extends moodleform { } else if ((!empty($entry->modassoc) || !empty($modid)) && has_capability('moodle/blog:associatemodule', $sitecontext)) { if (!empty($modid)) { $mod = get_coursemodule_from_id(false, $modid); + $a = new object(); $a->modtype = get_string('modulename', $mod->modname); $a->modname = $mod->name; $context = get_context_instance(CONTEXT_MODULE, $modid); } else { $context = $DB->get_record('context', array('id' => $entry->modassoc)); $cm = $DB->get_record('course_modules', array('id' => $context->instanceid)); + $a = new object(); $a->modtype = $DB->get_field('modules', 'name', array('id' => $cm->module)); $a->modname = $DB->get_field($a->modtype, 'name', array('id' => $cm->instance)); } diff --git a/blog/lib.php b/blog/lib.php index f16c486804f..56973e31bcb 100755 --- a/blog/lib.php +++ b/blog/lib.php @@ -662,6 +662,7 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu $cm = $DB->get_record('course_modules', array('id' => $modid)); $cm->modname = $DB->get_field('modules', 'name', array('id' => $cm->module)); $cm->name = $DB->get_field($cm->modname, 'name', array('id' => $cm->instance)); + $a = new object(); $a->type = get_string('modulename', $cm->modname); $PAGE->set_cm($cm, $course); $headers['stradd'] = get_string('blogaboutthis', 'blog', $a); @@ -740,6 +741,7 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu $PAGE->set_title("$site->shortname: $cm->name: " . fullname($user) . ': ' . get_string('blogentries', 'blog')); $PAGE->set_heading("$site->shortname: $cm->name: " . fullname($user) . ': ' . get_string('blogentries', 'blog')); + $a = new object(); $a->user = fullname($user); $a->mod = $cm->name; $a->type = get_string('modulename', $cm->modname); @@ -758,6 +760,7 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu $PAGE->set_title("$site->shortname: $course->shortname: " . fullname($user) . ': ' . get_string('blogentries', 'blog')); $PAGE->set_heading("$site->shortname: $course->shortname: " . fullname($user) . ': ' . get_string('blogentries', 'blog')); + $a = new object(); $a->user = fullname($user); $a->course = $course->fullname; $a->type = get_string('course'); @@ -781,6 +784,7 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu $PAGE->set_title("$site->shortname: $course->shortname: " . get_string('blogentries', 'blog') . ": $group->name"); $PAGE->set_heading("$site->shortname: $course->shortname: " . get_string('blogentries', 'blog') . ": $group->name"); + $a = new object(); $a->group = $group->name; $a->course = $course->fullname; $a->type = get_string('course'); @@ -801,6 +805,7 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu $PAGE->set_title("$site->shortname: $course->shortname: $cm->name: " . get_string('blogentries', 'blog') . ": $group->name"); $PAGE->set_heading("$site->shortname: $course->shortname: $cm->name: " . get_string('blogentries', 'blog') . ": $group->name"); + $a = new object(); $a->group = $group->name; $a->mod = $cm->name; $a->type = get_string('modulename', $cm->modname); @@ -818,6 +823,7 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu $PAGE->set_title("$site->shortname: $course->shortname: $cm->name: " . get_string('blogentries', 'blog')); $PAGE->set_heading("$site->shortname: $course->shortname: $cm->name: " . get_string('blogentries', 'blog')); $headers['heading'] = get_string('blogentriesabout', 'blog', $cm->name); + $a = new object(); $a->type = get_string('modulename', $cm->modname); $headers['stradd'] = get_string('blogaboutthis', 'blog', $a); $headers['strview'] = get_string('viewallmodentries', 'blog', $a); @@ -829,6 +835,7 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu $PAGE->navbar->add($strblogentries, $blogurl); $PAGE->set_title("$site->shortname: $course->shortname: " . get_string('blogentries', 'blog')); $PAGE->set_heading("$site->shortname: $course->shortname: " . get_string('blogentries', 'blog')); + $a = new object(); $a->type = get_string('course'); $headers['heading'] = get_string('blogentriesabout', 'blog', $course->fullname); $headers['stradd'] = get_string('blogaboutthis', 'blog', $a);