I copied the assign folder to create my own module and would now like to change its icon.. it obviously still has the same icon as that used for the assignment module but I'd like to change it to my own one.. any help would be greatly appreciated
Best to start by reading all the details on activity plugins here - https://docs.moodle.org/dev/Activity_modules
Pay particular attention to the "/pix" directory section.
The "assign" module already takes its own plugin types, so you may want to rethink completely copying it, and instead create a new assign plugin.
Submission plugins - https://docs.moodle.org/dev/Assign_submission_plugins
Feedback plugins - https://docs.moodle.org/dev/Assign_feedback_plugins
Hi Mike, I've already gone into the pix folder and removed the old icon and replaced it with mine (and named it as icon the same as before) but had no effect I copied the assign module but re-named everything from assign to my new plugin name. So the new plugin has separate database tables, files etc.. is that still not ok?
Have you purged all the Moodle caches from the admin UI? I'm sure images are cached within the Moodle caching system.
But, if you truly copied the entire "assign" module to a new plugin with a new name, there may be lots of changes you need to make. Including all of the submission and feedback plugins. Does what you are trying to do truly warrant a completely new copy of the assign plugin?
Yes I purged all the Moodle caches and still didn't work I'm correct in saying that the icon to change is in mod->myplugin->pix directory?
What do you mean by there might be lots of changes to make for plugins such submission and feedback? What could the issues be?
The assignment module (assign) is a large, complex module. Copying it "as is" to create a new module would require a lot of renaming and code changes to ensure it worked properly, including all of the subplugins that come with it. Many of those also create data tables. You would need to make sure you have changed all of the necessary code and table names throughout the entire new module.
I still think that duplicating the assignment module is likely overkill for what you need to do though, but I am only speculating, since I'm not sure what it is that you are trying to do.
I'm not sure if it's overkill myself to be honest! What I want to do is allow students to submit code that answers a given exercise then the system would perform unit tests on their code to see how well they've answered the questions. I was advised in a different post that it would be best to create a copy of the assign module so that I would have an assignment activity for general assignments and a coding activity that is specifically for performing unit tests..
If you really want to keep them separate, then maybe a clone is the way to do it, but I would personally have gone with Mike's suggestion of a submission plugin for the existing assign module - its upto the teacher in setting it up and providing the information for the students to select that its a coding assignment and select the relevant plugin (and deselect the others) then anyway - which you are likely still going to have to create in your clone of assign anyway, because that's the way it works (you would then though be able to remove all the other submission plugins from your 'coding' one so there are no other alternatives. The other advantage of creating a submission plugin within the existing Assign module, though, is to take advantage of those other options - eg. Allow the students to submit a description/justification of their code alongside the code itself (online text), or a project plan/system flowchart etc to accompany it (file submission)
Yes I think I would prefer a submission plugin for the assignment module as it seems rather pointless creating a complete copy of assign.. So it would then work as the teacher would add an assignment as an activity but then change the settings (I would specify in the plugin) to make it a coding activity? Could you offer some guidance in how I would create this plugin? would I chose a closely related plugin from the repository and modify it to make it my own? But then again.. I don't want the teacher having to select the Assignment option from the activity list as it won't be a assignment it'll be more like a lab exercise but with the capability of turning it into an assignment too
'I don't want the teacher having to select the Assignment option from the activity list as it won't be a assignment it'll be more like a lab exercise but with the capability of turning it into an assignment too'
Don't think of the Assignment activity as simply for summative (or even formal formative) assessment activities, just think of it as a submission point - could be for homework, could be for lab-reports, could be for coding, and then it becomes relevant for your coding activities. They are submissions that warrant feedback (whether that is teacher feedback or unit test feedback), and that makes the assignment activity the ideal one for them.
In terms of guidance - the best bet would be to look at some of the existing submission plugins and to the links Mike gave above https://moodle.org/mod/forum/discuss.php?d=334909#p1349375 Then post with specific queries as you have been doing There are plenty of people here who will provide the support you need once you get started and once you have particular questions
Ahh ok I understand, I misunderstood the purpose of that assignment activity >< so do you think the best thing to do would be to copy an existing submission plugin and modify it?
I suspect some of the links in the other thread, along with Mike's should get you started.
For myself, I would take the file submission plugin (I don't see a better one in the plugins database for what you need), clone that (similar to what you have already done, but smaller scale!). And then investigate what happens when...
Do it on a localhost sandbox - and I would be very tempted to do a full back up of everything as soon as you have got the basics in place, so when you mess it up (that's not intended to be critical, its called a sandbox for a reason - the 'messing up' could simply be reaching a point when you say you don't like the way you've developed that and want to go in a different direction!) you can simply roll back to your last checkpoint (database and moodledata as well as code base, unless you are prepared to reinstall everything). Personally, I tend to backup the plugin I'm working on (I usually use github) then reinstall a clean moodle core on a clean database/moodledata, reinstall my plugin and carry on from that last checkpoint.
You might also want to take a look at some of the plaigiarism plugins - effectively what you are trying to do is very similar, except that instead of running the 'essay' against a similarity checker, you would run it against your unit tests.
Still not having any luck with this icon :S I just don't understand.. I re-named all assignment icons, purged the cache and still had no effect!
As a general rule if changes to a file do not seem to update the file, try deleting it (after backing up first) and then if it still shows up you are probably updating the wrong file.
When I inspect the element (icon) on Chrome it shows the location as http://localhost/moodle/theme/image.php/clean/coding/1466161754/icon. I'm not sure how to find that file. Where and how would you usually change the icon of an activity?
It will be somewhere under your moodle/theme/clean folder (
The * .php file in the url indicates that this is not a real folder but the file is being dished up through code. Start deleting likely candidates untill it vanishes.
I can't find the icon in that folder anywhere this is so strange..
"removed the old icon and replaced it with mine"
Which one? or all?
In the mod/assign on github there's an icon.png and an icon.svg (on my work one, which is Moodle 2.9, there's also an icon.gif) I can't remember off the top of my head which one takes precedence when they get served up to the page, so have you changed all of them?
Clean, by default, doesn't override any of the module icons, but the theme mechanism is how the images are served up, so if you look at any other activity icon you will see the same kind of url, but with a different activity name in it. (unless you have added an icon override in your theme that is)
Thanks for your message, I can't believe this.. I deleted the icon.svg and the icon changed as expected! Do I really need the .svg file? and if so what changes do I need to make in order for it to use the new icon?
You don't need the "svg" icon, but it is the preferred format (see https://docs.moodle.org/dev/Themes_overview#SVG_icons). I'm pretty sure if it is present, it takes precedence over any of the other formats.
Yep, Mike is correct - looked it up after saying in my previous message I couldn't remember which takes precedence. If there is an svg version of the icon that is used, if not then png, so if you only replaced the png, but the svg version was still there, then it would have been using the unchanged svg icon.
Glad its sorted for you