MDL-72413 workshop: Use the common module for setting the header

This commit is contained in:
Peter Dias
2021-12-13 09:49:34 +08:00
parent 0705928b4a
commit b79bbcba05
7 changed files with 32 additions and 32 deletions
+4 -4
View File
@@ -48,6 +48,10 @@ require_capability('mod/workshop:allocate', $context);
$PAGE->set_title($workshop->name);
$PAGE->set_heading($course->fullname);
$PAGE->navbar->add(get_string('allocation', 'workshop'), $workshop->allocation_url($method));
$PAGE->activityheader->set_attrs([
'hidecompletion' => true,
'description' => ''
]);
$allocator = $workshop->allocator_instance($method);
$initresult = $allocator->init();
@@ -59,10 +63,6 @@ $actionbar = new \mod_workshop\output\actionbar($url, $workshop);
$output = $PAGE->get_renderer('mod_workshop');
echo $output->header();
if (!$PAGE->has_secondary_navigation()) {
echo $OUTPUT->heading(format_string($workshop->name));
}
echo $actionbar->get_allocation_menu();
if (is_null($initresult->get_status()) or $initresult->get_status() == workshop_allocation_result::STATUS_VOID) {
+5 -6
View File
@@ -53,6 +53,11 @@ $workshop = new workshop($workshop, $cm, $course);
$PAGE->set_url($workshop->assess_url($assessment->id));
$PAGE->set_title($workshop->name);
$PAGE->set_heading($course->fullname);
$PAGE->activityheader->set_attrs([
"hidecompletion" => true,
"description" => ""
]);
$PAGE->navbar->add(get_string('assessingsubmission', 'workshop'));
$PAGE->set_secondary_active_tab('modulepage');
@@ -75,9 +80,6 @@ if ($assessmenteditable) {
list($assessed, $notice) = $workshop->check_examples_assessed_before_assessment($assessment->reviewerid);
if (!$assessed) {
echo $output->header();
if (!$PAGE->has_secondary_navigation()) {
echo $output->heading(format_string($workshop->name));
}
notice(get_string($notice, 'workshop'), new moodle_url('/mod/workshop/view.php', array('id' => $cm->id)));
echo $output->footer();
exit;
@@ -158,9 +160,6 @@ if ($canoverridegrades or $cansetassessmentweight) {
// output starts here
$output = $PAGE->get_renderer('mod_workshop'); // workshop renderer
echo $output->header();
if (!$PAGE->has_secondary_navigation()) {
echo $output->heading(format_string($workshop->name));
}
echo $output->heading(get_string('assessedsubmission', 'workshop'), 3);
$submission = $workshop->get_submission_by_id($submission->id); // reload so can be passed to the renderer
+4 -3
View File
@@ -43,6 +43,10 @@ $workshop = new workshop($workshop, $cm, $course);
$PAGE->set_url($workshop->editform_url());
$PAGE->set_title($workshop->name);
$PAGE->set_heading($course->fullname);
$PAGE->activityheader->set_attrs([
'hidecompletion' => true,
'description' => ''
]);
$PAGE->navbar->add(get_string('editingassessmentform', 'workshop'));
// load the grading strategy logic
@@ -73,9 +77,6 @@ if ($mform->is_cancelled()) {
// Output starts here
echo $OUTPUT->header();
if (!$PAGE->has_secondary_navigation()) {
echo $OUTPUT->heading(format_string($workshop->name));
}
echo $OUTPUT->heading(get_string('pluginname', 'workshopform_' . $workshop->strategy), 3);
$mform->display();
+4 -3
View File
@@ -44,6 +44,10 @@ $PAGE->set_heading($course->fullname);
$PAGE->navbar->add(get_string('editingassessmentform', 'workshop'), $workshop->editform_url(), navigation_node::TYPE_CUSTOM);
$PAGE->navbar->add(get_string('previewassessmentform', 'workshop'));
$PAGE->set_secondary_active_tab('workshopassessement');
$PAGE->activityheader->set_attrs([
"hidecompletion" => true,
"description" => ''
]);
$currenttab = 'editform';
// load the grading strategy logic
@@ -54,9 +58,6 @@ $mform = $strategy->get_assessment_form($workshop->editform_url(), 'preview');
// output starts here
echo $OUTPUT->header();
if (!$PAGE->has_secondary_navigation()) {
echo $OUTPUT->heading(format_string($workshop->name));
}
echo $OUTPUT->heading(get_string('assessmentform', 'workshop'), 3);
$mform->display();
echo $OUTPUT->footer();
+4 -3
View File
@@ -175,6 +175,10 @@ if (!$edit and ($canoverride or $canpublish)) {
$PAGE->set_title($workshop->name);
$PAGE->set_heading($course->fullname);
$PAGE->activityheader->set_attrs([
'hidecompletion' => true,
'description' => ''
]);
if ($edit) {
$PAGE->navbar->add(get_string('mysubmission', 'workshop'), $workshop->submission_url(), navigation_node::TYPE_CUSTOM);
$PAGE->navbar->add(get_string('editingsubmission', 'workshop'));
@@ -187,9 +191,6 @@ if ($edit) {
// Output starts here
$output = $PAGE->get_renderer('mod_workshop');
echo $output->header();
if (!$PAGE->has_secondary_navigation()) {
echo $output->heading(format_string($workshop->name), 2);
}
echo $output->heading(get_string('mysubmission', 'workshop'), 3);
// show instructions for submitting as thay may contain some list of questions and we need to know them
+4 -4
View File
@@ -52,6 +52,10 @@ if ($confirm) {
$PAGE->set_title($workshop->name);
$PAGE->set_heading($course->fullname);
$PAGE->activityheader->set_attrs([
'hidecompletion' => true,
'description' => ''
]);
$PAGE->navbar->add(get_string('switchingphase', 'workshop'));
$PAGE->set_secondary_active_tab("modulepage");
@@ -60,10 +64,6 @@ $PAGE->set_secondary_active_tab("modulepage");
// Output starts here
//
echo $OUTPUT->header();
if (!$PAGE->has_secondary_navigation()) {
echo $OUTPUT->heading(format_string($workshop->name));
}
$continuebtn = new single_button(
new moodle_url($PAGE->url, array('confirm' => 1)), get_string('continue'), 'post', true);
$continuebtn->class .= ' mr-3';
+7 -9
View File
@@ -97,20 +97,18 @@ if ($eval) {
redirect($PAGE->url);
}
$heading = $OUTPUT->heading_with_help(format_string($workshop->name), 'userplan', 'workshop');
$heading = preg_replace('/<h2[^>]*>([.\s\S]*)<\/h2>/', '$1', $heading);
$PAGE->activityheader->set_attrs([
'title' => $PAGE->activityheader->is_title_allowed() ? $heading : "",
'description' => ''
]);
$output = $PAGE->get_renderer('mod_workshop');
/// Output starts here
echo $output->header();
if (!$PAGE->has_secondary_navigation()) {
echo $output->heading_with_help(format_string($workshop->name), 'userplan', 'workshop');
}
// Display any activity information (eg completion requirements / dates).
$cminfo = cm_info::create($cm);
$completiondetails = \core_completion\cm_completion_details::get_instance($cminfo, $USER->id);
$activitydates = \core\activity_dates::get_dates_for_module($cminfo, $USER->id);
echo $output->activity_information($cminfo, $completiondetails, $activitydates);
// Output action buttons here.
switch ($workshop->phase) {