Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You'll need to create a local plugin.</p> <p><a href="http://docs.moodle.org/dev/Local_plugins" rel="nofollow">http://docs.moodle.org/dev/Local_plugins</a></p> <p>Create the plugin in /local/myplugnname</p> <p>Create an events.php file</p> <pre><code>/local/mypluginname/db/events.php </code></pre> <p>With this</p> <pre><code>$handlers = array ( 'course_completed' =&gt; array ( 'handlerfile' =&gt; '/local/mypluginname/lib.php', 'handlerfunction' =&gt; 'local_mypluginname_course_completed', 'schedule' =&gt; 'cron', 'internal' =&gt; 1, ), </code></pre> <p>Have a look here for more info <a href="http://docs.moodle.org/dev/Events_API#Handling_an_event" rel="nofollow">http://docs.moodle.org/dev/Events_API#Handling_an_event</a></p> <p>You'll need a version.php file to install the plugin and add the event handler.</p> <p>Then create a function</p> <pre><code>function local_mypluginname_course_completed($eventdata) </code></pre> <p>in </p> <pre><code>/local/mypluginname/lib.pgp </code></pre> <p>This will be called when the cron runs</p> <p>To find out the contents of $eventdata have a look at</p> <pre><code>events_trigger('course_completed', $this-&gt;get_record_data()); </code></pre> <p>in </p> <pre><code>/completion/completion_completion.php </code></pre> <p>To update a remote database have a look at the code in db authentication</p> <pre><code>/auth/db/auth.php </code></pre> <p>Something like</p> <pre><code>$mydb = ADONewConnection('mysql'); $mydb-&gt;Connect($dbhost, $dbuser, $dbpass, $dbname, false); $mydb-&gt;Execute($insertsql); $mydb-&gt;Close(); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload