mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
MDL-20219 Deleted external blog block, and preferences link from blog_menu block. Placed these as links in settings block instead
This commit is contained in:
parent
ca497f4f7c
commit
2367726155
@ -1,92 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
// This file is part of Moodle - http://moodle.org/
|
|
||||||
//
|
|
||||||
// Moodle is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// Moodle is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Block for managing external blogs. This block will appear only on a user's blog page, not
|
|
||||||
* on any other blog listing page (site, course, module etc). It may be filtered by tag.
|
|
||||||
*
|
|
||||||
* @package moodlecore
|
|
||||||
* @subpackage blog
|
|
||||||
* @copyright 2009 Nicolas Connault
|
|
||||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
||||||
*/
|
|
||||||
|
|
||||||
require_once($CFG->dirroot .'/blog/lib.php');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* External Blog Block class
|
|
||||||
*/
|
|
||||||
class block_blog_externals extends block_base {
|
|
||||||
|
|
||||||
function init() {
|
|
||||||
global $USER, $DB;
|
|
||||||
|
|
||||||
$this->title = get_string('blockexternalstitle', 'blog');
|
|
||||||
$this->content_type = BLOCK_TYPE_TEXT;
|
|
||||||
$this->version = 2009101509;
|
|
||||||
|
|
||||||
// See if a deletion has been requested
|
|
||||||
$delete = optional_param('delete_blog_external', false, PARAM_INT);
|
|
||||||
if ($delete && ($external_blog = $DB->get_record('blog_external', array('id' => $delete)))) {
|
|
||||||
// Check caps and userid matching $USER->id
|
|
||||||
if ($external_blog->userid == $USER->id) {
|
|
||||||
$DB->delete_records('blog_external', array('id' => $delete));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_content() {
|
|
||||||
global $CFG, $USER, $DB, $PAGE, $OUTPUT;
|
|
||||||
|
|
||||||
// This block should not appear if $CFG->useexternalblogs is off
|
|
||||||
if (empty($CFG->bloglevel)) {
|
|
||||||
$this->content->text = '';
|
|
||||||
return $this->content;
|
|
||||||
}
|
|
||||||
|
|
||||||
// don't display menu block if block is set at site level, and user is not logged in
|
|
||||||
if ($CFG->bloglevel < BLOG_GLOBAL_LEVEL && !(isloggedin() && !isguest())) {
|
|
||||||
$this->content->text = '';
|
|
||||||
return $this->content;
|
|
||||||
}
|
|
||||||
|
|
||||||
$output = '';
|
|
||||||
|
|
||||||
$this->content = new stdClass;
|
|
||||||
$this->content->footer = '';
|
|
||||||
|
|
||||||
$external_blogs = $DB->get_records('blog_external', array('userid' => $USER->id));
|
|
||||||
|
|
||||||
$external_blog_url = $CFG->wwwroot.'/blog/external.php?returnurl='.urlencode($PAGE->url->out());
|
|
||||||
|
|
||||||
foreach ($external_blogs as $id => $eb) {
|
|
||||||
$strdelete = get_string('delete') . " $eb->name";
|
|
||||||
|
|
||||||
$delete_url = new moodle_url();
|
|
||||||
$delete_url->param('delete_blog_external', $id);
|
|
||||||
$deleteicon = '<a href="'.$delete_url->out().'" class="delete">' .
|
|
||||||
'<img src="'.$OUTPUT->old_icon_url('t/delete').'" alt="'.$strdelete.'" title="'.$strdelete.'" />' .
|
|
||||||
"</a>\n";
|
|
||||||
$output .= '<li><a href="'.$external_blog_url.'&id='.$id.'" title="'.$eb->name.'">'.shorten_text($eb->name, 20)."</a>$deleteicon</li>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->content->text = '<ul class="list">'. $output ."</ul>\n";
|
|
||||||
$this->content->text .= '<div class="newlink"><a href="'.$external_blog_url.'">'.get_string('addnewexternalblog', 'blog').'</a></div>';
|
|
||||||
return $this->content;
|
|
||||||
}
|
|
||||||
}
|
|
@ -120,11 +120,6 @@ class block_blog_menu extends block_base {
|
|||||||
$menulist->add_item($OUTPUT->link($myentrieslink));
|
$menulist->add_item($OUTPUT->link($myentrieslink));
|
||||||
}
|
}
|
||||||
|
|
||||||
// show link to manage blog prefs
|
|
||||||
$blogpreflink = html_link::make(new moodle_url($CFG->wwwroot .'/blog/preferences.php', array('userid' => $USER->id)), get_string('blogpreferences', 'blog'));
|
|
||||||
$blogpreflink->disableifcurrent = true;
|
|
||||||
$menulist->add_item($OUTPUT->link($blogpreflink));
|
|
||||||
|
|
||||||
// show Add entry link
|
// show Add entry link
|
||||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||||
if (has_capability('moodle/blog:create', $sitecontext)) {
|
if (has_capability('moodle/blog:create', $sitecontext)) {
|
||||||
|
@ -208,6 +208,7 @@ if (!empty($entryid)) {
|
|||||||
$filters['entry'] = $entryid;
|
$filters['entry'] = $entryid;
|
||||||
}
|
}
|
||||||
$blogheaders = blog_get_headers();
|
$blogheaders = blog_get_headers();
|
||||||
|
blog_extend_settings_navigation($PAGE->settingsnav);
|
||||||
|
|
||||||
// prints the tabs
|
// prints the tabs
|
||||||
$showroles = !empty($userid);
|
$showroles = !empty($userid);
|
||||||
|
14
blog/lib.php
14
blog/lib.php
@ -597,3 +597,17 @@ function blog_get_headers() {
|
|||||||
|
|
||||||
return $headers;
|
return $headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function blog_extend_settings_navigation($settingsnav) {
|
||||||
|
global $USER, $PAGE, $FULLME, $CFG, $DB, $OUTPUT;
|
||||||
|
$blogkey = $settingsnav->add(get_string('blogadministration', 'blog'));
|
||||||
|
$blog = $settingsnav->get($blogkey);
|
||||||
|
$blog->forceopen = true;
|
||||||
|
|
||||||
|
$blog->add(get_string('preferences', 'blog'), new moodle_url('preferences.php'), navigation_node::TYPE_SETTING);
|
||||||
|
if ($CFG->useexternalblogs && $CFG->maxexternalblogsperuser > 0) {
|
||||||
|
$blog->add(get_string('externalblogs', 'blog'), new moodle_url('external.php'), navigation_node::TYPE_SETTING);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $blogkey;
|
||||||
|
}
|
||||||
|
@ -13,6 +13,7 @@ $string['blockrecenttitle'] = 'Recent Blog Entries';
|
|||||||
$string['blocktagstitle'] = 'Blog Tags';
|
$string['blocktagstitle'] = 'Blog Tags';
|
||||||
$string['blocktitle'] = 'Blog tags block title';
|
$string['blocktitle'] = 'Blog tags block title';
|
||||||
$string['blog'] = 'Blog';
|
$string['blog'] = 'Blog';
|
||||||
|
$string['blogadministration'] = 'Blog administration';
|
||||||
$string['blogdeleteconfirm'] = 'Delete this blog?';
|
$string['blogdeleteconfirm'] = 'Delete this blog?';
|
||||||
$string['blogdisable'] = 'Blogging is disabled!';
|
$string['blogdisable'] = 'Blogging is disabled!';
|
||||||
$string['blogentries'] = 'Blog entries';
|
$string['blogentries'] = 'Blog entries';
|
||||||
@ -73,6 +74,7 @@ $string['numberoftags'] = 'Number of tags to display';
|
|||||||
$string['pagesize'] = 'Number of blog entries per Page';
|
$string['pagesize'] = 'Number of blog entries per Page';
|
||||||
$string['permalink'] = 'Permalink';
|
$string['permalink'] = 'Permalink';
|
||||||
$string['personalblogs'] = 'Users can only see their own blog';
|
$string['personalblogs'] = 'Users can only see their own blog';
|
||||||
|
$string['preferences'] = 'Preferences';
|
||||||
$string['publishto'] = 'Publish to';
|
$string['publishto'] = 'Publish to';
|
||||||
$string['publishtocourse'] = 'Users sharing a course with you';
|
$string['publishtocourse'] = 'Users sharing a course with you';
|
||||||
$string['publishtocourseassoc'] = 'Members of the associated course';
|
$string['publishtocourseassoc'] = 'Members of the associated course';
|
||||||
|
@ -1993,15 +1993,6 @@ body.has_navigation_bar {
|
|||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.block_blog_externals a.delete {
|
|
||||||
margin-left: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.block_blog_externals div.newlink {
|
|
||||||
margin-top: 10px;
|
|
||||||
text-align: center;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
/***
|
/***
|
||||||
*** Calendar
|
*** Calendar
|
||||||
***/
|
***/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user