-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add shortcut button serlo empty content
- Loading branch information
Showing
5 changed files
with
124 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?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/>. | ||
|
||
/** | ||
* Settings code for the serlo theme | ||
* | ||
* @package theme_serlo | ||
* @author Faisal Kaleem <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
* @copyright 2024 Serlo (https://adornis.de) | ||
*/ | ||
|
||
namespace theme_serlo\output; | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
use \format_topics\output\renderer; | ||
use \moodle_url; | ||
use context_course; | ||
|
||
/** | ||
* Renderers format topics | ||
*/ | ||
class format_topics_renderer extends renderer | ||
{ | ||
function course_section_add_cm_control($course, $section, $sectionreturn = null, $displayoptions = array()) | ||
{ | ||
// Check to see if user can add menus. | ||
if ( | ||
!has_capability('moodle/course:manageactivities', context_course::instance($course->id)) | ||
|| !$this->page->user_is_editing() | ||
) { | ||
return ''; | ||
} | ||
|
||
$data = [ | ||
'sectionid' => $section, | ||
'sectionreturn' => $sectionreturn, | ||
'serlo_empty_editor_url' => new moodle_url('/course/modedit.php', [ | ||
"course" => $course->id, | ||
"add" => "serlo", | ||
"return" => 0, | ||
"type" => "empty", | ||
"section" => $section, | ||
]) | ||
]; | ||
$ajaxcontrol = $this->render_from_template('core_course/activitychooserbutton', $data); | ||
|
||
// Load the JS for the modal. | ||
$this->course_activitychooser($course->id); | ||
|
||
return $ajaxcontrol; | ||
} | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,49 @@ | ||
{{! | ||
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/activitychooserbutton | ||
Displays a add activity or resource button. | ||
Context variables required for this template: | ||
* sectionid - Relative section number (field course_sections.section). | ||
* sectionreturn - The section to link back to. | ||
Example context (json): | ||
{ | ||
"sectionid": 1, | ||
"sectionreturn": 0 | ||
} | ||
}} | ||
{{< core_courseformat/local/content/divider}} | ||
{{$extraclasses}}always-visible my-3{{/extraclasses}} | ||
{{$content}} | ||
<button class="btn add-content section-modchooser section-modchooser-link justify-content-center align-items-center py-1 px-2" | ||
data-action="open-chooser" | ||
data-sectionid="{{sectionid}}" | ||
{{#sectionreturn}}data-sectionreturnid="{{.}}"{{/sectionreturn}} | ||
> | ||
{{#pix}} t/add, core {{/pix}} | ||
<span class="activity-add-text pr-1">{{#str}}addresourceoractivity, core{{/str}}</span> | ||
</button> | ||
<a href="{{{serlo_empty_editor_url}}}" class="btn add-content justify-content-center align-items-center py-1 px-2" | ||
> | ||
{{#pix}} serlo-logo-feather, theme_serlo {{/pix}} | ||
<span class="activity-add-text pr-1">{{#str}}serlo_empty_editor, theme_serlo{{/str}}</span> | ||
</a> | ||
{{/content}} | ||
{{/ core_courseformat/local/content/divider}} |