Skip to content

Commit

Permalink
MDL-35073 Badges - Set of minor fixes for issues found during integra…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
Damyon Wiese committed Apr 2, 2013
1 parent 2780655 commit 2188a69
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 7 deletions.
3 changes: 2 additions & 1 deletion admin/settings/badges.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
*/

global $SITE;
require_once($CFG->libdir . '/badgeslib.php');

if (!empty($CFG->enablebadges) && ($hassiteconfig || has_any_capability(array(
'moodle/badges:viewawarded',
Expand All @@ -37,6 +36,8 @@
'moodle/badges:configuredetails',
'moodle/badges:deletebadge'), $systemcontext))) {

require_once($CFG->libdir . '/badgeslib.php');

$globalsettings = new admin_settingpage('badgesettings', new lang_string('badgesettings', 'badges'),
array('moodle/badges:manageglobalsettings'));

Expand Down
1 change: 1 addition & 0 deletions badges/action.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
}

if ($copy) {
require_sesskey();
require_capability('moodle/badges:createbadge', $context);

$cloneid = $badge->make_clone();
Expand Down
2 changes: 2 additions & 0 deletions badges/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
$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');
}
Expand All @@ -136,6 +137,7 @@
$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');
}
Expand Down
2 changes: 1 addition & 1 deletion lang/en/badges.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
$string['allowexternalbackpack'] = 'Enable connection to external backpacks';
$string['allowexternalbackpack_desc'] = 'Allow users to set up connections and display badges from their external backpack providers.
Note: It is recommended to leave this option disabled if the web site cannot be accesed from the internet (e.g. because of the firewall).';
Note: It is recommended to leave this option disabled if the web site cannot be accessed from the internet (e.g. because of the firewall).';
$string['any'] = 'Any';
$string['anymethod'] = 'Any of the selected conditions is met';
$string['anymethodactivity'] = 'Any of the selected activities is complete';
Expand Down
4 changes: 2 additions & 2 deletions lib/navigationlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2182,7 +2182,7 @@ protected function load_for_user($user=null, $forceforcontext=false) {
$usernode->add(get_string('myfiles'), $url, self::TYPE_SETTING);
}

if ($CFG->enablebadges && $iscurrentuser &&
if (!empty($CFG->enablebadges) && $iscurrentuser &&
has_capability('moodle/badges:manageownbadges', context_user::instance($USER->id))) {
$url = new moodle_url('/badges/mybadges.php');
$usernode->add(get_string('mybadges', 'badges'), $url, self::TYPE_SETTING);
Expand Down Expand Up @@ -2511,7 +2511,7 @@ public function add_front_page_course_essentials(navigation_node $coursenode, st
}

//Badges
if ($CFG->enablebadges && has_capability('moodle/badges:viewbadges', $this->page->context)) {
if (!empty($CFG->enablebadges) && has_capability('moodle/badges:viewbadges', $this->page->context)) {
$url = new moodle_url($CFG->wwwroot . '/badges/view.php', array('type' => 1));
$coursenode->add(get_string('sitebadges', 'badges'), $url, navigation_node::TYPE_CUSTOM);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/pluginlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ public static function standard_plugins_list($type) {
),

'block' => array(
'activity_modules', 'admin_bookmarks', 'blog_menu',
'activity_modules', 'admin_bookmarks', 'badges', 'blog_menu',
'blog_recent', 'blog_tags', 'calendar_month',
'calendar_upcoming', 'comments', 'community',
'completionstatus', 'course_list', 'course_overview',
Expand Down
2 changes: 1 addition & 1 deletion pix/i/expired.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion pix/t/backpack.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2188a69

Please sign in to comment.