A poor man's way
This post is a follow-up to the previous discussion https://moodle.org/mod/forum/discuss.php?d=143575#p627005.
In order to change an activity's regular icon (or a resource icon) to a new one, you can proceed as follows:
- Edit the activity 'Settings'. Edit the HTML of the 'Description' and insert the following code:
<a href="url of the activity" target="_blank"> <img src="url of the new icon" class="img-responsive" style="position:absolute; top:-0.4em; left:1.4em; width:100px; z-index:10;"> </a>
where
- 'url of the activity' is the url that appears in the address bar of the browser when you
click the regular activity icon.
- 'url of the new icon' is the url of the image that will be used as the new icon.
- 'target="_blank"' opens the activity in a new window or tab. 'target="_self"' would open
it in the same frame as it is clicked.
- 'z-index:10' positions the new icon above the regular one.
- Enable 'Display description on course page' (just below the Description's input box) and then click 'Save and return to course'.
- You may need to adjust the 'top' and 'left' values so that the new icon is well positioned over the
regular icon. Adjust the 'width' value so that the new icon is large enough to cover completely the regular icon.
Use an image that is not transparent, at least in the area that covers the regular icon. You could also set the image's background color to match that of the page.
Pros
- Easily done by the teacher. No need to ask the site administrator.
- Very flexible. Any image can be used. Elements such as buttons or simply colored div's
can also be used.
- The activity can be opened in a new window or tab, which is not possible with regular activity icons.
- Removing the link to the 'url of the activity' allows keeping the activity 'Shown' but
not accessible to students, since clicking the icon would do nothing, which is not possible with regular activity icons.
Cons
This method is a workaround.
Does it work?
Yes, very well. I have used this method for some time with success.