Merge branch 'MDL-73360-master' of https://github.com/peterRd/moodle

This commit is contained in:
Andrew Nicols
2022-01-17 13:36:47 +08:00
7 changed files with 29 additions and 6 deletions
@@ -175,6 +175,7 @@ class standard_action_bar implements renderable, templatable {
global $USER, $CFG;
$items = [];
$buttons = [];
$openinnewwindow = [];
if (has_capability('mod/glossary:import', $this->context)) {
$items['button'] = new single_button(
@@ -204,6 +205,7 @@ class standard_action_bar implements renderable, templatable {
);
$printurl = new moodle_url('/mod/glossary/print.php', $params);
$buttons[get_string('printerfriendly', 'glossary')] = $printurl->out(false);
$openinnewwindow[] = $printurl->out(false);
}
if (!empty($CFG->enablerssfeeds) && !empty($CFG->glossary_enablerssfeeds)
@@ -213,6 +215,7 @@ class standard_action_bar implements renderable, templatable {
$string = get_string('rssfeed', 'glossary');
$url = new moodle_url(rss_get_url($this->context->id, $USER->id, 'mod_glossary', $this->cm->instance));
$buttons[$string] = $url->out(false);
$openinnewwindow[] = $url->out(false);
}
foreach ($items as $key => $value) {
@@ -223,7 +226,8 @@ class standard_action_bar implements renderable, templatable {
foreach ($buttons as $index => $value) {
$items['select']['options'][] = [
'url' => $value,
'string' => $index
'string' => $index,
'openinnewwindow' => ($openinnewwindow ? in_array($value, $openinnewwindow) : false)
];
}
}
+9 -1
View File
@@ -83,8 +83,16 @@ if (!empty($id)) {
$PAGE->set_title($glossary->name);
$PAGE->set_heading($course->fullname);
$PAGE->set_secondary_active_tab('modulepage');
$PAGE->activityheader->set_hidecompletion(true);
$PAGE->activityheader->set_attrs([
'hidecompletion' => true,
'description' => ''
]);
echo $OUTPUT->header();
if (!$id) {
echo $OUTPUT->heading(get_string('addsingleentry', 'mod_glossary'));
} else {
echo $OUTPUT->heading(get_string('editentry', 'mod_glossary'));
}
$data = new StdClass();
$data->tags = core_tag_tag::get_item_tags_array('mod_glossary', 'glossary_entries', $id);
+2
View File
@@ -54,6 +54,8 @@ $PAGE->set_secondary_active_tab('modulepage');
$PAGE->activityheader->disable();
echo $OUTPUT->header();
echo html_writer::link(new moodle_url('view.php', ['id' => $cm->id]),
get_string('back'), ['class' => 'btn btn-secondary mb-2']);
echo $OUTPUT->heading($strexportentries);
echo $OUTPUT->box_start('glossarydisplay generalbox');
$exporturl = moodle_url::make_pluginfile_url($context->id, 'mod_glossary', 'export', 0, "/$cat/", 'export.xml', true);
+5 -2
View File
@@ -52,11 +52,14 @@ $PAGE->set_heading($course->fullname);
$PAGE->set_secondary_active_tab('modulepage');
$PAGE->activityheader->disable();
$form = new mod_glossary_import_form('');
if ($form->is_cancelled()) {
redirect(new moodle_url('view.php', ['id' => $id]));
}
echo $OUTPUT->header();
echo $OUTPUT->heading($strimportentries);
$form = new mod_glossary_import_form();
if ( !$data = $form->get_data() ) {
echo $OUTPUT->box_start('glossarydisplay generalbox');
// display upload form
+1 -1
View File
@@ -23,6 +23,6 @@ class mod_glossary_import_form extends moodleform {
$submit_string = get_string('submit');
$mform->addElement('hidden', 'id');
$mform->setType('id', PARAM_INT);
$this->add_action_buttons(false, $submit_string);
$this->add_action_buttons(true, $submit_string);
}
}
+5
View File
@@ -79,6 +79,11 @@ if (!empty($courseid)) {
echo $OUTPUT->header(); // Needs to be something here to allow linking back to the whole glossary
}
if ($glossary) {
$url = new moodle_url('view.php', ['id' => $cm->id]);
echo html_writer::link($url, get_string('back'), ['class' => 'btn btn-secondary mb-2']);
}
if ($entries) {
glossary_print_dynaentry($courseid, $entries, $displayformat);
}
@@ -142,7 +142,8 @@
</button>
<div class="dropdown-menu">
{{#options}}
<a class="dropdown-item" href="{{url}}">{{string}}</a>
<a class="dropdown-item" href="{{url}}"
{{#openinnewwindow}}target="_blank"{{/openinnewwindow}}>{{string}}</a>
{{/options}}
</div>
</div>