Ejemplo n.º 1
0
if ($courseid != SITEID) {
    $PAGE->set_heading($course->fullname);
    echo $OUTPUT->header();
    if (!empty($user)) {
        $headerinfo = array('heading' => fullname($user), 'user' => $user);
        echo $OUTPUT->context_header($headerinfo, 2);
    }
} else {
    if (isset($userid)) {
        $PAGE->set_heading(fullname($user));
        echo $OUTPUT->header();
    } else {
        if ($courseid == SITEID) {
            echo $OUTPUT->header();
        }
    }
}
echo $OUTPUT->heading($blogheaders['heading'], 2);
$bloglisting = new blog_listing($blogheaders['filters']);
$bloglisting->print_entries();
if ($CFG->enablerssfeeds) {
    blog_rss_print_link($rsscontext, $filtertype, $thingid, $tagid, get_string('rssfeed', 'blog'));
}
echo $OUTPUT->footer();
$eventparams = array('other' => array('entryid' => $entryid, 'tagid' => $tagid, 'userid' => $userid, 'modid' => $modid, 'groupid' => $groupid, 'search' => $search, 'fromstart' => $start));
if (!empty($userid)) {
    $eventparams['relateduserid'] = $userid;
}
$eventparams['other']['courseid'] = $courseid === SITEID ? 0 : $courseid;
$event = \core\event\blog_entries_viewed::create($eventparams);
$event->trigger();
Ejemplo n.º 2
0
 /**
  * Tests for event blog_entries_viewed.
  */
 public function test_blog_entries_viewed_event()
 {
     $this->setAdminUser();
     $other = array('entryid' => $this->postid, 'tagid' => $this->tagid, 'userid' => $this->userid, 'modid' => $this->cmid, 'groupid' => $this->groupid, 'courseid' => $this->courseid, 'search' => 'search', 'fromstart' => 2);
     // Trigger event.
     $sink = $this->redirectEvents();
     $eventparams = array('other' => $other);
     $eventinst = \core\event\blog_entries_viewed::create($eventparams);
     $eventinst->trigger();
     $events = $sink->get_events();
     $event = reset($events);
     $sink->close();
     // Validate event data.
     $url = new moodle_url('/blog/index.php', $other);
     $url2 = new moodle_url('index.php', $other);
     $this->assertEquals($url, $event->get_url());
     $arr = array(SITEID, 'blog', 'view', $url2->out(), 'view blog entry');
     $this->assertEventLegacyLogData($arr, $event);
     $this->assertEventContextNotUsed($event);
 }