Creating mobile question types: Difference between revisions
From MoodleDocs
Marcus Green (talk | contribs) (Created page with " An empty template for creating quiz question types is available from here and it incorporates the skeleton code for supporting the App. https://github.com/marcusgreen/moodle...") |
Marcus Green (talk | contribs) No edit summary |
||
Line 7: | Line 7: | ||
The files that need to be modified/added are | The files that need to be modified/added are | ||
db/mobile.php | * db/mobile.php | ||
classes/output/mobile.php | * classes/output/mobile.php | ||
mobile/mobile.js | * mobile/mobile.js | ||
mobile/addon-qtype-YOURQTYPENAME.html | * mobile/addon-qtype-YOURQTYPENAME.html | ||
styles_app.css | * styles_app.css | ||
Create a new file db/mobile.php | Create a new file db/mobile.php |
Revision as of 22:15, 31 December 2018
An empty template for creating quiz question types is available from here and it incorporates the skeleton code for supporting the App.
https://github.com/marcusgreen/moodle-qtype_TEMPLATE
The files that need to be modified/added are
- db/mobile.php
- classes/output/mobile.php
- mobile/mobile.js
- mobile/addon-qtype-YOURQTYPENAME.html
- styles_app.css
Create a new file db/mobile.php
defined('MOODLE_INTERNAL') || die();
$addons = [
"qtype_YOURQTYPENAME" => [
"handlers" => [ // Different places where the add-on will display content.
'YOURQTYPENAME' => [ // Handler unique name (can be anything).
'displaydata' => [
'title' => 'YOURQTYPENAME question',
'icon' => '/question/type/YOURQTYPENAME/pix/icon.gif',
'class' => ,
],
'delegate' => 'CoreQuestionDelegate', // Delegate (where to display the link to the add-on).
'method' => 'mobile_get_YOURQTYPENAME',
'offlinefunctions' => [
'mobile_get_YOURQTYPENAME' => [],// function in classes/output/mobile.php
], // Function needs caching for offline.
'styles' => [
'url' => '/question/type/YOURQTYPENAME/mobile/styles_app.css',
'version' => '1.00'
]
]
],
'lang' => [
['pluginname', 'qtype_YOURQTYPENAME'], // matching value in lang/en/qtype_YOURQTYPENAME
],
]
];