Home
News
Forum
Wiki
Blog
Contents
Gallery
Movies
Downloads
About NSL
[
List of Titles
|
List of Pages
|
New
|
Search
|
Recent changes
|
Help
]
Moodle/Programming/2.2
[
Front page
]
[ ]
Start:
** Moodle2.2 Programing
- Block: http://docs.moodle.org/en/Development:Blocks
- [[1.x→2.x>../1.x→2.x]]
#br
*** Data Base
- DB は全面的に XMLDB に移行
- $DB 変数必須
**** XMLDB
- http://dev.moodle.org/mod/resource/view.php?id=48
- block にディレクトリを作成し,その中に dbディレクトリを...
- 「サイト管理」→「開発」→「XMLDBエディタ」 でデータベー...
#br
*** global 変数
**** $DB
- データベースにアクセスする場合は必ず必要
**** $CFG
- $CFG->wwwroot : top url
- $CFG->prefix
**** $USER
- メンバ変数例
-- id => 2
-- username => admin
-- firstname => 管理
-- lastname => ユーザ
-- email => iseki@solar-system.tuis.ac.jp
-- emailstop => 0
-- city => 千葉市
-- country => JP
-- lang => ja_utf8
-- timezone => 9.0
-- firstaccess => 1259809008
-- lastaccess => 1273976520
-- lastlogin => 1273631570
-- currentlogin => 1273761631
**** $_POST
- empty($_POST)
#br
*** POST, GET
- required_param('course', PARAM_INT);
- optional_param('mode', default, PARAM_ALPHA);
#br
*** PAGE, OUTPUT
**** エラー: The theme has already been set up for this ...
- 通常は require_login() を実行してから ヘッダーを書く.
- ヘッダーを書いた後に require_login() を実行すると,上記...
- 対策: require_login() を実行してから ヘッダーを書く.
$PAGE->set_title($title);
$PAGE->set_heading($heading);
$PAGE->set_cacheable($cache); // true
$PAGE->set_button($button); // ' '
$PAGE->set_headingmenu($menu);
require_login($course->id);
echo $OUTPUT->header();
#br
*** 権限
- require_login($course->id)
#br
**** 2.x で廃止になった関数
- %%isadmin()%%
- %%isguest()%%
- %%isteacher($course->id)%%
**** 代替関数
- see jbxl_moodle_tools.php
#br
*** メッセージ
- メッセージテーブルはローカルに持つ
- ja_utf-8 → ja, en_utf-8 → en
- get_string( , )
#br
*** DataBase
- lib/dml/moodle_database.php
- $strictness: MUST_EXIST, IGNORE_MISSING
#br
**** $DB->count_records
$count = $DB->count_records('autoattend_sessions', array...
**** $DB->get_record(s)
- $DB-> get_record($table, array $conditions, $fields='*'...
if ($user = $DB->get_record('user', array('id'=>$USER->i...
$firstname = $user->firstname;
}
- $DB->get_records($table, array $conditions=null, $sort=...
if (!$vars = $DB->get_records('autoattend_settings', arr...
$vars = $DB->get_records('autoattend_settings', array...
}
**** $DB->get_records_sql
- $DB->get_record_sql($sql, array $params=null, $strictne...
$qey = "SELECT * FROM .......";
if ($users = $DB->get_records_sql($qry)) {
foreach($users as $key => $user) {
$return['id'] = $user->id;
$return['attsid'] = $user->attsid;
.............................
}
}
**** $DB->update_record, $DB->insert_record
$update = false;
if ($rec = $DB->get_record('autoattend_settings', array(...
$update = true;
}
$rec->courseid = $course->id;
............................
if ($update) {
$result = $DB->update_record('autoattend_settings', ...
}
else {
$result = $DB->insert_record('autoattend_settings', ...
}
unset($rec);
**** $DB->delete_records
$DB->delete_records('autoattend_settings', array('course...
*** ログ
- add_to_log($course->id, 'autoattend', 'restore settings...
#br
*** User Table
- [id] => 237
- [auth] => email
- [confirmed] => 1
- [policyagreed] => 0
- [deleted] => 0
- [suspended] => 0
- [mnethostid] => 1
- [username] => alice
- [password] => **************
- [idnumber] =>
- [firstname] => 電脳空間内アリス
- [lastname] => alice
- [email] => alice@edu.tuis.ac.jp
- [emailstop] => 0
- [icq] =>
- [skype] =>
- [yahoo] =>
- [aim] =>
- [msn] =>
- [phone1] =>
- [phone2] =>
- [institution] =>
- [department] =>
- [address] =>
- [city] => 電脳空間内
- [country] => AQ
- [lang] => ja
- [theme] =>
- [timezone] => 99
- [firstaccess] => 1272419261
- [lastaccess] => 1334212672
- [lastlogin] => 1309493183
- [currentlogin] => 1334212371
- [lastip] => 202.26.159.212
- [secret] =>
- [picture] => 0
- [url] =>
- [description] =>
- [descriptionformat] => 1
- [mailformat] => 1
- [maildigest] => 0
- [maildisplay] => 2
- [htmleditor] => 1
- [ajax] => 1
- [autosubscribe] => 1
- [trackforums] => 0
- [timecreated] => 1272419261
- [timemodified] => 1334212362
- [trustbitmask] => 0
- [imagealt] =>
- [screenreader] => 0
#br
*** settings.php
- admin_setting_configtext
- admin_setting_configcheckbox
- admin_setting_configselect
**** Moodle Data Cleaning Parameters
- see also https://github.com/moodle/moodle/blob/master/l...
- PARAM_RAW: specifies a parameter that is not cleaned or...
- PARAM_CLEAN: Obsolete, please try to use a more specifi...
- PARAM_INT: Integers only, use when expecting only numbers
- PARAM_INTEGER: Alias for PARAM_INT
- PARAM_ALPHA: Contains only english letters.
- PARAM_ACTION: Alias for PARAM_ALPHA, use for various ac...
- PARAM_FORMAT: Alias for PARAM_ALPHA, use for names of p...
- PARAM_NOTAGS: All HTML tags are stripped from the text....
- PARAM_MULTILANG: Alias of PARAM_TEXT.
- PARAM_TEXT: General plain text compatible with multilan...
- PARAM_FILE: Safe file name, all dangerous chars are str...
- PARAM_PATH: Safe relative path name, all dangerous char...
-- note: The leading slash is not removed, window drive l...
- PARAM_HOST: expected fully qualified domain name (FQDN)...
- PARAM_URL: expected properly formatted URL.
- PARAM_LOCALURL: expected properly formatted URL as well...
- PARAM_CLEANFILE: safe file name, all dangerous and regi...
- PARAM_ALPHANUM: expected numbers and letters only.
- PARAM_BOOL: converts input into 0 or 1, use for switche...
- PARAM_CLEANHTML: cleans submitted HTML code and removes...
-- note: do not forget to addslashes() before storing int...
- PARAM_ALPHAEXT: the same contents as PARAM_ALPHA plus t...
- PARAM_ALPHANUMEXT: expected numbers, letters only and _-.
- PARAM_SAFEDIR: safe directory name, suitable for includ...
- PARAM_SEQUENCE: expects a sequence of numbers like 8 to...
End:
** Moodle2.2 Programing
- Block: http://docs.moodle.org/en/Development:Blocks
- [[1.x→2.x>../1.x→2.x]]
#br
*** Data Base
- DB は全面的に XMLDB に移行
- $DB 変数必須
**** XMLDB
- http://dev.moodle.org/mod/resource/view.php?id=48
- block にディレクトリを作成し,その中に dbディレクトリを...
- 「サイト管理」→「開発」→「XMLDBエディタ」 でデータベー...
#br
*** global 変数
**** $DB
- データベースにアクセスする場合は必ず必要
**** $CFG
- $CFG->wwwroot : top url
- $CFG->prefix
**** $USER
- メンバ変数例
-- id => 2
-- username => admin
-- firstname => 管理
-- lastname => ユーザ
-- email => iseki@solar-system.tuis.ac.jp
-- emailstop => 0
-- city => 千葉市
-- country => JP
-- lang => ja_utf8
-- timezone => 9.0
-- firstaccess => 1259809008
-- lastaccess => 1273976520
-- lastlogin => 1273631570
-- currentlogin => 1273761631
**** $_POST
- empty($_POST)
#br
*** POST, GET
- required_param('course', PARAM_INT);
- optional_param('mode', default, PARAM_ALPHA);
#br
*** PAGE, OUTPUT
**** エラー: The theme has already been set up for this ...
- 通常は require_login() を実行してから ヘッダーを書く.
- ヘッダーを書いた後に require_login() を実行すると,上記...
- 対策: require_login() を実行してから ヘッダーを書く.
$PAGE->set_title($title);
$PAGE->set_heading($heading);
$PAGE->set_cacheable($cache); // true
$PAGE->set_button($button); // ' '
$PAGE->set_headingmenu($menu);
require_login($course->id);
echo $OUTPUT->header();
#br
*** 権限
- require_login($course->id)
#br
**** 2.x で廃止になった関数
- %%isadmin()%%
- %%isguest()%%
- %%isteacher($course->id)%%
**** 代替関数
- see jbxl_moodle_tools.php
#br
*** メッセージ
- メッセージテーブルはローカルに持つ
- ja_utf-8 → ja, en_utf-8 → en
- get_string( , )
#br
*** DataBase
- lib/dml/moodle_database.php
- $strictness: MUST_EXIST, IGNORE_MISSING
#br
**** $DB->count_records
$count = $DB->count_records('autoattend_sessions', array...
**** $DB->get_record(s)
- $DB-> get_record($table, array $conditions, $fields='*'...
if ($user = $DB->get_record('user', array('id'=>$USER->i...
$firstname = $user->firstname;
}
- $DB->get_records($table, array $conditions=null, $sort=...
if (!$vars = $DB->get_records('autoattend_settings', arr...
$vars = $DB->get_records('autoattend_settings', array...
}
**** $DB->get_records_sql
- $DB->get_record_sql($sql, array $params=null, $strictne...
$qey = "SELECT * FROM .......";
if ($users = $DB->get_records_sql($qry)) {
foreach($users as $key => $user) {
$return['id'] = $user->id;
$return['attsid'] = $user->attsid;
.............................
}
}
**** $DB->update_record, $DB->insert_record
$update = false;
if ($rec = $DB->get_record('autoattend_settings', array(...
$update = true;
}
$rec->courseid = $course->id;
............................
if ($update) {
$result = $DB->update_record('autoattend_settings', ...
}
else {
$result = $DB->insert_record('autoattend_settings', ...
}
unset($rec);
**** $DB->delete_records
$DB->delete_records('autoattend_settings', array('course...
*** ログ
- add_to_log($course->id, 'autoattend', 'restore settings...
#br
*** User Table
- [id] => 237
- [auth] => email
- [confirmed] => 1
- [policyagreed] => 0
- [deleted] => 0
- [suspended] => 0
- [mnethostid] => 1
- [username] => alice
- [password] => **************
- [idnumber] =>
- [firstname] => 電脳空間内アリス
- [lastname] => alice
- [email] => alice@edu.tuis.ac.jp
- [emailstop] => 0
- [icq] =>
- [skype] =>
- [yahoo] =>
- [aim] =>
- [msn] =>
- [phone1] =>
- [phone2] =>
- [institution] =>
- [department] =>
- [address] =>
- [city] => 電脳空間内
- [country] => AQ
- [lang] => ja
- [theme] =>
- [timezone] => 99
- [firstaccess] => 1272419261
- [lastaccess] => 1334212672
- [lastlogin] => 1309493183
- [currentlogin] => 1334212371
- [lastip] => 202.26.159.212
- [secret] =>
- [picture] => 0
- [url] =>
- [description] =>
- [descriptionformat] => 1
- [mailformat] => 1
- [maildigest] => 0
- [maildisplay] => 2
- [htmleditor] => 1
- [ajax] => 1
- [autosubscribe] => 1
- [trackforums] => 0
- [timecreated] => 1272419261
- [timemodified] => 1334212362
- [trustbitmask] => 0
- [imagealt] =>
- [screenreader] => 0
#br
*** settings.php
- admin_setting_configtext
- admin_setting_configcheckbox
- admin_setting_configselect
**** Moodle Data Cleaning Parameters
- see also https://github.com/moodle/moodle/blob/master/l...
- PARAM_RAW: specifies a parameter that is not cleaned or...
- PARAM_CLEAN: Obsolete, please try to use a more specifi...
- PARAM_INT: Integers only, use when expecting only numbers
- PARAM_INTEGER: Alias for PARAM_INT
- PARAM_ALPHA: Contains only english letters.
- PARAM_ACTION: Alias for PARAM_ALPHA, use for various ac...
- PARAM_FORMAT: Alias for PARAM_ALPHA, use for names of p...
- PARAM_NOTAGS: All HTML tags are stripped from the text....
- PARAM_MULTILANG: Alias of PARAM_TEXT.
- PARAM_TEXT: General plain text compatible with multilan...
- PARAM_FILE: Safe file name, all dangerous chars are str...
- PARAM_PATH: Safe relative path name, all dangerous char...
-- note: The leading slash is not removed, window drive l...
- PARAM_HOST: expected fully qualified domain name (FQDN)...
- PARAM_URL: expected properly formatted URL.
- PARAM_LOCALURL: expected properly formatted URL as well...
- PARAM_CLEANFILE: safe file name, all dangerous and regi...
- PARAM_ALPHANUM: expected numbers and letters only.
- PARAM_BOOL: converts input into 0 or 1, use for switche...
- PARAM_CLEANHTML: cleans submitted HTML code and removes...
-- note: do not forget to addslashes() before storing int...
- PARAM_ALPHAEXT: the same contents as PARAM_ALPHA plus t...
- PARAM_ALPHANUMEXT: expected numbers, letters only and _-.
- PARAM_SAFEDIR: safe directory name, suitable for includ...
- PARAM_SEQUENCE: expects a sequence of numbers like 8 to...
Page:
Site Search
Advanced Search
Login
Username:
Password:
Lost Password?
Register now!!
Sub Menu
New Arrivals
Books
Web Links
Site Map
e-Learning
TUIS Certificate
mini Calendar
May 2025
Su
Mo
Tu
We
Th
Fr
Sa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Today
Who's Online
73 user(s) are online (4 user(s) are browsing xpwiki)
Members: 0
Guests: 73
more...
Access Counter
Today :
Yesterday :
Total :
Powered by XOOPS Cube 2.1© 2001-2006
XOOPS Cube Project
Design by
XoopsDesign.com