Quantcast
Channel: General developer forum
Viewing all articles
Browse latest Browse all 37673

Re: Insert table mdl_files itemid filearea draft

$
0
0
by Davo Smith.  

I think I'm going to make one last attempt to reply to this, as I've already posted extensively in reply to your other discussion. After this, I'm going to leave it in case someone else wants to help you out.

The meaning of the file itemid depends entirely on the internals of the activity that is using it.

If you are creating a form (which is very clearly NOT WHAT YOU ARE TRYING TO DO), then using the draft item it would be a sensible thing to do. You are not doing that, so please forget all about the draft item id.

You say you want to create a folder in a course - by this I can only assume you mean to create an instance of 'mod_folder' and populate it with files. I suggest, if that is the case, then you add a folder to a course and then fill it with files and look at the records in mdl_files that are then created. You will very quickly find a pattern in the itemid (hint, if you really want to find out what the answer to this is before you try it out, you could try reading the answer I've already given you in your previous discussion).

Ultimately, if you are going to write some code to insert files into Moodle and then are going to write some further code to retrieve those files, then it is up to YOU and only YOU to decide what you want the 'itemid' field to mean.

If, you are using some built-in Moodle code to display the files, and you are only going to insert the files (but not display them yourself), then it is now up to YOU to check through the code that will be displaying the files (and you haven't been clear enough at any point for anyone to really guess which code it is that you expect to display these files) and find out what itemid (if any) that code expects to find.


Viewing all articles
Browse latest Browse all 37673

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>