Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Repository plugin files

From MoodleDocs
Revision as of 10:05, 5 December 2012 by David Smith 2 (talk | contribs) (Created page with "This is an overview of the files that are found within Repository plugins. * /repository/myplugin/'''lib.php''' - this contains the core functionality for your plugin. Within...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

This is an overview of the files that are found within Repository plugins.

  • /repository/myplugin/lib.php - this contains the core functionality for your plugin. Within it you must define a class:

class repository_myplugin extends repository {

 // See Repository plugins for a list of functions to override in here

}

defined('MOODLE_INTERNAL') || die(); $plugin->version = 2012061700; //The current plugin version (Date: YYYYMMDDXX) $plugin->requires = 2012061700; //Requires this Moodle version $plugin->component = 'repository_myplugin'; //Full name of the plugin (used for diagnostics) $plugin->cron = 0; // How often to run automatic updates (0 to disable) $plugin->release = 'Human-readable version number';

  • /repository/myplugin/lang/en/repository_myplugin.php - contains the English language strings for display by your plugin. As a minimum, this must include:

defined('MOODLE_INTERNAL') || die(); $string['pluginname'] = 'My plugin repository'; $string['configplugin'] = 'Configuration for my plugin repository';

  • /repository/myplugin/db/access.php - defines any user capabilities related to the plugin. A basic access.php file will look like this:

defined('MOODLE_INTERNAL') || die(); $capabilities = array(

   'repository/myplugin:view' => array(
       'captype' => 'read',
       'contextlevel' => CONTEXT_MODULE,
       'archetypes' => array(
           'user' => CAP_ALLOW 
       )
   )

);

See also