|
現: 2021-07-29 (木) 15:12:00 iseki |
| + | *** event log [#ofb93dda] |
| | | |
| + | **** block_autoattend\event\view_log [#a41616c9] |
| + | - コンポーネント名: block_autoattend |
| + | - ターゲット名: view |
| + | - アクション名: log |
| + | |
| + | - ファイル名: classes/event/ターゲット名_アクション名.php (この命名規則に従わないとシステムが読んでくれない) |
| + | -- 変更後 キャッシュをクリア |
| + | -- バージョンをアップする.(説明書にはすると書いてあるがしなくてもよい) |
| + | |
| + | |
| + | - オブジェクトに値を渡すには,$this->other[] を使用する. |
| + | #br |
| + | |
| + | **** イベントオブジェクトの構造 for module [#i18c053f] |
| + | mod_autoattendmod\event\add_to_log Object ( |
| + | [data:protected] => Array ( |
| + | [eventname] => \mod_autoattendmod\event\add_to_log |
| + | [component] => mod_autoattendmod |
| + | [action] => log |
| + | [target] => add_to |
| + | [objecttable] => |
| + | [objectid] => |
| + | [crud] => c |
| + | [edulevel] => 0 |
| + | [contextid] => 416 |
| + | [contextlevel] => 70 |
| + | [contextinstanceid] => 142 |
| + | [userid] => 5 |
| + | [courseid] => 2 |
| + | [relateduserid] => |
| + | [anonymous] => 0 |
| + | [other] => |
| + | [timecreated] => 1417150766 |
| + | ) |
| + | [logextra:protected] => Array ( |
| + | [origin] => web |
| + | [ip] => 172.22.1.79 |
| + | [realuserid] => |
| + | ) |
| + | [context:protected] => |
| + | [triggered:core\event\base:private] => 1 |
| + | [dispatched:core\event\base:private] => 1 |
| + | [restored:core\event\base:private] => 1 |
| + | [recordsnapshots:core\event\base:private] => Array ( ) |
| + | ) |
| + | |
| + | **** イベントオブジェクトの構造 for block [#l935e5d0] |
| + | block_autoattend\event\view_log ( |
| + | [data:protected] => Array ( |
| + | [eventname] => \block_autoattend\event\view_log |
| + | [component] => block_autoattend |
| + | [action] => log |
| + | [target] => view |
| + | [objecttable] => |
| + | [objectid] => |
| + | [crud] => r |
| + | [edulevel] => 0 |
| + | [contextid] => 15 |
| + | [contextlevel] => 50 |
| + | [contextinstanceid] => 2 |
| + | [userid] => 5 : |
| + | [courseid] => 2 |
| + | [relateduserid] => |
| + | [anonymous] => 0 |
| + | [other] => |
| + | [timecreated] => 1417154135 |
| + | ) |
| + | [logextra:protected] => |
| + | [context:protected] => context_course Object ( |
| + | [_id:protected] => 15 |
| + | [_contextlevel:protected] => 50 |
| + | [_instanceid:protected] => 2 |
| + | [_path:protected] => /1/3/15 |
| + | [_depth:protected] => 3 |
| + | ) |
| + | [triggered:core\event\base:private] => |
| + | [dispatched:core\event\base:private] => |
| + | [restored:core\event\base:private] => |
| + | [recordsnapshots:core\event\base:private] => Array ( ) |
| + | ) |
| + | |
| + | #br |
| + | |
| + | **** doc.moodle.org [#p59b57fa] |
| + | - add_to_log() has been deprecated, please rewrite your code to the new events API |
| + | - http://docs.moodle.org/dev/Migrating_logging_calls_in_plugins |
| + | |
| + | $event = \mod_wiki\event\page_updated::create( |
| + | array( |
| + | 'context' => $context, |
| + | 'objectid' => $wikipage->id, |
| + | 'relateduserid' => $userid, |
| + | 'other' => array( |
| + | 'newcontent' => $newcontent |
| + | ) |
| + | )); |
| + | $event->add_record_snapshot('wiki', $wiki); |
| + | $event->add_record_snapshot('wiki_pages', $wikipage); |
| + | $event->add_record_snapshot('wiki_versions', $version); |
| + | $event->trigger(); |
| + | |
| + | $params = array( |
| + | 'context' => $context, |
| + | 'objectid' => $post->id, |
| + | 'other' => array( |
| + | 'content' => $post->message, |
| + | 'pathnamehashes' => array_keys($files), |
| + | 'discussionid' => $post->discussion, |
| + | 'triggeredfrom' => $name, |
| + | ) |
| + | ); |
| + | $event = \mod_forum\event\assessable_uploaded::create($params); |
| + | $event->trigger(); |
| + | #br |