Skip to content

Commit

Permalink
Merge branch 'MDL-53451-master-fixup3' of https://github.com/FMCorz/m…
Browse files Browse the repository at this point in the history
  • Loading branch information
David Monllao committed Apr 22, 2016
2 parents 48da3ee + 5592edb commit c047386
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 13 deletions.
12 changes: 6 additions & 6 deletions admin/tool/lp/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* @param context $coursecontext The context of the course
*/
function tool_lp_extend_navigation_course($navigation, $course, $coursecontext) {
if (!\core_competency\api::is_enabled()) {
if (!get_config('core_competency', 'enabled')) {
return;
}

Expand Down Expand Up @@ -61,7 +61,7 @@ function tool_lp_extend_navigation_course($navigation, $course, $coursecontext)
* @param context_course $coursecontext The context of the course
*/
function tool_lp_extend_navigation_user($navigation, $user, $usercontext, $course, $coursecontext) {
if (!\core_competency\api::is_enabled()) {
if (!get_config('core_competency', 'enabled')) {
return;
}

Expand All @@ -88,7 +88,7 @@ function tool_lp_extend_navigation_user($navigation, $user, $usercontext, $cours
* @return bool
*/
function tool_lp_myprofile_navigation(core_user\output\myprofile\tree $tree, $user, $iscurrentuser, $course) {
if (!\core_competency\api::is_enabled()) {
if (!get_config('core_competency', 'enabled')) {
return false;
} else if (!\core_competency\plan::can_read_user($user->id)) {
return false;
Expand All @@ -109,7 +109,7 @@ function tool_lp_myprofile_navigation(core_user\output\myprofile\tree $tree, $us
* @param context $coursecategorycontext The context of the course category
*/
function tool_lp_extend_navigation_category_settings($navigation, $coursecategorycontext) {
if (!\core_competency\api::is_enabled()) {
if (!get_config('core_competency', 'enabled')) {
return false;
}

Expand Down Expand Up @@ -160,7 +160,7 @@ function tool_lp_extend_navigation_category_settings($navigation, $coursecategor
function tool_lp_coursemodule_standard_elements($formwrapper, $mform) {
global $CFG, $COURSE;

if (!\core_competency\api::is_enabled()) {
if (!get_config('core_competency', 'enabled')) {
return;
} else if (!has_capability('moodle/competency:coursecompetencymanage', $formwrapper->get_context())) {
return;
Expand Down Expand Up @@ -195,7 +195,7 @@ function tool_lp_coursemodule_standard_elements($formwrapper, $mform) {
* @param stdClass $course The course.
*/
function tool_lp_coursemodule_edit_post_actions($data, $course) {
if (!\core_competency\api::is_enabled()) {
if (!get_config('core_competency', 'enabled')) {
return $data;
}

Expand Down
2 changes: 1 addition & 1 deletion admin/tool/lp/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
$parentname = 'competencies';

// If the plugin is enabled we add the pages.
if (\core_competency\api::is_enabled()) {
if (get_config('core_competency', 'enabled')) {

// Manage competency frameworks page.
$temp = new admin_externalpage(
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/lpmigrate/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
defined('MOODLE_INTERNAL') || die();

if (\core_competency\api::is_enabled()) {
if (get_config('core_competency', 'enabled')) {

$parentname = 'competencies';

Expand Down
2 changes: 1 addition & 1 deletion blocks/lp/block_lp.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function get_content() {
}
$this->content = new stdClass();

if (!\core_competency\api::is_enabled()) {
if (!get_config('core_competency', 'enabled')) {
return $this->content;
}

Expand Down
4 changes: 4 additions & 0 deletions competency/classes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ class api {
/**
* Returns whether competencies are enabled.
*
* This method should never do more than checking the config setting, the reason
* being that some other code could be checking the config value directly
* to avoid having to load this entire file into memory.
*
* @return boolean True when enabled.
*/
public static function is_enabled() {
Expand Down
8 changes: 4 additions & 4 deletions competency/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
function core_competency_comment_add($comment, $params) {
global $USER;

if (!api::is_enabled()) {
if (!get_config('core_competency', 'enabled')) {
return;
}

Expand Down Expand Up @@ -215,7 +215,7 @@ function core_competency_comment_add($comment, $params) {
* @return array
*/
function core_competency_comment_permissions($params) {
if (!api::is_enabled()) {
if (!get_config('core_competency', 'enabled')) {
return array('post' => false, 'view' => false);
}

Expand All @@ -241,7 +241,7 @@ function core_competency_comment_permissions($params) {
* @return bool
*/
function core_competency_comment_validate($params) {
if (!api::is_enabled()) {
if (!get_config('core_competency', 'enabled')) {
return false;
}

Expand Down Expand Up @@ -274,7 +274,7 @@ function core_competency_comment_validate($params) {
function core_competency_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array()) {
global $CFG;

if (!api::is_enabled()) {
if (!get_config('core_competency', 'enabled')) {
return false;
}

Expand Down
4 changes: 4 additions & 0 deletions report/competency/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
* @param stdClass $context The context of the course
*/
function report_competency_extend_navigation_course($navigation, $course, $context) {
if (!get_config('core_competency', 'enabled')) {
return;
}

if (has_capability('moodle/competency:coursecompetencyview', $context)) {
$url = new moodle_url('/report/competency/index.php', array('id' => $course->id));
$name = get_string('pluginname', 'report_competency');
Expand Down

0 comments on commit c047386

Please sign in to comment.