Skip to content

Commit

Permalink
tiny fix
Browse files Browse the repository at this point in the history
  • Loading branch information
fmido88 authored Feb 11, 2024
1 parent 0975a68 commit 7f020db
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions extra/offers.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,15 @@
$out .= $OUTPUT->heading(get_string('topupoffers', 'enrol_wallet'));
$out .= $OUTPUT->box(get_string('topupoffers_desc', 'enrol_wallet'));
$out .= $rules;
$out .= "<hr/>";
}
$config = get_config('enrol_wallet');
if (!empty($config->cashback)) {
$cashbackvalue = (float)$config->cashbackpercent;
if ($cashbackvalue > 0 && $cashbackvalue <= 100) {
$out .= $OUTPUT->heading(get_string('cashback', 'enrol_wallet'));
$out .= $OUTPUT->box(get_string('cashback_desc', 'enrol_wallet', $cashbackvalue));
$out .= "<hr/>";
}
}

Expand All @@ -89,16 +91,19 @@
$text = get_string('clickhere');
$link = html_writer::link($url, $text);
$out .= $OUTPUT->box(get_string('referral_site_desc', 'enrol_wallet') . $link);
$out .= "<hr/>";
}

if (!empty($free)) {
$out .= $OUTPUT->heading(get_string('freecourses', 'enrol_wallet'));
$out .= html_writer::div($free, 'courses courses-flex-cards');
$out .= "<hr/>";
}

if (!empty($withoffers)) {
$out .= $OUTPUT->heading(get_string('courseswithdiscounts', 'enrol_wallet'));
$out .= html_writer::div($withoffers, 'courses courses-flex-cards');
$out .= "<hr/>";
}

$out .= $OUTPUT->footer();
Expand Down
7 changes: 6 additions & 1 deletion settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,12 @@
get_string('frontpageoffers', 'enrol_wallet'),
get_string('frontpageoffers_desc', 'enrol_wallet'), 0));

$url = new moodle_url('/enrol/wallet/extra/offers_nav.php', ['return' => $PAGE->url]);
if ($PAGE->has_set_url()) {
$return = $PAGE->url->out();
} else {
$return = (new moodle_url('/admin/settings.php', ['section' => 'enrolsettingswallet']))->out();
}
$url = new moodle_url('/enrol/wallet/extra/offers_nav.php', ['return' => $return]);
$button = html_writer::link($url, get_string('offersnav', 'enrol_wallet'), ['class' => 'btn btn-secondary']);
$settings->add(new admin_setting_description('enrol_wallet/offers_nav', get_string('offersnav_desc', 'enrol_wallet'), $button));

Expand Down

0 comments on commit 7f020db

Please sign in to comment.