flagflag  
4: 2010-05-15 (Sat) 08:41:05 admin source Cur: 2013-03-20 (Wed) 09:39:44 iseki source
Line 1: Line 1:
-** Block [#cd316551+** Moodle1.9 Programing [#l2cb4679
-- http://docs.moodle.org/en/Development:Blocks+- http://docs.moodle.org/dev/Blocks/Blocks_for_1.5_to_1.9
#br #br
-global 変数 
-$CFG, $USER+*** global 変数 [#s52b390d]
-$CFG->wwwroot   top url +**** $CFG [#v460c415] 
-$CFG->prefix +- $CFG->wwwroot :  top url 
-$USER->id +- $CFG->prefix
-empty($submit)+
-$_POST+**** $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
-isadmin() 
-isguest() 
-require_login($course->id); 
-isteacher($course->id) 
-パラメータ 
 +*** メッセージ [#pb1c2054]
 +- get_string( , )
 +#br
-required_param('course',  PARAM_INT);  // Course id +*** DataBase [#v4abf387] 
-optional_param('mode', '', PARAM_ALPHA); // one or multiply or empty+- 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 ......."
-get_string( , ) + if ($users = get_records_sql($qry)) { 
- +    foreach($users as $key => $user) { 
- +        $return['id']     = $user->id; 
-DB操作 +        $return['attsid'] = $user->attsid; 
- +       .............................
-$course = get_record('course', 'id', $courseid) +
-$user = get_record("user", "id", $USER->id) +
-delete_records('autoattend_settings', 'courseid', $course->id); +
- +
-insert_record('autoattend_sessions', $rec) +
- +
-$count = count_records('autoattend_sessions', 'courseid', $course->id, 'sessdate', $sdate, 'starttime', $starttime); +
- +
-lib/dmllib.php +
- +
-get_record($table, $field1, $value1, $field2='', $value2='', $field3='', $value3='', $fields='*') +
- +
-get_records($table, $field='', $value='', $sort='', $fields='*', $limitfrom='', $limitnum='') +
- +
-       if ($rec = get_record('autoattend_settings', 'courseid', $course->id, 'status', $status[$i])) { +
-            $update = true+
-        } +
-       $rec->courseid = $course->id; +
-       $rec->status  = $status[$i]; +
-       $rec->grade    = $grade[$i]; +
- +
-       if (@$update) { +
-           $result = update_record('autoattend_settings', $rec); +
-           if (!$result) break; +
-       } +
-       else { +
-           $result = insert_record('autoattend_settings', $rec); +
-           if (!$result) break; +
-       } +
-       unset($rec); +
- +
- +
- +
- +
-   if ($users = get_records_sql($qry)) { +
-        foreach($users as $key => $user) { +
-            $return['id']         = $user->id; +
-            $return['attsid']     = $user->attsid+
-           $return['studentid']  = $user->studentid; +
-           $return['status']    = $user->status; +
-           $return['called']    = $user->called; +
-           $return['calledby']  = $user->calledby; +
-           $return['calledtime'] = $user->calledtime; +
-           $return['remarks']    = $user->remarks; +
-           $return['ipaddress']  = $user->ipaddress+
-       }+
   }    }
 + }
 +**** 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]
-add_to_log($course->id, 'autoattend', 'restore settings', 'att_settings.php?course='.$course->id);​ +
- +
-*** DataBase [#g7c2770d] +
-*** XMLDB [#r9a4bceb]+
- http://dev.moodle.org/mod/resource/view.​php?id=48 - http://dev.moodle.org/mod/resource/view.​php?id=48
- block にディレクトリを作成し,その中に 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 #br
*** Form [#o9495a23] *** Form [#o9495a23]
 +
 +#br
*** settings.php [#m49c050d] *** settings.php [#m49c050d]


Front page   New List of Pages Search Recent changes   Help   RSS of recent changes (RSS 1.0) RSS of recent changes (RSS 2.0) RSS of recent changes (RSS Atom)

Site Search

Login

Username:

Password:


Lost Password?
Register now!!

Sub Menu

mini Calendar

Last MonthNov 2024Next Month
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
Today

Who's Online

261 user(s) are online (100 user(s) are browsing xpwiki)

Members: 0
Guests: 261

more...

Access Counter

Today : 2948294829482948
Yesterday : 3947394739473947
Total : 2446683124466831244668312446683124466831244668312446683124466831
Powered by XOOPS Cube 2.1© 2001-2006 XOOPS Cube Project
Design by XoopsDesign.com