Moodle/Programming/2.2
をテンプレートにして作成
[
トップ
] [
タイトル一覧
|
ページ一覧
|
新規
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
** Moodle2.2 Programing [#l2cb4679]
- Block: http://docs.moodle.org/en/Development:Blocks
- [[1.x→2.x>../1.x→2.x]]
*** Data Base [#xc80db23]
- DB は全面的に XMLDB に移行
- $DB 変数必須
**** XMLDB [#yaa09041]
- http://dev.moodle.org/mod/resource/view.php?id=48
- block にディレクトリを作成し,その中に dbディレクトリを...
- 「サイト管理」→「開発」→「XMLDBエディタ」 でデータベー...
*** global 変数 [#s52b390d]
**** $DB [#c208b528]
- データベースにアクセスする場合は必ず必要
**** $CFG [#v460c415]
- $CFG->wwwroot : top url
- $CFG->prefix
**** $USER [#ecf0673b]
- メンバ変数例
-- 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 [#jf217b7d]
- empty($_POST)
*** POST, GET [#i893cfed]
- required_param('course', PARAM_INT);
- optional_param('mode', default, PARAM_ALPHA);
*** PAGE, OUTPUT [#p5713263]
**** エラー: 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();
*** 権限 [#kca35ac9]
- require_login($course->id)
**** 2.x で廃止になった関数 [#c3786957]
- %%isadmin()%%
- %%isguest()%%
- %%isteacher($course->id)%%
**** 代替関数 [#iafed563]
- see jbxl_moodle_tools.php
*** メッセージ [#pb1c2054]
- メッセージテーブルはローカルに持つ
- ja_utf-8 → ja, en_utf-8 → en
- get_string( , )
*** DataBase [#v4abf387]
- lib/dml/moodle_database.php
- $strictness: MUST_EXIST, IGNORE_MISSING
**** $DB->count_records [#rc2a2d4a]
$count = $DB->count_records('autoattend_sessions', array...
**** $DB->get_record(s) [#z3e3f469]
- $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 [#r096c770]
- $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 [#bfdf5685]
$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 [#u570f164]
$DB->delete_records('autoattend_settings', array('course...
*** ログ [#q8c98d5f]
- add_to_log($course->id, 'autoattend', 'restore settings...
*** User Table [#ne3233f5]
- [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
*** settings.php [#m49c050d]
- admin_setting_configtext
- admin_setting_configcheckbox
- admin_setting_configselect
**** Moodle Data Cleaning Parameters [#z68f6bc6]
- 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...
終了行:
** Moodle2.2 Programing [#l2cb4679]
- Block: http://docs.moodle.org/en/Development:Blocks
- [[1.x→2.x>../1.x→2.x]]
*** Data Base [#xc80db23]
- DB は全面的に XMLDB に移行
- $DB 変数必須
**** XMLDB [#yaa09041]
- http://dev.moodle.org/mod/resource/view.php?id=48
- block にディレクトリを作成し,その中に dbディレクトリを...
- 「サイト管理」→「開発」→「XMLDBエディタ」 でデータベー...
*** global 変数 [#s52b390d]
**** $DB [#c208b528]
- データベースにアクセスする場合は必ず必要
**** $CFG [#v460c415]
- $CFG->wwwroot : top url
- $CFG->prefix
**** $USER [#ecf0673b]
- メンバ変数例
-- 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 [#jf217b7d]
- empty($_POST)
*** POST, GET [#i893cfed]
- required_param('course', PARAM_INT);
- optional_param('mode', default, PARAM_ALPHA);
*** PAGE, OUTPUT [#p5713263]
**** エラー: 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();
*** 権限 [#kca35ac9]
- require_login($course->id)
**** 2.x で廃止になった関数 [#c3786957]
- %%isadmin()%%
- %%isguest()%%
- %%isteacher($course->id)%%
**** 代替関数 [#iafed563]
- see jbxl_moodle_tools.php
*** メッセージ [#pb1c2054]
- メッセージテーブルはローカルに持つ
- ja_utf-8 → ja, en_utf-8 → en
- get_string( , )
*** DataBase [#v4abf387]
- lib/dml/moodle_database.php
- $strictness: MUST_EXIST, IGNORE_MISSING
**** $DB->count_records [#rc2a2d4a]
$count = $DB->count_records('autoattend_sessions', array...
**** $DB->get_record(s) [#z3e3f469]
- $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 [#r096c770]
- $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 [#bfdf5685]
$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 [#u570f164]
$DB->delete_records('autoattend_settings', array('course...
*** ログ [#q8c98d5f]
- add_to_log($course->id, 'autoattend', 'restore settings...
*** User Table [#ne3233f5]
- [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
*** settings.php [#m49c050d]
- admin_setting_configtext
- admin_setting_configcheckbox
- admin_setting_configselect
**** Moodle Data Cleaning Parameters [#z68f6bc6]
- 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...
ページ名: