Пример #1
0
 /**
  * Test external blogs viewed event.
  *
  * There is no external API for this, so the unit test will simply
  * create and trigger the event and ensure data is returned as expected.
  */
 public function test_external_blogs_viewed_event()
 {
     // Trigger an event: external blogs viewed.
     $eventparams = array('context' => $context = context_system::instance());
     $event = \core\event\blog_external_viewed::create($eventparams);
     // Trigger and capture the event.
     $sink = $this->redirectEvents();
     $event->trigger();
     $events = $sink->get_events();
     $event = reset($events);
     // Check that the event data is valid.
     $this->assertInstanceOf('\\core\\event\\blog_external_viewed', $event);
     $this->assertDebuggingNotCalled();
 }
Пример #2
0
if (!empty($message)) {
    echo $OUTPUT->notification($message);
}
echo $OUTPUT->box_start('generalbox boxaligncenter');
if (!empty($blogs)) {
    $table = new html_table();
    $table->cellpadding = 4;
    $table->attributes['class'] = 'generaltable boxaligncenter';
    $table->head = array(get_string('name'), get_string('url', 'blog'), get_string('timefetched', 'blog'), get_string('valid', 'blog'), get_string('actions'));
    foreach ($blogs as $blog) {
        if ($blog->failedlastsync) {
            $validicon = $OUTPUT->pix_icon('i/invalid', get_string('feedisinvalid', 'blog'));
        } else {
            $validicon = $OUTPUT->pix_icon('i/valid', get_string('feedisvalid', 'blog'));
        }
        $editurl = new moodle_url('/blog/external_blog_edit.php', array('id' => $blog->id));
        $editicon = $OUTPUT->action_icon($editurl, new pix_icon('t/edit', get_string('editexternalblog', 'blog')));
        $deletelink = new moodle_url('/blog/external_blogs.php', array('delete' => $blog->id, 'sesskey' => sesskey()));
        $action = new confirm_action(get_string('externalblogdeleteconfirm', 'blog'));
        $deleteicon = $OUTPUT->action_icon($deletelink, new pix_icon('t/delete', get_string('deleteexternalblog', 'blog')), $action);
        $table->data[] = new html_table_row(array($blog->name, $blog->url, userdate($blog->timefetched), $validicon, $editicon . $deleteicon));
    }
    echo html_writer::table($table);
}
$newexternalurl = new moodle_url('/blog/external_blog_edit.php');
echo html_writer::link($newexternalurl, $straddnewexternalblog);
echo $OUTPUT->box_end();
// Log this page.
$event = \core\event\blog_external_viewed::create(array('context' => $context));
$event->trigger();
echo $OUTPUT->footer();