Skip to content

Commit

Permalink
MDL-72413 workshop: Use the common module for setting the header
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Dias committed Dec 13, 2021
1 parent 0705928 commit b79bbcb
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 32 deletions.
8 changes: 4 additions & 4 deletions mod/workshop/allocation.php
Expand Up @@ -48,6 +48,10 @@
$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();
Expand All @@ -59,10 +63,6 @@

$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) {
Expand Down
11 changes: 5 additions & 6 deletions mod/workshop/assessment.php
Expand Up @@ -53,6 +53,11 @@
$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');

Expand All @@ -75,9 +80,6 @@
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;
Expand Down Expand Up @@ -158,9 +160,6 @@
// 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
Expand Down
7 changes: 4 additions & 3 deletions mod/workshop/editform.php
Expand Up @@ -43,6 +43,10 @@
$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
Expand Down Expand Up @@ -73,9 +77,6 @@
// 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();
Expand Down
7 changes: 4 additions & 3 deletions mod/workshop/editformpreview.php
Expand Up @@ -44,6 +44,10 @@
$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
Expand All @@ -54,9 +58,6 @@

// 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();
7 changes: 4 additions & 3 deletions mod/workshop/submission.php
Expand Up @@ -175,6 +175,10 @@

$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'));
Expand All @@ -187,9 +191,6 @@
// 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
Expand Down
8 changes: 4 additions & 4 deletions mod/workshop/switchphase.php
Expand Up @@ -52,6 +52,10 @@

$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");
Expand All @@ -60,10 +64,6 @@
// 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';
Expand Down
16 changes: 7 additions & 9 deletions mod/workshop/view.php
Expand Up @@ -97,20 +97,18 @@
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) {
Expand Down

0 comments on commit b79bbcb

Please sign in to comment.