Skip to content

Commit

Permalink
Merge pull request #14 from saylordotorg/fix/NOTIFY_error
Browse files Browse the repository at this point in the history
Fix/notify error
  • Loading branch information
jazinheira authored Apr 22, 2020
2 parents c94a19f + 5ae1d35 commit 5fdb8c2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

foreach ($userstoassign as $adduser) {
if (discoursesso_add_group($adduser->id) === false) {
echo $OUTPUT->notification('The cohort was not added.', NOTIFY_ERROR);
echo $OUTPUT->notification('The cohort was not added.', \core\output\notification::NOTIFY_ERROR);
}
}

Expand All @@ -78,7 +78,7 @@
if (!empty($userstoremove)) {
foreach ($userstoremove as $removeuser) {
if (discoursesso_remove_group($removeuser->id) === false) {
echo $OUTPUT->notification('The cohort was not removed.', NOTIFY_ERROR);
echo $OUTPUT->notification('The cohort was not removed.', \core\output\notification::NOTIFY_ERROR);
}
}
$potentialuserselector->invalidate_selected_users();
Expand Down
12 changes: 6 additions & 6 deletions locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function local_discoursesso_cohort_deleted_handler($event) {
// First, delete the group from Discourse.
if (empty($CFG->discoursesso_api_key)) {
// No API key was found.
echo $OUTPUT->notification(get_string('errornoapikey', 'local_discoursesso'), NOTIFY_WARNING);
echo $OUTPUT->notification(get_string('errornoapikey', 'local_discoursesso'), \core\output\notification::NOTIFY_WARNING);
return false;
}

Expand Down Expand Up @@ -114,7 +114,7 @@ function discoursesso_add_group($cohortid) {
// Make sure that there is an API key set.
if (empty($CFG->discoursesso_api_key)) {
// No API key was found.
echo $OUTPUT->notification(get_string('errornoapikey', 'local_discoursesso'), NOTIFY_WARNING);
echo $OUTPUT->notification(get_string('errornoapikey', 'local_discoursesso'), \core\output\notification::NOTIFY_WARNING);
return false;
}

Expand All @@ -130,12 +130,12 @@ function discoursesso_add_group($cohortid) {
$r = $api->createGroup(clean_name($ssocohort->cohortname));

if ($r->http_code != 200) {
echo $OUTPUT->notification(get_string('errorcreategroupdiscourse', 'local_discoursesso', clean_name($ssocohort->cohortname)), NOTIFY_WARNING);
echo $OUTPUT->notification(get_string('errorcreategroupdiscourse', 'local_discoursesso', clean_name($ssocohort->cohortname)), \core\output\notification::NOTIFY_WARNING);
return false;
}

if (!($DB->insert_record('discoursesso_cohorts', $ssocohort, false))) {
echo $OUTPUT->notification(get_string('errorcreaterecorddb', 'local_discoursesso'), NOTIFY_WARNING);
echo $OUTPUT->notification(get_string('errorcreaterecorddb', 'local_discoursesso'), \core\output\notification::NOTIFY_WARNING);
return false;
}

Expand All @@ -153,7 +153,7 @@ function discoursesso_remove_group($cohortid) {
// First, delete the group from Discourse.
if (empty($CFG->discoursesso_api_key)) {
// No API key was found.
echo $OUTPUT->notification(get_string('errornoapikey', 'local_discoursesso'), NOTIFY_WARNING);
echo $OUTPUT->notification(get_string('errornoapikey', 'local_discoursesso'), \core\output\notification::NOTIFY_WARNING);
return false;
}
$api = new DiscourseAPI(preg_replace("(^https?://)", "", $CFG->discoursesso_discourse_url), $CFG->discoursesso_api_key, preg_replace("(://.+)", "", $CFG->discoursesso_discourse_url));
Expand All @@ -162,7 +162,7 @@ function discoursesso_remove_group($cohortid) {
$r = $api->deleteGroup(clean_name($cohort->name));

if (!($DB->delete_records('discoursesso_cohorts', array('cohortid' => $cohortid)))) {
echo $OUTPUT->notification(get_string('errordeleterecorddb', 'local_discoursesso'), NOTIFY_WARNING);
echo $OUTPUT->notification(get_string('errordeleterecorddb', 'local_discoursesso'), \core\output\notification::NOTIFY_WARNING);
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2019052300;
$plugin->version = 2020042200;
$plugin->requires = 2016052306; // Requires this Moodle version - at least 3.1
$plugin->cron = 0;
$plugin->component = 'local_discoursesso';

$plugin->release = '1.3.0';
$plugin->release = '1.3.1';
$plugin->maturity = MATURITY_STABLE;

0 comments on commit 5fdb8c2

Please sign in to comment.