moodle

moodle學習筆記

#debug

error_log($data->message, 3, '/tmp/your_log_file');

#其他用戶
不用加到課程的特別人員,但是需要增加以下權限
參考https://docs.moodle.org/311/en/Other_users

moodle/course:view

#私人檔案
關閉登入人員的私人檔案

moodle/user:manageownfiles

#同步AD使用者

/bitnami/moodle/auth/ldap/cli# php sync_users.php

#移除頁腳Data retention summary

showdataretentionsummary

#移除頁腳的moodle logo

vi /lib/outputrenderers.php
return '';//josh
return '<div class="sitelink">' .
'<a title="Moodle" class="d-inline-block aalink" href="http://moodle.org/">' .
'<img src="' . $this->image_url('moodlelogo_grayhat') . '" alt="'.get_string('moodlelogo').'" /></a></div>';

#不允許自行加入課程的用戶,自行退選

enrol/self:unenrolself

#LDAP設定

host_url
ldap://10.3.1.6/;ldap://10.3.1.3/;

bind_dn
CN=ldap,OU=TSCS_User,OU=TSCS,DC=tgenergy,DC=com,DC=tw

bind_pw
l12345678

contexts
OU=TSCS_User,OU=TSCS,DC=tgenergy,DC=com,DC=tw

user_type
MS ActiveDirectory

search_sub
Y

user_attribute
sAMAccountName

objectclass
(&(objectclass=person)(sAMAccountName=P00282)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))
(&(objectclass=person)(company=TSC)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))

removeuser
停用內部

field_map_firstname
cn

field_map_lastname
department

field_map_email
mail

#LDAP 密碼過期設定 必裝的套件

apt-get install php-bcmath

http://10.3.1.6/IISADMPWD/aexp2.asp

#php code新增同期生

<?php
require(__DIR__.'/../config.php');
require(__DIR__.'/../cohort/lib.php');

cohort_add_member(3,4);

//$user = $DB->get_record_sql('SELECT * FROM {user} WHERE deleted = 0 OR suspended = 1;');
//$user = $DB->get_records_sql('SELECT * FROM {user} WHERE deleted = 0 OR suspended = 1;');
//$cohortids = $DB->get_records('cohort', null, null, '*');

#插件推薦

onyetapp/onyetmpdf

#mail模版
vi ./forum_post_email_htmlemail_body.mustache
預計刪除如下,防止mail警告外部圖片

        <td width="35" valign="top" class="picture left">
            {{{ authorpicture }}}
        </td>

./html/mod/forum/classes/output/email/renderer.php

    public function format_message_attachments($cm, $post) {
            $zz =  forum_print_attachments($post, $cm, "html");
            $aa = strip_tags(  $zz , "<a>");
            return $aa;
        return forum_print_attachments($post, $cm, "html");
    }

#pdf亂碼修正

將字型改為droidsansfallback
vi /etc/nginx/html/lib/pdflib.php

define('PDF_DEFAULT_FONT', 'droidsansfallback');

#停用的用戶,不出現在課程加入下拉列表
vi /etc/nginx/html/enrol/locallib.php

找到:WHERE $wherecondition
增加:AND suspended=0
vi ./enrol/manual/locallib.php
在class enrol_manual_potential_participant extends user_selector_base內
找到WHERE $wherecondition
增加:AND suspended=0

#導航:我的課程:導到首頁
vi ./lib/templates/navbar.mustache

找到
{{{text}}}
改成
<a href="/?redirect=0">{{{text}}}</a>

#回饋單可以匿名填寫
feedback_allowfullanonymous

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。