How To / General

Get All Files

More
10 years 7 months ago #1 by Luigi
Get All Files was created by Luigi
Hi there,

While I was building my website, I got stuck on a problem. My employer wants me to build a page in which all files of all courses are listed, and, depending on whether or not the user is a guest or a registered one, allow downloading. I studied Joomdle code a bit and I haven't found a good solution yet. I am writing in the hope of having skipped over some method that would solve my problems.

Is there anything like a nice "getAllFilesFromAllCourses" function? If not, is there any feasible workaround? The only solution I can think of is
1. get all courses
2. for each course, get mods
3. for each mod, get the associate resources
4. iterate on each resource whether it is a file or not

I know this solution would actually slow down incredibly the page. Neither, Moodle 2.8 files structure helps me.
Any Ideas?
Thanks in advance :)

Please Log in or Create an account to join the conversation.

More
10 years 7 months ago #2 by Antonio Durán
Replied by Antonio Durán on topic Get All Files
As you guessed, that solution would be too slow.

I guess you could create a new web service to get all files, doing the procedure you describe in a function.
This could be slow, too, as it would need to fecth all Moodle files.

Please Log in or Create an account to join the conversation.