3.4.1を利用しています。
左側に表示されるメニューブロック(ダッシュボード、サイトホーム、カレンダー、・・・)を非表示にする方法を教えてください。
ワイド表示にすると消えるので常にワイド表示にする方法でも結構です。
今回、moodle サイトに 1つのコースに1つの小問題のみを設置する予定です。
この小問題の解答に必要のない全てのメニュー、ボタンを非表示にしたいのですが、
これを実現する極めてシンプルなテーマがありましたら紹介ください。
よろしくお願いいたします。
kaminaga です。
常にワイド表示にする方法を調査しています。
メニュー表示の時
<body> id="page-course-view-topics" class="format-topics path-course path-course-view safari dir-ltr lang-ja yui-skin-sam yui3-skin-sam 13-114-112-22 pagelayout-course course-2 context-21 category-2 jsenabled drawer-ease">
ワイド表示の時
<body> id="page-course-view-topics" class="format-topics path-course path-course-view safari dir-ltr lang-ja yui-skin-sam yui3-skin-sam 13-114-112-22 pagelayout-course course-2 context-21 category-2 jsenabled drawer-ease drawer-open-left">
で、"drawer-open-left" のオプションが異なるのですが、
これをどのソースで操作しているのかがわかりません。
どなたかアドバイスをいだけると助かります。
下記修正ではいかがでしょうか。
修正対象ファイル:
theme/boost/layout/columns2.php
修正箇所:
31行目
[ 修正前 ]
user_preference_allow_ajax_update('drawer-open-nav', PARAM_ALPHA);
require_once($CFG->libdir . '/behat/lib.php');
if (isloggedin()) {
$navdraweropen = (get_user_preferences('drawer-open-nav', 'true') == 'true');
} else {
$navdraweropen = false;
}
[ 修正後 ]
user_preference_allow_ajax_update('drawer-open-nav', PARAM_ALPHA);
require_once($CFG->libdir . '/behat/lib.php');
if (isloggedin()) {
// $navdraweropen = (get_user_preferences('drawer-open-nav', 'true') == 'true');
$navdraweropen = false;
} else {
$navdraweropen = false;
}
下記修正ではいかがでしょうか。
修正対象ファイル:
theme/boost/templates/header.mustache
修正箇所:
24行目
[ 修正前 ]
<header role="banner" class="pos-f-t navbar navbar-full navbar-light bg-faded navbar-static-top moodle-has-zindex">
<div class="container-fluid navbar-nav">
<div data-region="drawer-toggle">
<button aria-expanded="{{#navdraweropen}}true{{/navdraweropen}}{{^navdraweropen}}false{{/navdraweropen}}" aria-controls="nav-drawer" type="button" class="btn pull-xs-left m-r-1 btn-secondary" data-action="toggle-drawer" data-side="left" data-preference="drawer-open-nav">{{#pix}}i/menubars{{/pix}}<span class="sr-only">{{#str}}sidepanel, core{{/str}}</span></button>
</div>
<a href="{{{ config.wwwroot }}}" class="navbar-brand {{# output.should_display_navbar_logo }}has-logo{{/ output.should_display_navbar_logo }}
[ 修正後 ]
<header role="banner" class="pos-f-t navbar navbar-full navbar-light bg-faded navbar-static-top moodle-has-zindex">
<div class="container-fluid navbar-nav">
<a href="{{{ config.wwwroot }}}" class="navbar-brand {{# output.should_display_navbar_logo }}has-logo{{/ output.should_display_navbar_logo }}
左上の [三] (サイドメニュー表示/非表示)ボタンを学生には表示させたくない件
いまだ実現できておりません。
質問ばかりで申し訳ないのですが、どなたか実現方法をご教示いただけると助かります。
過去投稿の検索より
https://moodle.org/mod/forum/discuss.php?d=273828
if (has_capability('moodle/course:manageactivities', $this->page->context)) {
がヒントになるのかな・・・
とおもいソースを眺めているのですが、残念ながら具体的な修正箇所に辿りつくことができていません。
下記修正ではいかがでしょうか。
1. テーマ「boost」の学生用テーマテンプレート (header_student.mustache) を作成する
/theme/boost/templates/header.mustacheをコピーして新たにheader_student.mustacheを作成してください。
2. テーマ「boost」の学生用テーマテンプレート (header_student.mustache) を修正する
修正対象ファイル:
/theme/boost/templates/header_student.mustache
修正箇所:
24行目
[ 修正前 ]
<header role="banner" class="pos-f-t navbar navbar-full navbar-light bg-faded navbar-static-top moodle-has-zindex">
<div class="container-fluid navbar-nav">
<div data-region="drawer-toggle">
<button aria-expanded="{{#navdraweropen}}true{{/navdraweropen}}{{^navdraweropen}}false{{/navdraweropen}}" aria-controls="nav-drawer" type="button" class="btn pull-xs-left m-r-1 btn-secondary" data-action="toggle-drawer" data-side="left" data-preference="drawer-open-nav">{{#pix}}i/menubars{{/pix}}<span class="sr-only">{{#str}}sidepanel, core{{/str}}</span></button>
</div>
<a href="{{{ config.wwwroot }}}" class="navbar-brand {{# output.should_display_navbar_logo }}has-logo{{/ output.should_display_navbar_logo }}
[ 修正後 ]
<header role="banner" class="pos-f-t navbar navbar-full navbar-light bg-faded navbar-static-top moodle-has-zindex">
<div class="container-fluid navbar-nav">
<a href="{{{ config.wwwroot }}}" class="navbar-brand {{# output.should_display_navbar_logo }}has-logo{{/ output.should_display_navbar_logo }}
3. テーマ「boost」の学生用テーマテンプレート (columns2_student.mustache) を作成する
/theme/boost/templates/columns2.mustacheをコピーして新たにcolumns2_student.mustacheを作成してください。
4. テーマ「boost」の学生用テーマテンプレート (columns2_student.mustache) を修正する
修正箇所:
66行目
[ 修正前 ]
{{>theme_boost/header}}
[ 修正後 ]
{{>theme_boost/header_student}}.
5. テーマ「boost」のレイアウト用プログラムを修正する
修正対象ファイル:
/theme/boost/layout/columns2.php
修正箇所
30行目
[ 修正前 ]
if (isloggedin()) {
$navdraweropen = (get_user_preferences('drawer-open-nav', 'true') == 'true');
} else {
$navdraweropen = false;
}
[ 修正後 ]
if (isloggedin()) {
// $navdraweropen = (get_user_preferences('drawer-open-nav', 'true') == 'true');
$navdraweropen = false;
} else {
$navdraweropen = false;
}
-----------------------
修正箇所:
55行目
[ 修正前 ]
$templatecontext['flatnavigation'] = $PAGE->flatnav;
echo $OUTPUT->render_from_template('theme_boost/columns2', $templatecontext);
[ 修正後 ]
$templatecontext['flatnavigation'] = $PAGE->flatnav;
// echo $OUTPUT->render_from_template('theme_boost/columns2', $templatecontext);
if (has_capability('moodle/course:manageactivities', $PAGE->context)) {
echo $OUTPUT->render_from_template('theme_boost/columns2', $templatecontext);
} else {
echo $OUTPUT->render_from_template('theme_boost/columns2_student', $templatecontext);
}