1: 2010-03-28 (日) 10:33:21 iseki |
現: 2013-03-20 (水) 09:39:44 iseki |
- | *** XMLDB [#r9a4bceb] | + | ** Moodle1.9 Programing [#l2cb4679] |
| + | - http://docs.moodle.org/dev/Blocks/Blocks_for_1.5_to_1.9 |
| + | #br |
| + | |
| + | *** global 変数 [#s52b390d] |
| + | |
| + | **** $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) |
| + | |
| + | #br |
| + | *** POST, GET [#i893cfed] |
| + | - required_param('course', PARAM_INT); |
| + | - optional_param('mode', default, PARAM_ALPHA); |
| + | #br |
| + | |
| + | *** 権限 [#kca35ac9] |
| + | - isadmin() |
| + | - isguest() |
| + | - require_login($course->id); |
| + | - isteacher($course->id) |
| + | #br |
| + | |
| + | |
| + | |
| + | |
| + | *** メッセージ [#pb1c2054] |
| + | - get_string( , ) |
| + | #br |
| + | |
| + | *** DataBase [#v4abf387] |
| + | - lib/dmllib.php |
| + | #br |
| + | |
| + | **** count_records [#rc2a2d4a] |
| + | $count = count_records('autoattend_sessions', 'courseid', $course->id, 'sessdate', $sdate, 'starttime', $starttime); |
| + | |
| + | **** get_record(s) [#z3e3f469] |
| + | - get_record($table, $field1, $value1, $field2="", $value2="", $field3="", $value3="", $fields='*') |
| + | if ($user = get_record('user', 'id', $USER->id)) { |
| + | $firstname = $user->firstname; |
| + | } |
| + | - get_records($table, $field="", $value="", $sort="", $fields='*', $limitfrom="", $limitnum="") |
| + | if (!$vars = get_records('autoattend_settings', 'courseid', $courseid, 'id')) { |
| + | $vars = get_records('autoattend_settings', 'courseid', 0); // use default |
| + | } |
| + | |
| + | **** get_records_sql [#r096c770] |
| + | $qey = "SELECT * FROM ......."; |
| + | if ($users = get_records_sql($qry)) { |
| + | foreach($users as $key => $user) { |
| + | $return['id'] = $user->id; |
| + | $return['attsid'] = $user->attsid; |
| + | ............................. |
| + | } |
| + | } |
| + | |
| + | **** update_record, insert_record [#bfdf5685] |
| + | $update = false; |
| + | if ($rec = get_record('autoattend_settings', 'courseid', $course->id, 'status', $status[$i])) { |
| + | $update = true; |
| + | } |
| + | $rec->courseid = $course->id; |
| + | ............................ |
| + | if ($update) { |
| + | $result = update_record('autoattend_settings', $rec); |
| + | } |
| + | else { |
| + | $result = insert_record('autoattend_settings', $rec); |
| + | } |
| + | unset($rec); |
| + | |
| + | **** delete_records [#u570f164] |
| + | delete_records('autoattend_settings', 'courseid', $course->id); |
| + | |
| + | **** XMLDB [#yaa09041] |
| - http://dev.moodle.org/mod/resource/view.php?id=48 | | - http://dev.moodle.org/mod/resource/view.php?id=48 |
- | - block または mod にディレクトリを作成し,その中に dbディレクトリを作る. | + | - block にディレクトリを作成し,その中に dbディレクトリを作る. |
| - 「サイト管理」→「その他」→「XMLDBエディタ」 でデータベース定義用の db/install.xml を作成する. | | - 「サイト管理」→「その他」→「XMLDBエディタ」 でデータベース定義用の db/install.xml を作成する. |
| + | #br |
| + | |
| + | *** ログ [#q8c98d5f] |
| + | - add_to_log($course->id, 'autoattend', 'restore settings', 'att_settings.php?course='.$course->id); |
| + | #br |
| + | |
| + | *** Form [#o9495a23] |
| + | |
| + | #br |
| + | |
| + | *** settings.php [#m49c050d] |
| + | - admin_setting_configtext |
| + | - admin_setting_configcheckbox |
| + | - admin_setting_configselect |
| + | |
| + | **** Moodle Data Cleaning Parameters [#z68f6bc6] |
| + | - PARAM_RAW: specifies a parameter that is not cleaned or processed in any way. |
| + | - PARAM_CLEAN: Obsolete, please try to use a more specific type of parameter. |
| + | - 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 actions in forms and URLs. |
| + | - PARAM_FORMAT: Alias for PARAM_ALPHA, use for names of plugins, formats, etc. |
| + | - PARAM_NOTAGS: All HTML tags are stripped from the text. Do not abuse this type. |
| + | - PARAM_MULTILANG: Alias of PARAM_TEXT. |
| + | - PARAM_TEXT: General plain text compatible with multilang filter, no other html tags. |
| + | - PARAM_FILE: Safe file name, all dangerous chars are stripped, protects against XSS, SQL injections and directory traversals. |
| + | - PARAM_PATH: Safe relative path name, all dangerous chars are stripped, protects against XSS, SQL injections and directory traversals |
| + | -- note: The leading slash is not removed, window drive letter is not allowed |
| + | - PARAM_HOST: expected fully qualified domain name (FQDN) or an IPv4 dotted quad (IP address) |
| + | - PARAM_URL: expected properly formatted URL. |
| + | - PARAM_LOCALURL: expected properly formatted URL as well as one that refers to the local server itself. NOT orthogonal to the others! Implies PARAM_URL! |
| + | - PARAM_CLEANFILE: safe file name, all dangerous and regional chars are removed, |
| + | - PARAM_ALPHANUM: expected numbers and letters only. |
| + | - PARAM_BOOL: converts input into 0 or 1, use for switches in forms and urls. |
| + | - PARAM_CLEANHTML: cleans submitted HTML code and removes slashes |
| + | -- note: do not forget to addslashes() before storing into database! |
| + | - PARAM_ALPHAEXT: the same contents as PARAM_ALPHA plus the chars in quotes: "/-_" allowed, suitable for include() and require() |
| + | - PARAM_SAFEDIR: safe directory name, suitable for include() and require() |
| + | - PARAM_SEQUENCE: expects a sequence of numbers like 8 to 1, 5, 6, 4, 6, 8, 9. Numbers and commas only. |