Browse files

MDL-40550 badges: Change wording of badge activation message

Add confirmation check when activating badge from management page
  • Loading branch information...
1 parent 444433b commit a2547d7087099c2d812b7e1ce839bd437357e11c @ybozhko ybozhko committed Sep 6, 2013
View
1 badges/action.php
@@ -110,6 +110,7 @@
if ($confirm == 1) {
require_sesskey();
$badge->set_status($status);
+ $returnurl->param('msg', 'activatesuccess');
if ($badge->type == BADGE_TYPE_SITE) {
// Review on cron if there are more than 1000 users who can earn a site-level badge.
View
4 badges/criteria.php
@@ -72,7 +72,7 @@
$obj->id = $badge->criteria[BADGE_CRITERIA_TYPE_OVERALL]->id;
$obj->method = $update;
if ($DB->update_record('badge_criteria', $obj)) {
- $msg = get_string('changessaved');
+ $msg = 'criteriaupdated';
} else {
$emsg = get_string('error:save', 'badges');
}
@@ -84,7 +84,7 @@
if ($emsg !== '') {
echo $OUTPUT->notification($emsg);
} else if ($msg !== '') {
- echo $OUTPUT->notification($msg, 'notifysuccess');
+ echo $OUTPUT->notification(get_string($msg, 'badges'), 'notifysuccess');
}
echo $output->print_badge_status_box($badge);
View
1 badges/criteria_action.php
@@ -80,6 +80,7 @@
} else {
$badge->criteria[$type]->delete();
}
+ $return->param('msg', 'criteriadeleted');
redirect($return);
}
View
4 badges/criteria_settings.php
@@ -71,8 +71,10 @@
$cparams = array('criteriatype' => $type, 'badgeid' => $badge->id);
if ($edit) {
$criteria = $badge->criteria[$type];
+ $msg = 'criteriaupdated';
} else {
$criteria = award_criteria::build($cparams);
+ $msg = 'criteriacreated';
}
$mform = new edit_criteria_form($FULLME, array('criteria' => $criteria, 'addcourse' => $addcourse, 'course' => $badge->courseid));
@@ -96,7 +98,7 @@
$criteria_overall->save(array('agg' => BADGE_CRITERIA_AGGREGATION_ALL));
}
$criteria->save($data);
- $return->param('msg', get_string('changessaved'));
+ $return->param('msg', $msg);
redirect($return);
}
View
26 badges/index.php
@@ -124,33 +124,15 @@
}
}
-if ($activate && has_capability('moodle/badges:configuredetails', $PAGE->context)) {
- $badge = new badge($activate);
-
- if (!$badge->has_criteria()) {
- $err = get_string('error:cannotact', 'badges') . get_string('nocriteria', 'badges');
- } else {
- if ($badge->is_locked()) {
- $badge->set_status(BADGE_STATUS_ACTIVE_LOCKED);
- $msg = get_string('activatesuccess', 'badges');
- } else {
- require_sesskey();
- $badge->set_status(BADGE_STATUS_ACTIVE);
- $msg = get_string('activatesuccess', 'badges');
- }
- $returnurl->param('msg', $msg);
- redirect($returnurl);
- }
-} else if ($deactivate && has_capability('moodle/badges:configuredetails', $PAGE->context)) {
+if ($deactivate && has_capability('moodle/badges:configuredetails', $PAGE->context)) {
+ require_sesskey();
$badge = new badge($deactivate);
if ($badge->is_locked()) {
$badge->set_status(BADGE_STATUS_INACTIVE_LOCKED);
- $msg = get_string('deactivatesuccess', 'badges');
} else {
- require_sesskey();
$badge->set_status(BADGE_STATUS_INACTIVE);
- $msg = get_string('deactivatesuccess', 'badges');
}
+ $msg = 'deactivatesuccess';
$returnurl->param('msg', $msg);
redirect($returnurl);
}
@@ -178,7 +160,7 @@
}
if ($msg !== '') {
- echo $OUTPUT->notification($msg, 'notifysuccess');
+ echo $OUTPUT->notification(get_string($msg, 'badges'), 'notifysuccess');
}
$badges = new badge_management($records);
View
1 badges/recipients.php
@@ -31,7 +31,6 @@
$sortby = optional_param('sort', 'dateissued', PARAM_ALPHA);
$sorthow = optional_param('dir', 'DESC', PARAM_ALPHA);
$page = optional_param('page', 0, PARAM_INT);
-$updatepref = optional_param('updatepref', false, PARAM_BOOL);
require_login();
View
10 badges/renderer.php
@@ -228,12 +228,16 @@ public function print_badge_overview($badge, $context) {
public function print_badge_table_actions($badge, $context) {
$actions = "";
- if (has_capability('moodle/badges:configuredetails', $context)) {
+ if (has_capability('moodle/badges:configuredetails', $context) && $badge->has_criteria()) {
// Activate/deactivate badge.
if ($badge->status == BADGE_STATUS_INACTIVE || $badge->status == BADGE_STATUS_INACTIVE_LOCKED) {
- $url = new moodle_url(qualified_me());
- $url->param('activate', $badge->id);
+ // "Activate" will go to another page and ask for confirmation.
+ $url = new moodle_url('/badges/action.php');
+ $url->param('id', $badge->id);
+ $url->param('activate', true);
$url->param('sesskey', sesskey());
+ $return = new moodle_url(qualified_me());
+ $url->param('return', $return->out_as_local_url(false));
$actions .= $this->output->action_icon($url, new pix_icon('t/show', get_string('activate', 'badges'))) . " ";
} else {
$url = new moodle_url(qualified_me());
View
14 lang/en/badges.php
@@ -139,6 +139,9 @@
$string['creatorbody'] = '<p>{$a->user} has completed all badge requirements and has been awarded the badge. View issued badge at {$a->link} </p>';
$string['creatorsubject'] = '\'{$a}\' has been awarded!';
$string['criteriasummary'] = 'Criteria summary';
+$string['criteriacreated'] = 'Badge criteria successfully created';
+$string['criteriadeleted'] = 'Badge criteria successfully deleted';
+$string['criteriaupdated'] = 'Badge criteria successfully updated';
$string['criteria_descr'] = 'Users are awarded this badge when they complete the following requirement:';
$string['criteria_descr_bydate'] = ' by <em>{$a}</em> ';
$string['criteria_descr_grade'] = ' with minimum grade of <em>{$a}</em> ';
@@ -313,9 +316,14 @@
$string['recipientvalidationproblem'] = 'Current user cannot be verified as a recipient of this badge.';
$string['relative'] = 'Relative date';
$string['requiredcourse'] = 'At least one course should be added to the courseset criterion.';
-$string['reviewbadge'] = 'Review badge criteria';
-$string['reviewconfirm'] = '<p>This action will perform a check if any of the users have already completed all the requirements for \'{$a}\' badge?</p>
-<p>Would you like to proceed?</p>';
+$string['reviewbadge'] = 'Changes in badge access';
+$string['reviewconfirm'] = '<p>This will make your badge visible to users and allow them to start earning it.</p>
+
+<p>It is possible that some users already meet this badge\'s criteria and will be issued this badge immediately after you enable it.</p>
+
+<p>Once a badge has been issued it will be <strong>locked</strong> - certain settings including the criteria and expiry settings can no longer be changed.</p>
+
+<p>Are you sure you want to enable access to the badge \'{$a}\'?</p>';
$string['save'] = 'Save';
$string['searchname'] = 'Search by name';
$string['selectaward'] = 'Please select the role you would like to use to award this badge: ';

0 comments on commit a2547d7

Please sign in to comment.