__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?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 renderer_base;
use moodle_page;
use navigation_node;
use templatable;
/**
* 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;
/**
* Gets additional third party navigation nodes for display.
*
* @param renderer_base $output The output
* @return array All that sweet third party navigation action.
*/
public function get_third_party_nav_action(renderer_base $output): array {
$badgenode = $this->page->settingsnav->find('coursebadges', navigation_node::TYPE_CONTAINER);
if (!$badgenode) {
return [];
}
$leftovernodes = [];
foreach ($badgenode->children as $key => $value) {
if (array_search($value->key, $this->expected_items()) === false) {
$leftovernodes[] = $value;
}
}
$result = \core\navigation\views\secondary::create_menu_element($leftovernodes);
if ($result == false) {
return [];
} else {
$data ['thirdpartybutton'] = true;
if (count($result) == 1) {
// Return a button.
$link = key($result);
$text = current($result);
$data['thirdpartynodes'] = ['link' => $link, 'text' => $text];
} else {
// Return a url_select.
$selectobject = new \url_select($result, $this->page->url, get_string('othernavigation', 'badges'));
$data['thirdpartynodes'] = $selectobject->export_for_template($output);
$data['thirdpartybutton'] = false;
}
}
return $data;
}
/**
* Expected navigation node keys for badges.
*
* @return array default badge navigation node keys.
*/
protected function expected_items(): array {
return ['coursebadges', 'newbadge'];
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| badge_alignments.php | File | 2.25 KB | 0777 |
|
| badge_collection.php | File | 2.02 KB | 0777 |
|
| badge_management.php | File | 1.4 KB | 0777 |
|
| badge_recipients.php | File | 2.05 KB | 0777 |
|
| badge_related.php | File | 2.21 KB | 0777 |
|
| badge_user_collection.php | File | 1.93 KB | 0777 |
|
| badgeclass.php | File | 6.59 KB | 0777 |
|
| base_action_bar.php | File | 3.33 KB | 0777 |
|
| external_backpacks_page.php | File | 2.53 KB | 0777 |
|
| external_backpacks_table.php | File | 2.28 KB | 0777 |
|
| external_badge.php | File | 7.32 KB | 0777 |
|
| issued_badge.php | File | 9.58 KB | 0777 |
|
| manage_badge_action_bar.php | File | 6.41 KB | 0777 |
|
| recipients_action_bar.php | File | 2.07 KB | 0777 |
|
| standard_action_bar.php | File | 3.5 KB | 0777 |
|