Badge plugin
Claroline provides a badge system based on the Open Badge standard from Mozilla.
It uses the rule system also provided by Claroline.
How it works
Badge can be issue to a user.
A user can ask for earning a badge.
A badge manager can issue him the badge if criteria is reunited.
Rules can be added to a badge. This rules is used to determine if a badge can be awarded or not.
A badge can be automatically awarded, if configured that way.
Create badges
To create a badge you just need to access the badge interface, in the administration panel or in the wokrspace one. For managing badges on workspace you need to activate option first.
Rule validation link
When on your profil, you can go see which badge you’ve got. When entering a badge page you can see why someone issued you it. You see all the actions that lead to this awarding and for each action a link that lead to the resource, could be anything, on which the action was executed. This link is generate with associated log datas. Here is how link are generated.
You need to define a listener to the badge-%action_name%-generate_validation_link
event.
Here an example of what you can do:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use ;
public function onBagdeCreateValidationLink(BadgeCreateValidationLinkEvent $event)
{
$content = null;
$log = $event->getLog();
switch($log->getAction())
{
case LogPostCreateEvent::ACTION:
$logDetails = $event->getLog()->getDetails();
$parameters = array(
'blogId' => $logDetails['post']['blog'],
'postSlug' => $logDetails['post']['slug']
);
$url = $this->router->generate('icap_blog_post_view', $parameters, UrlGeneratorInterface::ABSOLUTE_PATH);
$title = $logDetails['post']['title'];
$content = sprintf('<a href="%s" title="%s">%s</a>', $url, $title, $title);
break;
}
$event->setContent($content);
$event->stopPropagation();
}
All this method need to return is some html content to represent the link to the associated resource, or any object you want.
If no listener is defined a default link will be generated with the resource node identifier of the log. If this one doesn’t exist either no link will be generate.
How to validate Badges
https://openbadges.org/developers/#verification
https://github.com/IMSGlobal/openbadges-validator-core sudo apt-get install python-pip
https://docs.python-guide.org/dev/virtualenvs/#lower-level-virtualenv
then run the cli tool