flagflag  If you want to see English page, please click "English" Button at Left.
Page Top

Data Base anchor.png

  • DB は全面的に XMLDB に移行
  • $DB 変数必須
Page Top
XMLDB anchor.png
  • http://dev.moodle.org/mod/resource/view.​php?id=48
  • block にディレクトリを作成し,その中に dbディレクトリを作る.
  • 「サイト管理」→「開発」→「XMLDBエディタ」 でデータベース定義用の db/install.xml を作成する.
     
Page Top

global 変数 anchor.png

Page Top
$DB anchor.png
  • データベースにアクセスする場合は必ず必要
Page Top
$CFG anchor.png
  • $CFG->wwwroot : top url
  • $CFG->prefix
Page Top
$USER anchor.png
  • メンバ変数例
    • 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
Page Top
$_POST anchor.png
  • empty($_POST)
 
Page Top

POST, GET anchor.png

  • required_param('course', PARAM_INT);
  • optional_param('mode', default, PARAM_ALPHA);
     
Page Top

PAGE, OUTPUT anchor.png

Page Top
エラー: The theme has already been set up for this page ready for output. Therefore, you can no longer change the theme, or anything that might affect what the current theme is, for example, the course. anchor.png
  • 通常は 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();
     
Page Top

権限 anchor.png

  • require_login($course->id)
 
Page Top
2.x で廃止になった関数 anchor.png
  • isadmin()
  • isguest()
  • isteacher($course->id)
Page Top
代替関数 anchor.png
  • see jbxl_moodle_tools.php
     
Page Top

メッセージ anchor.png

  • メッセージテーブルはローカルに持つ
  • ja_utf-8 → ja, en_utf-8 → en
  • get_string( , )
     
Page Top

DataBase anchor.png

  • lib/dml/moodle_database.php
  • $strictness: MUST_EXIST, IGNORE_MISSING
     
Page Top
$DB->count_records anchor.png
$count = $DB->count_records('autoattend_sessions', array('courseid'=>$course->id, 'sessdate'=>$sdate, 'starttime'=>$starttime));
Page Top
$DB->get_record(s) anchor.png
  • $DB-> get_record($table, array $conditions, $fields='*', $strictness=IGNORE_MISSING)
    if ($user = $DB->get_record('user', array('id'=>$USER->id))) {
       $firstname = $user->firstname;
    }
  • $DB->get_records($table, array $conditions=null, $sort='', $fields='*', $limitfrom=0, $limitnum=0)
    if (!$vars = $DB->get_records('autoattend_settings', array('courseid'=>$courseid), 'id ASC')) {
       $vars = $DB->get_records('autoattend_settings', array('courseid'=>0));      // use default
    }
Page Top
$DB->get_records_sql anchor.png
  • $DB->get_record_sql($sql, array $params=null, $strictness=IGNORE_MISSING)
    $qey = "SELECT * FROM .......";
    if ($users = $DB->get_records_sql($qry)) {
       foreach($users as $key => $user) {
           $return['id']      = $user->id;
           $return['attsid'] = $user->attsid;
           .............................
       }
    }
Page Top
$DB->update_record, $DB->insert_record anchor.png
$update = false;
if ($rec = $DB->get_record('autoattend_settings', array('courseid'=>$course->id, 'status'=>$status[$i]))) {
   $update = true;
}
$rec->courseid = $course->id;
............................
if ($update) {
    $result = $DB->update_record('autoattend_settings', $rec);
}
else {
    $result = $DB->insert_record('autoattend_settings', $rec);
}
unset($rec);
Page Top
$DB->delete_records anchor.png
$DB->delete_records('autoattend_settings', array('courseid'=>$course->id));
Page Top

ログ anchor.png

  • add_to_log($course->id, 'autoattend', 'restore settings', 'att_settings.php?course='.$course->id);​
     
Page Top

User Table anchor.png

  • [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
 
Page Top

settings.php anchor.png

  • admin_setting_configtext
  • admin_setting_configcheckbox
  • admin_setting_configselect
Page Top
Moodle Data Cleaning Parameters anchor.png
  • 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_ALPHANUMEXT: expected numbers, letters only and _-.
  • 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.

トップ   凍結 差分 バックアップ 複製 名前変更 リロード   新規 ページ一覧 単語検索 最終更新   ヘルプ   最終更新のRSS 1.0 最終更新のRSS 2.0 最終更新のRSS Atom
Counter: 3263, today: 2, yesterday: 1
最終更新: 2018-09-18 (火) 21:09:55 (JST) (2039d) by iseki

サイト内 検索

ログイン

ユーザー名:

パスワード:


パスワード紛失
新規登録

サブ メニュー

ミニカレンダー

前月2024年 4月翌月
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
<今日>

オンライン状況

71 人のユーザが現在オンラインです。 (9 人のユーザが xpwiki を参照しています。)

登録ユーザ: 0
ゲスト: 71

もっと...

アクセスカウンタ

今日 : 9907990799079907
昨日 : 8008800880088008
総計 : 2328554323285543232855432328554323285543232855432328554323285543
Powered by XOOPS Cube 2.1© 2001-2006 XOOPS Cube Project
Design by XoopsDesign.com