Merge branch 'MDL-40550_25' of https://github.com/totara/openbadges into MOODLE_25_STABLE

This commit is contained in:
Marina Glancy
2013-09-24 21:43:18 +10:00
8 changed files with 29 additions and 32 deletions
+1
View File
@@ -110,6 +110,7 @@ if ($activate) {
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.
+2 -2
View File
@@ -72,7 +72,7 @@ if ((($update == BADGE_CRITERIA_AGGREGATION_ALL) || ($update == BADGE_CRITERIA_A
$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 @@ echo $OUTPUT->heading(print_badge_image($badge, $context, 'small') . ' ' . $badg
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);
+1
View File
@@ -80,6 +80,7 @@ if ($delete && has_capability('moodle/badges:configurecriteria', $context)) {
} else {
$badge->criteria[$type]->delete();
}
$return->param('msg', 'criteriadeleted');
redirect($return);
}
+3 -1
View File
@@ -71,8 +71,10 @@ $PAGE->navbar->add($badge->name, new moodle_url('overview.php', array('id' => $b
$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 @@ if (!empty($addcourse)) {
$criteria_overall->save(array('agg' => BADGE_CRITERIA_AGGREGATION_ALL));
}
$criteria->save($data);
$return->param('msg', get_string('changessaved'));
$return->param('msg', $msg);
redirect($return);
}
+4 -22
View File
@@ -124,33 +124,15 @@ if ($delete && has_capability('moodle/badges:deletebadge', $PAGE->context)) {
}
}
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 ($totalcount) {
}
if ($msg !== '') {
echo $OUTPUT->notification($msg, 'notifysuccess');
echo $OUTPUT->notification(get_string($msg, 'badges'), 'notifysuccess');
}
$badges = new badge_management($records);
-1
View File
@@ -31,7 +31,6 @@ $badgeid = required_param('id', PARAM_INT);
$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();
+7 -3
View File
@@ -228,12 +228,16 @@ class core_badges_renderer extends plugin_renderer_base {
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());
+11 -3
View File
@@ -142,6 +142,9 @@ $string['createbutton'] = 'Create badge';
$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> ';
@@ -325,9 +328,14 @@ $string['recipientidentificationproblem'] = 'Cannot find a recipient of this bad
$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: ';