mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 12:32:08 +02:00
Merge branch 'MDL-72904-master-dec21' of https://github.com/peterRd/moodle
This commit is contained in:
commit
0fc33251bf
@ -42,11 +42,14 @@ $navurl = new moodle_url('/badges/index.php', array('type' => $badge->type));
|
||||
|
||||
if ($badge->type == BADGE_TYPE_COURSE) {
|
||||
require_login($badge->courseid);
|
||||
$course = get_course($badge->courseid);
|
||||
$heading = format_string($course->fullname, true, ['context' => $context]);
|
||||
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
|
||||
$PAGE->set_pagelayout('standard');
|
||||
navigation_node::override_active_url($navurl);
|
||||
} else {
|
||||
$PAGE->set_pagelayout('admin');
|
||||
$heading = get_string('administrationsite');
|
||||
navigation_node::override_active_url($navurl, true);
|
||||
}
|
||||
|
||||
@ -107,7 +110,7 @@ if ($activate) {
|
||||
$strheading = get_string('reviewbadge', 'badges');
|
||||
$PAGE->navbar->add($strheading);
|
||||
$PAGE->set_title($strheading);
|
||||
$PAGE->set_heading($badge->name);
|
||||
$PAGE->set_heading($heading);
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($strheading);
|
||||
|
||||
|
@ -45,18 +45,21 @@ if ($badge->type == BADGE_TYPE_COURSE) {
|
||||
print_error('coursebadgesdisabled', 'badges');
|
||||
}
|
||||
require_login($badge->courseid);
|
||||
$course = get_course($badge->courseid);
|
||||
$heading = format_string($course->fullname, true, ['context' => $context]);
|
||||
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
|
||||
$PAGE->set_pagelayout('standard');
|
||||
navigation_node::override_active_url($navurl);
|
||||
} else {
|
||||
$PAGE->set_pagelayout('admin');
|
||||
$heading = get_string('administrationsite');
|
||||
navigation_node::override_active_url($navurl, true);
|
||||
}
|
||||
|
||||
$currenturl = new moodle_url('/badges/alignment.php', array('id' => $badge->id));
|
||||
$PAGE->set_context($context);
|
||||
$PAGE->set_url($currenturl);
|
||||
$PAGE->set_heading($badge->name);
|
||||
$PAGE->set_heading($heading);
|
||||
$PAGE->set_title($badge->name);
|
||||
$PAGE->navbar->add($badge->name);
|
||||
|
||||
@ -80,9 +83,10 @@ if ($mform->is_cancelled()) {
|
||||
}
|
||||
|
||||
echo $OUTPUT->header();
|
||||
$actionbar = new \core_badges\output\manage_badge_action_bar($badge, $PAGE);
|
||||
echo $output->render_tertiary_navigation($actionbar);
|
||||
echo $OUTPUT->heading(print_badge_image($badge, $context, 'small') . ' ' . $badge->name);
|
||||
echo $output->print_badge_status_box($badge);
|
||||
$output->print_badge_tabs($badgeid, $context, 'alignment');
|
||||
if ($emsg !== '') {
|
||||
echo $OUTPUT->notification($emsg);
|
||||
} else if ($msg !== '') {
|
||||
|
@ -50,11 +50,14 @@ if ($badge->type == BADGE_TYPE_COURSE) {
|
||||
print_error('coursebadgesdisabled', 'badges');
|
||||
}
|
||||
require_login($badge->courseid);
|
||||
$course = get_course($badge->courseid);
|
||||
$heading = format_string($course->fullname, true, ['context' => $context]);
|
||||
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
|
||||
$PAGE->set_pagelayout('standard');
|
||||
navigation_node::override_active_url($navurl);
|
||||
} else {
|
||||
$PAGE->set_pagelayout('admin');
|
||||
$heading = get_string('administrationsite');
|
||||
navigation_node::override_active_url($navurl, true);
|
||||
}
|
||||
|
||||
@ -68,7 +71,7 @@ $PAGE->set_context($context);
|
||||
$strrecipients = get_string('recipients', 'badges');
|
||||
$PAGE->navbar->add($badge->name, new moodle_url('overview.php', array('id' => $badge->id)))->add($strrecipients);
|
||||
$PAGE->set_title($strrecipients);
|
||||
$PAGE->set_heading($badge->name);
|
||||
$PAGE->set_heading($heading);
|
||||
|
||||
if (!$badge->is_active()) {
|
||||
echo $OUTPUT->header();
|
||||
@ -77,15 +80,18 @@ if (!$badge->is_active()) {
|
||||
die();
|
||||
}
|
||||
|
||||
$returnurl = new moodle_url('recipients.php', array('id' => $badge->id));
|
||||
$returnlink = html_writer::link($returnurl, $strrecipients);
|
||||
$actionbar = new \core_badges\output\standard_action_bar($PAGE, $badge->type, false, false, $returnurl);
|
||||
$output = $PAGE->get_renderer('core', 'badges');
|
||||
$tertiarynav = $output->render_tertiary_navigation($actionbar);
|
||||
|
||||
// Roles that can award this badge.
|
||||
$acceptedroles = array_keys($badge->criteria[BADGE_CRITERIA_TYPE_MANUAL]->params);
|
||||
|
||||
if (empty($acceptedroles)) {
|
||||
echo $OUTPUT->header();
|
||||
$return = html_writer::link(new moodle_url('recipients.php', array('id' => $badge->id)), $strrecipients);
|
||||
echo $OUTPUT->notification(get_string('notacceptedrole', 'badges', $return));
|
||||
echo $OUTPUT->notification(get_string('notacceptedrole', 'badges', $returnlink));
|
||||
echo $OUTPUT->footer();
|
||||
die();
|
||||
}
|
||||
@ -126,6 +132,7 @@ if (count($acceptedroles) > 1) {
|
||||
if (!$role) {
|
||||
$pageurl = new moodle_url('/badges/award.php', array('id' => $badgeid));
|
||||
echo $OUTPUT->header();
|
||||
echo $tertiarynav;
|
||||
echo $OUTPUT->box($OUTPUT->single_select(new moodle_url($pageurl), 'role', $select, '', array('' => 'choosedots'),
|
||||
null, array('label' => get_string('selectaward', 'badges'))));
|
||||
echo $OUTPUT->footer();
|
||||
@ -139,8 +146,7 @@ if (count($acceptedroles) > 1) {
|
||||
}
|
||||
} else {
|
||||
echo $OUTPUT->header();
|
||||
$return = html_writer::link(new moodle_url('recipients.php', array('id' => $badge->id)), $strrecipients);
|
||||
echo $OUTPUT->notification(get_string('notacceptedrole', 'badges', $return));
|
||||
echo $OUTPUT->notification(get_string('notacceptedrole', 'badges', $returnlink));
|
||||
echo $OUTPUT->footer();
|
||||
die();
|
||||
}
|
||||
@ -150,8 +156,7 @@ if (count($acceptedroles) > 1) {
|
||||
$usersids = array_keys($users);
|
||||
if (!$isadmin && !in_array($USER->id, $usersids)) {
|
||||
echo $OUTPUT->header();
|
||||
$return = html_writer::link(new moodle_url('recipients.php', array('id' => $badge->id)), $strrecipients);
|
||||
echo $OUTPUT->notification(get_string('notacceptedrole', 'badges', $return));
|
||||
echo $OUTPUT->notification(get_string('notacceptedrole', 'badges', $returnlink));
|
||||
echo $OUTPUT->footer();
|
||||
die();
|
||||
} else {
|
||||
@ -206,6 +211,7 @@ if ($award && data_submitted() && has_capability('moodle/badges:awardbadge', $co
|
||||
}
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $tertiarynav;
|
||||
echo $OUTPUT->heading($strrecipients);
|
||||
|
||||
// Print group selector/dropdown menu (find out current groups mode).
|
||||
|
53
badges/classes/output/base_action_bar.php
Normal file
53
badges/classes/output/base_action_bar.php
Normal file
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace core_badges\output;
|
||||
|
||||
use renderable;
|
||||
use templatable;
|
||||
use moodle_page;
|
||||
|
||||
/**
|
||||
* Abstract class for the badges tertiary navigation. The class initialises the page and type class variables.
|
||||
*
|
||||
* @package core_badges
|
||||
* @copyright 2021 Peter Dias
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
abstract class base_action_bar implements renderable, templatable {
|
||||
/** @var moodle_page $page The context we are operating within. */
|
||||
protected $page;
|
||||
/** @var int $type The badge type. */
|
||||
protected $type;
|
||||
|
||||
/**
|
||||
* standard_action_bar constructor.
|
||||
*
|
||||
* @param moodle_page $page
|
||||
* @param int $type
|
||||
*/
|
||||
public function __construct(moodle_page $page, int $type) {
|
||||
$this->type = $type;
|
||||
$this->page = $page;
|
||||
}
|
||||
|
||||
/**
|
||||
* The template that this tertiary nav should use.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract public function get_template(): string;
|
||||
}
|
172
badges/classes/output/manage_badge_action_bar.php
Normal file
172
badges/classes/output/manage_badge_action_bar.php
Normal file
@ -0,0 +1,172 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace core_badges\output;
|
||||
|
||||
use core_badges\badge;
|
||||
use moodle_url;
|
||||
use renderer_base;
|
||||
use single_button;
|
||||
use moodle_page;
|
||||
use url_select;
|
||||
|
||||
/**
|
||||
* Class manage_badge_action_bar - Display the action bar
|
||||
*
|
||||
* @package core_badges
|
||||
* @copyright 2021 Peter Dias
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class manage_badge_action_bar extends base_action_bar {
|
||||
/** @var badge $badge The badge we are managing. */
|
||||
protected $badge;
|
||||
|
||||
/**
|
||||
* manage_badge_action_bar constructor
|
||||
*
|
||||
* @param badge $badge The badge we are viewing
|
||||
* @param moodle_page $page The page object
|
||||
*/
|
||||
public function __construct(badge $badge, moodle_page $page) {
|
||||
parent::__construct($page, $badge->type);
|
||||
$this->badge = $badge;
|
||||
}
|
||||
|
||||
/**
|
||||
* The template that this tertiary nav should use.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_template(): string {
|
||||
return 'core_badges/manage_badge';
|
||||
}
|
||||
|
||||
/**
|
||||
* Export the action bar
|
||||
*
|
||||
* @param renderer_base $output
|
||||
* @return array
|
||||
*/
|
||||
public function export_for_template(renderer_base $output): array {
|
||||
$elements = [];
|
||||
$params = ['type' => $this->type];
|
||||
if ($this->page->context->contextlevel == CONTEXT_COURSE) {
|
||||
$params['id'] = $this->page->context->instanceid;
|
||||
}
|
||||
$elements['button'] = new single_button(new moodle_url('/badges/index.php', $params), get_string('back'), 'get');
|
||||
$elements['urlselect'] = new url_select($this->generate_badge_navigation(), $this->page->url->out(false), null);
|
||||
foreach ($elements as $key => $element) {
|
||||
$elements[$key] = $element->export_for_template($output);
|
||||
}
|
||||
|
||||
return $elements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a multi dimensional array of the links that should be displayed when creating a badge.
|
||||
* The keys of the array feed into the text shown to the user and content of each element contain the following:
|
||||
* - url URL for the option
|
||||
* - additionalparams Additional params to feed into the url
|
||||
* - capability The capabilities to check that governs visibility
|
||||
* @return array
|
||||
*/
|
||||
protected function get_badge_administration_mapping_construct(): array {
|
||||
return [
|
||||
'boverview' => [
|
||||
'url' => '/badges/overview.php',
|
||||
'capability' => ''
|
||||
],
|
||||
'bdetails' => [
|
||||
'url' => '/badges/edit.php',
|
||||
'additionalparams' => ['action' => 'badge'],
|
||||
'capability' => 'moodle/badges:configuredetails'
|
||||
],
|
||||
'bcriteria' => [
|
||||
'url' => '/badges/criteria.php',
|
||||
'capability' => 'moodle/badges:configurecriteria'
|
||||
],
|
||||
'bmessage' => [
|
||||
'url' => '/badges/edit.php',
|
||||
'additionalparams' => ['action' => 'message'],
|
||||
'capability' => 'moodle/badges:configuremessages'
|
||||
],
|
||||
'bawards' => [
|
||||
'url' => '/badges/recipients.php',
|
||||
'additionalparams' => ['sort' => 'dateissued', 'dir' => 'DESC'],
|
||||
'capability' => 'moodle/badges:viewawarded'
|
||||
],
|
||||
'bendorsement' => [
|
||||
'url' => '/badges/endorsement.php',
|
||||
'capability' => 'moodle/badges:configuredetails'
|
||||
],
|
||||
'brelated' => [
|
||||
'url' => '/badges/related.php',
|
||||
'capability' => 'moodle/badges:configuredetails'
|
||||
],
|
||||
'balignment' => [
|
||||
'url' => '/badges/alignment.php',
|
||||
'capability' => 'moodle/badges:configuredetails'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the options to be displayed when editing a badge. This feeds into a URL select which will be displayed
|
||||
* in the tertiary navigation.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function generate_badge_navigation(): array {
|
||||
global $DB;
|
||||
$params = ['id' => $this->badge->id];
|
||||
$options = [];
|
||||
$construct = $this->get_badge_administration_mapping_construct();
|
||||
foreach ($construct as $stringidentifier => $checks) {
|
||||
if ($checks['capability'] && !has_capability($checks['capability'], $this->page->context)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$sql = '';
|
||||
switch ($stringidentifier) {
|
||||
case 'bawards':
|
||||
$sql = "SELECT COUNT(b.userid)
|
||||
FROM {badge_issued} b
|
||||
INNER JOIN {user} u ON b.userid = u.id
|
||||
WHERE b.badgeid = :badgeid AND u.deleted = 0";
|
||||
break;
|
||||
case 'brelated':
|
||||
$sql = "SELECT COUNT(br.badgeid)
|
||||
FROM {badge_related} br
|
||||
WHERE (br.badgeid = :badgeid OR br.relatedbadgeid = :badgeid2)";
|
||||
break;
|
||||
case 'balignment':
|
||||
$sql = "SELECT COUNT(bc.id)
|
||||
FROM {badge_alignment} bc
|
||||
WHERE bc.badgeid = :badgeid";
|
||||
break;
|
||||
}
|
||||
|
||||
$content = null;
|
||||
if ($sql) {
|
||||
$content = $DB->count_records_sql($sql, ['badgeid' => $this->badge->id, 'badgeid2' => $this->badge->id]);
|
||||
}
|
||||
|
||||
$url = new moodle_url($checks['url'], $params + ($checks['additionalparams'] ?? []));
|
||||
$options[get_string($stringidentifier, 'core_badges', $content)] = $url->out(false);
|
||||
}
|
||||
return array_flip($options);
|
||||
}
|
||||
}
|
59
badges/classes/output/recipients_action_bar.php
Normal file
59
badges/classes/output/recipients_action_bar.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace core_badges\output;
|
||||
|
||||
use moodle_url;
|
||||
use renderer_base;
|
||||
use single_button;
|
||||
|
||||
/**
|
||||
* Class recipients_action_bar - Display the action bar
|
||||
*
|
||||
* @package core_badges
|
||||
* @copyright 2021 Peter Dias
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class recipients_action_bar extends manage_badge_action_bar {
|
||||
/**
|
||||
* The template that this tertiary nav should use.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_template(): string {
|
||||
return 'core_badges/award_badge';
|
||||
}
|
||||
|
||||
/**
|
||||
* Export the action bar
|
||||
*
|
||||
* @param renderer_base $output
|
||||
* @return array
|
||||
*/
|
||||
public function export_for_template(renderer_base $output): array {
|
||||
$elements = parent::export_for_template($output);
|
||||
|
||||
// Add button for badge manual award.
|
||||
if ($this->badge->has_manual_award_criteria()
|
||||
&& has_capability('moodle/badges:awardbadge', $this->page->context) && $this->badge->is_active()) {
|
||||
$url = new moodle_url('/badges/award.php', ['id' => $this->badge->id]);
|
||||
$button = new single_button($url, get_string('award', 'badges'), 'post', true);
|
||||
$elements['awardbutton'] = $button->export_for_template($output);
|
||||
}
|
||||
|
||||
return $elements;
|
||||
}
|
||||
}
|
101
badges/classes/output/standard_action_bar.php
Normal file
101
badges/classes/output/standard_action_bar.php
Normal file
@ -0,0 +1,101 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace core_badges\output;
|
||||
|
||||
use moodle_page;
|
||||
use moodle_url;
|
||||
use renderer_base;
|
||||
use single_button;
|
||||
|
||||
/**
|
||||
* Class standard_action_bar - Display the action bar
|
||||
*
|
||||
* @package core_badges
|
||||
* @copyright 2021 Peter Dias
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class standard_action_bar extends base_action_bar {
|
||||
/** @var bool $showmanage Whether or not to show the manage badges button. */
|
||||
protected $showmanage;
|
||||
|
||||
/** @var bool $showaddbadge Whether or not to show the add badges button. */
|
||||
protected $showaddbadge;
|
||||
|
||||
/** @var moodle_url $backurl BackURL to be used when the back button is required. */
|
||||
protected $backurl;
|
||||
|
||||
/**
|
||||
* standard_action_bar constructor
|
||||
*
|
||||
* @param moodle_page $page The page object
|
||||
* @param int $type The type of badge we are operating with
|
||||
* @param bool $showmanage Whether or not to show the manage badges button
|
||||
* @param bool $showaddbadge Whether or not to show the add badges button
|
||||
* @param moodle_url|null $backurl The backurl to be used
|
||||
*/
|
||||
public function __construct(moodle_page $page, int $type, bool $showmanage = true,
|
||||
$showaddbadge = true, ?moodle_url $backurl = null) {
|
||||
parent::__construct($page, $type);
|
||||
|
||||
$this->showmanage = $showmanage;
|
||||
$this->showaddbadge = $showaddbadge;
|
||||
$this->backurl = $backurl;
|
||||
}
|
||||
|
||||
/**
|
||||
* The template that this tertiary nav should use.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_template(): string {
|
||||
return 'core_badges/manage_badges';
|
||||
}
|
||||
|
||||
/**
|
||||
* Export the action bar
|
||||
*
|
||||
* @param renderer_base $output
|
||||
* @return array The buttons to be rendered
|
||||
*/
|
||||
public function export_for_template(renderer_base $output): array {
|
||||
$buttons = [];
|
||||
if ($this->backurl) {
|
||||
$buttons[] = new single_button($this->backurl, get_string('back'), 'get');
|
||||
}
|
||||
|
||||
$params = ['type' => $this->type];
|
||||
if ($this->page->context->contextlevel == CONTEXT_COURSE) {
|
||||
$params['id'] = $this->page->context->instanceid;
|
||||
}
|
||||
|
||||
if ($this->showmanage) {
|
||||
$buttons[] = new single_button(new moodle_url('/badges/index.php', $params),
|
||||
get_string('managebadges', 'core_badges'), 'get');
|
||||
}
|
||||
|
||||
if ($this->showaddbadge && has_capability('moodle/badges:createbadge', $this->page->context)) {
|
||||
$buttons[] = new single_button(new moodle_url('/badges/newbadge.php', $params),
|
||||
get_string('newbadge', 'core_badges'), 'post', true);
|
||||
}
|
||||
|
||||
foreach ($buttons as $key => $button) {
|
||||
$buttons[$key] = $button->export_for_template($output);
|
||||
}
|
||||
|
||||
return ['buttons' => $buttons];
|
||||
}
|
||||
}
|
@ -47,11 +47,14 @@ if ($badge->type == BADGE_TYPE_COURSE) {
|
||||
print_error('coursebadgesdisabled', 'badges');
|
||||
}
|
||||
require_login($badge->courseid);
|
||||
$course = get_course($badge->courseid);
|
||||
$heading = format_string($course->fullname, true, ['context' => $context]);
|
||||
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
|
||||
$PAGE->set_pagelayout('standard');
|
||||
navigation_node::override_active_url($navurl);
|
||||
} else {
|
||||
$PAGE->set_pagelayout('admin');
|
||||
$heading = get_string('administrationsite');
|
||||
navigation_node::override_active_url($navurl, true);
|
||||
}
|
||||
|
||||
@ -59,7 +62,7 @@ $currenturl = new moodle_url('/badges/criteria.php', array('id' => $badge->id));
|
||||
|
||||
$PAGE->set_context($context);
|
||||
$PAGE->set_url($currenturl);
|
||||
$PAGE->set_heading($badge->name);
|
||||
$PAGE->set_heading($heading);
|
||||
$PAGE->set_title($badge->name);
|
||||
$PAGE->navbar->add($badge->name, $currenturl);
|
||||
|
||||
@ -80,6 +83,8 @@ if ((($update == BADGE_CRITERIA_AGGREGATION_ALL) || ($update == BADGE_CRITERIA_A
|
||||
}
|
||||
|
||||
echo $OUTPUT->header();
|
||||
$actionbar = new \core_badges\output\manage_badge_action_bar($badge, $PAGE);
|
||||
echo $output->render_tertiary_navigation($actionbar);
|
||||
echo $OUTPUT->heading(print_badge_image($badge, $context, 'small') . ' ' . $badge->name);
|
||||
|
||||
if ($emsg !== '') {
|
||||
@ -87,9 +92,7 @@ if ($emsg !== '') {
|
||||
} else if ($msg !== '') {
|
||||
echo $OUTPUT->notification(get_string($msg, 'badges'), 'notifysuccess');
|
||||
}
|
||||
|
||||
echo $output->print_badge_status_box($badge);
|
||||
$output->print_badge_tabs($badgeid, $context, 'criteria');
|
||||
|
||||
if (!$badge->is_locked() && !$badge->is_active()) {
|
||||
echo $output->print_criteria_actions($badge);
|
||||
|
@ -57,18 +57,21 @@ if ($badge->is_active() || $badge->is_locked()) {
|
||||
|
||||
if ($badge->type == BADGE_TYPE_COURSE) {
|
||||
require_login($badge->courseid);
|
||||
$course = get_course($badge->courseid);
|
||||
$heading = format_string($course->fullname, true, ['context' => $context]);
|
||||
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
|
||||
$PAGE->set_pagelayout('standard');
|
||||
navigation_node::override_active_url($navurl);
|
||||
} else {
|
||||
$PAGE->set_pagelayout('admin');
|
||||
$heading = get_string('administrationsite');
|
||||
navigation_node::override_active_url($navurl, true);
|
||||
}
|
||||
|
||||
$urlparams = array('badgeid' => $badgeid, 'edit' => $edit, 'type' => $type, 'crit' => $crit);
|
||||
$PAGE->set_context($context);
|
||||
$PAGE->set_url('/badges/criteria_settings.php', $urlparams);
|
||||
$PAGE->set_heading($badge->name);
|
||||
$PAGE->set_heading($heading);
|
||||
$PAGE->set_title($badge->name);
|
||||
$PAGE->navbar->add($badge->name, new moodle_url('overview.php', array('id' => $badge->id)))->add(get_string('criteria_' . $type, 'badges'));
|
||||
|
||||
|
@ -52,11 +52,14 @@ if ($badge->type == BADGE_TYPE_COURSE) {
|
||||
print_error('coursebadgesdisabled', 'badges');
|
||||
}
|
||||
require_login($badge->courseid);
|
||||
$course = get_course($badge->courseid);
|
||||
$heading = format_string($course->fullname, true, ['context' => $context]);
|
||||
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
|
||||
$PAGE->set_pagelayout('incourse');
|
||||
navigation_node::override_active_url($navurl);
|
||||
} else {
|
||||
$PAGE->set_pagelayout('admin');
|
||||
$heading = get_string('administrationsite');
|
||||
navigation_node::override_active_url($navurl, true);
|
||||
}
|
||||
|
||||
@ -64,7 +67,7 @@ $currenturl = new moodle_url('/badges/edit.php', array('id' => $badge->id, 'acti
|
||||
|
||||
$PAGE->set_context($context);
|
||||
$PAGE->set_url($currenturl);
|
||||
$PAGE->set_heading($badge->name);
|
||||
$PAGE->set_heading($heading);
|
||||
$PAGE->set_title($badge->name);
|
||||
$PAGE->navbar->add($badge->name);
|
||||
|
||||
@ -145,6 +148,9 @@ if ($form->is_cancelled()) {
|
||||
}
|
||||
|
||||
echo $OUTPUT->header();
|
||||
$actionbar = new \core_badges\output\manage_badge_action_bar($badge, $PAGE);
|
||||
echo $output->render_tertiary_navigation($actionbar);
|
||||
|
||||
echo $OUTPUT->heading(print_badge_image($badge, $context, 'small') . ' ' . $badge->name);
|
||||
|
||||
if ($errormsg !== '') {
|
||||
@ -153,9 +159,7 @@ if ($errormsg !== '') {
|
||||
} else if ($statusmsg !== '') {
|
||||
echo $OUTPUT->notification($statusmsg, 'notifysuccess');
|
||||
}
|
||||
|
||||
echo $output->print_badge_status_box($badge);
|
||||
$output->print_badge_tabs($badgeid, $context, $action);
|
||||
|
||||
$form->display();
|
||||
|
||||
|
@ -44,18 +44,21 @@ if ($badge->type == BADGE_TYPE_COURSE) {
|
||||
print_error('coursebadgesdisabled', 'badges');
|
||||
}
|
||||
require_login($badge->courseid);
|
||||
$course = get_course($badge->courseid);
|
||||
$heading = format_string($course->fullname, true, ['context' => $context]);
|
||||
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
|
||||
$PAGE->set_pagelayout('standard');
|
||||
navigation_node::override_active_url($navurl);
|
||||
} else {
|
||||
$PAGE->set_pagelayout('admin');
|
||||
$heading = get_string('administrationsite');
|
||||
navigation_node::override_active_url($navurl, true);
|
||||
}
|
||||
|
||||
$currenturl = new moodle_url('/badges/endorsement.php', array('id' => $badgeid));
|
||||
$PAGE->set_context($context);
|
||||
$PAGE->set_url($currenturl);
|
||||
$PAGE->set_heading($badge->name);
|
||||
$PAGE->set_heading($heading);
|
||||
$PAGE->set_title($badge->name);
|
||||
$PAGE->navbar->add($badge->name);
|
||||
|
||||
@ -68,10 +71,12 @@ if ($msg !== '') {
|
||||
}
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(print_badge_image($badge, $context, 'small') . ' ' . $badge->name);
|
||||
|
||||
$actionbar = new \core_badges\output\manage_badge_action_bar($badge, $PAGE);
|
||||
echo $output->render_tertiary_navigation($actionbar);
|
||||
|
||||
echo $OUTPUT->heading(print_badge_image($badge, $context, 'small') . ' ' . $badge->name);
|
||||
echo $output->print_badge_status_box($badge);
|
||||
$output->print_badge_tabs($badgeid, $context, 'bendorsement');
|
||||
|
||||
$form = new endorsement_form($currenturl, array('badge' => $badge));
|
||||
if ($form->is_cancelled()) {
|
||||
|
@ -78,7 +78,7 @@ if ($type == BADGE_TYPE_SITE) {
|
||||
$title = get_string('sitebadges', 'badges');
|
||||
$PAGE->set_context(context_system::instance());
|
||||
$PAGE->set_pagelayout('admin');
|
||||
$PAGE->set_heading($title . ': ' . $hdr);
|
||||
$PAGE->set_heading(get_string('administrationsite'));
|
||||
navigation_node::override_active_url(new moodle_url('/badges/index.php', array('type' => BADGE_TYPE_SITE)), true);
|
||||
} else {
|
||||
require_login($course);
|
||||
@ -86,7 +86,7 @@ if ($type == BADGE_TYPE_SITE) {
|
||||
$title = get_string('coursebadges', 'badges');
|
||||
$PAGE->set_context($coursecontext);
|
||||
$PAGE->set_pagelayout('incourse');
|
||||
$PAGE->set_heading(format_string($course->fullname, true, array('context' => $coursecontext)) . ': ' . $hdr);
|
||||
$PAGE->set_heading(format_string($course->fullname, true, array('context' => $coursecontext)));
|
||||
navigation_node::override_active_url(
|
||||
new moodle_url('/badges/index.php', array('type' => BADGE_TYPE_COURSE, 'id' => $course->id))
|
||||
);
|
||||
@ -152,19 +152,22 @@ if ($deactivate && has_capability('moodle/badges:configuredetails', $PAGE->conte
|
||||
}
|
||||
|
||||
echo $OUTPUT->header();
|
||||
$backurl = $type == BADGE_TYPE_SITE ? null : new moodle_url('/badges/view.php', ['type' => $type, 'id' => $courseid]);
|
||||
$actionbar = new \core_badges\output\standard_action_bar($PAGE, $type, false, true, $backurl);
|
||||
echo $output->render_tertiary_navigation($actionbar);
|
||||
|
||||
if ($type == BADGE_TYPE_SITE) {
|
||||
echo $OUTPUT->heading_with_help($PAGE->heading, 'sitebadges', 'badges');
|
||||
echo $OUTPUT->heading_with_help($hdr, 'sitebadges', 'badges');
|
||||
} else {
|
||||
echo $OUTPUT->heading($PAGE->heading);
|
||||
echo $OUTPUT->heading($hdr);
|
||||
}
|
||||
|
||||
echo $OUTPUT->box('', 'notifyproblem hide', 'check_connection');
|
||||
|
||||
$totalcount = count(badges_get_badges($type, $courseid, '', '' , 0, 0));
|
||||
$records = badges_get_badges($type, $courseid, $sortby, $sorthow, $page, BADGE_PERPAGE);
|
||||
|
||||
if ($totalcount) {
|
||||
echo $output->heading(get_string('badgestoearn', 'badges', $totalcount), 4);
|
||||
|
||||
if ($course && $course->startdate > time()) {
|
||||
echo $OUTPUT->box(get_string('error:notifycoursedate', 'badges'), 'generalbox notifyproblem');
|
||||
}
|
||||
@ -187,11 +190,6 @@ if ($totalcount) {
|
||||
echo $output->render($badges);
|
||||
} else {
|
||||
echo $output->notification(get_string('nobadges', 'badges'));
|
||||
|
||||
if (has_capability('moodle/badges:createbadge', $PAGE->context)) {
|
||||
echo $OUTPUT->box($OUTPUT->single_button(new moodle_url('newbadge.php', array('type' => $type, 'id' => $courseid)),
|
||||
get_string('newbadge', 'badges')));
|
||||
}
|
||||
}
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
|
@ -45,11 +45,15 @@ if ($badge->type == BADGE_TYPE_COURSE) {
|
||||
print_error('coursebadgesdisabled', 'badges');
|
||||
}
|
||||
require_login($badge->courseid);
|
||||
$course = get_course($badge->courseid);
|
||||
$heading = format_string($course->fullname, true, ['context' => $context]);
|
||||
|
||||
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
|
||||
$PAGE->set_pagelayout('standard');
|
||||
navigation_node::override_active_url($navurl);
|
||||
} else {
|
||||
$PAGE->set_pagelayout('admin');
|
||||
$heading = get_string('administrationsite');
|
||||
navigation_node::override_active_url($navurl, true);
|
||||
}
|
||||
|
||||
@ -57,13 +61,16 @@ $currenturl = new moodle_url('/badges/overview.php', array('id' => $badge->id));
|
||||
|
||||
$PAGE->set_context($context);
|
||||
$PAGE->set_url($currenturl);
|
||||
$PAGE->set_heading($badge->name);
|
||||
$PAGE->set_heading($heading);
|
||||
$PAGE->set_title($badge->name);
|
||||
$PAGE->navbar->add($badge->name);
|
||||
|
||||
require_capability('moodle/badges:viewbadges', $context);
|
||||
|
||||
echo $OUTPUT->header();
|
||||
$output = $PAGE->get_renderer('core', 'badges');
|
||||
$actionbar = new \core_badges\output\manage_badge_action_bar($badge, $PAGE);
|
||||
echo $output->render_tertiary_navigation($actionbar);
|
||||
echo $OUTPUT->heading(print_badge_image($badge, $context, 'small') . ' ' . $badge->name);
|
||||
|
||||
if ($awards == 'cron') {
|
||||
@ -71,10 +78,7 @@ if ($awards == 'cron') {
|
||||
} else if ($awards != 0) {
|
||||
echo $OUTPUT->notification(get_string('numawardstat', 'badges', $awards), 'notifysuccess');
|
||||
}
|
||||
|
||||
$output = $PAGE->get_renderer('core', 'badges');
|
||||
echo $output->print_badge_status_box($badge);
|
||||
$output->print_badge_tabs($badgeid, $context, 'overview');
|
||||
echo $output->print_badge_overview($badge, $context);
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
|
@ -59,33 +59,32 @@ if ($badge->type == BADGE_TYPE_COURSE) {
|
||||
print_error('coursebadgesdisabled', 'badges');
|
||||
}
|
||||
require_login($badge->courseid);
|
||||
$course = get_course($badge->courseid);
|
||||
$heading = format_string($course->fullname, true, ['context' => $context]);
|
||||
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
|
||||
$PAGE->set_pagelayout('standard');
|
||||
navigation_node::override_active_url($navurl);
|
||||
} else {
|
||||
$PAGE->set_pagelayout('admin');
|
||||
$heading = get_string('administrationsite');
|
||||
navigation_node::override_active_url($navurl, true);
|
||||
}
|
||||
|
||||
$PAGE->set_context($context);
|
||||
$PAGE->set_url('/badges/recipients.php', array('id' => $badgeid, 'sort' => $sortby, 'dir' => $sorthow));
|
||||
$PAGE->set_heading($badge->name);
|
||||
$PAGE->set_heading($heading);
|
||||
$PAGE->set_title($badge->name);
|
||||
$PAGE->navbar->add($badge->name);
|
||||
|
||||
$output = $PAGE->get_renderer('core', 'badges');
|
||||
|
||||
echo $output->header();
|
||||
|
||||
$actionbar = new \core_badges\output\recipients_action_bar($badge, $PAGE);
|
||||
echo $output->render_tertiary_navigation($actionbar);
|
||||
|
||||
echo $OUTPUT->heading(print_badge_image($badge, $context, 'small') . ' ' . $badge->name);
|
||||
|
||||
echo $output->print_badge_status_box($badge);
|
||||
$output->print_badge_tabs($badgeid, $context, 'awards');
|
||||
|
||||
// Add button for badge manual award.
|
||||
if ($badge->has_manual_award_criteria() && has_capability('moodle/badges:awardbadge', $context) && $badge->is_active()) {
|
||||
$url = new moodle_url('/badges/award.php', array('id' => $badge->id));
|
||||
echo $OUTPUT->box($OUTPUT->single_button($url, get_string('award', 'badges')), 'clearfix mdl-align');
|
||||
}
|
||||
|
||||
$userfieldsapi = \core_user\fields::for_name();
|
||||
$namefields = $userfieldsapi->get_sql('u', false, '', '', false)->selects;
|
||||
|
@ -48,18 +48,22 @@ if ($badge->type == BADGE_TYPE_COURSE) {
|
||||
print_error('coursebadgesdisabled', 'badges');
|
||||
}
|
||||
require_login($badge->courseid);
|
||||
$course = get_course($badge->courseid);
|
||||
$heading = format_string($course->fullname, true, ['context' => $context]);
|
||||
|
||||
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
|
||||
$PAGE->set_pagelayout('standard');
|
||||
navigation_node::override_active_url($navurl);
|
||||
} else {
|
||||
$PAGE->set_pagelayout('admin');
|
||||
$heading = get_string('administrationsite');
|
||||
navigation_node::override_active_url($navurl, true);
|
||||
}
|
||||
|
||||
$currenturl = new moodle_url('/badges/related.php', array('id' => $badge->id));
|
||||
$PAGE->set_context($context);
|
||||
$PAGE->set_url($currenturl);
|
||||
$PAGE->set_heading($badge->name);
|
||||
$PAGE->set_heading($heading);
|
||||
$PAGE->set_title($badge->name);
|
||||
$PAGE->navbar->add($badge->name);
|
||||
$output = $PAGE->get_renderer('core', 'badges');
|
||||
@ -78,10 +82,13 @@ if ($mform->is_cancelled()) {
|
||||
redirect($currenturl);
|
||||
}
|
||||
echo $OUTPUT->header();
|
||||
|
||||
$actionbar = new \core_badges\output\manage_badge_action_bar($badge, $PAGE);
|
||||
echo $output->render_tertiary_navigation($actionbar);
|
||||
|
||||
echo $OUTPUT->heading(print_badge_image($badge, $context, 'small') . ' ' . $badge->name);
|
||||
echo $output->print_badge_status_box($badge);
|
||||
|
||||
$output->print_badge_tabs($badgeid, $context, 'brelated');
|
||||
if ($emsg !== '') {
|
||||
echo $OUTPUT->notification($emsg);
|
||||
} else if ($msg !== '') {
|
||||
|
@ -476,13 +476,6 @@ class core_badges_renderer extends plugin_renderer_base {
|
||||
|
||||
// New badge button.
|
||||
$htmlnew = '';
|
||||
if (has_capability('moodle/badges:createbadge', $this->page->context)) {
|
||||
$n['type'] = $this->page->url->get_param('type');
|
||||
$n['id'] = $this->page->url->get_param('id');
|
||||
$btn = $this->output->single_button(new moodle_url('newbadge.php', $n), get_string('newbadge', 'badges'));
|
||||
$htmlnew = $this->output->box($btn);
|
||||
}
|
||||
|
||||
$htmlpagingbar = $this->render($paging);
|
||||
$table = new html_table();
|
||||
$table->attributes['class'] = 'table table-bordered table-striped';
|
||||
@ -527,6 +520,8 @@ class core_badges_renderer extends plugin_renderer_base {
|
||||
/**
|
||||
* Prints tabs for badge editing.
|
||||
*
|
||||
* @deprecated since Moodle 4.0
|
||||
* @todo MDL-73426 Final deprecation.
|
||||
* @param integer $badgeid The badgeid to edit.
|
||||
* @param context $context The current context.
|
||||
* @param string $current The currently selected tab.
|
||||
@ -534,6 +529,8 @@ class core_badges_renderer extends plugin_renderer_base {
|
||||
*/
|
||||
public function print_badge_tabs($badgeid, $context, $current = 'overview') {
|
||||
global $DB;
|
||||
debugging("print_badge_tabs() is deprecated. " .
|
||||
"This is replaced with the manage_badge_action_bar tertiary navigation.", DEBUG_DEVELOPER);
|
||||
|
||||
$badge = new badge($badgeid);
|
||||
$row = array();
|
||||
@ -1131,4 +1128,14 @@ class core_badges_renderer extends plugin_renderer_base {
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the tertiary navigation for the page.
|
||||
*
|
||||
* @param \core_badges\output\base_action_bar $actionbar
|
||||
* @return bool|string
|
||||
*/
|
||||
public function render_tertiary_navigation(\core_badges\output\base_action_bar $actionbar) {
|
||||
return $this->render_from_template($actionbar->get_template(), $actionbar->export_for_template($this));
|
||||
}
|
||||
}
|
||||
|
107
badges/templates/award_badge.mustache
Normal file
107
badges/templates/award_badge.mustache
Normal file
@ -0,0 +1,107 @@
|
||||
{{!
|
||||
This file is part of Moodle - http://moodle.org/
|
||||
Moodle is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
Moodle is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
}}
|
||||
{{!
|
||||
@template core_badges/award_badge
|
||||
Displays the tertiary nav for the badge recipients page
|
||||
|
||||
Context variables required for this template:
|
||||
* button stdClass - The back button to be rendered
|
||||
* urlselect stdClass - The URL select to be rendered
|
||||
* awardbutton stdClass - The award badge button to be rendered
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
"button": {
|
||||
"id": "buttons_button",
|
||||
"method" : "get",
|
||||
"url" : "#",
|
||||
"primary" : true,
|
||||
"tooltip" : "This is a tooltip",
|
||||
"label" : "Button2",
|
||||
"attributes": [
|
||||
{
|
||||
"name": "data-attribute",
|
||||
"value": "yeah"
|
||||
}
|
||||
]
|
||||
},
|
||||
"urlselect": {
|
||||
"id": "url_select_test",
|
||||
"action": "https://example.com/post",
|
||||
"formid": "url_select_form",
|
||||
"sesskey": "sesskey",
|
||||
"label": "core/url_select",
|
||||
"helpicon": {
|
||||
"title": "Help with something",
|
||||
"text": "Help with something",
|
||||
"url": "http://example.org/help",
|
||||
"linktext": "",
|
||||
"icon":{
|
||||
"extraclasses": "iconhelp",
|
||||
"attributes": [
|
||||
{"name": "src", "value": "../../../pix/help.svg"},
|
||||
{"name": "alt", "value": "Help icon"}
|
||||
]
|
||||
}
|
||||
},
|
||||
"showbutton": "Go",
|
||||
"options": [{
|
||||
"name": "Group 1", "isgroup": true, "options":
|
||||
[
|
||||
{"name": "Item 1", "isgroup": false, "value": "1"},
|
||||
{"name": "Item 2", "isgroup": false, "value": "2"}
|
||||
]},
|
||||
{"name": "Group 2", "isgroup": true, "options":
|
||||
[
|
||||
{"name": "Item 3", "isgroup": false, "value": "3"},
|
||||
{"name": "Item 4", "isgroup": false, "value": "4"}
|
||||
]}],
|
||||
"disabled": false,
|
||||
"title": "Some cool title"
|
||||
},
|
||||
"awardbutton": {
|
||||
"id" : "id_id",
|
||||
"method" : "get",
|
||||
"url" : "#",
|
||||
"primary" : true,
|
||||
"tooltip" : "This is a tooltip",
|
||||
"label" : "Button2",
|
||||
"attributes": [
|
||||
{
|
||||
"name": "data-attribute",
|
||||
"value": "yeah"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}}
|
||||
<div class="container-fluid pl-0 pb-2" id="action_bar">
|
||||
<div class="row pl-0 ml-0">
|
||||
{{#button}}
|
||||
<div class="col-xs-4 pr-1">
|
||||
{{> core/single_button }}
|
||||
</div>
|
||||
{{/button}}
|
||||
{{#urlselect}}
|
||||
<div class="col-xs-4 pr-1">
|
||||
{{> core/url_select }}
|
||||
</div>
|
||||
{{/urlselect}}
|
||||
{{#awardbutton}}
|
||||
<div class="col-xs-4 pr-1">
|
||||
{{> core/single_button }}
|
||||
</div>
|
||||
{{/awardbutton}}
|
||||
</div>
|
||||
</div>
|
87
badges/templates/manage_badge.mustache
Normal file
87
badges/templates/manage_badge.mustache
Normal file
@ -0,0 +1,87 @@
|
||||
{{!
|
||||
This file is part of Moodle - http://moodle.org/
|
||||
Moodle is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
Moodle is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
}}
|
||||
{{!
|
||||
@template core_badges/manage_badge
|
||||
Displays the tertiary nav for the page managing a particular badge
|
||||
|
||||
Context variables required for this template:
|
||||
* button stdClass - The back button to be rendered
|
||||
* urlselect stdClass - The URL select to be rendered
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
"button": {
|
||||
"id": "buttons_button",
|
||||
"method" : "get",
|
||||
"url" : "#",
|
||||
"primary" : true,
|
||||
"tooltip" : "This is a tooltip",
|
||||
"label" : "Button2",
|
||||
"attributes": [
|
||||
{
|
||||
"name": "data-attribute",
|
||||
"value": "yeah"
|
||||
}
|
||||
]
|
||||
},
|
||||
"urlselect": {
|
||||
"id": "url_select_test",
|
||||
"action": "https://example.com/post",
|
||||
"formid": "url_select_form",
|
||||
"sesskey": "sesskey",
|
||||
"label": "core/url_select",
|
||||
"helpicon": {
|
||||
"title": "Help with something",
|
||||
"text": "Help with something",
|
||||
"url": "http://example.org/help",
|
||||
"linktext": "",
|
||||
"icon":{
|
||||
"extraclasses": "iconhelp",
|
||||
"attributes": [
|
||||
{"name": "src", "value": "../../../pix/help.svg"},
|
||||
{"name": "alt", "value": "Help icon"}
|
||||
]
|
||||
}
|
||||
},
|
||||
"showbutton": "Go",
|
||||
"options": [{
|
||||
"name": "Group 1", "isgroup": true, "options":
|
||||
[
|
||||
{"name": "Item 1", "isgroup": false, "value": "1"},
|
||||
{"name": "Item 2", "isgroup": false, "value": "2"}
|
||||
]},
|
||||
{"name": "Group 2", "isgroup": true, "options":
|
||||
[
|
||||
{"name": "Item 3", "isgroup": false, "value": "3"},
|
||||
{"name": "Item 4", "isgroup": false, "value": "4"}
|
||||
]}],
|
||||
"disabled": false,
|
||||
"title": "Some cool title"
|
||||
}
|
||||
}
|
||||
}}
|
||||
<div class="container-fluid pl-0 pb-2" id="action_bar">
|
||||
<div class="row pl-0 ml-0">
|
||||
{{#button}}
|
||||
<div class="col-xs-4 pr-1">
|
||||
{{> core/single_button }}
|
||||
</div>
|
||||
{{/button}}
|
||||
{{#urlselect}}
|
||||
<div class="col-xs-4 pr-1">
|
||||
{{> core/url_select }}
|
||||
</div>
|
||||
{{/urlselect}}
|
||||
</div>
|
||||
</div>
|
63
badges/templates/manage_badges.mustache
Normal file
63
badges/templates/manage_badges.mustache
Normal file
@ -0,0 +1,63 @@
|
||||
{{!
|
||||
This file is part of Moodle - http://moodle.org/
|
||||
Moodle is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
Moodle is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
}}
|
||||
{{!
|
||||
@template core_badges/manage_badges
|
||||
Displays the tertiary nav for manage badges page
|
||||
|
||||
Context variables required for this template:
|
||||
* buttons Array - List of buttons to be displayed in the tertiary navigation section
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
"buttons": [
|
||||
{
|
||||
"id": "buttons_button",
|
||||
"method" : "get",
|
||||
"url" : "#",
|
||||
"primary" : true,
|
||||
"tooltip" : "This is a tooltip",
|
||||
"label" : "Button1",
|
||||
"attributes": [
|
||||
{
|
||||
"name": "data-attribute",
|
||||
"value": "yeah"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "buttons_button_2",
|
||||
"method" : "get",
|
||||
"url" : "#",
|
||||
"primary" : true,
|
||||
"tooltip" : "This is a tooltip",
|
||||
"label" : "Button2",
|
||||
"attributes": [
|
||||
{
|
||||
"name": "data-attribute",
|
||||
"value": "yeah"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}}
|
||||
<div class="container-fluid pl-0 pb-2" id="action_bar">
|
||||
<div class="row pl-0 ml-0">
|
||||
{{#buttons}}
|
||||
<div class="col-xs-4 pr-1">
|
||||
{{> core/single_button }}
|
||||
</div>
|
||||
{{/buttons}}
|
||||
</div>
|
||||
</div>
|
@ -40,12 +40,11 @@ Feature: Add badges to the system
|
||||
And I should see "Alignments (0)"
|
||||
And I should not see "Create badge"
|
||||
And I should not see "Issuer details"
|
||||
And I follow "Overview"
|
||||
And I select "Overview" from the "jump" singleselect
|
||||
And I should see "Issuer details"
|
||||
And I should see "Test Badge Site"
|
||||
And I should see "testuser@example.com"
|
||||
And I navigate to "Badges > Manage badges" in site administration
|
||||
And I should see "Number of badges available: 1"
|
||||
And I should not see "There are no badges available."
|
||||
|
||||
@javascript @_file_upload
|
||||
@ -62,7 +61,6 @@ Feature: Add badges to the system
|
||||
And I press "Create badge"
|
||||
And I wait until the page is ready
|
||||
And I navigate to "Badges > Manage badges" in site administration
|
||||
And I should see "Number of badges available: 1"
|
||||
And I press "Add a new badge"
|
||||
And I set the following fields to these values:
|
||||
| Name | Test Badge 2 |
|
||||
@ -73,7 +71,7 @@ Feature: Add badges to the system
|
||||
| Image caption | Test caption image |
|
||||
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
|
||||
And I press "Create badge"
|
||||
And I follow "Related badges (0)"
|
||||
And I select "Related badges (0)" from the "jump" singleselect
|
||||
And I should see "This badge does not have any related badges."
|
||||
And I press "Add related badge"
|
||||
And I follow "Related badges"
|
||||
@ -97,7 +95,7 @@ Feature: Add badges to the system
|
||||
When I press "Create badge"
|
||||
Then I should see "Edit details"
|
||||
And I should see "Endorsement"
|
||||
And I follow "Endorsement"
|
||||
And I select "Endorsement" from the "jump" singleselect
|
||||
And I set the following fields to these values:
|
||||
| Endorser name | Endorser |
|
||||
| Email | endorsement@example.com |
|
||||
@ -121,7 +119,7 @@ Feature: Add badges to the system
|
||||
When I press "Create badge"
|
||||
Then I should see "Test Badge"
|
||||
And I should see "Endorsement"
|
||||
And I follow "Alignments (0)"
|
||||
And I select "Alignments (0)" from the "jump" singleselect
|
||||
And I should see "This badge does not have any external skills or standards specified."
|
||||
And I press "Add external skill or standard"
|
||||
And I set the following fields to these values:
|
||||
@ -158,7 +156,6 @@ Feature: Add badges to the system
|
||||
And I should see "Alignments (0)"
|
||||
And I should not see "Create badge"
|
||||
And I navigate to "Badges > Manage badges" in site administration
|
||||
And I should see "Number of badges available: 1"
|
||||
And I should not see "There are no badges available."
|
||||
# See buttons from the "Site badges" page.
|
||||
And I am on homepage
|
||||
@ -183,14 +180,14 @@ Feature: Add badges to the system
|
||||
| Image caption | Test caption image |
|
||||
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
|
||||
And I press "Create badge"
|
||||
When I follow "Edit details"
|
||||
When I select "Edit details" from the "jump" singleselect
|
||||
And I should see "Test badge with 'apostrophe' and other friends (&@#)"
|
||||
And I should not see "Issuer details"
|
||||
And I set the following fields to these values:
|
||||
| Name | Test badge renamed |
|
||||
| Version | secondversion |
|
||||
And I press "Save changes"
|
||||
And I follow "Overview"
|
||||
And I select "Overview" from the "jump" singleselect
|
||||
Then I should not see "Test badge with 'apostrophe' and other friends (&@#)"
|
||||
And I should not see "firstversion"
|
||||
And I should see "Test badge renamed"
|
||||
|
@ -63,7 +63,7 @@ Feature: Award badges
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Badges > Manage badges" in current page administration
|
||||
And I follow "Course Badge 1"
|
||||
And I follow "Recipients (0)"
|
||||
And I select "Recipients (0)" from the "jump" singleselect
|
||||
And I press "Award badge"
|
||||
# Award course badge 1 to student 1.
|
||||
And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
|
||||
@ -71,7 +71,7 @@ Feature: Award badges
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Badges > Manage badges" in current page administration
|
||||
And I follow "Course Badge 1"
|
||||
And I follow "Recipients (1)"
|
||||
And I select "Recipients (1)" from the "jump" singleselect
|
||||
Then I should see "Recipients (1)"
|
||||
And I log out
|
||||
# Student 1 should have both badges.
|
||||
@ -152,7 +152,7 @@ Feature: Award badges
|
||||
And I press "Save"
|
||||
And I press "Enable access"
|
||||
And I press "Continue"
|
||||
And I follow "Recipients (0)"
|
||||
And I select "Recipients (0)" from the "jump" singleselect
|
||||
And I press "Award badge"
|
||||
And I set the field "potentialrecipients[]" to "Teacher 1 (teacher1@example.com)"
|
||||
And I press "Award badge"
|
||||
@ -181,7 +181,7 @@ Feature: Award badges
|
||||
And I press "Save"
|
||||
And I press "Enable access"
|
||||
And I press "Continue"
|
||||
And I follow "Recipients (0)"
|
||||
And I select "Recipients (0)" from the "jump" singleselect
|
||||
And I press "Award badge"
|
||||
And I set the field "potentialrecipients[]" to "Student 2 (student2@example.com)"
|
||||
And I press "Award badge"
|
||||
@ -284,7 +284,7 @@ Feature: Award badges
|
||||
And I press "Save"
|
||||
And I press "Enable access"
|
||||
And I press "Continue"
|
||||
And I follow "Recipients (0)"
|
||||
And I select "Recipients (0)" from the "jump" singleselect
|
||||
And I press "Award badge"
|
||||
# Award course badge 1 to student 1.
|
||||
And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
|
||||
@ -292,7 +292,7 @@ Feature: Award badges
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Badges > Manage badges" in current page administration
|
||||
And I follow "Course Badge 1"
|
||||
And I follow "Recipients (1)"
|
||||
And I select "Recipients (1)" from the "jump" singleselect
|
||||
Then I should see "Recipients (1)"
|
||||
# Add course badge 2.
|
||||
And I am on "Course 1" course homepage
|
||||
@ -310,7 +310,7 @@ Feature: Award badges
|
||||
And I press "Save"
|
||||
And I press "Enable access"
|
||||
And I press "Continue"
|
||||
And I follow "Recipients (0)"
|
||||
And I select "Recipients (0)" from the "jump" singleselect
|
||||
And I press "Award badge"
|
||||
# Award course badge 2 to student 2.
|
||||
And I set the field "potentialrecipients[]" to "Student 2 (student2@example.com)"
|
||||
@ -318,7 +318,7 @@ Feature: Award badges
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Badges > Manage badges" in current page administration
|
||||
And I follow "Course Badge 2"
|
||||
And I follow "Recipients (1)"
|
||||
And I select "Recipients (1)" from the "jump" singleselect
|
||||
Then I should see "Recipients (1)"
|
||||
And I log out
|
||||
And I trigger cron
|
||||
@ -351,7 +351,7 @@ Feature: Award badges
|
||||
And I press "Save"
|
||||
And I press "Enable access"
|
||||
And I press "Continue"
|
||||
And I follow "Recipients (0)"
|
||||
And I select "Recipients (0)" from the "jump" singleselect
|
||||
And I press "Award badge"
|
||||
And I set the field "potentialrecipients[]" to "Student 2 (student2@example.com)"
|
||||
And I press "Award badge"
|
||||
@ -361,7 +361,7 @@ Feature: Award badges
|
||||
And I navigate to "Badges > Manage badges" in current page administration
|
||||
And I follow "Course Badge"
|
||||
Then I should see "Recipients (2)"
|
||||
And I follow "Recipients (2)"
|
||||
And I select "Recipients (2)" from the "jump" singleselect
|
||||
And I press "Award badge"
|
||||
And I set the field "existingrecipients[]" to "Student 2 (student2@example.com)"
|
||||
And I press "Revoke badge"
|
||||
|
@ -60,7 +60,7 @@ Feature: Backpack badges
|
||||
And I press "Save"
|
||||
And I press "Enable access"
|
||||
And I press "Continue"
|
||||
And I follow "Recipients (0)"
|
||||
And I select "Recipients (0)" from the "jump" singleselect
|
||||
And I press "Award badge"
|
||||
And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
|
||||
And I press "Award badge"
|
||||
@ -97,7 +97,7 @@ Feature: Backpack badges
|
||||
And I press "Save"
|
||||
And I press "Enable access"
|
||||
And I press "Continue"
|
||||
And I follow "Recipients (0)"
|
||||
And I select "Recipients (0)" from the "jump" singleselect
|
||||
And I press "Award badge"
|
||||
And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
|
||||
And I press "Award badge"
|
||||
|
147
badges/tests/behat/badge_navigation.feature
Normal file
147
badges/tests/behat/badge_navigation.feature
Normal file
@ -0,0 +1,147 @@
|
||||
@core @core_badges @_file_upload @javascript
|
||||
Feature: Test tertiary navigation as various users
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
| teacher | Teacher | 1 | teacher@example.com |
|
||||
| nonediting | Nonediting | 1 | nonediting@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | format | enablecompletion |
|
||||
| Course 1 | C1 | topics | 1 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
| nonediting | C1 | teacher |
|
||||
# Create system badge and define a criterion.
|
||||
And I log in as "admin"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Badges > Add a new badge" in current page administration
|
||||
And I set the following fields to these values:
|
||||
| Name | Testing course badge |
|
||||
| Version | 1.1 |
|
||||
| Language | Catalan |
|
||||
| Description | Testing course badge description |
|
||||
| Image author | http://author.example.com |
|
||||
| Image caption | Test caption image |
|
||||
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
|
||||
And I press "Create badge"
|
||||
And I set the field "type" to "Manual issue by role"
|
||||
And I expand all fieldsets
|
||||
And I set the field "Teacher" to "1"
|
||||
And I press "Save"
|
||||
And I am on site homepage
|
||||
And I navigate to "Badges > Add a new badge" in site administration
|
||||
And I set the following fields to these values:
|
||||
| Name | Testing site badge |
|
||||
| Version | 1.1 |
|
||||
| Language | Catalan |
|
||||
| Description | Testing site badge description |
|
||||
| Image author | http://author.example.com |
|
||||
| Image caption | Test caption image |
|
||||
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
|
||||
And I press "Create badge"
|
||||
And I set the field "type" to "Manual issue by role"
|
||||
And I expand all fieldsets
|
||||
And I set the field "Teacher" to "1"
|
||||
And I press "Save"
|
||||
|
||||
Scenario Outline: Check navigation as different users in a course context
|
||||
Given I log in as "<user>"
|
||||
And I am on "Course 1" course homepage
|
||||
When I navigate to "Badges" in current page administration
|
||||
Then "Manage badges" "button" should exist
|
||||
And "Add a new badge" "button" <createbutton>
|
||||
And I should see "<activetab>" is active in secondary navigation
|
||||
And I click on "Manage badges" "button"
|
||||
And "Manage badges" "button" should not exist
|
||||
And "Back" "button" should exist
|
||||
And "Add a new badge" "button" <createbutton>
|
||||
And I should see "<activetab>" is active in secondary navigation
|
||||
And I click on "Back" "button"
|
||||
And "Back" "button" should not exist
|
||||
And "Manage badges" "button" should exist
|
||||
And "Add a new badge" "button" <createbutton>
|
||||
And I should see "<activetab>" is active in secondary navigation
|
||||
And I click on "Manage badges" "button"
|
||||
And I click on "Testing course badge" "link"
|
||||
And "Manage badges" "button" should not exist
|
||||
And "Add a new badge" "button" should not exist
|
||||
And "Back" "button" should exist
|
||||
And I should see "<activetab>" is active in secondary navigation
|
||||
And I click on "Back" "button"
|
||||
And "Back" "button" should exist
|
||||
And "Manage badges" "button" should not exist
|
||||
And "Add a new badge" "button" <createbutton>
|
||||
And I should see "<activetab>" is active in secondary navigation
|
||||
|
||||
Examples:
|
||||
| user | createbutton | activetab |
|
||||
| admin | should exist | More |
|
||||
| teacher | should exist | More |
|
||||
| nonediting | should not exist | Badges |
|
||||
|
||||
Scenario: Check navigation as a student
|
||||
Given I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
When I navigate to "Badges" in current page administration
|
||||
Then "Back" "button" should not exist
|
||||
And "Manage badges" "button" should not exist
|
||||
And "Add a new badge" "button" should not exist
|
||||
And I should see "Badges" is active in secondary navigation
|
||||
|
||||
Scenario: Check navigation as an admin in a site context
|
||||
Given I log in as "admin"
|
||||
When I navigate to "Badges > Manage badges" in site administration
|
||||
Then "Manage badges" "button" should not exist
|
||||
And "Add a new badge" "button" should exist
|
||||
And I should see "Site administration" is active in secondary navigation
|
||||
And I click on "Testing site badge" "link"
|
||||
And "Manage badges" "button" should not exist
|
||||
And "Add a new badge" "button" should not exist
|
||||
And "Back" "button" should exist
|
||||
And I should see "Site administration" is active in secondary navigation
|
||||
And I click on "Back" "button"
|
||||
And "Back" "button" should not exist
|
||||
And "Manage badges" "button" should not exist
|
||||
And "Add a new badge" "button" should exist
|
||||
|
||||
Scenario Outline: Check secondary navigation highlights after tertiary nav jumps in site admin
|
||||
Given I log in as "admin"
|
||||
And I navigate to "Badges > Manage badges" in site administration
|
||||
And I click on "Testing site badge" "link"
|
||||
When I select "<option>" from the "jump" singleselect
|
||||
Then I should see "Site administration" is active in secondary navigation
|
||||
|
||||
Examples:
|
||||
| option |
|
||||
| Overview |
|
||||
| Edit details |
|
||||
| Criteria |
|
||||
| Message |
|
||||
| Recipients (0) |
|
||||
| Endorsement |
|
||||
| Related badges (0) |
|
||||
| Alignments (0) |
|
||||
|
||||
Scenario Outline: Check secondary navigation highlights after tertiary nav jumps in course as admin
|
||||
Given I log in as "admin"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Badges" in current page administration
|
||||
And I click on "Manage badges" "button"
|
||||
And I click on "Testing course badge" "link"
|
||||
When I select "<option>" from the "jump" singleselect
|
||||
Then I should see "More" is active in secondary navigation
|
||||
|
||||
Examples:
|
||||
| option |
|
||||
| Overview |
|
||||
| Edit details |
|
||||
| Criteria |
|
||||
| Message |
|
||||
| Recipients (0) |
|
||||
| Endorsement |
|
||||
| Related badges (0) |
|
||||
| Alignments (0) |
|
@ -146,7 +146,7 @@ Feature: Award badges based on cohort
|
||||
And I press "Save"
|
||||
When I press "Enable access"
|
||||
And I press "Continue"
|
||||
And I follow "Recipients (0)"
|
||||
And I select "Recipients (0)" from the "jump" singleselect
|
||||
And I press "Award badge"
|
||||
And I set the field "potentialrecipients[]" to "First User (first@example.com)"
|
||||
And I press "Award badge"
|
||||
@ -198,7 +198,7 @@ Feature: Award badges based on cohort
|
||||
And I set the field "update" to "Any"
|
||||
When I press "Enable access"
|
||||
And I press "Continue"
|
||||
And I follow "Recipients (1)"
|
||||
And I select "Recipients (1)" from the "jump" singleselect
|
||||
And I press "Award badge"
|
||||
And I set the field "potentialrecipients[]" to "First User (first@example.com)"
|
||||
And I press "Award badge"
|
||||
@ -255,7 +255,7 @@ Feature: Award badges based on cohort
|
||||
And I set the field "update" to "Any"
|
||||
When I press "Enable access"
|
||||
And I press "Continue"
|
||||
And I follow "Recipients (1)"
|
||||
And I select "Recipients (1)" from the "jump" singleselect
|
||||
And I press "Award badge"
|
||||
And I set the field "potentialrecipients[]" to "First User (first@example.com)"
|
||||
And I press "Award badge"
|
||||
@ -314,7 +314,7 @@ Feature: Award badges based on cohort
|
||||
And I set the field "update" to "All"
|
||||
When I press "Enable access"
|
||||
And I press "Continue"
|
||||
And I follow "Recipients (0)"
|
||||
And I select "Recipients (0)" from the "jump" singleselect
|
||||
And I press "Award badge"
|
||||
And I set the field "potentialrecipients[]" to "First User (first@example.com)"
|
||||
And I press "Award badge"
|
||||
|
@ -30,14 +30,14 @@ Feature: Display badges
|
||||
Given I press "Enable access"
|
||||
And I press "Continue"
|
||||
# Award badge to student1.
|
||||
And I follow "Recipients (0)"
|
||||
And I select "Recipients (0)" from the "jump" singleselect
|
||||
And I press "Award badge"
|
||||
And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
|
||||
And I press "Award badge"
|
||||
# Check badge details are displayed.
|
||||
And I navigate to "Badges > Manage badges" in site administration
|
||||
And I follow "Testing system badge"
|
||||
And I follow "Recipients (1)"
|
||||
And I select "Recipients (1)" from the "jump" singleselect
|
||||
When I click on "View issued badge" "link" in the "Student 1" "table_row"
|
||||
Then I should see "Awarded to Student 1"
|
||||
And I should see "This badge has to be awarded by a user with the following role:"
|
||||
@ -55,14 +55,14 @@ Feature: Display badges
|
||||
And I press "Enable access"
|
||||
And I press "Continue"
|
||||
# Award badge to student1.
|
||||
And I follow "Recipients (0)"
|
||||
And I select "Recipients (0)" from the "jump" singleselect
|
||||
And I press "Award badge"
|
||||
And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
|
||||
And I press "Award badge"
|
||||
# Check badge details are displayed.
|
||||
And I navigate to "Badges > Manage badges" in site administration
|
||||
And I follow "Testing system badge"
|
||||
And I follow "Recipients (1)"
|
||||
And I select "Recipients (1)" from the "jump" singleselect
|
||||
When I click on "View issued badge" "link" in the "Student 1" "table_row"
|
||||
Then I should see "Awarded to Student 1"
|
||||
And I should see "Complete ALL of the listed requirements."
|
||||
@ -83,7 +83,7 @@ Feature: Display badges
|
||||
And I press "Enable access"
|
||||
And I press "Continue"
|
||||
# Check badge details are displayed.
|
||||
And I follow "Recipients (2)"
|
||||
And I select "Recipients (2)" from the "jump" singleselect
|
||||
When I click on "View issued badge" "link" in the "Student 1" "table_row"
|
||||
Then I should see "Awarded to Student 1"
|
||||
And I should see "Complete ANY of the listed requirements."
|
||||
@ -97,28 +97,28 @@ Feature: Display badges
|
||||
|
||||
Scenario: Display badge with expiration date but not expired yet
|
||||
# Set expired date to badge (future date).
|
||||
Given I follow "Edit details"
|
||||
Given I select "Edit details" from the "jump" singleselect
|
||||
When I click on "Relative date" "radio"
|
||||
And I set the field "expireperiod[number]" to "1"
|
||||
And I press "Save changes"
|
||||
And I press "Enable access"
|
||||
And I press "Continue"
|
||||
# Award badge to student1.
|
||||
And I follow "Recipients (0)"
|
||||
And I select "Recipients (0)" from the "jump" singleselect
|
||||
And I press "Award badge"
|
||||
And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
|
||||
And I press "Award badge"
|
||||
# Check "Expires" date is displayed.
|
||||
And I navigate to "Badges > Manage badges" in site administration
|
||||
And I follow "Testing system badge"
|
||||
And I follow "Recipients (1)"
|
||||
And I select "Recipients (1)" from the "jump" singleselect
|
||||
And I click on "View issued badge" "link" in the "Student 1" "table_row"
|
||||
Then I should see "Expires"
|
||||
And I should not see "Expired"
|
||||
|
||||
Scenario: Display expired badge
|
||||
# Set expired date to badge (relative date 1 seconds after the date of issue it).
|
||||
Given I follow "Edit details"
|
||||
Given I select "Edit details" from the "jump" singleselect
|
||||
When I click on "Relative date" "radio"
|
||||
And I set the field "expireperiod[timeunit]" to "1"
|
||||
And I set the field "expireperiod[number]" to "1"
|
||||
@ -126,7 +126,7 @@ Feature: Display badges
|
||||
And I press "Enable access"
|
||||
And I press "Continue"
|
||||
# Award badge to student1.
|
||||
And I follow "Recipients (0)"
|
||||
And I select "Recipients (0)" from the "jump" singleselect
|
||||
And I press "Award badge"
|
||||
And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
|
||||
And I press "Award badge"
|
||||
@ -135,7 +135,7 @@ Feature: Display badges
|
||||
# Check "Expired" date is displayed.
|
||||
And I navigate to "Badges > Manage badges" in site administration
|
||||
And I follow "Testing system badge"
|
||||
And I follow "Recipients (1)"
|
||||
And I select "Recipients (1)" from the "jump" singleselect
|
||||
And I click on "View issued badge" "link" in the "Student 1" "table_row"
|
||||
Then I should see "Expired"
|
||||
And I should not see "Expires"
|
||||
|
141
badges/tests/output/manage_badge_action_bar_test.php
Normal file
141
badges/tests/output/manage_badge_action_bar_test.php
Normal file
@ -0,0 +1,141 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace core_badges\output;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
global $CFG;
|
||||
require_once($CFG->libdir . '/badgeslib.php');
|
||||
|
||||
/**
|
||||
* Class manage_badge_action_bar_test
|
||||
*
|
||||
* Unit test for the badges tertiary navigation
|
||||
*
|
||||
* @coversDefaultClass \core_badges\output\manage_badge_action_bar
|
||||
* @package core_badges
|
||||
* @copyright 2021 onwards Peter Dias
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class manage_badge_action_bar_test extends \advanced_testcase {
|
||||
/**
|
||||
* Data provider for test_generate_badge_navigation
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function generate_badge_navigation_provider(): array {
|
||||
return [
|
||||
"Test tertiary nav as an editing teacher" => [
|
||||
"editingteacher", [
|
||||
'Overview',
|
||||
'Edit details',
|
||||
'Criteria',
|
||||
'Message',
|
||||
'Recipients (0)',
|
||||
'Endorsement',
|
||||
'Related badges (0)',
|
||||
'Alignments (0)'
|
||||
],
|
||||
],
|
||||
"Test tertiary nav as an non-editing teacher" => [
|
||||
"teacher", [
|
||||
'Overview',
|
||||
'Recipients (0)'
|
||||
],
|
||||
],
|
||||
"Test tertiary nav as an admin" => [
|
||||
"admin", [
|
||||
'Overview',
|
||||
'Edit details',
|
||||
'Criteria',
|
||||
'Message',
|
||||
'Recipients (0)',
|
||||
'Endorsement',
|
||||
'Related badges (0)',
|
||||
'Alignments (0)'
|
||||
]
|
||||
],
|
||||
"Test tertiary nav as a student" => [
|
||||
"student", [
|
||||
'Overview'
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the generate_badge_navigation function
|
||||
*
|
||||
* @dataProvider generate_badge_navigation_provider
|
||||
* @param string $role
|
||||
* @param array $expected
|
||||
* @covers ::generate_badge_navigation
|
||||
*/
|
||||
public function test_generate_badge_navigation(string $role, array $expected) {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$teacher = self::getDataGenerator()->create_and_enrol($course, 'editingteacher');
|
||||
if ($role != 'admin') {
|
||||
$user = $this->getDataGenerator()->create_and_enrol($course, $role);
|
||||
$this->setUser($user);
|
||||
} else {
|
||||
$this->setAdminUser();
|
||||
}
|
||||
|
||||
// Mock up a course badge.
|
||||
$now = time();
|
||||
$badge = new \stdClass();
|
||||
$badge->id = null;
|
||||
$badge->name = "Test badge course";
|
||||
$badge->description = "Testing badges course";
|
||||
$badge->type = BADGE_TYPE_COURSE;
|
||||
$badge->courseid = $course->id;
|
||||
$badge->timecreated = $now - 12;
|
||||
$badge->timemodified = $now - 12;
|
||||
$badge->usercreated = $teacher->id;
|
||||
$badge->usermodified = $teacher->id;
|
||||
$badge->issuername = "Test issuer";
|
||||
$badge->issuerurl = "http://issuer-url.domain.co.nz";
|
||||
$badge->issuercontact = "issuer@example.com";
|
||||
$badge->expiredate = null;
|
||||
$badge->expireperiod = null;
|
||||
$badge->messagesubject = "Test message subject for badge";
|
||||
$badge->message = "Test message body for badge";
|
||||
$badge->attachment = 1;
|
||||
$badge->notification = 0;
|
||||
$badge->status = BADGE_STATUS_ACTIVE;
|
||||
$badge->version = '1';
|
||||
$badge->language = 'en';
|
||||
$badge->imageauthorname = 'Image author';
|
||||
$badge->imageauthoremail = 'imageauthor@example.com';
|
||||
$badge->imageauthorurl = 'http://image-author-url.domain.co.nz';
|
||||
$badge->imagecaption = 'Caption';
|
||||
$coursebadgeid = $DB->insert_record('badge', $badge, true);
|
||||
$badge = new \core_badges\badge($coursebadgeid);
|
||||
|
||||
$context = \context_course::instance($course->id);
|
||||
$page = new \moodle_page();
|
||||
$page->set_context($context);
|
||||
$actionbar = new manage_badge_action_bar($badge, $page);
|
||||
|
||||
$rc = new \ReflectionClass(manage_badge_action_bar::class);
|
||||
$rcm = $rc->getMethod('generate_badge_navigation');
|
||||
$rcm->setAccessible(true);
|
||||
$content = $rcm->invoke($actionbar);
|
||||
$this->assertEquals($expected, array_values($content));
|
||||
}
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
This files describes API changes in /badges/*,
|
||||
information provided here is intended especially for developers.
|
||||
=== 4.0 ===
|
||||
* Function print_badge_tabs has been deprecated in favour of manage_badge_action_bar instead
|
||||
|
||||
=== 3.11 ===
|
||||
* $CFG->badges_site_backpack setting has been completely removed because it's not required anymore. From now, the primary
|
||||
|
@ -64,13 +64,13 @@ if ($course = $DB->get_record('course', array('id' => $courseid))) {
|
||||
if ($type == BADGE_TYPE_SITE) {
|
||||
$PAGE->set_context(context_system::instance());
|
||||
$PAGE->set_pagelayout('admin');
|
||||
$PAGE->set_heading($SITE->fullname);
|
||||
$PAGE->set_heading(get_string('administrationsite'));
|
||||
$title = get_string('sitebadges', 'badges');
|
||||
$eventotherparams = array('badgetype' => BADGE_TYPE_SITE);
|
||||
} else {
|
||||
require_login($course);
|
||||
$coursename = format_string($course->fullname, true, array('context' => context_course::instance($course->id)));
|
||||
$title = $coursename . ': ' . get_string('coursebadges', 'badges');
|
||||
$title = get_string('coursebadges', 'badges');
|
||||
$PAGE->set_context(context_course::instance($course->id));
|
||||
$PAGE->set_pagelayout('incourse');
|
||||
$PAGE->set_heading($coursename);
|
||||
@ -82,15 +82,30 @@ require_capability('moodle/badges:viewbadges', $PAGE->context);
|
||||
$PAGE->set_title($title);
|
||||
$output = $PAGE->get_renderer('core', 'badges');
|
||||
|
||||
// Display "Manage badges" button to users with proper capabilities.
|
||||
$isfrontpage = (empty($courseid) || $courseid == $SITE->id);
|
||||
if ($isfrontpage) {
|
||||
$context = context_system::instance();
|
||||
} else {
|
||||
$context = context_course::instance($courseid);
|
||||
}
|
||||
$canmanage = has_any_capability(array('moodle/badges:viewawarded',
|
||||
'moodle/badges:createbadge',
|
||||
'moodle/badges:awardbadge',
|
||||
'moodle/badges:configurecriteria',
|
||||
'moodle/badges:configuremessages',
|
||||
'moodle/badges:configuredetails',
|
||||
'moodle/badges:deletebadge'), $context);
|
||||
|
||||
$actionbar = new \core_badges\output\standard_action_bar($PAGE, $type, $canmanage);
|
||||
echo $output->header();
|
||||
echo $output->render_tertiary_navigation($actionbar);
|
||||
echo $OUTPUT->heading($title);
|
||||
|
||||
$totalcount = count(badges_get_badges($type, $courseid, '', '', 0, 0, $USER->id));
|
||||
$records = badges_get_badges($type, $courseid, $sortby, $sorthow, $page, BADGE_PERPAGE, $USER->id);
|
||||
|
||||
if ($totalcount) {
|
||||
echo $output->heading(get_string('badgestoearn', 'badges', $totalcount), 4);
|
||||
|
||||
if ($course && $course->startdate > time()) {
|
||||
echo $OUTPUT->box(get_string('error:notifycoursedate', 'badges'), 'generalbox notifyproblem');
|
||||
}
|
||||
@ -106,32 +121,6 @@ if ($totalcount) {
|
||||
} else {
|
||||
echo $output->notification(get_string('nobadges', 'badges'));
|
||||
}
|
||||
|
||||
// Display "Manage badges" button to users with proper capabilities.
|
||||
$isfrontpage = (empty($courseid) || $courseid == $SITE->id);
|
||||
if ($isfrontpage) {
|
||||
$context = context_system::instance();
|
||||
} else {
|
||||
$context = context_course::instance($courseid);
|
||||
}
|
||||
$canmanage = has_any_capability(array('moodle/badges:viewawarded',
|
||||
'moodle/badges:createbadge',
|
||||
'moodle/badges:awardbadge',
|
||||
'moodle/badges:configurecriteria',
|
||||
'moodle/badges:configuremessages',
|
||||
'moodle/badges:configuredetails',
|
||||
'moodle/badges:deletebadge'), $context);
|
||||
if ($canmanage) {
|
||||
echo $output->single_button(new moodle_url('/badges/index.php', array('type' => $type, 'id' => $courseid)),
|
||||
get_string('managebadges', 'badges'));
|
||||
}
|
||||
|
||||
// Display "Add new badge" button to users with capability to create badges.
|
||||
if (has_capability('moodle/badges:createbadge', $PAGE->context)) {
|
||||
echo $output->single_button(new moodle_url('newbadge.php', array('type' => $type, 'id' => $courseid)),
|
||||
get_string('newbadge', 'badges'));
|
||||
}
|
||||
|
||||
// Trigger event, badge listing viewed.
|
||||
$eventparams = array('context' => $PAGE->context, 'other' => $eventotherparams);
|
||||
$event = \core\event\badge_listing_viewed::create($eventparams);
|
||||
|
@ -28,7 +28,7 @@ Feature: Enable Block Badges in a course
|
||||
And I press "Save"
|
||||
And I press "Enable access"
|
||||
And I press "Continue"
|
||||
And I follow "Recipients (0)"
|
||||
And I select "Recipients (0)" from the "jump" singleselect
|
||||
And I press "Award badge"
|
||||
And I set the field "potentialrecipients[]" to "Teacher 1 (teacher1@example.com)"
|
||||
And I press "Award badge"
|
||||
@ -45,7 +45,7 @@ Feature: Enable Block Badges in a course
|
||||
And I press "Save"
|
||||
And I press "Enable access"
|
||||
And I press "Continue"
|
||||
And I follow "Recipients (0)"
|
||||
And I select "Recipients (0)" from the "jump" singleselect
|
||||
And I press "Award badge"
|
||||
And I set the field "potentialrecipients[]" to "Teacher 1 (teacher1@example.com)"
|
||||
And I press "Award badge"
|
||||
|
@ -28,7 +28,7 @@ Feature: Enable Block Badges on the dashboard and view awarded badges
|
||||
And I press "Save"
|
||||
And I press "Enable access"
|
||||
And I press "Continue"
|
||||
And I follow "Recipients (0)"
|
||||
And I select "Recipients (0)" from the "jump" singleselect
|
||||
And I press "Award badge"
|
||||
And I set the field "potentialrecipients[]" to "Teacher 1 (teacher1@example.com)"
|
||||
And I press "Award badge"
|
||||
|
@ -33,7 +33,7 @@ Feature: Enable Block Badges on the frontpage and view awarded badges
|
||||
And I press "Save"
|
||||
And I press "Enable access"
|
||||
And I press "Continue"
|
||||
And I follow "Recipients (0)"
|
||||
And I select "Recipients (0)" from the "jump" singleselect
|
||||
And I press "Award badge"
|
||||
And I set the field "potentialrecipients[]" to "Teacher 1 (teacher1@example.com)"
|
||||
And I press "Award badge"
|
||||
|
@ -68,6 +68,8 @@ class secondary extends view {
|
||||
'gradebooksetup' => 2.1,
|
||||
'outcomes' => 2.2,
|
||||
'coursecompletion' => 6,
|
||||
'coursebadges' => 7.1,
|
||||
'newbadge' => 7.2,
|
||||
'filtermanagement' => 9,
|
||||
'unenrolself' => 10,
|
||||
'coursetags' => 11,
|
||||
|
@ -189,10 +189,12 @@ class boostnavbar implements \renderable {
|
||||
|
||||
/**
|
||||
* Remove items that are categories or have no actions associated with them.
|
||||
*
|
||||
* The only exception is the last item in the list which may not have a link but needs to be displayed.
|
||||
*/
|
||||
protected function remove_no_link_items(): void {
|
||||
foreach ($this->items as $key => $value) {
|
||||
if (!$value->has_action() || $value->type == \navigation_node::TYPE_SECTION) {
|
||||
if (!$value->is_last() && (!$value->has_action() || $value->type == \navigation_node::TYPE_SECTION)) {
|
||||
unset($this->items[$key]);
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,18 @@ class behat_theme_boost_behat_navigation extends behat_navigation {
|
||||
$this->execute("behat_general::assert_element_contains_text",
|
||||
[$element, '.navbar .nav-link.active', 'css_element']);
|
||||
}
|
||||
/**
|
||||
* Checks whether a node is active in the secondary nav.
|
||||
*
|
||||
* @Given i should see :name is active in secondary navigation
|
||||
* @throws ElementNotFoundException
|
||||
* @param string $element The name of the nav elemnent to look for.
|
||||
* @return void
|
||||
*/
|
||||
public function i_should_see_is_active_in_secondary_navigation($element) {
|
||||
$this->execute("behat_general::assert_element_contains_text",
|
||||
[$element, '.secondary-navigation .nav-link.active', 'css_element']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the language selector menu is present in the navbar.
|
||||
|
168
theme/boost/tests/boostnavbar_test.php
Normal file
168
theme/boost/tests/boostnavbar_test.php
Normal file
@ -0,0 +1,168 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace theme_boost;
|
||||
|
||||
/**
|
||||
* Test the boostnavbar file
|
||||
*
|
||||
* @package theme_boost
|
||||
* @copyright 2021 Peter Dias
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class boostnavbar_test extends \advanced_testcase {
|
||||
/**
|
||||
* Provider for test_remove_no_link_items
|
||||
* The setup and expected arrays are defined as an array of 'nodekey' => $hasaction
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function remove_no_link_items_provider(): array {
|
||||
return [
|
||||
'All nodes have links links including leaf node' => [
|
||||
[
|
||||
'node1' => true,
|
||||
'node2' => true,
|
||||
'node3' => true,
|
||||
],
|
||||
[
|
||||
'Home' => true,
|
||||
'Courses' => true,
|
||||
'tc_1' => true,
|
||||
'node1' => true,
|
||||
'node2' => true,
|
||||
'node3' => true,
|
||||
]
|
||||
],
|
||||
'Only some parent nodes have links. Leaf node has a link.' => [
|
||||
[
|
||||
'node1' => false,
|
||||
'node2' => true,
|
||||
'node3' => true,
|
||||
],
|
||||
[
|
||||
'Home' => true,
|
||||
'Courses' => true,
|
||||
'tc_1' => true,
|
||||
'node2' => true,
|
||||
'node3' => true,
|
||||
]
|
||||
],
|
||||
'All parent nodes do not have links. Leaf node has a link.' => [
|
||||
[
|
||||
'node1' => false,
|
||||
'node2' => false,
|
||||
'node3' => true,
|
||||
],
|
||||
[
|
||||
'Home' => true,
|
||||
'Courses' => true,
|
||||
'tc_1' => true,
|
||||
'node3' => true,
|
||||
]
|
||||
],
|
||||
'All parent nodes have links. Leaf node does not has a link.' => [
|
||||
[
|
||||
'node1' => true,
|
||||
'node2' => true,
|
||||
'node3' => false,
|
||||
],
|
||||
[
|
||||
'Home' => true,
|
||||
'Courses' => true,
|
||||
'tc_1' => true,
|
||||
'node1' => true,
|
||||
'node2' => true,
|
||||
'node3' => false,
|
||||
]
|
||||
],
|
||||
'All parent nodes do not have links. Leaf node does not has a link.' => [
|
||||
[
|
||||
'node1' => false,
|
||||
'node2' => false,
|
||||
'node3' => false,
|
||||
],
|
||||
[
|
||||
'Home' => true,
|
||||
'Courses' => true,
|
||||
'tc_1' => true,
|
||||
'node3' => false,
|
||||
]
|
||||
],
|
||||
'Some parent nodes do not have links. Leaf node does not has a link.' => [
|
||||
[
|
||||
'node1' => true,
|
||||
'node2' => false,
|
||||
'node3' => false,
|
||||
],
|
||||
[
|
||||
'Home' => true,
|
||||
'Courses' => true,
|
||||
'tc_1' => true,
|
||||
'node1' => true,
|
||||
'node3' => false,
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
/**
|
||||
* Test the remove_no_link_items function
|
||||
*
|
||||
* @dataProvider remove_no_link_items_provider
|
||||
* @param array $setup
|
||||
* @param array $expected
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public function test_remove_no_link_items(array $setup, array $expected) {
|
||||
global $PAGE;
|
||||
|
||||
$this->resetAfterTest();
|
||||
// Unfortunate hack needed because people use global $PAGE around the place.
|
||||
$PAGE->set_url('/');
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$page = new \moodle_page();
|
||||
$page->set_course($course);
|
||||
$page->set_url(new \moodle_url('/course/view.php', array('id' => $course->id)));
|
||||
// A dummy url to use. We don't care where it's pointing to.
|
||||
$url = new \moodle_url('/');
|
||||
foreach ($setup as $node => $hasaction) {
|
||||
$page->navbar->add($node, $hasaction ? $url : null);
|
||||
}
|
||||
|
||||
$boostnavbar = $this->getMockBuilder(boostnavbar::class)
|
||||
->disableOriginalConstructor()
|
||||
->onlyMethods([])
|
||||
->getMock();
|
||||
|
||||
$rc = new \ReflectionClass(boostnavbar::class);
|
||||
$rcp = $rc->getProperty('items');
|
||||
$rcp->setAccessible(true);
|
||||
$rcp->setValue($boostnavbar, $page->navbar->get_items());
|
||||
|
||||
// Make the call to the function.
|
||||
$rcm = $rc->getMethod('remove_no_link_items');
|
||||
$rcm->setAccessible(true);
|
||||
$rcm->invoke($boostnavbar);
|
||||
|
||||
// Get the value for the class variable that the function modifies.
|
||||
$values = $rcp->getValue($boostnavbar);
|
||||
$actual = [];
|
||||
foreach ($values as $value) {
|
||||
$actual[$value->text] = $value->has_action();
|
||||
}
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
}
|
@ -9,6 +9,7 @@
|
||||
"blocks/tests/behat/move_blocks.feature",
|
||||
"course/format/tests/behat/course_courseindex.feature",
|
||||
"course/format/tests/behat/courseindex_keyboardnav.feature",
|
||||
"course/format/tests/behat/courseindex_completion.feature"
|
||||
"course/format/tests/behat/courseindex_completion.feature",
|
||||
"badges/tests/behat/badge_navigation.feature"
|
||||
]
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user