ご参考までに下記投稿をご覧ください。
[Moodle in English: Remove items from navigation block?]
https://moodle.org/mod/forum/discuss.php?d=180982また、今後のMoodleバージョンアップを考えますと、あまりお勧めできる方法ではありませんが、下記修正によりナビゲーションブロックの項目を削除することはできます。
----------------------------------------------------------------
修正対象プログラム:
lib/navigationlib.php
修正箇所:
2196行目
[ 修正前 ]
if (!empty($CFG->navadduserpostslinks)) {
// Add nodes for forum posts and discussions if the user can view either or both
// There are no capability checks here as the content of the page is based
// purely on the forums the current user has access too.
$forumtab = $usernode->add(get_string('forumposts', 'forum'));
$forumtab->add(get_string('posts', 'forum'), new moodle_url('/mod/forum/user.php', $baseargs));
$forumtab->add(get_string('discussions', 'forum'), new moodle_url('/mod/forum/user.php', array_merge($baseargs, array('mode'=>'discussions'))));
}
[ 修正後 ]
if (!empty($CFG->navadduserpostslinks)) {
// Add nodes for forum posts and discussions if the user can view either or both
// There are no capability checks here as the content of the page is based
// purely on the forums the current user has access too.
// $forumtab = $usernode->add(get_string('forumposts', 'forum'));
// $forumtab->add(get_string('posts', 'forum'), new moodle_url('/mod/forum/user.php', $baseargs));
// $forumtab->add(get_string('discussions', 'forum'), new moodle_url('/mod/forum/user.php', array_merge($baseargs, array('mode'=>'discussions'))));
}
備考:
ナビゲーションブロックより「フォーラム投稿」メニューを削除します。
----------------------------------------------------------------
修正対象プログラム:
lib/navigationlib.php
修正箇所:
2213行目
[ 修正前 ]
// Add blog nodes
if (!empty($CFG->enableblogs)) {
if (!$this->cache->cached('userblogoptions'.$user->id)) {
require_once($CFG->dirroot.'/blog/lib.php');
// Get all options for the user
$options = blog_get_options_for_user($user);
$this->cache->set('userblogoptions'.$user->id, $options);
} else {
$options = $this->cache->{'userblogoptions'.$user->id};
}
if (count($options) > 0) {
$blogs = $usernode->add(get_string('blogs', 'blog'), null, navigation_node::TYPE_CONTAINER);
foreach ($options as $type => $option) {
if ($type == "rss") {
$blogs->add($option['string'], $option['link'], settings_navigation::TYPE_SETTING, null, null, new pix_icon('i/rss', ''));
} else {
$blogs->add($option['string'], $option['link']);
}
}
}
}
[ 修正後 ]
// Add blog nodes
if (!empty($CFG->enableblogs)) {
if (!$this->cache->cached('userblogoptions'.$user->id)) {
require_once($CFG->dirroot.'/blog/lib.php');
// Get all options for the user
$options = blog_get_options_for_user($user);
$this->cache->set('userblogoptions'.$user->id, $options);
} else {
$options = $this->cache->{'userblogoptions'.$user->id};
}
if (count($options) > 0) {
// $blogs = $usernode->add(get_string('blogs', 'blog'), null, navigation_node::TYPE_CONTAINER); foreach ($options as $type => $option) {
if ($type == "rss") {
// $blogs->add($option['string'], $option['link'], settings_navigation::TYPE_SETTING, null, null, new pix_icon('i/rss', '')); } else {
// $blogs->add($option['string'], $option['link']); }
}
}
}
備考:
ナビゲーションブロックより「ブログ」メニューを削除します。
----------------------------------------------------------------
修正対象プログラム:
lib/navigationlib.php
修正箇所:
2233行目
[ 修正前 ]
if (!empty($CFG->messaging)) {
$messageargs = array('user1' => $USER->id);
if ($USER->id != $user->id) {
$messageargs['user2'] = $user->id;
}
if ($course->id != $SITE->id) {
$messageargs['viewing'] = MESSAGE_VIEW_COURSE. $course->id;
}
$url = new moodle_url('/message/index.php',$messageargs);
$usernode->add(get_string('messages', 'message'), $url, self::TYPE_SETTING, null, 'messages');
}
if ($iscurrentuser && has_capability('moodle/user:manageownfiles', context_user::instance($USER->id))) {
$url = new moodle_url('/user/files.php');
$usernode->add(get_string('myfiles'), $url, self::TYPE_SETTING);
}
if (!empty($CFG->enablebadges) && $iscurrentuser &&
has_capability('moodle/badges:manageownbadges', context_user::instance($USER->id))) {
$url = new moodle_url('/badges/mybadges.php');
$usernode->add(get_string('mybadges', 'badges'), $url, self::TYPE_SETTING);
}
// Add a node to view the users notes if permitted
if (!empty($CFG->enablenotes) && has_any_capability(array('moodle/notes:manage', 'moodle/notes:view'), $coursecontext)) {
$url = new moodle_url('/notes/index.php',array('user'=>$user->id));
if ($coursecontext->instanceid != SITEID) {
$url->param('course', $coursecontext->instanceid);
}
$usernode->add(get_string('notes', 'notes'), $url);
}
[ 修正後 ]
if (!empty($CFG->messaging)) {
$messageargs = array('user1' => $USER->id);
if ($USER->id != $user->id) {
$messageargs['user2'] = $user->id;
}
if ($course->id != $SITE->id) {
$messageargs['viewing'] = MESSAGE_VIEW_COURSE. $course->id;
}
$url = new moodle_url('/message/index.php',$messageargs);
// $usernode->add(get_string('messages', 'message'), $url, self::TYPE_SETTING, null, 'messages'); }
if ($iscurrentuser && has_capability('moodle/user:manageownfiles', context_user::instance($USER->id))) {
$url = new moodle_url('/user/files.php');
$usernode->add(get_string('myfiles'), $url, self::TYPE_SETTING);
}
if (!empty($CFG->enablebadges) && $iscurrentuser &&
has_capability('moodle/badges:manageownbadges', context_user::instance($USER->id))) {
$url = new moodle_url('/badges/mybadges.php');
// $usernode->add(get_string('mybadges', 'badges'), $url, self::TYPE_SETTING); }
// Add a node to view the users notes if permitted
if (!empty($CFG->enablenotes) && has_any_capability(array('moodle/notes:manage', 'moodle/notes:view'), $coursecontext)) {
$url = new moodle_url('/notes/index.php',array('user'=>$user->id));
if ($coursecontext->instanceid != SITEID) {
$url->param('course', $coursecontext->instanceid);
}
// $usernode->add(get_string('notes', 'notes'), $url); }
備考:
ナビゲーションブロックより「メッセージ」「マイバッジ」「ノート」メニューを削除します。