mirrored from git://git.moodle.org/moodle.git
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-73863 course: Add tertiary navigation in completion pages
- Loading branch information
Mihail Geshoski
committed
Mar 10, 2022
1 parent
01eb6d2
commit 36fe569
Showing
12 changed files
with
184 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?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_course\output; | ||
|
||
use core_completion\manager; | ||
use moodle_url; | ||
use renderable; | ||
use renderer_base; | ||
use templatable; | ||
use url_select; | ||
|
||
/** | ||
* Renderable class for the action bar elements in the course completion pages. | ||
* | ||
* @package core_course | ||
* @copyright 2022 Mihail Geshoski <mihail@moodle.com> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class completion_action_bar implements templatable, renderable { | ||
|
||
/** @var int $courseid The course id. */ | ||
private $courseid; | ||
|
||
/** @var moodle_url $currenturl The URL of the current page. */ | ||
private $currenturl; | ||
|
||
/** | ||
* The class constructor. | ||
* | ||
* @param int $courseid The course id. | ||
* @param moodle_url $pageurl The URL of the current page. | ||
*/ | ||
public function __construct(int $courseid, moodle_url $pageurl) { | ||
$this->courseid = $courseid; | ||
$this->currenturl = $pageurl; | ||
} | ||
|
||
/** | ||
* Export the data for the mustache template. | ||
* | ||
* @param renderer_base $output renderer to be used to render the action bar elements. | ||
* @return array The array which contains the data required to output the tertiary navigation selector for the course | ||
* completion pages. | ||
*/ | ||
public function export_for_template(renderer_base $output): array { | ||
$urlselect = new url_select(manager::get_available_completion_options($this->courseid), | ||
$this->currenturl->out(false), null, 'coursecompletionactionselect'); | ||
$urlselect->set_label(get_string('coursecompletionnavigation', 'completion'), ['class' => 'sr-only']); | ||
|
||
return [ | ||
'urlselect' => $urlselect->export_for_template($output), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{{! | ||
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_course/completion_action_bar | ||
Actions bar in the course completion pages. | ||
Context variables required for this template: | ||
* urlselect - The data object containing the required properties to render core/url_select. | ||
Example context (json): | ||
{ | ||
"urlselect": { | ||
"id": "url_select_test", | ||
"action": "https://example.com/post", | ||
"formid": "url_select_form", | ||
"sesskey": "sesskey", | ||
"classes": "urlselect", | ||
"label": "", | ||
"helpicon": false, | ||
"showbutton": null, | ||
"options": [ | ||
{ | ||
"name": "Some name", | ||
"value": "/mod/data/someurl.php", | ||
"selected": false | ||
} | ||
], | ||
"disabled": false, | ||
"title": null | ||
} | ||
} | ||
}} | ||
<div class="container-fluid tertiary-navigation"> | ||
<div class="row"> | ||
{{#urlselect}} | ||
<div class="navitem"> | ||
{{>core/url_select}} | ||
</div> | ||
{{/urlselect}} | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters