Note:

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

Moodle Mobile 2 (Ionic 1) Remote add-ons: Difference between revisions

From MoodleDocs
(Created page with "Only available for Moodle 3.1 onwards. A Moodle Mobile remote addon is the mobile app version of a Moodle plugin that will be loaded when a user accesses the plugin on the ap...")
 
mNo edit summary
Line 1: Line 1:
Only available for Moodle 3.1 onwards.
Only available for Moodle 3.1 onwards.


A Moodle Mobile remote addon is the mobile app version of a Moodle plugin that will be loaded when a user accesses the plugin on the app.
A Moodle Mobile remote add-on is the mobile app version of a Moodle plugin that will be loaded when a user accesses the plugin on the app.


Moodle Mobile remote addons are stored within a Moodle plugin and are downloaded and lazy-loaded by the Mobile app in every site that uses them.
Moodle Mobile remote add-ons are stored within a Moodle plugin and are downloaded and lazy-loaded by the Mobile app in every site that uses them.


Moodle plugins can include several Mobile addons, they also can declare dependencies between plugins.
Moodle plugins can include several Mobile add-ons. They can also declare dependencies between plugins.


We can say that a Remote addon is an special version of a Moodle Mobile addon. The main differences are:
We can say that a remote add-on is a special version of a Moodle Mobile add-on. The main differences are:
* Mobile remote addons are placed inside Moodle plugins (outside the Mobile app).
* Mobile remote add-ons are placed inside Moodle plugins (outside the Mobile app).
* Mobile remote addons language files must include the whole component prefix.
* Mobile remote add-ons language files must include the whole component prefix.
* Mobile remote addons uses special placeholders for paths inside CSS files or Javascript code.
* Mobile remote add-ons uses special placeholders for paths inside CSS files or Javascript code.


== How to create a remote addon ==
== How to create a remote add-on ==


Remote addons must be developed first as standard Moodle Mobile addons and then packaged as a remote addon.
Remote add-ons must be developed first as standard Moodle Mobile add-ons and then packaged as a remote add-on.


These are the main steps required:
These are the main required steps:


* Develop the required Moodle Web Services
* Develop the required Moodle Web Services
* Develop a standard Moodle Mobile addon
* Develop a standard Moodle Mobile add-on
* Package the Moodle Mobile addon as a Remote addon
* Package the Moodle Mobile add-on as a remote add-on
* Include the Remote addon in your Moodle plugin
* Include the remote add-on in your Moodle plugin


=== Web Services ===
=== Web Services ===


Most of Mobile addons requires Web Services to work, but in some cases (like addons implementing question types) won't be necessary.
Most of Mobile add-ons require Web Services to work, but in some cases (like add-ons implementing question types) it won't be necessary.


Please refer to [[Web services]] documentation, you have an example here: https://github.com/markn86/moodle-mod_certificate/blob/MOODLE_31_STABLE/classes/external.php
Please refer to [[Web services]] documentation, you have an example here: https://github.com/markn86/moodle-mod_certificate/blob/MOODLE_31_STABLE/classes/external.php


Once the Web Services has been developed, you must include them into the Mobile service using the "services" field when declaring external functions, see: https://github.com/markn86/moodle-mod_certificate/blob/MOODLE_31_STABLE/db/services.php
Once the Web Services are developed, you must include them into the Mobile service using the "services" field when declaring external functions, see: https://github.com/markn86/moodle-mod_certificate/blob/MOODLE_31_STABLE/db/services.php


Remember that this is only available Moodle 3.1 onwards.
Remember that this is only available from Moodle 3.1 onwards.


=== Mobile addon ===
=== Mobile add-on ===


Refer to [[Moodle Mobile Plugins Development]]
Refer to [[Moodle Mobile Plugins Development]]


=== Remote addon packaging ===
=== Remote add-on packaging ===




=== Remote addon publishing ===
=== Remote add-on publishing ===


Once you have a zip file containing the remote addon you must include it into the Moodle plugin.
Once you have a zip file containing the remote add-on, you must include it into the Moodle plugin.


Please, refer to [[Activity_modules#mobile.php]] for instructions, basically you will need to create a db/mobile.php and place the zip file into mobile/addonname.zip
Please, refer to [[Activity_modules#mobile.php]] for instructions. Basically you will need to create a db/mobile.php and place the zip file into mobile/addonname.zip

Revision as of 09:25, 20 May 2016

Only available for Moodle 3.1 onwards.

A Moodle Mobile remote add-on is the mobile app version of a Moodle plugin that will be loaded when a user accesses the plugin on the app.

Moodle Mobile remote add-ons are stored within a Moodle plugin and are downloaded and lazy-loaded by the Mobile app in every site that uses them.

Moodle plugins can include several Mobile add-ons. They can also declare dependencies between plugins.

We can say that a remote add-on is a special version of a Moodle Mobile add-on. The main differences are:

  • Mobile remote add-ons are placed inside Moodle plugins (outside the Mobile app).
  • Mobile remote add-ons language files must include the whole component prefix.
  • Mobile remote add-ons uses special placeholders for paths inside CSS files or Javascript code.

How to create a remote add-on

Remote add-ons must be developed first as standard Moodle Mobile add-ons and then packaged as a remote add-on.

These are the main required steps:

  • Develop the required Moodle Web Services
  • Develop a standard Moodle Mobile add-on
  • Package the Moodle Mobile add-on as a remote add-on
  • Include the remote add-on in your Moodle plugin

Web Services

Most of Mobile add-ons require Web Services to work, but in some cases (like add-ons implementing question types) it won't be necessary.

Please refer to Web services documentation, you have an example here: https://github.com/markn86/moodle-mod_certificate/blob/MOODLE_31_STABLE/classes/external.php

Once the Web Services are developed, you must include them into the Mobile service using the "services" field when declaring external functions, see: https://github.com/markn86/moodle-mod_certificate/blob/MOODLE_31_STABLE/db/services.php

Remember that this is only available from Moodle 3.1 onwards.

Mobile add-on

Refer to Moodle Mobile Plugins Development

Remote add-on packaging

Remote add-on publishing

Once you have a zip file containing the remote add-on, you must include it into the Moodle plugin.

Please, refer to Activity_modules#mobile.php for instructions. Basically you will need to create a db/mobile.php and place the zip file into mobile/addonname.zip