[Plugin 3.5] course download feature does not download core-files?

[Plugin 3.5] course download feature does not download core-files?

by Jérôme Mouneyrac -
Number of replies: 5

Hi

I added a few core-file components to my mustache template. I can download these files when I press them or the download arrow.

However when I click on download the full course these files are not automatically marked downloaded/downloaded.

I tried to add a an array of file objects into the files attribut of the return value of the mobile.php function (similar format to the one demo in the certificate - but I doubt it works as the certificate doesn't seem to download).

Is "course download" supposed to automatically download the core-files? If yes do you have a code example?

Thank you,

Jerome

Average of ratings: -
In reply to Jérôme Mouneyrac

Re: [Plugin 3.5] course download feature does not download core-files?

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 Jérôme,

we don't parse templates searching for core-files or similar. Like you said, you need to add the files to the "files" array that is returned by the function. Each file must contain:

  • url or fileurl: Required. The URL of the file.
  • filename: Required. The name of the file.
  • timemodified: Optional, to detect if the file has changed and needs to be re-downloaded.
  • isexternalfile: Optional, whether it's an external file (like Google Drive).
  • repositorytype: Optional, the type of repository the file belongs to (like Google Drive, Dropbox, etc.)

Also, you need to add that function to "offlinefunctions" in mobile.php.

Kind regards,

Dani

In reply to Dani Palou

Re: [Plugin 3.5] course download feature does not download core-files?

by Jérôme Mouneyrac -

Hi Dani

I can not make it work. Both the android mobile app and the https://mobileapp.moodledemo.net/ do not automatically (full course download) download core-file even though it seems I have fileurl and filename correctly set. Manually downloading core-file works well.

Here are my files (I suppose as the new plugin support is new it is probably a good idea to help the first plugin mobile 3.5 devs - not only saying that because it will help me :P):

https://bitbucket.org/covuni/moodle-mod_courseguide/src/master/classes/output/mobile.php

https://bitbucket.org/covuni/moodle-mod_courseguide/src/master/templates/mobile_view_page.mustache

https://bitbucket.org/covuni/moodle-mod_courseguide/src/master/db/mobile.php


PS: the mobile_course_view() logic may seem a bit complicated because this plugin generate sMoodle form placeholders (the plugin allows to create Moodle form template - it is pretty cool) so I have to rebuild the data from the template. But I guess you can skip that part my problem likely come from somewhere around that logic.

In reply to Jérôme Mouneyrac

Re: [Plugin 3.5] course download feature does not download core-files?

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 Jérôme,

I took a quick look and the code seems ok to me, I'll have to download the plugin and test it myself. I don't think I'll have time to test it today, but I'll try to check it ASAP.

Cheers,

Dani

In reply to Dani Palou

Re: [Plugin 3.5] course download feature does not download core-files?

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 Jérôme,

I was finally able to test the plugin and there's a bug in the Mobile app, I opened an issue to fix it:

https://tracker.moodle.org/browse/MOBILE-2531

With the fix applied I was able to download the activity and its files were downloaded. Also, the plugin looks really good in the app, good job!

Cheers,

Dani

Average of ratings: Useful (1)
In reply to Dani Palou

Re: [Plugin 3.5] course download feature does not download core-files?

by Jérôme Mouneyrac -

Hi Dani

great news and thank you for your work on this new plugin mobile support.

For my use case, It was much faster to develop the mobile support this way than learning Angular (even as it was my first time with this new tech).

Cheers,

Jerome