diff --git a/blocks/blog_menu/block_blog_menu.php b/blocks/blog_menu/block_blog_menu.php
index 19823d92e3e..bfd6b2a1e5b 100755
--- a/blocks/blog_menu/block_blog_menu.php
+++ b/blocks/blog_menu/block_blog_menu.php
@@ -52,7 +52,7 @@ class block_blog_menu extends block_base {
}
function get_content() {
- global $CFG, $USER, $PAGE;
+ global $CFG, $USER, $PAGE, $OUTPUT;
$context = $PAGE->get_context();
@@ -72,7 +72,7 @@ class block_blog_menu extends block_base {
$this->content = new stdClass;
$this->content->footer = '';
- $viewblogentries_url = blog_get_context_url();
+ $viewblogentriesurl = blog_get_context_url();
$strlevel = '';
switch ($context->contextlevel) {
@@ -92,63 +92,48 @@ class block_blog_menu extends block_base {
/// Accessibility: markup as a list.
$blogmodon = false;
+ $menulist = new html_list();
+ $menulist->add_class('list');
if (!empty($strlevel)) {
- $output = '
'.get_string('viewblogentries', 'blog', $strlevel).'';
- }
-
- $parts = array();
- $query = parse_url($viewblogentries_url);
-
- if (!empty($query['query'])) {
- parse_str($query['query'], $parts);
+ $menulist->add_item($OUTPUT->link(html_link::make($viewblogentriesurl, get_string('viewblogentries', 'blog', $strlevel))));
}
// show View site entries link
if ($CFG->bloglevel >= BLOG_SITE_LEVEL && $canviewblogs) {
- $output .= '';
- $output .= get_string('viewsiteentries', 'blog')."\n";
+ $menulist->add_item($OUTPUT->link(html_link::make($CFG->wwwroot .'/blog/index.php', get_string('viewsiteentries', 'blog'))));
}
$output .= '';
// show View my entries link
if ($context->contextlevel != CONTEXT_USER) {
- $output .= '\n";
+ $myentrieslink = html_link::make(new moodle_url($CFG->wwwroot .'/blog/index.php', array('userid' => $USER->id)), get_string('viewmyentries', 'blog'));
+ $myentrieslink->url->params($viewblogentriesurl->params());
+ $menulist->add_item($OUTPUT->link($myentrieslink));
}
// show link to manage blog prefs
- $output .= ''.
- get_string('blogpreferences', 'blog')."\n";
+ $blogpreflink = html_link::make(new moodle_url($CFG->wwwroot .'/blog/preferences.php', array('userid' => $USER->id)), get_string('blogpreferences', 'blog'));
+
+ $menulist->add_item($OUTPUT->link($blogpreflink));
// show Add entry link
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
if (has_capability('moodle/blog:create', $sitecontext)) {
- $output .= '\n";
+ $addentrylink = html_link::make(new moodle_url($CFG->wwwroot .'/blog/edit.php', array('action' => 'add')), get_string('addnewentry', 'blog'));
+ $addentrylink->url->params($viewblogentriesurl->params());
+ $menulist->add_item($OUTPUT->link($addentrylink));
}
// Full-text search field
+ $searchform = new html_form();
+ $searchform->method = 'get';
+ $searchform->url = new moodle_url($viewblogentriesurl);
+ $searchform->button->text = get_string('search');
+ $formcontents = $OUTPUT->field(html_field::make_text('search'));
- $output .= '';
- $this->content->text = '\n";
+ $menulist->add_item($OUTPUT->form($searchform, $formcontents));
+ $this->content->text = $OUTPUT->htmllist($menulist);
}
}
diff --git a/blocks/blog_tags/block_blog_tags.php b/blocks/blog_tags/block_blog_tags.php
index 6b410d4bf88..8dfbab78f78 100644
--- a/blocks/blog_tags/block_blog_tags.php
+++ b/blocks/blog_tags/block_blog_tags.php
@@ -39,7 +39,7 @@ class block_blog_tags extends block_base {
}
function get_content() {
- global $CFG, $SITE, $USER, $DB;
+ global $CFG, $SITE, $USER, $DB, $OUTPUT;
if (empty($CFG->usetags) || empty($CFG->bloglevel)) {
$this->content->text = '';
@@ -139,11 +139,10 @@ class block_blog_tags extends block_base {
break;
}
- $link = blog_get_blogs_url(array($filtertype => $filterselect, 'tag'=>$tag->id));
- $this->content->text .= 'class.'" '.
- 'title="'.get_string('numberofentries','blog',$tag->ct).'">'.
- tag_display_name($tag) .' ';
+ $link = html_link::make(blog_get_blogs_url(array($filtertype => $filterselect, 'tag'=>$tag->id)), tag_display_name($tag));
+ $link->add_class($tag->class);
+ $link->title = get_string('numberofentries','blog',$tag->ct);
+ $this->content->text .= '' . $OUTPUT->link($link) . ' ';
}
$this->content->text .= "\n\n";
diff --git a/blog/edit.php b/blog/edit.php
index e76e6f9f270..2d0214c6425 100755
--- a/blog/edit.php
+++ b/blog/edit.php
@@ -37,6 +37,8 @@ $courseid = optional_param('courseid', 0, PARAM_INT); // needed for user tab - d
$PAGE->set_url('blog/edit.php', array('action' => $action, 'entryid' => $id, 'confirm' => $confirm, 'modid' => $modid, 'courseid' => $courseid));
+$blog_headers = blog_get_headers();
+
require_login($courseid);
if ($action == 'edit') {
@@ -229,8 +231,6 @@ if (!$user = $DB->get_record('user', array('id'=>$userid))) {
print_error('invaliduserid');
}
-$blog_headers = blog_get_headers();
-
$PAGE->requires->js('blog/edit_form.js');
echo $OUTPUT->header();
diff --git a/blog/edit_form.php b/blog/edit_form.php
index 34df8ec8fcd..ba0087b8011 100644
--- a/blog/edit_form.php
+++ b/blog/edit_form.php
@@ -68,7 +68,7 @@ class blog_edit_form extends moodleform {
$mform->addElement('format', 'format', get_string('format'));
- $mform->addElement('file', 'attachment', get_string('attachment', 'forum'));
+ $mform->addElement('filepicker', 'attachment', get_string('attachment', 'forum'), null, array('filetypes' => '*'));
//disable publishstate options that are not allowed
$publishstates = array();
diff --git a/blog/lib.php b/blog/lib.php
index 73eec5baafb..957b697c251 100755
--- a/blog/lib.php
+++ b/blog/lib.php
@@ -179,14 +179,29 @@ function blog_remove_associations_for_user($userid) {
*/
function blog_get_blogs_url($filters) {
global $CFG;
- return $CFG->wwwroot.'/blog/index.php?'.
- (empty($filters['course']) ? '' : 'courseid='.$filters['course'].'&').
- (empty($filters['mod']) ? '' : 'modid='.$filters['mod'].'&').
- (empty($filters['group']) ? '' : 'groupid='.$filters['group'].'&').
- (empty($filters['user']) ? '' : 'userid='.$filters['user'].'&').
- (empty($filters['entry']) ? '' : 'entryid='.$filters['entry'].'&').
- (empty($filters['tag']) ? '' : 'tagid='.$filters['tag'].'&').
- (empty($filters['tagtext']) ? '' : 'tag='.$filters['tagtext']);
+ $blogsurl = new moodle_url($CFG->wwwroot . '/blog/index.php');
+ if (!empty($filters['course'])) {
+ $blogsurl->param('courseid', $filters['course']);
+ }
+ if (!empty($filters['mod'])) {
+ $blogsurl->param('modid', $filters['mod']);
+ }
+ if (!empty($filters['group'])) {
+ $blogsurl->param('groupid', $filters['group']);
+ }
+ if (!empty($filters['user'])) {
+ $blogsurl->param('userid', $filters['user']);
+ }
+ if (!empty($filters['entry'])) {
+ $blogsurl->param('entryid', $filters['entry']);
+ }
+ if (!empty($filters['tag'])) {
+ $blogsurl->param('tagid', $filters['tag']);
+ }
+ if (!empty($filters['tagtext'])) {
+ $blogsurl->param('tag', $filters['tagtext']);
+ }
+ return $blogsurl;
}
/**
@@ -306,7 +321,7 @@ function blog_fetch_external_entries($external_blog) {
function blog_get_context_url($context=null) {
global $CFG;
- $viewblogentries_url = $CFG->wwwroot . '/blog/index.php?';
+ $viewblogentriesurl = new moodle_url($CFG->wwwroot . '/blog/index.php');
if (empty($context)) {
global $PAGE;
@@ -341,10 +356,10 @@ function blog_get_context_url($context=null) {
}
if (!empty($filterparam)) {
- $viewblogentries_url .= "$filterparam=$context->instanceid";
+ $viewblogentriesurl->param($filterparam, $context->instanceid);
}
- return $viewblogentries_url;
+ return $viewblogentriesurl;
}
/**
diff --git a/blog/preferences.php b/blog/preferences.php
index 6b28503fd30..66c16579531 100755
--- a/blog/preferences.php
+++ b/blog/preferences.php
@@ -30,7 +30,12 @@ require_once($CFG->dirroot.'/blog/lib.php');
require_once('preferences_form.php');
$courseid = optional_param('courseid', SITEID, PARAM_INT);
-$PAGE->set_url('blog/preferences.php', array('courseid' => $courseid));
+$modid = optional_param('modid', null, PARAM_INT);
+$userid = optional_param('userid', null, PARAM_INT);
+$tagid = optional_param('tagid', null, PARAM_INT);
+$groupid = optional_param('groupid', null, PARAM_INT);
+
+$PAGE->set_url('blog/preferences.php', array('courseid' => $courseid, 'modid' => $modid, 'userid' => $userid, 'tagid' => $tagid, 'groupid' => $groupid));
if ($courseid == SITEID) {
require_login();
diff --git a/tag/index.php b/tag/index.php
index 1d43d3295ee..af78d6140ad 100644
--- a/tag/index.php
+++ b/tag/index.php
@@ -126,7 +126,7 @@ if (has_capability('moodle/blog:view', $systemcontext)) { // You have to see bl
}
echo '';
- echo ''.get_string('seeallblogs', 'tag', $tagname).'
';
+ echo ''.get_string('seeallblogs', 'tag', $tagname).'
';
echo $OUTPUT->box_end();
}
diff --git a/user/tabs.php b/user/tabs.php
index 00d7f16de7a..344dfa33bbb 100644
--- a/user/tabs.php
+++ b/user/tabs.php
@@ -43,7 +43,7 @@
get_string('participants'));
}
- $toprow[] = new tabobject('blogs', blog_get_blogs_url(array()),
+ $toprow[] = new tabobject('blogs', blog_get_blogs_url(array())->out(),
get_string('blogs','blog'));
}
@@ -60,7 +60,7 @@
get_string('participants'));
if ($CFG->bloglevel >= 3) {
- $toprow[] = new tabobject('blogs', blog_get_blogs_url(array('course'=>$filterselect)), get_string('blogs','blog'));
+ $toprow[] = new tabobject('blogs', blog_get_blogs_url(array('course'=>$filterselect))->out(), get_string('blogs','blog'));
}
if (!empty($CFG->enablenotes) and (has_capability('moodle/notes:manage', $coursecontext) || has_capability('moodle/notes:view', $coursecontext))) {
@@ -81,7 +81,7 @@
get_string('participants'));
- $toprow[] = new tabobject('blogs', blog_get_blogs_url(array('group'=>$filterselect)), get_string('blogs','blog'));
+ $toprow[] = new tabobject('blogs', blog_get_blogs_url(array('group'=>$filterselect))->out(), get_string('blogs','blog'));
}
/**************************************
@@ -139,7 +139,7 @@
) // able to read blogs in site or course context
) { //end if
- $toprow[] = new tabobject('blogs', blog_get_blogs_url(array('user'=>$user->id,'course'=>$course->id)), get_string('blog', 'blog'));
+ $toprow[] = new tabobject('blogs', blog_get_blogs_url(array('user'=>$user->id,'course'=>$course->id))->out(), get_string('blog', 'blog'));
}
if (!empty($CFG->enablenotes) and (has_capability('moodle/notes:manage', $coursecontext) || has_capability('moodle/notes:view', $coursecontext))) {