I'd like to connect to my Moodle database (localhost) and retrieve all files submitted by students for an assignment. I'd be grateful for any advice/guidance. I'm confused by how Moodle sets up the tables as 1 table contains the submission details but doesn't contain the actual file submitted by the student?
Files would be stored in the moodledata folder, the table in the database simply references the hash given to each file.
You probably need to look at
as well as looking at how it is being done in some of the existing plugins, such as the file submissions plugin
Oh waw this is more confusing than I thought! >< I'm just trying to think how my plugin will actually work along side the Assignment activity in terms of the UI... I'd like it that when the student uploads and submits their file, they'll immediately (or immediate ish) see the results from the unit testing done on their code. What or where would I have to look at to get this sort of functionality?
You will need to look at the feedback plugins as well as the submission ones - students can access feedback as soon as it is marked and released, so if you are looking at an automated 'marking' solution (running the unit tests) you probably need to capture an event (the submission) to trigger the marking and feedback. The students would then access the feedback (unit test results) the same way as they would any other assignment feedback.
Getting the file submitted is not a massive problem (conceptually) - that should be very similar to the existing file submission plugin.
Displaying the feedback shouldn't be a huge problem either - that should be fairly similar to the online feedback comments plugin (in its display).
I would start by cloning those two plugins as a first step.
The challenges lie in using the act of submission to trigger the running of the unit tests (creating the feedback) and thereby automating the 'marking' process.
Firstly though - make a mock assignment on a sandbox moodle, submit some files, create some online feedback, track what happens in the database (and moodledata), try to follow how the file picker element works. Look at it as a student as well as looking as a developer - what do you see, what do you want to see in your version.
My thoughts would be something like:
1. Student submits code file (limit to 1 so that unit tests can be run on that file? ie in your clone remove setting option for more files)
This creates a database entry for the submission as well as storing the file in the moodledata folder
2. Submission triggers some code to run the preset unit tests against that submitted code
3. Unit test output is parsed directly into the database in the cloned equivalent of the online feedback plugin
4. Student revisits assignment page, unit test results are visible as 'feedback' (any completion/progress bar is ticked)
As I said - its pt2 of that which I think will provide the greatest challenge.
Hope that helps a bit!
Thanks so much for your helpful and informative responses - very much appreciate it. When you say cloning the submission and feedback plugins. That would be copying and completely re-naming those files and folders? After doing that what would happen in terms of the UI? would just the original submission and feedback plugins be displayed? I'm not sure how I would 'plug in' these new cloned plugins to work with the existing submission and feedback plugins.. would I immediately see the new plugin on the assignment set-up page and then I can start editing it to make what I want of it? I tend to better understand what needs to be changed or modified if I can see what's going on! >< (if that makes sense)
Yes, cloning = copy and completely rename
Once you have done that, change some of the obvious language strings as well, just so you can see it on the assignment page and tell the difference between the original and your clone(s)
I think you need to just have a play around first Lloyd - try just installing some of the other submission and feedback plugins into the mod/assign/submission and mod/assign/feedback folders, run through the admin notification page to install them, then set up a couple of assignments - take note of what changes for the tutor in terms of the settings and options that appear on the assignment settings page. That will give you a better understanding of how the plugins work from the UI perspective and what you can expect to tinker with on the UI side for your own versions.
Don't worry about what they actually do to much, you are just in the first instance looking at how they plugin and what the UI changes on the assign setting page are. Use the basic exsiting submission and feedback types as well as some of the available 3rd party ones to keep monitoring what changes in the database, what tables are used, what is put in them, etc. Make yourself familiar with what is actually happening - but give up at least half a day to installing examples, playing with the assignment settings and getting familiar with the way it works in the first instance - it will be time very well spent!
Then clone the basic ones as I suggested, copy them, rename them, play with some of the obvious language strings just so you can see the difference on the UI (even if that is just using a search and replace to put 'LD' at the beginning of every string to start with You just need to be able to identify what's yours from what is the original.
Get those clones working as clones, without adding in any of your extra unit tests or triggers or anything like that in the first place, just as renamed versions of the original.
Once you are happy you have done that, snapshot the work you have done so you have a point to roll back to. Then and only then start thinking about the specific changes you need to make to achieve your goal of automatic unit testing feedback for code submissions.
Take it one step at a time - in summary:
Familiarise yourself with the core assign plugins - things like the UI, the database etc
Familiarise yourself with installing existing 3rd party assign/submission and assign/feedback plugins - look at how the UI and database are affected by those new plugins
Clone (copy and rename) a suitable submission and feedback plugin (one at a time!), ncluding changing language strings
Snapshot a roll back point (save your plugin somewhere, or set it up on github)
Then start actually developing your changes for your particular needs.
Ok cool, I will do exactly that I've been looking at submission plugins but I can't seem to find many that would closely suit what I'd need.. I've been looking at plagiarism plugins but they need to be installed under the plagiarism directory..I'd want my plugin to be located under mod->assign->submission right?
I've been thinking.. that's all I'd need on the submission side of my plugin is an additional checkbox (maybe in the General section when creating an assignment) to specify that the assignment is a coding exercise that runs unit tests on the students code... then a dropdown box or something to show a list of unit tests (that the teacher had created and stored somewhere) that should be used to run on the student's code. I think that's pretty much it? (for a simple implementation anyway) so would I really need to go into the complexity of installing another plugin if I only need that much functionality on the submission side? If I can find out how and where to add these elements to the page I think I'd be alright?
oh but then again I'd be re-naming the actual assign code which I don't want to do >< I'll stick to the plan of cloning an existing plugin I think.. unless creating one from scratch would be better? (although I have no idea how to do that and I can't seem to find an empty template online). Anyway, I'm trying to work out how I'd actually make changes to the assignment form whilst using a cloned plugin.. say if I wanted to add an extra checkbox, specify what the checkbox does if enabled etc, where would I do these changes? I've seen a lot about the Form API but it makes no sense to me I can't find anything to do with what I'd want to achieve i.e. adding checkboxes and text fields.
$mform->addElement('select', 'assignsubmission_onlinepoodll_recordertype', get_string("recordertype", "assignsubmission_onlinepoodll"), $recorderoptions);
This would add a dropdown box, show its name and populate it by using the $recorderoptions variable?
i think I understand this but what I don't get so far is how to add elements to other sections found in the Assignment settings? At the moment this plugin (onlinepoodll) has only extended functionality under the Submission types section.. how would I add elements to the other sections that are specific to my plugin?