Adding custom web service functions

From Joomdle
Revision as of 18:07, 4 February 2019 by Antonio (Talk | contribs)

Jump to: navigation, search

Sometimes it can be handy to create some custom Moodle web service functions that you could use alongside Joomdle stock ones.

For example, you may want to generate some custom report in Joomla that uses Moodle data, some of which it is not offered by Joomdle.


In those cases, you can create a new Moodle plugin of type Local:

https://docs.moodle.org/dev/Local_plugins


You can then have your functions there, and add them to Joomdle web service so you can call them as you would call any other Joomdle functions.

The only thing you have to remember is to have your functions names prefixed with 'joomdle_' so you can call them with Joomdle's call method in Joomla.


Here you can find an example plugin to help you get started:

https://www.joomdle.com/download/category/35-development?download=112:moodle-web-services-demo

Once you have installed it in Moodle, you could add this to your Joomla code to call the new function provided by the plugin:

    $return = JoomdleHelperContent::call_method ('testjoomdlewsdemo', "TEST STRING");
    print_R ($return);