MDL-55491 badges: Add cohort as badge criteria

This commit is contained in:
Stephen Bourget 2018-01-10 22:12:03 -05:00 committed by Sara Arjona
parent abc07b53a7
commit 75653a3068
6 changed files with 568 additions and 42 deletions

View File

@ -170,18 +170,17 @@ class core_badges_observer {
}
/**
* Triggered when an event happens that updates cohort membership. Seeing as there
* are more than one event that can trigger this, we're accepting a generic event object
* as param.
* Triggered when the 'cohort_member_added' event happens.
*
* @param \core\event\base $event generated event
* @param \core\event\cohort_member_added $event generated when a user is added to a cohort
*/
public static function cohort_criteria_review(\core\event\base $event) {
public static function cohort_criteria_review(\core\event\cohort_member_added $event) {
global $DB, $CFG;
if (!empty($CFG->enablebadges)) {
require_once($CFG->dirroot.'/lib/badgeslib.php');
$cohortid = $event->objectid;
$userid = $event->relateduserid;
// Get relevant badges.
$badgesql = "SELECT badgeid
@ -194,36 +193,21 @@ class core_badges_observer {
return;
}
// Get the users that should be issued badges.
$usersql = "SELECT userid
FROM {cohort_members} cm
WHERE cohortid = ?
AND userid NOT IN (
SELECT userid
FROM {badge_issued} bi
WHERE badgeid IN (
{$badgesql}
)
)";
$users = $DB->get_records_sql($usersql, array($cohortid, BADGE_CRITERIA_TYPE_COHORT, "cohort_{$cohortid}"));
foreach ($badges as $b) {
$badge = new badge($b->badgeid);
if (!$badge->is_active()) {
continue;
}
foreach ($users as $u) {
if ($badge->is_issued($u->userid)) {
continue;
}
if ($badge->is_issued($userid)) {
continue;
}
if ($badge->criteria[BADGE_CRITERIA_TYPE_COHORT]->review($u->userid)) {
$badge->criteria[BADGE_CRITERIA_TYPE_COHORT]->mark_complete($u->userid);
if ($badge->criteria[BADGE_CRITERIA_TYPE_COHORT]->review($userid)) {
$badge->criteria[BADGE_CRITERIA_TYPE_COHORT]->mark_complete($userid);
if ($badge->criteria[BADGE_CRITERIA_TYPE_OVERALL]->review($u->userid)) {
$badge->criteria[BADGE_CRITERIA_TYPE_OVERALL]->mark_complete($u->userid);
$badge->issue($u->userid);
}
if ($badge->criteria[BADGE_CRITERIA_TYPE_OVERALL]->review($userid)) {
$badge->criteria[BADGE_CRITERIA_TYPE_OVERALL]->mark_complete($userid);
$badge->issue($userid);
}
}
}

View File

@ -78,7 +78,7 @@ define('BADGE_CRITERIA_TYPE_BADGE', 7);
* Cohort criteria type
* Criteria type constant, primarily for storing criteria type in the database.
*/
define('BADGE_CRITERIA_TYPE_COHORT', 98);
define('BADGE_CRITERIA_TYPE_COHORT', 8);
/*
* Criteria type constant to class name mapping

View File

@ -31,18 +31,26 @@ require_once($CFG->dirroot.'/cohort/lib.php');
/**
* Badge award criteria -- award on cohort membership
*
* @package core
* @subpackage badges
* @copyright 2016 onwards Catalyst IT {@link https://www.catalyst.net.nz/}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author Eugene Venter <eugene@catalyst.net.nz>
*/
class award_criteria_cohort extends award_criteria {
/* @var int Criteria [BADGE_CRITERIA_TYPE_COHORT] */
/* @var int $criteriatype Criteria [BADGE_CRITERIA_TYPE_COHORT] */
public $criteriatype = BADGE_CRITERIA_TYPE_COHORT;
/* @var string $required_param Required form param */
public $required_param = 'cohort';
/* @var array $optional_params Optional form params */
public $optional_params = array();
/**
* Get criteria details for displaying to users
*
* @param string $short Print short version of criteria
* @return string
*/
public function get_details($short = '') {
@ -69,6 +77,7 @@ class award_criteria_cohort extends award_criteria {
/**
* Add appropriate new criteria options to the form
*
* @param object $mform moodle form
*/
public function get_options(&$mform) {
global $DB;
@ -77,7 +86,7 @@ class award_criteria_cohort extends award_criteria {
$mform->addElement('header', 'first_header', $this->get_title());
$mform->addHelpButton('first_header', 'criteria_' . $this->criteriatype, 'badges');
// Get cohorts
// Get cohorts.
$cohorts = $DB->get_records_menu('cohort', array(), 'name ASC', 'id, name');
if (!empty($cohorts)) {
$select = array();
@ -122,10 +131,11 @@ class award_criteria_cohort extends award_criteria {
/**
* Save criteria records
*
* @param $params criteria params
* @param array $params Values from the form or any other array.
*/
public function save($params = array()) {
$cohorts = $params['cohort_cohorts'];
unset($params['cohort_cohorts']);
foreach ($cohorts as $cohortid) {
$params["cohort_{$cohortid}"] = $cohortid;
@ -137,7 +147,11 @@ class award_criteria_cohort extends award_criteria {
/**
* Review this criteria and decide if it has been completed
*
* @return bool Whether criteria is complete
* @param int $userid User whose criteria completion needs to be reviewed.
* @param bool $filtered An additional parameter indicating that user list
* has been reduced and some expensive checks can be skipped.
*
* @return bool Whether criteria is complete.
*/
public function review($userid, $filtered = false) {
global $DB;
@ -197,9 +211,43 @@ class award_criteria_cohort extends award_criteria {
return array(true, '');
}
/**
* Returns array with sql code and parameters returning all ids
* of users who meet this particular criterion.
*
* @return array list($join, $where, $params)
*/
public function get_completed_criteria_sql() {
// TODO;
$join = '';
$where = '';
$params = array();
return array($join, $where, $params);
if ($this->method == BADGE_CRITERIA_AGGREGATION_ANY) {
// User is a member of ANY of the specified cohorts.
$join = " LEFT JOIN {cohort_members} cm ON cm.userid = u.id";
$where = "AND (";
$i = 0;
foreach ($this->params as $param) {
if ($i == 0) {
$where .= ' cm.cohortid = :cohortid'.$i;
} else {
$where .= ' OR cm.cohortid = :cohortid'.$i;
}
$params['cohortid'.$i] = $param['cohort'];
$i++;
}
$where .= ") ";
return array($join, $where, $params);
} else {
// User is a member of ALL of the specified cohorts.
$join = " LEFT JOIN {cohort_members} cm ON cm.userid = u.id";
$i = 0;
foreach ($this->params as $param) {
$i++;
$where = ' AND cm.cohortid = :cohortid'.$i;
$params['cohortid'.$i] = $param['cohort'];
}
return array($join, $where, $params);
}
}
}

View File

@ -481,6 +481,38 @@ class core_badges_badgeslib_testcase extends advanced_testcase {
$this->assertTrue($badge->is_issued($this->user->id));
}
/**
* Test badges observer when cohort_member_added event is fired.
*/
public function test_badges_observer_cohort_criteria_review() {
global $CFG;
require_once("$CFG->dirroot/cohort/lib.php");
$cohort = $this->getDataGenerator()->create_cohort();
$this->preventResetByRollback(); // Messaging is not compatible with transactions.
$badge = new badge($this->badgeid);
$this->assertFalse($badge->is_issued($this->user->id));
// Set up the badge criteria.
$criteriaoverall = award_criteria::build(array('criteriatype' => BADGE_CRITERIA_TYPE_OVERALL, 'badgeid' => $badge->id));
$criteriaoverall->save(array('agg' => BADGE_CRITERIA_AGGREGATION_ANY));
$criteriaoverall1 = award_criteria::build(array('criteriatype' => BADGE_CRITERIA_TYPE_COHORT, 'badgeid' => $badge->id));
$criteriaoverall1->save(array('agg' => BADGE_CRITERIA_AGGREGATION_ANY, 'cohort_cohorts' => array('0' => $cohort->id)));
// Make the badge active.
$badge->set_status(BADGE_STATUS_ACTIVE);
// Add the user to the cohort.
cohort_add_member($cohort->id, $this->user->id);
// Verify that the badge was awarded.
$this->assertDebuggingCalled();
$this->assertTrue($badge->is_issued($this->user->id));
}
/**
* Test badges assertion generated when a badge is issued.
*/

View File

@ -0,0 +1,462 @@
@core @core_badges @_file_upload
Feature: Award badges based on cohort
In order to award badges to users based on their cohort membership
As an admin
I need to add cohort criteria to badges in the system
@javascript
Scenario: Award cohort membership badge for a member of a single cohort.
Given the following "cohorts" exist:
| name | idnumber |
| One Cohort | CH1 |
| Two Cohort | CH2 |
And the following "users" exist:
| username | firstname | lastname | email |
| user1 | First | User | first@example.com |
| user2 | Second | User | second@example.com |
And the following "cohort members" exist:
| user | cohort |
| user1 | CH1 |
| user2 | CH2 |
And I log in as "admin"
And I navigate to "Add a new badge" node in "Site administration > Badges"
And I set the following fields to these values:
| Name | Site Badge |
| Description | Site badge description |
| issuername | Tester of site badge |
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
And I press "Create badge"
And I set the field "type" to "Cohort membership"
And I set the field "id_cohort_cohorts" to "One Cohort"
And I press "Save"
And I press "Enable access"
When I press "Continue"
Then I should see "Recipients (1)"
And I log out
And I log in as "user1"
And I follow "Profile" in the user menu
And I should see "Site Badge"
@javascript
Scenario: Award cohort membership badge for a member of all required cohorts.
Given the following "cohorts" exist:
| name | idnumber |
| One Cohort | CH1 |
| Two Cohort | CH2 |
| Three Cohort | CH3 |
And the following "users" exist:
| username | firstname | lastname | email |
| user1 | First | User | first@example.com |
| user2 | Second | User | second@example.com |
And the following "cohort members" exist:
| user | cohort |
| user1 | CH1 |
| user1 | CH2 |
| user2 | CH1 |
| user2 | CH3 |
And I log in as "admin"
And I navigate to "Add a new badge" node in "Site administration > Badges"
And I set the following fields to these values:
| Name | Site Badge |
| Description | Site badge description |
| issuername | Tester of site badge |
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
And I press "Create badge"
And I set the field "type" to "Cohort membership"
And I expand all fieldsets
And I set the field "id_cohort_cohorts" to "One Cohort,Two Cohort"
And I set the field "id_agg_1" to "1"
And I press "Save"
When I press "Enable access"
And I press "Continue"
Then I should see "Recipients (1)"
And I log out
And I log in as "user1"
And I follow "Profile" in the user menu
And I should see "Site Badge"
@javascript
Scenario: Award cohort membership badge for a member of any required cohorts.
Given the following "cohorts" exist:
| name | idnumber |
| One Cohort | CH1 |
| Two Cohort | CH2 |
| Three Cohort | CH3 |
And the following "users" exist:
| username | firstname | lastname | email |
| user1 | First | User | first@example.com |
| user2 | Second | User | second@example.com |
| user3 | third | User | third@example.com |
And the following "cohort members" exist:
| user | cohort |
| user1 | CH1 |
| user1 | CH2 |
| user2 | CH1 |
| user2 | CH3 |
| user3 | CH2 |
| user3 | CH3 |
And I log in as "admin"
And I navigate to "Add a new badge" node in "Site administration > Badges"
And I set the following fields to these values:
| Name | Site Badge |
| Description | Site badge description |
| issuername | Tester of site badge |
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
And I press "Create badge"
And I set the field "type" to "Cohort membership"
And I set the field "id_cohort_cohorts" to "One Cohort"
And I press "Save"
When I press "Enable access"
And I press "Continue"
Then I should see "Recipients (2)"
And I log out
And I log in as "user1"
And I follow "Profile" in the user menu
And I should see "Site Badge"
And I log out
And I log in as "user2"
And I follow "Profile" in the user menu
And I should see "Site Badge"
@javascript
Scenario: Award badge based on a single cohort membership and other criteria.
Given the following "cohorts" exist:
| name | idnumber |
| One Cohort | CH1 |
| Two Cohort | CH2 |
And the following "users" exist:
| username | firstname | lastname | email |
| user1 | First | User | first@example.com |
| user2 | Second | User | second@example.com |
And the following "cohort members" exist:
| user | cohort |
| user1 | CH1 |
| user2 | CH2 |
And I log in as "admin"
And I navigate to "Add a new badge" node in "Site administration > Badges"
And I set the following fields to these values:
| Name | Site Badge |
| Description | Site badge description |
| issuername | Tester of site badge |
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
And I press "Create badge"
And I set the field "type" to "Cohort membership"
And I set the field "id_cohort_cohorts" to "One Cohort"
And I press "Save"
And I set the field "type" to "Manual issue by role"
And I expand all fieldsets
And I set the field "Manager" to "1"
And I set the field "Any of the selected roles awards the badge" to "1"
And I press "Save"
When I press "Enable access"
And I press "Continue"
And I follow "Recipients (0)"
And I press "Award badge"
And I set the field "potentialrecipients[]" to "First User (first@example.com)"
And I press "Award badge"
And I set the field "potentialrecipients[]" to "Second User (second@example.com)"
And I press "Award badge"
And I follow "Site Badge"
Then I should see "Recipients (1)"
And I log out
And I log in as "user1"
And I follow "Profile" in the user menu
And I should see "Site Badge"
And I log out
And I log in as "user2"
And I follow "Profile" in the user menu
And I should not see "Site Badge"
@javascript
Scenario: Award badge based on a single cohort membership or other criteria.
Given the following "cohorts" exist:
| name | idnumber |
| One Cohort | CH1 |
| Two Cohort | CH2 |
And the following "users" exist:
| username | firstname | lastname | email |
| user1 | First | User | first@example.com |
| user2 | Second | User | second@example.com |
| user3 | Third | User | third@example.com |
And the following "cohort members" exist:
| user | cohort |
| user1 | CH1 |
| user2 | CH2 |
| user3 | CH2 |
And I log in as "admin"
And I navigate to "Add a new badge" node in "Site administration > Badges"
And I set the following fields to these values:
| Name | Site Badge |
| Description | Site badge description |
| issuername | Tester of site badge |
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
And I press "Create badge"
And I set the field "type" to "Cohort membership"
And I set the field "id_cohort_cohorts" to "One Cohort"
And I press "Save"
And I set the field "type" to "Manual issue by role"
And I expand all fieldsets
And I set the field "Manager" to "1"
And I set the field "Any of the selected roles awards the badge" to "1"
And I press "Save"
And I set the field "update" to "Any"
When I press "Enable access"
And I press "Continue"
And I follow "Recipients (1)"
And I press "Award badge"
And I set the field "potentialrecipients[]" to "First User (first@example.com)"
And I press "Award badge"
And I set the field "potentialrecipients[]" to "Second User (second@example.com)"
And I press "Award badge"
And I follow "Site Badge"
Then I should see "Recipients (2)"
And I log out
And I log in as "user1"
And I follow "Profile" in the user menu
And I should see "Site Badge"
And I log out
And I log in as "user2"
And I follow "Profile" in the user menu
And I should see "Site Badge"
And I log out
And I log in as "user3"
And I follow "Profile" in the user menu
And I should not see "Site Badge"
@javascript
Scenario: Award badge based on a multiple cohort membership or other criteria.
Given the following "cohorts" exist:
| name | idnumber |
| One Cohort | CH1 |
| Two Cohort | CH2 |
And the following "users" exist:
| username | firstname | lastname | email |
| user1 | First | User | first@example.com |
| user2 | Second | User | second@example.com |
| user3 | third | User | third@example.com |
And the following "cohort members" exist:
| user | cohort |
| user1 | CH1 |
| user1 | CH2 |
| user2 | CH2 |
| user2 | CH2 |
And I log in as "admin"
And I navigate to "Add a new badge" node in "Site administration > Badges"
And I set the following fields to these values:
| Name | Site Badge |
| Description | Site badge description |
| issuername | Tester of site badge |
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
And I press "Create badge"
And I set the field "type" to "Cohort membership"
And I set the field "id_cohort_cohorts" to "One Cohort"
And I press "Save"
And I set the field "type" to "Manual issue by role"
And I expand all fieldsets
And I set the field "Manager" to "1"
And I set the field "Any of the selected roles awards the badge" to "1"
And I press "Save"
And I set the field "update" to "Any"
When I press "Enable access"
And I press "Continue"
And I follow "Recipients (1)"
And I press "Award badge"
And I set the field "potentialrecipients[]" to "First User (first@example.com)"
And I press "Award badge"
And I set the field "potentialrecipients[]" to "Second User (second@example.com)"
And I press "Award badge"
And I follow "Site Badge"
Then I should see "Recipients (2)"
And I log out
And I log in as "user1"
And I follow "Profile" in the user menu
And I should see "Site Badge"
And I log out
And I log in as "user2"
And I follow "Profile" in the user menu
And I should see "Site Badge"
And I log out
And I log in as "user3"
And I follow "Profile" in the user menu
And I should not see "Site Badge"
@javascript
Scenario: Award badge based on a multiple cohort membership and other criteria.
Given the following "cohorts" exist:
| name | idnumber |
| One Cohort | CH1 |
| Two Cohort | CH2 |
And the following "users" exist:
| username | firstname | lastname | email |
| user1 | First | User | first@example.com |
| user2 | Second | User | second@example.com |
| user3 | Third | User | third@example.com |
And the following "cohort members" exist:
| user | cohort |
| user1 | CH1 |
| user1 | CH2 |
| user2 | CH1 |
| user3 | CH2 |
And I log in as "admin"
And I navigate to "Add a new badge" node in "Site administration > Badges"
And I set the following fields to these values:
| Name | Site Badge |
| Description | Site badge description |
| issuername | Tester of site badge |
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
And I press "Create badge"
And I set the field "type" to "Cohort membership"
And I expand all fieldsets
And I set the field "id_cohort_cohorts" to "One Cohort,Two Cohort"
And I set the field "id_agg_1" to "1"
And I press "Save"
And I set the field "type" to "Manual issue by role"
And I expand all fieldsets
And I set the field "Manager" to "1"
And I set the field "Any of the selected roles awards the badge" to "1"
And I press "Save"
And I set the field "update" to "All"
When I press "Enable access"
And I press "Continue"
And I follow "Recipients (0)"
And I press "Award badge"
And I set the field "potentialrecipients[]" to "First User (first@example.com)"
And I press "Award badge"
And I set the field "potentialrecipients[]" to "Second User (second@example.com)"
And I press "Award badge"
And I follow "Site Badge"
Then I should see "Recipients (1)"
And I log out
And I log in as "user1"
And I follow "Profile" in the user menu
And I should see "Site Badge"
And I log out
And I log in as "user2"
And I follow "Profile" in the user menu
And I should not see "Site Badge"
And I log out
And I log in as "user3"
And I follow "Profile" in the user menu
And I should not see "Site Badge"
@javascript
Scenario: Award multiple badges based on single cohort membership
Given the following "cohorts" exist:
| name | idnumber |
| One Cohort | CH1 |
| Two Cohort | CH2 |
And the following "users" exist:
| username | firstname | lastname | email |
| user1 | First | User | first@example.com |
| user2 | Second | User | second@example.com |
| user3 | Third | User | third@example.com |
And the following "cohort members" exist:
| user | cohort |
| user1 | CH1 |
| user1 | CH2 |
| user2 | CH2 |
And I log in as "admin"
And I navigate to "Add a new badge" node in "Site administration > Badges"
And I set the following fields to these values:
| Name | Site Badge 1 |
| Description | Site badge description |
| issuername | Tester of site badge |
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
And I press "Create badge"
And I set the field "type" to "Cohort membership"
And I set the field "id_cohort_cohorts" to "One Cohort"
And I press "Save"
And I press "Enable access"
When I press "Continue"
And I should see "Recipients (1)"
And I navigate to "Add a new badge" node in "Site administration > Badges"
And I set the following fields to these values:
| Name | Site Badge 2 |
| Description | Site badge description |
| issuername | Tester of site badge |
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
And I press "Create badge"
And I set the field "type" to "Cohort membership"
And I set the field "id_cohort_cohorts" to "Two Cohort"
And I press "Save"
And I press "Enable access"
And I press "Continue"
Then I should see "Recipients (2)"
And I log out
And I log in as "user1"
And I follow "Profile" in the user menu
And I should see "Site Badge 1"
And I should see "Site Badge 2"
And I log out
And I log in as "user2"
And I follow "Profile" in the user menu
And I should not see "Site Badge 1"
And I should see "Site Badge 2"
And I log out
And I log in as "user3"
And I follow "Profile" in the user menu
And I should not see "Site Badge 1"
And I should not see "Site Badge 2"
@javascript
Scenario: Award multiple badges based on multiple cohort memberships
Given the following "cohorts" exist:
| name | idnumber |
| One Cohort | CH1 |
| Two Cohort | CH2 |
| Three Cohort | CH3 |
And the following "users" exist:
| username | firstname | lastname | email |
| user1 | First | User | first@example.com |
| user2 | Second | User | second@example.com |
| user3 | Third | User | third@example.com |
And I log in as "admin"
And I navigate to "Add a new badge" node in "Site administration > Badges"
And I set the following fields to these values:
| Name | Site Badge 1 |
| Description | Site badge description |
| issuername | Tester of site badge |
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
And I press "Create badge"
And I set the field "type" to "Cohort membership"
And I expand all fieldsets
And I set the field "id_cohort_cohorts" to "One Cohort,Two Cohort"
And I set the field "id_agg_1" to "1"
And I press "Save"
And I press "Enable access"
When I press "Continue"
And I should see "Recipients (0)"
And I navigate to "Add a new badge" node in "Site administration > Badges"
And I set the following fields to these values:
| Name | Site Badge 2 |
| Description | Site badge description |
| issuername | Tester of site badge |
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
And I press "Create badge"
And I set the field "type" to "Cohort membership"
And I expand all fieldsets
And I set the field "id_cohort_cohorts" to "Three Cohort,Two Cohort"
And I set the field "id_agg_1" to "1"
And I press "Save"
And I press "Enable access"
And I press "Continue"
Then I navigate to "Cohorts" node in "Site administration > Users > Accounts"
And I add "First User (first@example.com)" user to "CH1" cohort members
And I add "First User (first@example.com)" user to "CH2" cohort members
And I add "Second User (second@example.com)" user to "CH2" cohort members
And I add "Second User (second@example.com)" user to "CH3" cohort members
And I log out
And I log in as "user1"
And I follow "Profile" in the user menu
And I should see "Site Badge 1"
And I should not see "Site Badge 2"
And I log out
And I log in as "user2"
And I follow "Profile" in the user menu
And I should not see "Site Badge 1"
And I should see "Site Badge 2"
And I log out
And I log in as "user3"
And I follow "Profile" in the user menu
And I should not see "Site Badge 1"
And I should not see "Site Badge 2"

View File

@ -185,21 +185,21 @@ $string['criteria_descr_short4'] = 'Complete the course ';
$string['criteria_descr_short5'] = 'Complete <strong>{$a}</strong> of: ';
$string['criteria_descr_short6'] = 'Complete <strong>{$a}</strong> of: ';
$string['criteria_descr_short7'] = 'Complete <strong>{$a}</strong> of: ';
$string['criteria_descr_short98'] = 'Cohort membership in <strong>{$a}</strong> of: ';
$string['criteria_descr_short8'] = 'Cohort membership in <strong>{$a}</strong> of: ';
$string['criteria_descr_single_short1'] = 'Complete: ';
$string['criteria_descr_single_short2'] = 'Awarded by: ';
$string['criteria_descr_single_short4'] = 'Complete the course ';
$string['criteria_descr_single_short5'] = 'Complete: ';
$string['criteria_descr_single_short6'] = 'Complete: ';
$string['criteria_descr_single_short7'] = 'Complete: ';
$string['criteria_descr_single_short98'] = 'Membership in: ';
$string['criteria_descr_single_short8'] = 'Membership in: ';
$string['criteria_descr_single_1'] = 'The following activity has to be completed:';
$string['criteria_descr_single_2'] = 'This badge has to be awarded by a user with the following role:';
$string['criteria_descr_single_4'] = 'Users must complete the course';
$string['criteria_descr_single_5'] = 'The following course has to be completed:';
$string['criteria_descr_single_6'] = 'The following user profile field has to be completed:';
$string['criteria_descr_single_7'] = 'The following badge has to be earned:';
$string['criteria_descr_single_98'] = 'Membership in the following cohort is required:';
$string['criteria_descr_single_8'] = 'Membership in the following cohort is required:';
$string['criteria_descr_0'] = 'Users are awarded this badge when they complete <strong>{$a}</strong> of the listed requirements.';
$string['criteria_descr_1'] = '<strong>{$a}</strong> of the following activities are completed:';
$string['criteria_descr_2'] = 'This badge has to be awarded by the users with <strong>{$a}</strong> of the following roles:';
@ -207,7 +207,7 @@ $string['criteria_descr_4'] = 'Users must complete the course';
$string['criteria_descr_5'] = '<strong>{$a}</strong> of the following courses have to be completed:';
$string['criteria_descr_6'] = '<strong>{$a}</strong> of the following user profile fields have to be completed:';
$string['criteria_descr_7'] = '<strong>{$a}</strong> of the following badges have to be earned:';
$string['criteria_descr_98'] = 'Membership in <strong>{$a}</strong> of the following cohorts is required:';
$string['criteria_descr_8'] = 'Membership in <strong>{$a}</strong> of the following cohorts is required:';
$string['criteria_0'] = 'This badge is awarded when...';
$string['criteria_1'] = 'Activity completion';
$string['criteria_1_help'] = 'Allows a badge to be awarded to users based on the completion of a set of activities within a course.';
@ -223,8 +223,8 @@ $string['criteria_6'] = 'Profile completion';
$string['criteria_6_help'] = 'Allows a badge to be awarded to users for completing certain fields in their profile. You can select from default and custom profile fields that are available to users. ';
$string['criteria_7'] = 'Awarded badges';
$string['criteria_7_help'] = 'Allows a badge to be awarded to users based on the other badges thay have earned.';
$string['criteria_98'] = 'Cohort membership';
$string['criteria_98_help'] = 'Allows a badge to be awarded to users for becoming a member of certian cohorts.';
$string['criteria_8'] = 'Cohort membership';
$string['criteria_8_help'] = 'Allows a badge to be awarded to users for becoming a member of certian cohorts.';
$string['criterror'] = 'Current parameters issues';
$string['criterror_help'] = 'This fieldset shows all parameters that were initially added to this badge requirement but are no longer available. It is recommended that you un-check such parameters to make sure that users can earn this badge in the future.';
$string['currentimage'] = 'Current image';