mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 13:38:32 +01:00
MDL-80131 mod_data: Make page titles unique
This commit is contained in:
parent
abba174fe1
commit
5672927c28
@ -122,8 +122,18 @@ if ($rid) {
|
||||
}
|
||||
|
||||
$PAGE->add_body_class('mediumwidth');
|
||||
$PAGE->set_title($data->name);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
if ($rid) {
|
||||
$pagename = get_string('editentry', 'data');
|
||||
} else {
|
||||
$pagename = get_string('newentry', 'data');
|
||||
}
|
||||
$PAGE->navbar->add($pagename);
|
||||
$titleparts = [
|
||||
$pagename,
|
||||
format_string($data->name),
|
||||
format_string($course->fullname),
|
||||
];
|
||||
$PAGE->set_title(implode(moodle_page::TITLE_SEPARATOR, $titleparts));
|
||||
$PAGE->force_settings_menu(true);
|
||||
$PAGE->set_secondary_active_tab('modulepage');
|
||||
$PAGE->activityheader->disable();
|
||||
@ -184,11 +194,7 @@ echo '<input name="rid" value="'.$rid.'" type="hidden" />';
|
||||
echo '<input name="sesskey" value="'.sesskey().'" type="hidden" />';
|
||||
echo $OUTPUT->box_start('generalbox boxaligncenter boxwidthwide');
|
||||
|
||||
if (!$rid){
|
||||
echo $OUTPUT->heading(get_string('newentry','data'));
|
||||
} else {
|
||||
echo $OUTPUT->heading(get_string('editentry','data'));
|
||||
}
|
||||
echo $OUTPUT->heading($pagename);
|
||||
|
||||
$template = $manager->get_template($mode);
|
||||
echo $template->parse_add_entry($processeddata, $rid, $datarecord);
|
||||
|
@ -124,13 +124,19 @@ if ($mform->is_cancelled()) {
|
||||
|
||||
// Build header to match the rest of the UI.
|
||||
$PAGE->add_body_class('mediumwidth');
|
||||
$PAGE->set_title($data->name);
|
||||
$pagename = get_string('exportentries', 'data');
|
||||
$titleparts = [
|
||||
$pagename,
|
||||
format_string($data->name),
|
||||
format_string($course->fullname),
|
||||
];
|
||||
$PAGE->set_title(implode(moodle_page::TITLE_SEPARATOR, $titleparts));
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->force_settings_menu(true);
|
||||
$PAGE->set_secondary_active_tab('modulepage');
|
||||
$PAGE->activityheader->disable();
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('exportentries', 'data'));
|
||||
echo $OUTPUT->heading($pagename);
|
||||
|
||||
groups_print_activity_menu($cm, $url);
|
||||
|
||||
|
@ -93,7 +93,6 @@ require_capability('mod/data:managetemplates', $context);
|
||||
$actionbar = new \mod_data\output\action_bar($data->id, $PAGE->url);
|
||||
|
||||
$PAGE->add_body_class('mediumwidth');
|
||||
$PAGE->set_title(get_string('course') . ': ' . $course->fullname);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->activityheader->disable();
|
||||
|
||||
@ -224,7 +223,12 @@ switch ($mode) {
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$titleparts = [
|
||||
get_string('deletefield', 'data'),
|
||||
format_string($data->name),
|
||||
format_string($course->fullname),
|
||||
];
|
||||
$PAGE->set_title(implode(moodle_page::TITLE_SEPARATOR, $titleparts));
|
||||
data_print_header($course,$cm,$data, false);
|
||||
echo $OUTPUT->heading(get_string('deletefield', 'data'), 2, 'mb-4');
|
||||
|
||||
@ -303,26 +307,34 @@ asort($menufield); //sort in alphabetical order
|
||||
$PAGE->force_settings_menu(true);
|
||||
|
||||
$PAGE->set_pagetype('mod-data-field-' . $newtype);
|
||||
$titleparts = [
|
||||
format_string($data->name),
|
||||
format_string($course->fullname),
|
||||
];
|
||||
if (($mode == 'new') && (!empty($newtype))) { // Adding a new field.
|
||||
data_print_header($course, $cm, $data,'fields');
|
||||
array_unshift($titleparts, get_string('newfield', 'data'));
|
||||
$PAGE->set_title(implode(moodle_page::TITLE_SEPARATOR, $titleparts));
|
||||
data_print_header($course, $cm, $data, 'fields');
|
||||
echo $OUTPUT->heading(get_string('newfield', 'data'));
|
||||
|
||||
$field = data_get_field_new($newtype, $data);
|
||||
$field->display_edit_field();
|
||||
|
||||
} else if ($mode == 'display' && confirm_sesskey()) { /// Display/edit existing field
|
||||
data_print_header($course, $cm, $data,'fields');
|
||||
array_unshift($titleparts, get_string('editfield', 'data'));
|
||||
$PAGE->set_title(implode(moodle_page::TITLE_SEPARATOR, $titleparts));
|
||||
data_print_header($course, $cm, $data, 'fields');
|
||||
echo $OUTPUT->heading(get_string('editfield', 'data'));
|
||||
|
||||
$field = data_get_field_from_id($fid, $data);
|
||||
$field->display_edit_field();
|
||||
|
||||
} else { /// Display the main listing of all fields
|
||||
array_unshift($titleparts, get_string('managefields', 'data'));
|
||||
$PAGE->set_title(implode(moodle_page::TITLE_SEPARATOR, $titleparts));
|
||||
$hasfields = $manager->has_fields();
|
||||
|
||||
// Check if it is an empty database with no fields.
|
||||
if (!$hasfields) {
|
||||
$PAGE->set_title($data->name);
|
||||
echo $OUTPUT->header();
|
||||
echo $renderer->render_fields_zero_state($manager);
|
||||
echo $OUTPUT->footer();
|
||||
|
@ -76,15 +76,7 @@ if ($rid) {
|
||||
require_course_login($course, true, $cm);
|
||||
|
||||
$context = context_module::instance($cm->id);
|
||||
|
||||
/// If it's hidden then it's don't show anything. :)
|
||||
if (empty($cm->visible) and !has_capability('moodle/course:viewhiddenactivities', $context)) {
|
||||
$PAGE->set_title($data->name);
|
||||
echo $OUTPUT->header();
|
||||
notice(get_string("activityiscurrentlyhidden"));
|
||||
}
|
||||
|
||||
/// If we have an empty Database then redirect because this page is useless without data
|
||||
// If we have an empty Database then redirect because this page is useless without data.
|
||||
if (has_capability('mod/data:managetemplates', $context)) {
|
||||
if (!$DB->record_exists('data_fields', array('dataid'=>$data->id))) { // Brand new database!
|
||||
redirect($CFG->wwwroot.'/mod/data/field.php?d='.$data->id); // Redirect to field entry
|
||||
|
@ -76,14 +76,20 @@ if ($form->is_cancelled()) {
|
||||
}
|
||||
|
||||
/// Print the page header
|
||||
$PAGE->navbar->add(get_string('add', 'data'));
|
||||
$pagename = get_string('uploadrecords', 'data');
|
||||
$PAGE->navbar->add($pagename);
|
||||
$PAGE->add_body_class('mediumwidth');
|
||||
$PAGE->set_title($data->name);
|
||||
$titleparts = [
|
||||
$pagename,
|
||||
format_string($data->name),
|
||||
format_string($course->fullname),
|
||||
];
|
||||
$PAGE->set_title(implode(moodle_page::TITLE_SEPARATOR, $titleparts));
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->set_secondary_active_tab('modulepage');
|
||||
$PAGE->activityheader->disable();
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading_with_help(get_string('uploadrecords', 'mod_data'), 'uploadrecords', 'mod_data');
|
||||
echo $OUTPUT->heading_with_help($pagename, 'uploadrecords', 'mod_data');
|
||||
|
||||
if ($formdata = $form->get_data()) {
|
||||
$uploadedfilepath = $form->save_temp_file('recordsfile');
|
||||
|
@ -51,7 +51,11 @@ $strdata = get_string('modulename','data');
|
||||
$strdataplural = get_string('modulenameplural','data');
|
||||
|
||||
$PAGE->navbar->add($strdata, new moodle_url('/mod/data/index.php', array('id'=>$course->id)));
|
||||
$PAGE->set_title($strdata);
|
||||
$titleparts = [
|
||||
$strdataplural,
|
||||
format_string($course->fullname),
|
||||
];
|
||||
$PAGE->set_title(implode(moodle_page::TITLE_SEPARATOR, $titleparts));
|
||||
$PAGE->set_heading($course->fullname);
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($strdataplural, 2);
|
||||
|
@ -422,6 +422,7 @@ $string['savesuccess'] = 'Preset saved. <a href="{$a->url}">Preview preset</a>';
|
||||
$string['search'] = 'Search';
|
||||
$string['search:activity'] = 'Database - activity information';
|
||||
$string['search:entry'] = 'Database - entries';
|
||||
$string['searchresults'] = 'Entries containing "{$a}"';
|
||||
$string['selectedrequired'] = 'All selected required';
|
||||
$string['selectfields'] = 'Select fields';
|
||||
$string['selectexportoptions'] = 'Select export options';
|
||||
|
@ -2259,7 +2259,6 @@ function data_print_header($course, $cm, $data, $currenttab='', string $actionba
|
||||
|
||||
global $CFG, $displaynoticegood, $displaynoticebad, $OUTPUT, $PAGE, $USER;
|
||||
|
||||
$PAGE->set_title($data->name);
|
||||
echo $OUTPUT->header();
|
||||
|
||||
echo $actionbar;
|
||||
|
@ -72,7 +72,12 @@ $url = new moodle_url('/mod/data/preset.php', array('d' => $data->id));
|
||||
|
||||
$PAGE->add_body_class('mediumwidth');
|
||||
$PAGE->set_url($url);
|
||||
$PAGE->set_title(get_string('course') . ': ' . $course->fullname);
|
||||
$titleparts = [
|
||||
get_string('presets', 'data'),
|
||||
format_string($cm->name),
|
||||
format_string($course->fullname),
|
||||
];
|
||||
$PAGE->set_title(implode(moodle_page::TITLE_SEPARATOR, $titleparts));
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->force_settings_menu(true);
|
||||
$PAGE->activityheader->disable();
|
||||
@ -142,6 +147,17 @@ if ($action === 'preview') {
|
||||
}
|
||||
$preview = new preset_preview($manager, $preset, $templatename);
|
||||
$preview->prepare_page($PAGE);
|
||||
$url->params([
|
||||
'fullname' => $fullname,
|
||||
'template' => $templatename,
|
||||
]);
|
||||
$PAGE->set_url($url);
|
||||
$titleparts = [
|
||||
get_string('preview', 'data', $preset->name),
|
||||
format_string($cm->name),
|
||||
format_string($course->fullname),
|
||||
];
|
||||
$PAGE->set_title(implode(moodle_page::TITLE_SEPARATOR, $titleparts));
|
||||
// Print the preview screen.
|
||||
echo $OUTPUT->header();
|
||||
$actionbar = new action_bar($data->id, $url);
|
||||
|
@ -71,7 +71,39 @@ if ($useeditor !== null) {
|
||||
}
|
||||
|
||||
$PAGE->requires->js('/mod/data/data.js');
|
||||
$PAGE->set_title($instance->name);
|
||||
switch ($mode) {
|
||||
case 'asearchtemplate':
|
||||
$title = get_string('asearchtemplate', 'data');
|
||||
break;
|
||||
case 'csstemplate':
|
||||
$title = get_string('csstemplate', 'data');
|
||||
break;
|
||||
case 'jstemplate':
|
||||
$title = get_string('jstemplate', 'data');
|
||||
break;
|
||||
case 'listtemplate':
|
||||
$title = get_string('listtemplate', 'data');
|
||||
break;
|
||||
case 'rsstemplate':
|
||||
$title = get_string('rsstemplate', 'data');
|
||||
break;
|
||||
case 'singletemplate':
|
||||
$title = get_string('singletemplate', 'data');
|
||||
break;
|
||||
default:
|
||||
if ($manager->has_fields()) {
|
||||
$title = get_string('addtemplate', 'data');
|
||||
} else {
|
||||
$title = get_string('data:managetemplates', 'data');
|
||||
}
|
||||
break;
|
||||
}
|
||||
$titleparts = [
|
||||
$title,
|
||||
format_string($instance->name),
|
||||
format_string($course->fullname),
|
||||
];
|
||||
$PAGE->set_title(implode(moodle_page::TITLE_SEPARATOR, $titleparts));
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->set_pagelayout('admin');
|
||||
$PAGE->force_settings_menu(true);
|
||||
|
@ -44,6 +44,7 @@ $disapprove = optional_param('disapprove', 0, PARAM_INT); // disapproval reco
|
||||
$delete = optional_param('delete', 0, PARAM_INT); //delete recordid
|
||||
$multidelete = optional_param_array('delcheck', null, PARAM_INT);
|
||||
$serialdelete = optional_param('serialdelete', null, PARAM_RAW);
|
||||
$confirm = optional_param('confirm', 0, PARAM_INT);
|
||||
|
||||
$record = null;
|
||||
|
||||
@ -206,7 +207,6 @@ if ($data->jstemplate) {
|
||||
/// Print the page header
|
||||
// Note: MDL-19010 there will be further changes to printing header and blocks.
|
||||
// The code will be much nicer than this eventually.
|
||||
$title = $courseshortname.': ' . format_string($data->name);
|
||||
|
||||
if ($PAGE->user_allowed_editing() && !$PAGE->theme->haseditswitch) {
|
||||
// Change URL parameter and block display string value depending on whether editing is enabled or not
|
||||
@ -226,7 +226,21 @@ if ($mode == 'asearch') {
|
||||
}
|
||||
|
||||
$PAGE->add_body_class('mediumwidth');
|
||||
$PAGE->set_title($title);
|
||||
$titleparts = [
|
||||
format_string($data->name),
|
||||
format_string($course->fullname),
|
||||
];
|
||||
if (!empty(trim($search))) {
|
||||
// Indicate search results on page title when searching.
|
||||
array_unshift($titleparts, get_string('searchresults', 'data', s($search)));
|
||||
} else if (!empty($delete) && empty($confirm)) {
|
||||
// Displaying the delete confirmation page.
|
||||
array_unshift($titleparts, get_string('deleteentry', 'data'));
|
||||
} else if ($record !== null || $mode == 'single') {
|
||||
// Indicate on the page tile if the user is viewing this page on single view mode.
|
||||
array_unshift($titleparts, get_string('single', 'data'));
|
||||
}
|
||||
$PAGE->set_title(implode(moodle_page::TITLE_SEPARATOR, $titleparts));
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->force_settings_menu(true);
|
||||
if ($delete && confirm_sesskey() && (data_user_can_manage_entry($delete, $data, $context))) {
|
||||
@ -271,7 +285,7 @@ if ($data->intro and empty($page) and empty($record) and $mode != 'single') {
|
||||
/// Delete any requested records
|
||||
|
||||
if ($delete && confirm_sesskey() && (data_user_can_manage_entry($delete, $data, $context))) {
|
||||
if ($confirm = optional_param('confirm',0,PARAM_INT)) {
|
||||
if ($confirm) {
|
||||
if (data_delete_record($delete, $data, $course->id, $cm->id)) {
|
||||
echo $OUTPUT->notification(get_string('recorddeleted','data'), 'notifysuccess');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user