Moodle 2 understanding file paths in questions

Moodle 2 understanding file paths in questions

- Nathan Hammond の投稿
返信数: 4

Hi

I am trying to understand the file structure of Moodle 2 when adding an MP3 file (or some other file) to a question. I created a question with an mp3 file then moved it to a higher context so that a colleague can use the same question in her quiz (with the mp3 file of course).

Question/Concern 1
My main concern is that I don't have file sharing issues like I had in 1.8 and 1.9 where sound files would play in questions in one course but not in my colleagues course (or she and I could hear the questions with the mp3 files but our students couldn't). In the end I finally largely understood those file issues in 1.8 and 1.9. I am just trying to understand if I'm going to have any issues similar to this when I start using Moodle 2.

Question/Concern 2
Will Moodle 2 be able to import my quiz questions properly when I import them into Moodle 2. Will all the file paths be changed to this new Moodle 2 format?

Question/Concern 3
Below you can see the filepath of my mp3 file in both courses. My question is what do the following mean?

draftfile.php
(this is the same in both, but draft makes me think that the file may not be permanent)

14
Where did this 14 come from (my course ID=3 for the one course and ID=4 for the other course...so it's not that)

user
Does this mean that all users have access to it?

draft
again, I'm curious why the word draft is used

9digit number (that changes)
Why did this number change between courses when it's the same question used in both quizzes and then I noticed it changed again when I went in to view it again.

 

Original Question Code

Questions in course 1
Car in German<a href="https://mymoodledomain/draftfile.php/14/user/draft/203564184/d1-23-01.mp3

Same question in course 2
https://mymoodledomain/draftfile.php/14/user/draft/154865467/d1-23-01.mp3

Upon looking at the question again the 9digit folder changed again
Car in German<a href="https://moodle.cypanthers.org/2.0/draftfile.php/14/user/draft/946817809/d1-23-01.mp3

 

Thanks for any input on this.

 

Nathan Hammond への返信

Re: Moodle 2 understanding file paths in questions

- Tim Hunt の投稿
画像 Core developers 画像 Documentation writers 画像 Particularly helpful Moodlers 画像 Peer reviewers 画像 Plugin developers

It may be clearer if you look in the database, or in an exported Moodle XML file.

What is stored in the database is something like @@PLUGINFILE@@ / d1-23-01.mp3 (but without the spaces).

And Moodle stores a link saying that this file belongs to this question.

So, wherever you copy that question, the link to the file remains, and nothing breaks.

When Moodle displays the question, the @@PLUGINFILE@@ bit is replaced by the correct URL to link to that file from the place where the question is being used.

If you want to know more than that, you will have to delve into the developer documentation for the File API.

Nathan Hammond への返信

このフォーラム投稿は削除されました。

このフォーラム投稿のコンテンツは削除されたため現在アクセスすることはできません。
削除済みユーザ への返信

Re: Moodle 2 understanding file paths in questions

- Tim Hunt の投稿
画像 Core developers 画像 Documentation writers 画像 Particularly helpful Moodlers 画像 Peer reviewers 画像 Plugin developers

Oups, it seems that we are synchronized

Yes, but that is good. I think you have to read about five different explanations of the File API before there is any chance of understanding it, so if anything we need more responses ウインク