Skip to content

Commit 5d86f95

Browse files
committed
Added documentation
1 parent dd522a6 commit 5d86f95

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed

README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Activity Completion Image
2+
3+
This filter lets you add a completion status icon to hyperlinks that contain an image. This can be useful if you use hidden activities and use hyperlinks to get to those activities. The result can be a nicely formatted list of images that users can click on, but can also see the completion status of an activity as an icon.
4+
5+
Currently it has three possible icons - not yet completed, not available (for activites you can't get to because of a condition), and completed. These icons are hard coded at this time, but use font-awesome and could potentially be changed using `::before` class content hacks.
6+
7+
The filter modifies the HTML of the hyperlink to contain an extra span and icon, with various classnames applied to the objects in order for them to be styled. No styling is applied by default, but it is expected that a user could add custom styling to their theme's CSS.
8+
9+
## Installation
10+
11+
Drop this folder into your moodle `filter` folder and install as normal.
12+
13+
## Example
14+
15+
![Course Screenshot](preview.png)
16+
17+
A course introduction with hyperlinked hidden activites, alongside the standard completion status block.
18+
19+
And the styles shown here (added to the theme custom css):
20+
21+
```css
22+
a.completion-info {
23+
position: relative;
24+
display: inline-block;
25+
}
26+
a.completion-info > span:before {
27+
content: '';
28+
border: 45px solid transparent;
29+
border-bottom-color: rgba(8, 189, 242, 0.9);
30+
transform: rotate(45deg);
31+
position: absolute;
32+
top: -45px;
33+
right: -45px;
34+
z-index: 1;
35+
}
36+
a.completion-info > span.state-completed:before {
37+
border-bottom-color: rgba(33, 242, 8, 0.9);
38+
}
39+
a.completion-info > span.state-unavailable:before {
40+
border-bottom-color: rgba(67, 156, 182, 0.5);
41+
}
42+
a.completion-info > span {
43+
display: block;
44+
position: absolute;
45+
top: 0;
46+
right: 0;
47+
z-index: 2;
48+
width: 32px;
49+
height: 32px;
50+
padding: 4px 4px 0 0;
51+
}
52+
a.completion-info > span > i {
53+
z-index: 3;
54+
position: relative;
55+
color: white;
56+
font-size: 2em;
57+
}
58+
a.completion-info > img {
59+
margin: 0;
60+
}
61+
```
62+
63+
## Example usage
64+
65+
On your course, add activities to the section. Hide the activities (and make them available; which in turn requires the `allow stealth activities` option in *Advanced features* in Moodle 3.5). Copy the hyperlink of each activity and put it into the editor. Inside that hyperlink, place an image. Each link might have html that is like this:
66+
67+
```html
68+
<a href="http://your-moodle-url/mod/page/view.php?id=514"><img width="210" height="170" class="img-responsive" role="presentation" alt="" src="http://your-moodle-url/draftfile.php/23/user/draft/514152870/TILE_feedback.png"></a>
69+
```
70+
71+
Next, ensure that the filter is ON for the course (it is on-but-disabled by default). When the course renders, it will find these hyperlinks links, look up the completion status of the activity in the context of the current user, and append extra html before they render. The resulting html will be something like this:
72+
73+
```html
74+
<a href="http://your-moodle-url/mod/page/view.php?id=514" data-cmid="514" class="completion-info"><span title="Not yet completed" class="state-incomplete"><i class="fa fa-circle-o"></i></span><img width="210" height="170" class="img-responsive" role="presentation" alt="" src="http://your-moodle-url/pluginfile.php/4908/course/section/606/TILE_feedback.png"></a>
75+
```
76+
77+
## Licence
78+
79+
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

preview.png

150 KB
Loading

0 commit comments

Comments
 (0)