O'Reilly logo

Moodle 3.x Developer's Guide by Ian Wild

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Synchronisation settings

Storing and retrieving settings will need to be managed by the framework_importer class. We can implement a new function that attempts to load settings from our new database table and, if it fails to do so, stores a set of defaults (so-called "lazy" loading). The following is the init() function in its entirety:

function init() {       global $DB;       // Get details of external database from our config. Currently we       do this one record at a time, which is a little clunky:       $records = $DB->get_records('tool_lpsync', null, null);       // if there aren't any entries in the table then we need to       prepare them:       if(count($records) == 0)       {             $rows = array(  'type' => 'mysqli',                              'host' => 'localhost',                              'user' => '',  'pass' => '',  ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required