Support for course activities

Support for course activities

by Anthony Durif -
Number of replies: 2
Picture of Plugin developers

Hello,

I try to plug the moodle mobile app with our platform but I have some problems with plugins we specifically developped for our moodle. At first we had an error with a "Uh Oh! Your organisation installed a plugin that not yet supported" message when we tried to access to one of these course activities.

So I read this documentation to add this support. I managed to display some informations I needed but in some cases I make calls to extern APIs to get these informations to display and for theses calls I used to use the Guzzle library. This works well directly in the plateform and in the view.php file of my module. But in the mobile app theses same functions don't work and I have a "class GuzzleHttp/Client not found" error.

Maybe I missed something but is there any restrictions about the mobile app to make this kind of call ? Do I need to change my code to do more "classic" curl calls ?

Thanks for your help. Feel free to ask details if it's not very clear.

For information I use the last version of the Moodle mobile app and our platform is in Moodle 3.10.

Anthony


Average of ratings: -
In reply to Anthony Durif

Re: Support for course activities

by Dani Palou -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Hi Anthony,

are you trying to use the Guzzle library in the app itself? Or the app is calling a WebService you developed and this WebService is using the Guzzle library?

Please notice usually the app communicates with Moodle using WebServices, the app doesn't include any external lib you might have installed in Moodle.

Cheers,
Dani
In reply to Dani Palou

Re: Support for course activities

by Anthony Durif -
Picture of Plugin developers
Hello Dani,

Thanks for the answer (and sorry for my late answer to yours).
In my plugin I used to use Guzzle to easily call functions which were in another library I added thanks to a local composer file. I have no problem in my browser and the plugin works well but when I tried to test it on the moodle mobile app I encounted the error (probably because of what you say about the app who doesn't include any external lib installed in Moodle).

For that I edited my plugin to have two different behiavours in function of if we call it classicly (web, browser) or if we call it via the mobile app. In this case I do not use guzzle and my other library and I do some curl directly on the API. It is a little more complicated because I cannot use existant functions of my library but I think I managed to do what I needed.

For information I test the source by using this:
if (WS_SERVER) {
    // Curl calls.
} else {
    // Guzzle calls.
}