mirror of
https://github.com/moodle/moodle.git
synced 2025-04-15 13:33:52 +02:00
Merge branch 'MDL-72413-master-dec13' of https://github.com/peterRd/moodle
This commit is contained in:
commit
16a7c3a698
@ -61,6 +61,7 @@ if ($returnurl) {
|
||||
}
|
||||
$PAGE->set_url($pageurl);
|
||||
$PAGE->set_context($context);
|
||||
$PAGE->activityheader->disable();
|
||||
|
||||
$contextname = $context->get_context_name();
|
||||
$courseid = $course->id;
|
||||
|
@ -87,6 +87,7 @@ if ($context->contextlevel == CONTEXT_BLOCK) {
|
||||
$PAGE->blocks->show_only_fake_blocks(true);
|
||||
}
|
||||
$PAGE->set_title($title);
|
||||
$PAGE->activityheader->disable();
|
||||
|
||||
switch ($context->contextlevel) {
|
||||
case CONTEXT_SYSTEM:
|
||||
|
@ -97,6 +97,7 @@ if ($context->contextlevel == CONTEXT_BLOCK) {
|
||||
}
|
||||
|
||||
$PAGE->set_title($title);
|
||||
$PAGE->activityheader->disable();
|
||||
switch ($context->contextlevel) {
|
||||
case CONTEXT_SYSTEM:
|
||||
print_error('cannotoverridebaserole', 'error');
|
||||
|
@ -107,6 +107,7 @@ switch ($type) {
|
||||
|
||||
$PAGE->set_title($heading);
|
||||
$PAGE->set_heading($heading);
|
||||
$PAGE->activityheader->disable();
|
||||
|
||||
if (empty($cancel)) {
|
||||
// Do not print the header if user cancelled the process, as we are going to redirect the user.
|
||||
|
@ -114,6 +114,7 @@ $PAGE->set_context($context);
|
||||
$PAGE->set_title(get_string('course') . ': ' . $coursefullname);
|
||||
$PAGE->set_heading($heading);
|
||||
$PAGE->set_pagelayout('admin');
|
||||
$PAGE->activityheader->disable();
|
||||
$PAGE->requires->js_call_amd('core_backup/async_backup', 'asyncBackupAllStatus', array($context->id));
|
||||
|
||||
$form = new course_restore_form(null, array('contextid'=>$contextid));
|
||||
|
@ -200,6 +200,7 @@ if ($mform->is_cancelled()) {
|
||||
if (isset($navbaraddition)) {
|
||||
$PAGE->navbar->add($navbaraddition);
|
||||
}
|
||||
$PAGE->activityheader->disable();
|
||||
|
||||
echo $OUTPUT->header();
|
||||
|
||||
|
@ -123,6 +123,7 @@ $straction = get_string('filters', 'admin'); // Used by tabs.php
|
||||
$PAGE->set_cacheable(false);
|
||||
$PAGE->set_title($title);
|
||||
$PAGE->set_pagelayout('admin');
|
||||
$PAGE->activityheader->disable();
|
||||
echo $OUTPUT->header();
|
||||
|
||||
/// Print heading.
|
||||
|
@ -82,6 +82,8 @@ $PAGE->set_url($manager->get_management_url($returnurl));
|
||||
navigation_node::override_active_url($manager->get_management_url());
|
||||
$PAGE->set_title(get_string('gradingmanagement', 'core_grading'));
|
||||
$PAGE->set_heading(get_string('gradingmanagement', 'core_grading'));
|
||||
// We don't need to show the default header on a management page.
|
||||
$PAGE->activityheader->disable();
|
||||
$output = $PAGE->get_renderer('core_grading');
|
||||
|
||||
// process the eventual change of the active grading method
|
||||
|
@ -60,6 +60,7 @@ $string['addedtogroupnot'] = 'Not added to group "{$a}"';
|
||||
$string['addedtogroupnotenrolled'] = 'Not added to group "{$a}", because not enrolled in course';
|
||||
$string['addfilehere'] = 'Add file(s) here';
|
||||
$string['addinganew'] = 'Adding a new {$a}';
|
||||
$string['additionalcustomnav'] = 'Additional custom navigation';
|
||||
$string['addnew'] = 'Add a new {$a}';
|
||||
$string['addinganewto'] = 'Adding a new {$a->what} to {$a->to}';
|
||||
$string['addingdatatoexisting'] = 'Adding data to existing';
|
||||
|
184
lib/classes/output/activity_header.php
Normal file
184
lib/classes/output/activity_header.php
Normal file
@ -0,0 +1,184 @@
|
||||
<?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/>.
|
||||
|
||||
namespace core\output;
|
||||
|
||||
use moodle_page;
|
||||
use renderer_base;
|
||||
use url_select;
|
||||
|
||||
/**
|
||||
* Data structure representing standard components displayed on the activity header.
|
||||
*
|
||||
* Consists of title, header, description. In addition, additional_items can be provided which is a url_select
|
||||
*
|
||||
* @copyright 2021 Peter
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @since Moodle 4.0
|
||||
* @package core
|
||||
* @category output
|
||||
*/
|
||||
class activity_header implements \renderable, \templatable {
|
||||
/** @var moodle_page $page The current page we are looking at */
|
||||
protected $page;
|
||||
/** @var string $title The title to be displayed in the header. Defaults to activityrecord name. */
|
||||
protected $title;
|
||||
/** @var string $description The description to be displayed. Defaults to activityrecord intro. */
|
||||
protected $description;
|
||||
/** @var \stdClass $user The user we are dealing with */
|
||||
protected $user;
|
||||
/** @var url_select $additionalnavitems Any additional custom navigation elements to be injected into template. */
|
||||
protected $additionalnavitems;
|
||||
/** @var bool $hidecompletion Whether to show completion criteria, if available, or not */
|
||||
protected $hidecompletion;
|
||||
/** @var bool $hideoverflow Whether to show the overflow data or not */
|
||||
protected $hideoverflow;
|
||||
/** @var bool $hideheader Whether or not to show the header */
|
||||
protected $hideheader;
|
||||
|
||||
/**
|
||||
* Constructor for activity_header
|
||||
*
|
||||
* @param moodle_page $page
|
||||
* @param \stdClass $user
|
||||
*/
|
||||
public function __construct(moodle_page $page, \stdClass $user) {
|
||||
$this->page = $page;
|
||||
$this->user = $user;
|
||||
$pageoptions = $this->page->theme->activityheaderconfig ?? [];
|
||||
$layoutoptions = $this->page->layout_options['activityheader'] ?? [];
|
||||
// Do a basic setup for the header based on theme/page options.
|
||||
if ($page->activityrecord) {
|
||||
if (empty($pageoptions['notitle']) && empty($layoutoptions['notitle'])) {
|
||||
$this->title = format_string($page->activityrecord->name);
|
||||
}
|
||||
|
||||
if (empty($layoutoptions['nodescription']) && $page->activityrecord->intro && trim($page->activityrecord->intro)) {
|
||||
$this->description = format_module_intro($this->page->activityname, $page->activityrecord, $page->cm->id);
|
||||
}
|
||||
}
|
||||
$this->hidecompletion = !empty($layoutoptions['nocompletion']);
|
||||
$this->hideoverflow = false;
|
||||
$this->hideheader = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the theme has specified titles to be displayed.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_title_allowed(): bool {
|
||||
return empty($this->page->theme->activityheaderconfig['notitle']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Bulk set class member variables. Only updates variables which have corresponding setters
|
||||
*
|
||||
* @param array $config
|
||||
*/
|
||||
public function set_attrs(array $config): void {
|
||||
foreach ($config as $key => $value) {
|
||||
if (method_exists($this, "set_$key")) {
|
||||
$this->{"set_$key"}($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the hidecompletion class member variable
|
||||
*
|
||||
* @param bool $value
|
||||
*/
|
||||
public function set_hidecompletion(bool $value): void {
|
||||
$this->hidecompletion = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the additionalnavitems class member variable
|
||||
*
|
||||
* @param url_select $value
|
||||
*/
|
||||
public function set_additionalnavitems(url_select $value): void {
|
||||
$this->additionalnavitems = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the hideoverflow class member variable
|
||||
*
|
||||
* @param bool $value
|
||||
*/
|
||||
public function set_hideoverflow(bool $value): void {
|
||||
$this->hideoverflow = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the title class member variable.
|
||||
*
|
||||
* @param string $value
|
||||
*/
|
||||
public function set_title(string $value): void {
|
||||
$this->title = preg_replace('/<h2[^>]*>([.\s\S]*)<\/h2>/', '$1', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the description class member variable
|
||||
*
|
||||
* @param string $value
|
||||
*/
|
||||
public function set_description(string $value): void {
|
||||
$this->description = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable the activity header completely. Use this if the page has some custom content, headings to be displayed.
|
||||
*/
|
||||
public function disable(): void {
|
||||
$this->hideheader = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Export items to be rendered with a template.
|
||||
*
|
||||
* @param renderer_base $output
|
||||
* @return array
|
||||
*/
|
||||
public function export_for_template(renderer_base $output): array {
|
||||
// Don't need to show anything if not displaying within an activity context.
|
||||
if (!$this->page->activityrecord) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// If within an activity context but requesting to hide the header,
|
||||
// then just trigger the render for maincontent div.
|
||||
if ($this->hideheader) {
|
||||
return ['title' => ''];
|
||||
}
|
||||
|
||||
$completion = null;
|
||||
if (!$this->hidecompletion) {
|
||||
$completiondetails = \core_completion\cm_completion_details::get_instance($this->page->cm, $this->user->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($this->page->cm, $this->user->id);
|
||||
$completion = $output->activity_information($this->page->cm, $completiondetails, $activitydates);
|
||||
}
|
||||
|
||||
return [
|
||||
'title' => $this->title,
|
||||
'description' => $this->description,
|
||||
'completion' => $completion,
|
||||
'additional_items' => $this->hideoverflow ? '' : $this->additionalnavitems,
|
||||
];
|
||||
}
|
||||
}
|
@ -760,7 +760,7 @@ class theme_config {
|
||||
'rendererfactory', 'csspostprocess', 'editor_sheets', 'editor_scss', 'rarrow', 'larrow', 'uarrow', 'darrow',
|
||||
'hidefromselector', 'doctype', 'yuicssmodules', 'blockrtlmanipulations', 'blockrendermethod',
|
||||
'scss', 'extrascsscallback', 'prescsscallback', 'csstreepostprocessor', 'addblockposition',
|
||||
'iconsystem', 'precompiledcsscallback', 'haseditswitch', 'usescourseindex');
|
||||
'iconsystem', 'precompiledcsscallback', 'haseditswitch', 'usescourseindex', 'activityheaderconfig');
|
||||
|
||||
foreach ($config as $key=>$value) {
|
||||
if (in_array($key, $configurable)) {
|
||||
|
@ -1402,7 +1402,11 @@ class core_renderer extends renderer_base {
|
||||
$this->opencontainers->push('header/footer', $footer);
|
||||
$this->page->set_state(moodle_page::STATE_IN_BODY);
|
||||
|
||||
return $header . $this->skip_link_target('maincontent');
|
||||
// If an activity record has been set, activity_header will handle this.
|
||||
if (!$this->page->activityrecord || !empty($this->page->layout_options['noactivityheader'])) {
|
||||
$header .= $this->skip_link_target('maincontent');
|
||||
}
|
||||
return $header;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2903,6 +2907,8 @@ EOD;
|
||||
//$this->page->set_pagelayout('base'); //TODO: MDL-20676 blocks on error pages are weird, unfortunately it somehow detect the pagelayout from URL :-(
|
||||
$this->page->set_title(get_string('error'));
|
||||
$this->page->set_heading($this->page->course->fullname);
|
||||
// No need to display the activity header when encountering an error.
|
||||
$this->page->activityheader->disable();
|
||||
$output .= $this->header();
|
||||
}
|
||||
|
||||
|
@ -403,6 +403,11 @@ class moodle_page {
|
||||
*/
|
||||
protected $_activenodeprimary = null;
|
||||
|
||||
/**
|
||||
* @var \core\output\activity_header The default activity header for standardised.
|
||||
*/
|
||||
protected $_activityheader;
|
||||
|
||||
/**
|
||||
* Force the settings menu to be displayed on this page. This will only force the
|
||||
* settings menu on an activity / resource page that is being displayed on a theme that
|
||||
@ -823,6 +828,24 @@ class moodle_page {
|
||||
return $this->_flatnav;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the activity header object
|
||||
* @return secondary
|
||||
*/
|
||||
protected function magic_get_activityheader() {
|
||||
global $USER;
|
||||
if ($this->_activityheader === null) {
|
||||
$class = 'core\output\activity_header';
|
||||
// Try and load a custom class first.
|
||||
if (class_exists("mod_{$this->activityname}\\output\\activity_header")) {
|
||||
$class = "mod_{$this->activityname}\\output\\activity_header";
|
||||
}
|
||||
|
||||
$this->_activityheader = new $class($this, $USER);
|
||||
}
|
||||
return $this->_activityheader;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the secondary navigation object
|
||||
* @return secondary
|
||||
|
@ -1117,7 +1117,10 @@ function portfolio_export_pagesetup($PAGE, $caller) {
|
||||
|
||||
// and now we know the course for sure and maybe the cm, call require_login with it
|
||||
require_login($PAGE->course, false, $cm);
|
||||
|
||||
$PAGE->activityheader->set_attrs([
|
||||
'description' => '',
|
||||
'hidecompletion' => true
|
||||
]);
|
||||
foreach ($extranav as $navitem) {
|
||||
$PAGE->navbar->add($navitem['name']);
|
||||
}
|
||||
|
86
lib/templates/activity_header.mustache
Normal file
86
lib/templates/activity_header.mustache
Normal file
@ -0,0 +1,86 @@
|
||||
{{!
|
||||
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/activity_header
|
||||
|
||||
Activity header template.
|
||||
|
||||
Context variables required for this template:
|
||||
* title - The title of the activity module
|
||||
* description - The intro for the module
|
||||
* completion - The completion info if available for the the module as acquired via the activity_information method
|
||||
* additional_items - Any additional URL select navigation that needs to show up in the header
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
"title": "Assignment 1",
|
||||
"description": "The assignment does something",
|
||||
"completion": "<div class='activitycompletion'>Some activity completion criteria</div>",
|
||||
"additional_items": {
|
||||
"id": "url_select_test",
|
||||
"action": "https://example.com/post",
|
||||
"formid": "url_select_form",
|
||||
"sesskey": "sesskey",
|
||||
"label": "core/url_select",
|
||||
"helpicon": {
|
||||
"title": "Help with something",
|
||||
"text": "Help with something",
|
||||
"url": "http://example.org/help",
|
||||
"linktext": "",
|
||||
"icon":{
|
||||
"extraclasses": "iconhelp",
|
||||
"attributes": [
|
||||
{"name": "src", "value": "../../../pix/help.svg"},
|
||||
{"name": "alt", "value": "Help icon"}
|
||||
]
|
||||
}
|
||||
},
|
||||
"showbutton": "Go",
|
||||
"options": [{
|
||||
"name": "Group 1", "isgroup": true, "options":
|
||||
[
|
||||
{"name": "Item 1", "isgroup": false, "value": "1"},
|
||||
{"name": "Item 2", "isgroup": false, "value": "2"}
|
||||
]},
|
||||
{"name": "Group 2", "isgroup": true, "options":
|
||||
[
|
||||
{"name": "Item 3", "isgroup": false, "value": "3"},
|
||||
{"name": "Item 4", "isgroup": false, "value": "4"}
|
||||
]}],
|
||||
"disabled": false,
|
||||
"title": "Some cool title"
|
||||
}
|
||||
}
|
||||
}}
|
||||
<span id="maincontent"></span>
|
||||
{{#title}}
|
||||
<h2>{{{title}}}</h2>
|
||||
{{/title}}
|
||||
{{#completion}}
|
||||
<span class="sr-only">{{#str}} overallaggregation, completion {{/str}}</span>
|
||||
{{{completion}}}
|
||||
{{/completion}}
|
||||
{{#description}}
|
||||
<div class="box py-3 generalbox" id="intro">
|
||||
{{{description}}}
|
||||
</div>
|
||||
{{/description}}
|
||||
{{#additional_items}}
|
||||
<nav aria-label="{{#str}} additionalcustomnav, core {{/str}}">
|
||||
{{> core/url_select}}
|
||||
</nav>
|
||||
{{/additional_items}}
|
73
lib/tests/output/activity_header_test.php
Normal file
73
lib/tests/output/activity_header_test.php
Normal file
@ -0,0 +1,73 @@
|
||||
<?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/>.
|
||||
|
||||
namespace core\output;
|
||||
|
||||
/**
|
||||
* Unit tests for activity header
|
||||
*
|
||||
* @package core
|
||||
* @category test
|
||||
* @copyright 2021 Peter
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class activity_header_test extends \advanced_testcase {
|
||||
/**
|
||||
* Test the title setter
|
||||
*
|
||||
* @dataProvider test_set_title_provider
|
||||
* @param string $value
|
||||
* @param string $expected
|
||||
*/
|
||||
public function test_set_title(string $value, string $expected): void {
|
||||
global $PAGE, $DB;
|
||||
$this->resetAfterTest();
|
||||
$course = $this->getDataGenerator()->create_course(['enablecompletion' => true]);
|
||||
$assign = $this->getDataGenerator()->create_module('assign', [
|
||||
'course' => $course->id,
|
||||
'completion' => COMPLETION_TRACKING_AUTOMATIC,
|
||||
'completionview' => 1
|
||||
]);
|
||||
$this->setAdminUser();
|
||||
|
||||
$cm = $DB->get_record('course_modules', ['id' => $assign->cmid]);
|
||||
$PAGE->set_cm($cm);
|
||||
$PAGE->set_activity_record($assign);
|
||||
|
||||
$header = $PAGE->activityheader;
|
||||
$header->set_title($value);
|
||||
$data = $header->export_for_template($PAGE->get_renderer('core'));
|
||||
$this->assertEquals($expected, $data['title']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provider for the test_set_title unit test.
|
||||
* @return array
|
||||
*/
|
||||
public function test_set_title_provider(): array {
|
||||
return [
|
||||
"Set the title with a plain text" => [
|
||||
"Activity title", "Activity title"
|
||||
],
|
||||
"Set the title with a string with standard header tags" => [
|
||||
"<h2>Activity title</h2>", "Activity title"
|
||||
],
|
||||
"Set the title with a string with multiple header content" => [
|
||||
"<h2 id='heading'>Activity title</h2><h2>Header 2</h2>", "Activity title</h2><h2>Header 2"
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
@ -230,10 +230,6 @@ class renderer extends \plugin_renderer_base {
|
||||
* @return string
|
||||
*/
|
||||
public function render_assign_header(assign_header $header) {
|
||||
global $USER;
|
||||
|
||||
$o = '';
|
||||
|
||||
if ($header->subpage) {
|
||||
$this->page->navbar->add($header->subpage, $header->subpageurl);
|
||||
$args = ['contextname' => $header->context->get_context_name(false, true), 'subpage' => $header->subpage];
|
||||
@ -248,33 +244,24 @@ class renderer extends \plugin_renderer_base {
|
||||
$this->page->set_title($title);
|
||||
$this->page->set_heading($this->page->course->fullname);
|
||||
|
||||
$o .= $this->output->header();
|
||||
if (!$this->page->has_secondary_navigation()) {
|
||||
$o .= $this->output->heading($heading);
|
||||
}
|
||||
|
||||
// Show the activity information output component.
|
||||
$modinfo = get_fast_modinfo($header->assign->course);
|
||||
$cm = $modinfo->get_cm($header->coursemoduleid);
|
||||
$cmcompletion = \core_completion\cm_completion_details::get_instance($cm, $USER->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($cm, $USER->id);
|
||||
$o .= $this->output->activity_information($cm, $cmcompletion, $activitydates);
|
||||
|
||||
if ($header->preface) {
|
||||
$o .= $header->preface;
|
||||
}
|
||||
|
||||
$description = $header->preface;
|
||||
if ($header->showintro) {
|
||||
$o .= $this->output->box_start('generalbox boxaligncenter', 'intro');
|
||||
$o .= format_module_intro('assign', $header->assign, $header->coursemoduleid);
|
||||
$description = $this->output->box_start('generalbox boxaligncenter', 'intro');
|
||||
$description .= format_module_intro('assign', $header->assign, $header->coursemoduleid);
|
||||
if ($header->activity) {
|
||||
$o .= $this->format_activity_text($header->assign, $header->coursemoduleid);
|
||||
$description .= $this->format_activity_text($header->assign, $header->coursemoduleid);
|
||||
}
|
||||
$o .= $header->postfix;
|
||||
$o .= $this->output->box_end();
|
||||
$description .= $header->postfix;
|
||||
$description .= $this->output->box_end();
|
||||
}
|
||||
|
||||
return $o;
|
||||
$activityheader = $this->page->activityheader;
|
||||
$activityheader->set_attrs([
|
||||
'title' => $activityheader->is_title_allowed() ? $heading : '',
|
||||
'description' => $description
|
||||
]);
|
||||
|
||||
return $this->output->header();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -82,9 +82,13 @@ $PAGE->set_pagelayout('admin');
|
||||
$PAGE->navbar->add($title);
|
||||
$PAGE->set_title($title);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->activityheader->set_attrs([
|
||||
"title" => format_string($assign->get_instance()->name, true, ['context' => $context]),
|
||||
"description" => "",
|
||||
"hidecompletion" => true
|
||||
]);
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(format_string($assign->get_instance()->name, true, array('context' => $context)));
|
||||
|
||||
if ($override->groupid) {
|
||||
$group = $DB->get_record('groups', array('id' => $override->groupid), 'id, name');
|
||||
|
@ -257,8 +257,13 @@ $PAGE->navbar->add($pagetitle);
|
||||
$PAGE->set_pagelayout('admin');
|
||||
$PAGE->set_title($pagetitle);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$activityheader = $PAGE->activityheader;
|
||||
$activityheader->set_attrs([
|
||||
'description' => '',
|
||||
'hidecompletion' => true,
|
||||
'title' => $activityheader->is_title_allowed() ? format_string($assigninstance->name, true, ['context' => $context]) : ""
|
||||
]);
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(format_string($assigninstance->name, true, array('context' => $context)));
|
||||
|
||||
$mform->display();
|
||||
|
||||
|
@ -82,10 +82,13 @@ if ($action == 'movegroupoverride') {
|
||||
$PAGE->set_pagelayout('admin');
|
||||
$PAGE->set_title(get_string('overrides', 'assign'));
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$activityheader = $PAGE->activityheader;
|
||||
$activityheader->set_attrs([
|
||||
'description' => '',
|
||||
'hidecompletion' => true,
|
||||
'title' => $activityheader->is_title_allowed() ? format_string($assign->name, true, ['context' => $context]) : ""
|
||||
]);
|
||||
echo $OUTPUT->header();
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
echo $OUTPUT->heading(format_string($assign->name, true, array('context' => $context)));
|
||||
}
|
||||
$overridemenu = new \mod_assign\output\override_actionmenu($url, $cm);
|
||||
$renderer = $PAGE->get_renderer('mod_assign');
|
||||
echo $renderer->render($overridemenu);
|
||||
|
@ -4225,106 +4225,6 @@ Anchor link 2:<a title=\"bananas\" href=\"../logo-240x60.gif\">Link text</a>
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for test_view_group_override
|
||||
*
|
||||
* @return array Provider data
|
||||
*/
|
||||
public function view_group_override_provider() {
|
||||
return [
|
||||
'Other users should see their duedate' => [
|
||||
'student',
|
||||
['group2'],
|
||||
'group1',
|
||||
'7 June 2019, 5:37 PM',
|
||||
],
|
||||
'Teacher should be able to see all group override duedate' => [
|
||||
'teacher',
|
||||
['group1'],
|
||||
'group1',
|
||||
'20 September 2019, 10:37 PM',
|
||||
],
|
||||
'Teacher should be able to see all group override duedate even if they are not member' => [
|
||||
'editingteacher',
|
||||
['group1'],
|
||||
'group2',
|
||||
'7 June 2019, 5:37 PM',
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test showing group override duedate for admin
|
||||
*
|
||||
* @dataProvider view_group_override_provider
|
||||
* @param string $role the role of the user (teacher, student, etc)
|
||||
* @param string[] $groups the groups the user are member of
|
||||
* @param string $activegroup The selected group
|
||||
* @param string $expecteddate The expected due date
|
||||
*/
|
||||
public function test_view_group_override(string $role, array $groups, string $activegroup, string $expecteddate) {
|
||||
global $DB, $PAGE, $SESSION;
|
||||
|
||||
$this->resetAfterTest();
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
|
||||
$group1 = $this->getDataGenerator()->create_group(['courseid' => $course->id]);
|
||||
$group2 = $this->getDataGenerator()->create_group(['courseid' => $course->id]);
|
||||
|
||||
$user = $this->getDataGenerator()->create_and_enrol($course, $role);
|
||||
if (in_array('group1', $groups)) {
|
||||
groups_add_member($group1, $user);
|
||||
}
|
||||
if (in_array('group2', $groups)) {
|
||||
groups_add_member($group2, $user);
|
||||
}
|
||||
$activegroup = $$activegroup;
|
||||
|
||||
$assign = $this->create_instance($course, [
|
||||
'groupmode' => SEPARATEGROUPS,
|
||||
'duedate' => 1558999899, // 28 May 2019, 7:31 AM.
|
||||
]);
|
||||
$instance = $assign->get_instance();
|
||||
|
||||
// Overrides for two groups.
|
||||
$overrides = [
|
||||
(object) [
|
||||
'assignid' => $instance->id,
|
||||
'groupid' => $group1->id,
|
||||
'userid' => null,
|
||||
'sortorder' => 1,
|
||||
'duedate' => 1568990258, // 20 September 2019, 10:37 PM.
|
||||
],
|
||||
(object) [
|
||||
'assignid' => $instance->id,
|
||||
'groupid' => $group2->id,
|
||||
'userid' => null,
|
||||
'sortorder' => 2,
|
||||
'duedate' => 1559900258, // 7 June 2019, 5:37 PM.
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($overrides as &$override) {
|
||||
$override->id = $DB->insert_record('assign_overrides', $override);
|
||||
}
|
||||
|
||||
$currenturl = new moodle_url('/mod/assign/view.php', ['id' => $assign->get_course_module()->id]);
|
||||
$PAGE->set_url($currenturl);
|
||||
|
||||
$this->setUser($user);
|
||||
$_GET['group'] = $activegroup->id;
|
||||
|
||||
/** @var assign $assign */
|
||||
$header = new \mod_assign\output\assign_header(
|
||||
$assign->get_instance(),
|
||||
$assign->get_context(),
|
||||
false,
|
||||
$assign->get_course_module()->id
|
||||
);
|
||||
$output = $assign->get_renderer()->render($header);
|
||||
$this->assertStringContainsStringIgnoringCase($expecteddate, $output);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that cron task uses task API to get its last run time.
|
||||
*/
|
||||
|
@ -135,9 +135,12 @@ $PAGE->set_heading($course->fullname);
|
||||
if ($chapters = book_preload_chapters($book)) {
|
||||
book_add_fake_block($chapters, $chapter, $book, $cm);
|
||||
}
|
||||
$PAGE->activityheader->set_attrs([
|
||||
"description" => '',
|
||||
"hidecompletion" => true
|
||||
]);
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(format_string($book->name));
|
||||
|
||||
$mform->display();
|
||||
|
||||
|
@ -50,7 +50,10 @@ if ($chapterid) {
|
||||
|
||||
$PAGE->set_title($book->name);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
|
||||
$PAGE->activityheader->set_attrs([
|
||||
'hidecompletion' => true,
|
||||
'description' => ''
|
||||
]);
|
||||
// Prepare the page header.
|
||||
$strbook = get_string('modulename', 'mod_book');
|
||||
$strbooks = get_string('modulenameplural', 'mod_book');
|
||||
@ -67,7 +70,6 @@ if ($mform->is_cancelled()) {
|
||||
|
||||
} else if ($data = $mform->get_data()) {
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(format_string($book->name));
|
||||
echo $OUTPUT->heading(get_string('importingchapters', 'booktool_importhtml'), 3);
|
||||
|
||||
// this is a bloody hack - children do not try this at home!
|
||||
@ -85,7 +87,6 @@ if ($mform->is_cancelled()) {
|
||||
}
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(format_string($book->name));
|
||||
|
||||
$mform->display();
|
||||
|
||||
|
@ -137,20 +137,6 @@ book_view($book, $chapter, $islastchapter, $course, $cm, $context);
|
||||
// =====================================================
|
||||
|
||||
echo $OUTPUT->header();
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
echo $OUTPUT->heading(format_string($book->name));
|
||||
}
|
||||
|
||||
// Render the activity information.
|
||||
$cminfo = cm_info::create($cm);
|
||||
$cmcompletion = \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, $cmcompletion, $activitydates);
|
||||
|
||||
// Info box.
|
||||
if ($book->intro) {
|
||||
echo $OUTPUT->box(format_module_intro('book', $book, $cm->id), 'generalbox', 'intro');
|
||||
}
|
||||
|
||||
echo $renderedmenu;
|
||||
|
||||
|
@ -84,6 +84,12 @@ $navlinks = array();
|
||||
$canexportsess = has_capability('mod/chat:exportsession', $context);
|
||||
$canviewfullnames = has_capability('moodle/site:viewfullnames', $context);
|
||||
|
||||
$PAGE->activityheader->set_attrs([
|
||||
'title' => '',
|
||||
'description' => '',
|
||||
'hidecompletion' => true,
|
||||
'hideoverflow' => true,
|
||||
]);
|
||||
// Print a session if one has been specified.
|
||||
|
||||
if ($start and $end and !$confirmdelete) { // Show a full transcript.
|
||||
|
@ -84,9 +84,6 @@ $PAGE->set_url('/mod/chat/view.php', array('id' => $cm->id));
|
||||
$PAGE->set_title($title);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
|
||||
// Print the page header.
|
||||
echo $OUTPUT->header();
|
||||
|
||||
// Check to see if groups are being used here.
|
||||
$groupmode = groups_get_activity_groupmode($cm);
|
||||
$currentgroup = groups_get_activity_group($cm, true);
|
||||
@ -102,19 +99,8 @@ if ($currentgroup) {
|
||||
$groupparam = "";
|
||||
}
|
||||
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
echo $OUTPUT->heading(format_string($chat->name), 2);
|
||||
}
|
||||
|
||||
// Render the activity information.
|
||||
$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);
|
||||
|
||||
if ($chat->intro) {
|
||||
echo $OUTPUT->box(format_module_intro('chat', $chat, $cm->id), 'generalbox', 'intro');
|
||||
}
|
||||
// Print the page header.
|
||||
echo $OUTPUT->header();
|
||||
|
||||
groups_print_activity_menu($cm, $CFG->wwwroot . "/mod/chat/view.php?id=$cm->id");
|
||||
|
||||
|
@ -67,10 +67,12 @@
|
||||
$PAGE->navbar->add($strresponses);
|
||||
$PAGE->set_title(format_string($choice->name).": $strresponses");
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->activityheader->set_attrs([
|
||||
'hidecompletion' => true,
|
||||
'description' => ''
|
||||
]);
|
||||
echo $OUTPUT->header();
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
echo $OUTPUT->heading(format_string($choice->name), 2, null);
|
||||
}
|
||||
|
||||
/// Check to see if groups are being used in this choice
|
||||
$groupmode = groups_get_activity_groupmode($cm);
|
||||
if ($groupmode) {
|
||||
|
@ -98,14 +98,6 @@ if (data_submitted() && !empty($action) && confirm_sesskey()) {
|
||||
choice_view($choice, $course, $cm, $context);
|
||||
|
||||
echo $OUTPUT->header();
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
echo $OUTPUT->heading(format_string($choice->name), 2, null);
|
||||
}
|
||||
|
||||
// Render the activity information.
|
||||
$completiondetails = \core_completion\cm_completion_details::get_instance($cm, $USER->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($cm, $USER->id);
|
||||
echo $OUTPUT->activity_information($cm, $completiondetails, $activitydates);
|
||||
|
||||
if ($notify and confirm_sesskey()) {
|
||||
if ($notify === 'choicesaved') {
|
||||
@ -140,10 +132,6 @@ if (has_capability('mod/choice:readresponses', $context) && !$PAGE->has_secondar
|
||||
|
||||
echo '<div class="clearer"></div>';
|
||||
|
||||
if ($choice->intro) {
|
||||
echo $OUTPUT->box(format_module_intro('choice', $choice, $cm->id), 'generalbox', 'intro');
|
||||
}
|
||||
|
||||
$timenow = time();
|
||||
$current = choice_get_my_response($choice);
|
||||
//if user has already made a selection, and they are not allowed to update it or if choice is not open, show their selected answer.
|
||||
|
@ -227,17 +227,6 @@ if ($datarecord = data_submitted() and confirm_sesskey()) {
|
||||
|
||||
echo $OUTPUT->header();
|
||||
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
echo $OUTPUT->heading(format_string($data->name), 2);
|
||||
}
|
||||
|
||||
// Render the activity information.
|
||||
$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);
|
||||
|
||||
echo $OUTPUT->box(format_module_intro('data', $data, $cm->id), 'generalbox', 'intro');
|
||||
groups_print_activity_menu($cm, $CFG->wwwroot.'/mod/data/edit.php?d='.$data->id);
|
||||
|
||||
/// Print the browsing interface
|
||||
|
@ -77,7 +77,6 @@ foreach ($fieldrecords as $fieldrecord) {
|
||||
$fields[]= data_get_field($fieldrecord, $data);
|
||||
}
|
||||
|
||||
|
||||
$mform = new mod_data_export_form(new moodle_url('/mod/data/export.php', ['d' => $data->id,
|
||||
'backto' => $redirectbackto]), $fields, $cm, $data);
|
||||
|
||||
@ -118,17 +117,6 @@ $PAGE->set_heading($course->fullname);
|
||||
$PAGE->force_settings_menu(true);
|
||||
$PAGE->set_secondary_active_tab('modulepage');
|
||||
echo $OUTPUT->header();
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
echo $OUTPUT->heading(format_string($data->name), 2);
|
||||
}
|
||||
|
||||
// Render the activity information.
|
||||
$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);
|
||||
|
||||
echo $OUTPUT->box(format_module_intro('data', $data, $cm->id), 'generalbox', 'intro');
|
||||
|
||||
groups_print_activity_menu($cm, $url);
|
||||
|
||||
|
@ -80,6 +80,7 @@ $PAGE->navbar->add(get_string('add', 'data'));
|
||||
$PAGE->set_title($data->name);
|
||||
$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');
|
||||
|
||||
|
@ -2321,18 +2321,6 @@ function data_print_header($course, $cm, $data, $currenttab='', string $actionba
|
||||
$PAGE->set_title($data->name);
|
||||
echo $OUTPUT->header();
|
||||
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
echo $OUTPUT->heading(format_string($data->name), 2);
|
||||
}
|
||||
|
||||
// Render the activity information.
|
||||
$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);
|
||||
|
||||
echo $OUTPUT->box(format_module_intro('data', $data, $cm->id), 'generalbox', 'intro');
|
||||
|
||||
echo $actionbar;
|
||||
|
||||
// Print any notices
|
||||
|
@ -102,9 +102,6 @@ if ($formimportzip->is_cancelled()) {
|
||||
}
|
||||
|
||||
echo $OUTPUT->header();
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
echo $OUTPUT->heading(format_string($data->name), 2);
|
||||
}
|
||||
|
||||
if ($formdata = $formimportzip->get_data()) {
|
||||
$file = new stdClass;
|
||||
@ -184,14 +181,6 @@ if (in_array($action, ['confirmdelete', 'delete', 'finishimport'])) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// Render the activity information.
|
||||
$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);
|
||||
|
||||
echo $OUTPUT->box(format_module_intro('data', $data, $cm->id), 'generalbox', 'intro');
|
||||
|
||||
if ($action === 'import') {
|
||||
echo $formimportzip->display();
|
||||
} else {
|
||||
|
@ -104,17 +104,6 @@ $PAGE->set_pagelayout('admin');
|
||||
$PAGE->force_settings_menu(true);
|
||||
|
||||
echo $OUTPUT->header();
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
echo $OUTPUT->heading(format_string($data->name), 2);
|
||||
}
|
||||
|
||||
// Render the activity information.
|
||||
$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);
|
||||
echo $OUTPUT->box(format_module_intro('data', $data, $cm->id), 'generalbox', 'intro');
|
||||
|
||||
$actionbar = new \mod_data\output\action_bar($data->id, $url);
|
||||
echo $actionbar->get_templates_action_bar();
|
||||
|
@ -261,21 +261,11 @@ $groupmode = groups_get_activity_groupmode($cm);
|
||||
$canmanageentries = has_capability('mod/data:manageentries', $context);
|
||||
echo $OUTPUT->header();
|
||||
|
||||
|
||||
// Detect entries not approved yet and show hint instead of not found error.
|
||||
if ($record and !data_can_view_record($data, $record, $currentgroup, $canmanageentries)) {
|
||||
print_error('notapproved', 'data');
|
||||
}
|
||||
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
echo $OUTPUT->heading(format_string($data->name), 2);
|
||||
}
|
||||
|
||||
// Render the activity information.
|
||||
$completiondetails = \core_completion\cm_completion_details::get_instance($cm, $USER->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($cm, $USER->id);
|
||||
echo $OUTPUT->activity_information($cm, $completiondetails, $activitydates);
|
||||
|
||||
// Do we need to show a link to the RSS feed for the records?
|
||||
//this links has been Settings (database activity administration) block
|
||||
/*if (!empty($CFG->enablerssfeeds) && !empty($CFG->data_enablerssfeeds) && $data->rssarticles > 0) {
|
||||
@ -289,7 +279,6 @@ if ($data->intro and empty($page) and empty($record) and $mode != 'single') {
|
||||
$options = new stdClass();
|
||||
$options->noclean = true;
|
||||
}
|
||||
echo $OUTPUT->box(format_module_intro('data', $data, $cm->id), 'generalbox', 'intro');
|
||||
|
||||
$returnurl = $CFG->wwwroot . '/mod/data/view.php?d='.$data->id.'&search='.s($search).'&sort='.s($sort).'&order='.s($order).'&';
|
||||
groups_print_activity_menu($cm, $returnurl);
|
||||
|
@ -48,10 +48,11 @@ if (!$feedbackstructure->can_view_analysis()) {
|
||||
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->set_title($feedback->name);
|
||||
$PAGE->activityheader->set_attrs([
|
||||
'hidecompletion' => true,
|
||||
'description' => ''
|
||||
]);
|
||||
echo $OUTPUT->header();
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
echo $OUTPUT->heading(format_string($feedback->name));
|
||||
}
|
||||
|
||||
//get the groupid
|
||||
$mygroupid = groups_get_activity_group($cm, true);
|
||||
|
@ -85,6 +85,10 @@ $PAGE->set_url($url);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->set_title($feedback->name);
|
||||
$actionbar = new \mod_feedback\output\edit_action_bar($cm->id, $url, $lastposition);
|
||||
$PAGE->activityheader->set_attrs([
|
||||
'hidecompletion' => true,
|
||||
'description' => ''
|
||||
]);
|
||||
|
||||
//Adding the javascript module for the items dragdrop.
|
||||
if (count($feedbackitems) > 1) {
|
||||
|
@ -99,13 +99,12 @@ if ($item->id) {
|
||||
}
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->set_title($feedback->name);
|
||||
$PAGE->activityheader->set_attrs([
|
||||
"hidecompletion" => true,
|
||||
"description" => ''
|
||||
]);
|
||||
echo $OUTPUT->header();
|
||||
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
// Print the main part of the page.
|
||||
echo $OUTPUT->heading(format_string($feedback->name));
|
||||
}
|
||||
|
||||
/// print the tabs
|
||||
$current_tab = 'edit';
|
||||
$id = $cm->id;
|
||||
|
@ -95,13 +95,14 @@ $strfeedback = get_string("modulename", "feedback");
|
||||
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->set_title($feedback->name);
|
||||
$PAGE->activityheader->set_attrs([
|
||||
"hidecompletion" => true,
|
||||
"description" => ''
|
||||
]);
|
||||
echo $OUTPUT->header();
|
||||
/** @var \mod_feedback\output\renderer $renderer */
|
||||
$renderer = $PAGE->get_renderer('mod_feedback');
|
||||
echo $renderer->main_action_bar($actionbar);
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
echo $OUTPUT->heading(format_string($feedback->name));
|
||||
}
|
||||
|
||||
/// Print the main part of the page
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
@ -71,7 +71,10 @@ if ($templateid) {
|
||||
$successurl = new moodle_url('/mod/feedback/manage_templates.php', ['id' => $id]);
|
||||
redirect($url, get_string('template_deleted', 'feedback'), null, \core\output\notification::NOTIFY_SUCCESS);
|
||||
}
|
||||
|
||||
$PAGE->activityheader->set_attrs([
|
||||
"hidecompletion" => true,
|
||||
"description" => ''
|
||||
]);
|
||||
echo $OUTPUT->header();
|
||||
/** @var \mod_feedback\output\renderer $renderer */
|
||||
$renderer = $PAGE->get_renderer('mod_feedback');
|
||||
|
@ -58,9 +58,7 @@ $strfeedback = get_string("modulename", "feedback");
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->set_title($feedback->name);
|
||||
echo $OUTPUT->header();
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
echo $OUTPUT->heading(format_string($feedback->name));
|
||||
}
|
||||
|
||||
echo $OUTPUT->box(get_string('mapcourseinfo', 'feedback'));
|
||||
|
||||
$form->display();
|
||||
|
@ -48,11 +48,9 @@ $PAGE->navbar->add(format_string($feedback->name));
|
||||
|
||||
$PAGE->set_title($feedback->name);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->activityheader->set_title(format_string($feedback->name));
|
||||
echo $OUTPUT->header();
|
||||
|
||||
// Print the main part of the page.
|
||||
echo $OUTPUT->heading(format_string($feedback->name));
|
||||
|
||||
$continueurl = new moodle_url('/mod/feedback/view.php', array('id' => $id));
|
||||
if ($courseid) {
|
||||
$continueurl->param('courseid', $courseid);
|
||||
|
@ -86,6 +86,10 @@ if ($data = $courseselectform->get_data()) {
|
||||
navigation_node::override_active_url($baseurl);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->set_title($feedback->name);
|
||||
$PAGE->activityheader->set_attrs([
|
||||
'hidecompletion' => true,
|
||||
'description' => ''
|
||||
]);
|
||||
echo $OUTPUT->header();
|
||||
|
||||
/** @var \mod_feedback\output\renderer $renderer */
|
||||
|
@ -137,6 +137,10 @@ if ($action == 'sendmessage' AND $canbulkmessaging) {
|
||||
/// Print the page header
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->set_title($feedback->name);
|
||||
$PAGE->activityheader->set_attrs([
|
||||
'hidecompletion' => true,
|
||||
'description' => ''
|
||||
]);
|
||||
echo $OUTPUT->header();
|
||||
|
||||
/** @var \mod_feedback\output\renderer $renderer */
|
||||
|
@ -63,6 +63,10 @@ if ($mode == 'manage') {
|
||||
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->set_title($feedback->name);
|
||||
$PAGE->activityheader->set_attrs([
|
||||
"hidecompletion" => true,
|
||||
"description" => ''
|
||||
]);
|
||||
$actionbar = new \mod_feedback\output\edit_template_action_bar($cm->id, $templateid, $mode);
|
||||
/** @var \mod_feedback\output\renderer $renderer */
|
||||
$renderer = $PAGE->get_renderer('mod_feedback');
|
||||
|
@ -72,9 +72,6 @@ $renderer = $PAGE->get_renderer('mod_feedback');
|
||||
// Trigger module viewed event.
|
||||
$feedbackcompletion->trigger_module_viewed();
|
||||
|
||||
/// Print the page header
|
||||
echo $OUTPUT->header();
|
||||
|
||||
/// Print the main part of the page
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@ -87,10 +84,10 @@ if ($courseid) {
|
||||
}
|
||||
$preview = html_writer::link($previewlnk, $previewimg);
|
||||
|
||||
// Render the activity information.
|
||||
$completiondetails = \core_completion\cm_completion_details::get_instance($cm, $USER->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($cm, $USER->id);
|
||||
echo $OUTPUT->activity_information($cm, $completiondetails, $activitydates);
|
||||
$PAGE->activityheader->set_description("");
|
||||
|
||||
// Print the page header.
|
||||
echo $OUTPUT->header();
|
||||
|
||||
// Show description.
|
||||
echo $OUTPUT->box_start('generalbox feedback_description');
|
||||
|
@ -43,7 +43,10 @@ $PAGE->set_title($course->shortname.': '.$folder->name);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->set_activity_record($folder);
|
||||
$PAGE->set_secondary_active_tab('modulepage');
|
||||
|
||||
$PAGE->activityheader->set_attrs([
|
||||
'hidecompletion' => true,
|
||||
'description' => ''
|
||||
]);
|
||||
$data = new stdClass();
|
||||
$data->id = $cm->id;
|
||||
$maxbytes = get_user_max_upload_file_size($context, $CFG->maxbytes);
|
||||
@ -79,9 +82,6 @@ if ($mform->is_cancelled()) {
|
||||
}
|
||||
|
||||
echo $OUTPUT->header();
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
echo $OUTPUT->heading(format_string($folder->name));
|
||||
}
|
||||
echo $OUTPUT->box_start('generalbox foldertree');
|
||||
$mform->display();
|
||||
echo $OUTPUT->box_end();
|
||||
|
@ -47,10 +47,7 @@ class mod_folder_renderer extends plugin_renderer_base {
|
||||
}
|
||||
|
||||
if (trim($folder->intro)) {
|
||||
if ($folder->display != FOLDER_DISPLAY_INLINE) {
|
||||
$output .= $this->output->box(format_module_intro('folder', $folder, $cm->id),
|
||||
'generalbox', 'intro');
|
||||
} else if ($cm->showdescription) {
|
||||
if ($folder->display == FOLDER_DISPLAY_INLINE && $cm->showdescription) {
|
||||
// for "display inline" do not filter, filters run at display time.
|
||||
$output .= format_module_intro('folder', $folder, $cm->id, false);
|
||||
}
|
||||
|
@ -69,21 +69,10 @@ $PAGE->set_title($course->shortname.': '.$folder->name);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->set_activity_record($folder);
|
||||
|
||||
|
||||
$output = $PAGE->get_renderer('mod_folder');
|
||||
|
||||
echo $output->header();
|
||||
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
echo $output->heading(format_string($folder->name), 2);
|
||||
}
|
||||
|
||||
// Render the activity information.
|
||||
$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);
|
||||
|
||||
echo $output->display_folder($folder);
|
||||
|
||||
echo $output->footer();
|
||||
|
@ -310,6 +310,7 @@ if ($node && $post->get_id() != $discussion->get_first_post_id()) {
|
||||
$isnestedv2displaymode = $displaymode == FORUM_MODE_NESTED_V2;
|
||||
$PAGE->set_title("$course->shortname: " . format_string($discussion->get_name()));
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->activityheader->disable();
|
||||
if ($isnestedv2displaymode) {
|
||||
$PAGE->add_body_class('nested-v2-display-mode reset-style');
|
||||
$settingstrigger = $OUTPUT->render_from_template('mod_forum/settings_drawer_trigger', null);
|
||||
|
@ -182,6 +182,7 @@ $PAGE->set_url($url);
|
||||
$PAGE->set_title($pagetitle);
|
||||
$PAGE->set_pagelayout('admin');
|
||||
$PAGE->set_heading($pagetitle);
|
||||
$PAGE->activityheader->disable();
|
||||
|
||||
echo $OUTPUT->header();
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
|
@ -1094,11 +1094,12 @@ if ($edit) {
|
||||
$PAGE->set_title("{$course->shortname}: {$strdiscussionname}{$titlesubject}");
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->set_secondary_active_tab("modulepage");
|
||||
|
||||
echo $OUTPUT->header();
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
echo $OUTPUT->heading(format_string($forum->name), 2);
|
||||
$activityheaderconfig['hidecompletion'] = true;
|
||||
if (!empty($parententity)) {
|
||||
$activityheaderconfig['description'] = '';
|
||||
}
|
||||
$PAGE->activityheader->set_attrs($activityheaderconfig);
|
||||
echo $OUTPUT->header();
|
||||
|
||||
// Checkup.
|
||||
if (!empty($parententity) && !$capabilitymanager->can_view_post($USER, $discussionentity, $parententity)) {
|
||||
@ -1141,10 +1142,6 @@ if (!empty($parententity)) {
|
||||
$rendererfactory = mod_forum\local\container::get_renderer_factory();
|
||||
$postsrenderer = $rendererfactory->get_single_discussion_posts_renderer(FORUM_MODE_THREADED, true);
|
||||
echo $postsrenderer->render($USER, [$forumentity], [$discussionentity], $postentities);
|
||||
} else {
|
||||
if (!empty($forum->intro)) {
|
||||
echo $OUTPUT->box(format_module_intro('forum', $forum, $cm->id), 'generalbox', 'intro');
|
||||
}
|
||||
}
|
||||
|
||||
// Call print disclosure for enabled plagiarism plugins.
|
||||
|
@ -107,6 +107,7 @@ $PAGE->set_url($pageurl);
|
||||
$PAGE->set_pagelayout('report');
|
||||
$PAGE->set_title($title);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->activityheader->disable();
|
||||
$PAGE->navbar->add(get_string('nodetitle', 'forumreport_summary'));
|
||||
|
||||
// Activate the secondary nav tab.
|
||||
|
@ -109,13 +109,13 @@ $PAGE->set_secondary_active_tab("forumsubscriptions");
|
||||
|
||||
// Output starts from here.
|
||||
$actionbar = new \mod_forum\output\subscription_actionbar($id, $url, $forum);
|
||||
$PAGE->activityheader->disable();
|
||||
echo $OUTPUT->header();
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
echo $OUTPUT->heading(get_string('forum', 'forum') . ' ' . $strsubscribers);
|
||||
}
|
||||
echo $forumoutput->subscription_actionbar($actionbar);
|
||||
|
||||
|
||||
if ($edit === 0) {
|
||||
$subscribers = \mod_forum\subscriptions::fetch_subscribed_users($forum, $currentgroup, $context);
|
||||
if (\mod_forum\subscriptions::is_forcesubscribed($forum)) {
|
||||
|
@ -157,24 +157,21 @@ if (!empty($CFG->enablerssfeeds) && !empty($CFG->forum_enablerssfeeds) && $forum
|
||||
]) . ': ' . format_string($forum->get_name());
|
||||
rss_add_http_header($forum->get_context(), 'mod_forum', $forumrecord, $rsstitle);
|
||||
}
|
||||
|
||||
// Output starts from here.
|
||||
echo $OUTPUT->header();
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
echo $OUTPUT->heading(format_string($forum->get_name()), 2);
|
||||
$activityheader = $PAGE->activityheader;
|
||||
$pageheader = [];
|
||||
if ($activityheader->is_title_allowed()) {
|
||||
$pageheader['title'] = format_string($forum->get_name());
|
||||
}
|
||||
|
||||
// Render the activity information.
|
||||
$completiondetails = \core_completion\cm_completion_details::get_instance($cm, $USER->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($cm, $USER->id);
|
||||
echo $OUTPUT->activity_information($cm, $completiondetails, $activitydates);
|
||||
|
||||
// Fetch the current groupid.
|
||||
$groupid = groups_get_activity_group($cm, true) ?: null;
|
||||
|
||||
if (!$istypesingle && !empty($forum->get_intro())) {
|
||||
echo $OUTPUT->box(format_module_intro('forum', $forumrecord, $cm->id), 'generalbox', 'intro');
|
||||
if ($istypesingle || empty($forum->get_intro())) {
|
||||
$pageheader['description'] = '';
|
||||
}
|
||||
$activityheader->set_attrs($pageheader);
|
||||
|
||||
echo $OUTPUT->header();
|
||||
|
||||
$rendererfactory = mod_forum\local\container::get_renderer_factory();
|
||||
// The elements for view action are rendered and added to the page.
|
||||
|
@ -66,6 +66,7 @@ if ($confirm and confirm_sesskey()) { // the operation was confirmed.
|
||||
$PAGE->navbar->add(get_string('delete'));
|
||||
$PAGE->set_title($glossary->name);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->activityheader->disable();
|
||||
echo $OUTPUT->header();
|
||||
$areyousure = "<b>".format_string($entry->concept)."</b><p>$strareyousuredelete</p>";
|
||||
$linkyes = 'deleteentry.php';
|
||||
|
@ -83,11 +83,8 @@ if (!empty($id)) {
|
||||
$PAGE->set_title($glossary->name);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->set_secondary_active_tab('modulepage');
|
||||
$PAGE->activityheader->set_hidecompletion(true);
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(format_string($glossary->name), 2);
|
||||
if ($glossary->intro) {
|
||||
echo $OUTPUT->box(format_module_intro('glossary', $glossary, $cm->id), 'generalbox', 'intro');
|
||||
}
|
||||
|
||||
$data = new StdClass();
|
||||
$data->tags = core_tag_tag::get_item_tags_array('mod_glossary', 'glossary_entries', $id);
|
||||
|
@ -51,6 +51,7 @@ $PAGE->navbar->add($strexportentries);
|
||||
$PAGE->set_title($glossary->name);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->set_secondary_active_tab('modulepage');
|
||||
$PAGE->activityheader->disable();
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($strexportentries);
|
||||
|
@ -50,6 +50,7 @@ $PAGE->navbar->add($strimportentries);
|
||||
$PAGE->set_title($glossary->name);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->set_secondary_active_tab('modulepage');
|
||||
$PAGE->activityheader->disable();
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($strimportentries);
|
||||
|
@ -40,6 +40,7 @@ if ($eid) {
|
||||
}
|
||||
|
||||
$PAGE->set_pagelayout('incourse');
|
||||
$PAGE->activityheader->disable();
|
||||
|
||||
if ($entries) {
|
||||
foreach ($entries as $key => $entry) {
|
||||
|
@ -297,23 +297,24 @@ if ($tab == GLOSSARY_APPROVAL_VIEW) {
|
||||
require_capability('mod/glossary:approve', $context);
|
||||
$PAGE->navbar->add($strwaitingapproval);
|
||||
}
|
||||
echo $OUTPUT->header();
|
||||
$hassecondary = $PAGE->has_secondary_navigation();
|
||||
|
||||
if (!$hassecondary) {
|
||||
if ($tab == GLOSSARY_APPROVAL_VIEW) {
|
||||
echo $OUTPUT->heading($strwaitingapproval);
|
||||
}
|
||||
echo $OUTPUT->heading(format_string($glossary->name), 2);
|
||||
$hassecondary = $PAGE->has_secondary_navigation();
|
||||
if ($tab == GLOSSARY_APPROVAL_VIEW && !$hassecondary && $PAGE->activityheader->is_title_allowed()) {
|
||||
$PAGE->activityheader->set_title(
|
||||
$OUTPUT->heading($strwaitingapproval) .
|
||||
$OUTPUT->heading(format_string($glossary->name))
|
||||
);
|
||||
}
|
||||
|
||||
// Render the activity information.
|
||||
$completiondetails = \core_completion\cm_completion_details::get_instance($cm, $USER->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($cm, $USER->id);
|
||||
echo $OUTPUT->activity_information($cm, $completiondetails, $activitydates);
|
||||
if ($tab == GLOSSARY_APPROVAL_VIEW || !($glossary->intro && $showcommonelements)) {
|
||||
$PAGE->activityheader->set_description('');
|
||||
}
|
||||
|
||||
echo $OUTPUT->header();
|
||||
if ($showcommonelements) {
|
||||
echo $renderer->main_action_bar($actionbar);
|
||||
}
|
||||
|
||||
/// All this depends if whe have $showcommonelements
|
||||
if ($showcommonelements) {
|
||||
/// To calculate available options
|
||||
@ -368,11 +369,6 @@ if ($showcommonelements) {
|
||||
// print_box(' ', 'clearer');
|
||||
}
|
||||
|
||||
/// Info box
|
||||
if ($glossary->intro && $showcommonelements) {
|
||||
echo $OUTPUT->box(format_module_intro('glossary', $glossary, $cm->id), 'generalbox', 'intro');
|
||||
}
|
||||
|
||||
require("tabs.php");
|
||||
|
||||
require("sql.php");
|
||||
|
@ -84,6 +84,7 @@ $event->trigger();
|
||||
$shortname = format_string($course->shortname, true, ['context' => $context]);
|
||||
$pagetitle = strip_tags($shortname.': '.format_string($moduleinstance->name));
|
||||
$PAGE->set_title(format_string($pagetitle));
|
||||
$PAGE->activityheader->disable();
|
||||
|
||||
$navbar = [];
|
||||
if ($manager->can_view_all_attempts()) {
|
||||
|
@ -68,19 +68,8 @@ $PAGE->set_heading(format_string($course->fullname));
|
||||
$PAGE->set_context($context);
|
||||
|
||||
echo $OUTPUT->header();
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
echo $OUTPUT->heading(format_string($moduleinstance->name));
|
||||
}
|
||||
|
||||
// Render the activity information.
|
||||
$completiondetails = \core_completion\cm_completion_details::get_instance($cm, $USER->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($cm, $USER->id);
|
||||
echo $OUTPUT->activity_information($cm, $completiondetails, $activitydates);
|
||||
|
||||
$instance = $manager->get_instance();
|
||||
if (!empty($instance->intro)) {
|
||||
echo $OUTPUT->box(format_module_intro('h5pactivity', $instance, $cm->id), 'generalbox', 'intro');
|
||||
}
|
||||
|
||||
if (!$manager->is_tracking_enabled()) {
|
||||
$message = get_string('previewmode', 'mod_h5pactivity');
|
||||
|
@ -69,18 +69,6 @@ if (!$imscp->structure) {
|
||||
}
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(format_string($imscp->name));
|
||||
|
||||
// Render the activity information.
|
||||
$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);
|
||||
|
||||
// Info box.
|
||||
if ($imscp->intro) {
|
||||
echo $OUTPUT->box(format_module_intro('imscp', $imscp, $cm->id), 'generalbox', 'intro');
|
||||
}
|
||||
|
||||
imscp_print_content($imscp, $cm, $course);
|
||||
|
||||
|
@ -57,8 +57,11 @@ $mform->set_data($data);
|
||||
$PAGE->navbar->add($strimportquestions);
|
||||
$PAGE->set_title($strimportquestions);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->activityheader->set_attrs([
|
||||
'hidecompletion' => true,
|
||||
'description' => ''
|
||||
]);
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(format_string($lesson->name), 2);
|
||||
echo $OUTPUT->heading_with_help($strimportquestions, 'importquestions', 'lesson', '', '', 3);
|
||||
|
||||
if ($data = $mform->get_data()) {
|
||||
|
@ -53,42 +53,30 @@ class mod_lesson_renderer extends plugin_renderer_base {
|
||||
$this->page->set_title($title);
|
||||
$this->page->set_heading($this->page->course->fullname);
|
||||
lesson_add_header_buttons($cm, $context, $extraeditbuttons, $lessonpageid);
|
||||
|
||||
$canmanage = has_capability('mod/lesson:manage', $context);
|
||||
$activityheader = $this->page->activityheader;
|
||||
$activitypage = new moodle_url('/mod/' . $this->page->activityname . '/view.php');
|
||||
$setactive = $activitypage->compare($this->page->url, URL_MATCH_BASE);
|
||||
if ($activityheader->is_title_allowed()) {
|
||||
$title = $canmanage && $setactive ?
|
||||
$this->output->heading_with_help($activityname, 'overview', 'lesson') :
|
||||
$activityname;
|
||||
$activityheader->set_title($title);
|
||||
}
|
||||
|
||||
// If we have the capability to manage the lesson but not within the view page,
|
||||
// there's no reason to show activity/completion information.
|
||||
if ($canmanage && !$setactive) {
|
||||
$activityheader->set_hidecompletion(true);
|
||||
}
|
||||
|
||||
$output = $this->output->header();
|
||||
|
||||
$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);
|
||||
if (has_capability('mod/lesson:manage', $context)) {
|
||||
$activitypage = new moodle_url('/mod/' . $this->page->activityname . '/view.php');
|
||||
$setactive = $activitypage->compare($this->page->url, URL_MATCH_BASE);
|
||||
if ($setactive) {
|
||||
if (!$this->page->has_secondary_navigation()) {
|
||||
$output .= $this->output->heading_with_help($activityname, 'overview', 'lesson');
|
||||
}
|
||||
$output .= $this->output->activity_information($cminfo, $completiondetails, $activitydates);
|
||||
}
|
||||
|
||||
// Info box.
|
||||
if ($lesson->intro) {
|
||||
$output .= $this->output->box(format_module_intro('lesson', $lesson, $cm->id), 'generalbox', 'intro');
|
||||
}
|
||||
|
||||
if (!empty($currenttab) && !$this->page->has_secondary_navigation()) {
|
||||
ob_start();
|
||||
include($CFG->dirroot.'/mod/lesson/tabs.php');
|
||||
$output .= ob_get_contents();
|
||||
ob_end_clean();
|
||||
}
|
||||
} else {
|
||||
if (!$this->page->has_secondary_navigation()) {
|
||||
$output .= $this->output->heading($activityname);
|
||||
}
|
||||
$output .= $this->output->activity_information($cminfo, $completiondetails, $activitydates);
|
||||
|
||||
// Info box.
|
||||
if ($lesson->intro) {
|
||||
$output .= $this->output->box(format_module_intro('lesson', $lesson, $cm->id), 'generalbox', 'intro');
|
||||
}
|
||||
if ($canmanage && !empty($currenttab) && !$this->page->has_secondary_navigation()) {
|
||||
ob_start();
|
||||
include($CFG->dirroot.'/mod/lesson/tabs.php');
|
||||
$output .= ob_get_contents();
|
||||
ob_end_clean();
|
||||
}
|
||||
|
||||
foreach ($lesson->messages as $message) {
|
||||
|
@ -106,26 +106,18 @@ $pagetitle = strip_tags($course->shortname.': '.format_string($lti->name));
|
||||
$PAGE->set_title($pagetitle);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
|
||||
$activityheader = $PAGE->activityheader;
|
||||
if (!$lti->showtitlelaunch) {
|
||||
$header['title'] = '';
|
||||
}
|
||||
if (!$lti->showdescriptionlaunch) {
|
||||
$header['description'] = '';
|
||||
}
|
||||
$activityheader->set_attrs($header ?? []);
|
||||
|
||||
// Print the page header.
|
||||
echo $OUTPUT->header();
|
||||
|
||||
if ($lti->showtitlelaunch) {
|
||||
// Print the main part of the page.
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
echo $OUTPUT->heading(format_string($lti->name, true, array('context' => $context)));
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
if ($lti->showdescriptionlaunch && $lti->intro) {
|
||||
echo $OUTPUT->box(format_module_intro('lti', $lti, $cm->id), 'generalbox description', 'intro');
|
||||
}
|
||||
|
||||
if ($typeid) {
|
||||
$config = lti_get_type_type_config($typeid);
|
||||
} else {
|
||||
|
@ -16,9 +16,9 @@ Feature: Configure page appearance
|
||||
Scenario Outline: Hide and display page features
|
||||
Given I am on the "PageName1" "page activity editing" page logged in as admin
|
||||
And I expand all fieldsets
|
||||
And I set the field "Display page name" to "<value>"
|
||||
And I set the field "<feature>" to "<value>"
|
||||
And I press "Save and display"
|
||||
Then I <shouldornot> see "PageName1" in the "region-main" "region"
|
||||
Then I <shouldornot> see "<lookfor>" in the "region-main" "region"
|
||||
|
||||
Examples:
|
||||
| feature | lookfor | value | shouldornot |
|
||||
|
@ -58,6 +58,15 @@ $PAGE->set_url('/mod/page/view.php', array('id' => $cm->id));
|
||||
|
||||
$options = empty($page->displayoptions) ? [] : (array) unserialize_array($page->displayoptions);
|
||||
|
||||
$activityheader = ['hidecompletion' => false];
|
||||
if (empty($options['printheading'])) {
|
||||
$activityheader['title'] = '';
|
||||
}
|
||||
|
||||
if (empty($options['printintro']) || !trim(strip_tags($page->intro))) {
|
||||
$activityheader['description'] = '';
|
||||
}
|
||||
|
||||
if ($inpopup and $page->display == RESOURCELIB_DISPLAY_POPUP) {
|
||||
$PAGE->set_pagelayout('popup');
|
||||
$PAGE->set_title($course->shortname.': '.$page->name);
|
||||
@ -66,26 +75,12 @@ if ($inpopup and $page->display == RESOURCELIB_DISPLAY_POPUP) {
|
||||
$PAGE->set_title($course->shortname.': '.$page->name);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->set_activity_record($page);
|
||||
}
|
||||
echo $OUTPUT->header();
|
||||
if (!isset($options['printheading']) || !empty($options['printheading'])) {
|
||||
echo $OUTPUT->heading(format_string($page->name), 2);
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
if (!empty($options['printintro'])) {
|
||||
if (trim(strip_tags($page->intro))) {
|
||||
echo $OUTPUT->box_start('mod_introbox', 'pageintro');
|
||||
echo format_module_intro('page', $page, $cm->id);
|
||||
echo $OUTPUT->box_end();
|
||||
if (!$PAGE->activityheader->is_title_allowed()) {
|
||||
$activityheader['title'] = "";
|
||||
}
|
||||
}
|
||||
|
||||
$PAGE->activityheader->set_attrs($activityheader);
|
||||
echo $OUTPUT->header();
|
||||
$content = file_rewrite_pluginfile_urls($page->content, 'pluginfile.php', $context->id, 'mod_page', 'content', $page->revision);
|
||||
$formatoptions = new stdClass;
|
||||
$formatoptions->noclean = true;
|
||||
|
@ -128,7 +128,7 @@ $PAGE->blocks->add_fake_block($navbc, reset($regions));
|
||||
$headtags = $attemptobj->get_html_head_contributions($page);
|
||||
$PAGE->set_title($attemptobj->attempt_page_title($page));
|
||||
$PAGE->set_heading($attemptobj->get_course()->fullname);
|
||||
|
||||
$PAGE->activityheader->disable();
|
||||
if ($attemptobj->is_last_page($page)) {
|
||||
$nextpage = -1;
|
||||
} else {
|
||||
|
@ -182,6 +182,7 @@ $output = $PAGE->get_renderer('mod_quiz', 'edit');
|
||||
|
||||
$PAGE->set_title(get_string('editingquizx', 'quiz', format_string($quiz->name)));
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->activityheader->disable();
|
||||
$node = $PAGE->settingsnav->find('mod_quiz_edit', navigation_node::TYPE_SETTING);
|
||||
if ($node) {
|
||||
$node->make_active();
|
||||
|
@ -87,11 +87,12 @@ $PAGE->set_pagelayout('admin');
|
||||
$PAGE->navbar->add($title);
|
||||
$PAGE->set_title($title);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
|
||||
$PAGE->activityheader->set_attrs([
|
||||
"title" => format_string($quiz->name, true, ['context' => $context]),
|
||||
"description" => "",
|
||||
"hidecompletion" => true
|
||||
]);
|
||||
echo $OUTPUT->header();
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
echo $OUTPUT->heading(format_string($quiz->name, true, array('context' => $context)));
|
||||
}
|
||||
|
||||
if ($override->groupid) {
|
||||
$group = $DB->get_record('groups', ['id' => $override->groupid], 'id, name');
|
||||
|
@ -241,10 +241,12 @@ $PAGE->navbar->add($pagetitle);
|
||||
$PAGE->set_pagelayout('admin');
|
||||
$PAGE->set_title($pagetitle);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->activityheader->set_attrs([
|
||||
"title" => format_string($quiz->name, true, array('context' => $context)),
|
||||
"description" => "",
|
||||
"hidecompletion" => true
|
||||
]);
|
||||
echo $OUTPUT->header();
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
echo $OUTPUT->heading(format_string($quiz->name, true, array('context' => $context)));
|
||||
}
|
||||
|
||||
$mform->display();
|
||||
|
||||
|
@ -68,6 +68,7 @@ $PAGE->set_url($url);
|
||||
$PAGE->set_pagelayout('admin');
|
||||
$PAGE->set_title($title);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->activityheader->disable();
|
||||
|
||||
// Activate the secondary nav tab.
|
||||
$PAGE->set_secondary_active_tab("mod_quiz_useroverrides");
|
||||
|
@ -972,24 +972,8 @@ class mod_quiz_renderer extends plugin_renderer_base {
|
||||
* @return string HTML to output.
|
||||
*/
|
||||
public function view_information($quiz, $cm, $context, $messages, bool $quizhasquestions = false) {
|
||||
global $USER;
|
||||
|
||||
$output = '';
|
||||
|
||||
// Print quiz name.
|
||||
if (!$this->page->has_secondary_navigation()) {
|
||||
$output .= $this->heading(format_string($quiz->name));
|
||||
}
|
||||
|
||||
// Print 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);
|
||||
$output .= $this->output->activity_information($cminfo, $completiondetails, $activitydates);
|
||||
|
||||
// Print quiz description.
|
||||
$output .= $this->quiz_intro($quiz, $cm);
|
||||
|
||||
// Print the preview, quiz buttons for tertiary nav.
|
||||
$canedit = has_capability('mod/quiz:manage', $context);
|
||||
$canpreview = has_capability('mod/quiz:preview', $context);
|
||||
|
@ -65,7 +65,7 @@ $PAGE->set_url($url);
|
||||
require_login($course, false, $cm);
|
||||
$context = context_module::instance($cm->id);
|
||||
$PAGE->set_pagelayout('report');
|
||||
|
||||
$PAGE->activityheader->disable();
|
||||
$reportlist = quiz_report_list($context);
|
||||
if (empty($reportlist)) {
|
||||
print_error('erroraccessingreport', 'quiz');
|
||||
|
@ -108,6 +108,7 @@ if ($attemptobj->is_own_preview()) {
|
||||
$headtags = $attemptobj->get_html_head_contributions($page, $showall);
|
||||
$PAGE->set_title($attemptobj->review_page_title($page, $showall));
|
||||
$PAGE->set_heading($attemptobj->get_course()->fullname);
|
||||
$PAGE->activityheader->disable();
|
||||
|
||||
// Summary table start. ============================================================================
|
||||
|
||||
|
@ -94,7 +94,7 @@ $PAGE->blocks->add_fake_block($navbc, reset($regions));
|
||||
$PAGE->navbar->add(get_string('summaryofattempt', 'quiz'));
|
||||
$PAGE->set_title($attemptobj->summary_page_title());
|
||||
$PAGE->set_heading($attemptobj->get_course()->fullname);
|
||||
|
||||
$PAGE->activityheader->disable();
|
||||
// Display the page.
|
||||
echo $output->summary_page($attemptobj, $displayoptions);
|
||||
|
||||
|
@ -143,6 +143,9 @@ if (!empty($grading_info->items)) {
|
||||
$title = $course->shortname . ': ' . format_string($quiz->name);
|
||||
$PAGE->set_title($title);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
if (html_is_blank($quiz->intro)) {
|
||||
$PAGE->activityheader->set_description('');
|
||||
}
|
||||
$output = $PAGE->get_renderer('mod_quiz');
|
||||
// MDL-71915 Will remove this place holder.
|
||||
if (defined('BEHAT_SITE_RUNNING')) {
|
||||
|
59
mod/resource/deprecatedlib.php
Normal file
59
mod/resource/deprecatedlib.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?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/>.
|
||||
|
||||
/**
|
||||
* List of deprecated mod_resource functions.
|
||||
*
|
||||
* @package mod_resource
|
||||
* @copyright 2021 Peter D
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
/**
|
||||
* Print resource heading.
|
||||
*
|
||||
* @deprecated since Moodle 4.0
|
||||
* @param object $resource
|
||||
* @param object $cm
|
||||
* @param object $course
|
||||
* @param bool $notused This variable is no longer used
|
||||
* @return void
|
||||
*/
|
||||
function resource_print_heading($resource, $cm, $course, $notused = false) {
|
||||
global $OUTPUT;
|
||||
debugging('resource_print_heading is deprecated. Handled by activity_header now.', DEBUG_DEVELOPER);
|
||||
echo $OUTPUT->heading(format_string($resource->name), 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print resource introduction.
|
||||
*
|
||||
* @deprecated since Moodle 4.0
|
||||
* @param object $resource
|
||||
* @param object $cm
|
||||
* @param object $course
|
||||
* @param bool $ignoresettings print even if not specified in modedit
|
||||
* @return void
|
||||
*/
|
||||
function resource_print_intro($resource, $cm, $course, $ignoresettings=false) {
|
||||
global $OUTPUT;
|
||||
debugging('resource_print_intro is deprecated. Handled by activity_header now.', DEBUG_DEVELOPER);
|
||||
if ($intro = resource_get_intro($resource, $cm, $ignoresettings)) {
|
||||
echo $OUTPUT->box_start('mod_introbox', 'resourceintro');
|
||||
echo $intro;
|
||||
echo $OUTPUT->box_end();
|
||||
}
|
||||
}
|
@ -61,7 +61,7 @@ function resource_redirect_if_migrated($oldid, $cmid) {
|
||||
* @return does not return
|
||||
*/
|
||||
function resource_display_embed($resource, $cm, $course, $file) {
|
||||
global $PAGE, $OUTPUT, $USER;
|
||||
global $PAGE, $OUTPUT;
|
||||
|
||||
$clicktoopen = resource_get_clicktoopen($file, $resource->revision);
|
||||
|
||||
@ -99,19 +99,13 @@ function resource_display_embed($resource, $cm, $course, $file) {
|
||||
$code = resourcelib_embed_general($moodleurl, $title, $clicktoopen, $mimetype);
|
||||
}
|
||||
|
||||
resource_print_header($resource, $cm, $course);
|
||||
resource_print_heading($resource, $cm, $course);
|
||||
// Let the module handle the display.
|
||||
$PAGE->activityheader->set_description(resource_get_intro($resource, $cm));
|
||||
|
||||
// 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);
|
||||
resource_print_header($resource, $cm, $course);
|
||||
|
||||
echo format_text($code, FORMAT_HTML, ['noclean' => true]);
|
||||
|
||||
resource_print_intro($resource, $cm, $course);
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
die;
|
||||
}
|
||||
@ -131,9 +125,8 @@ function resource_display_frame($resource, $cm, $course, $file) {
|
||||
|
||||
if ($frame === 'top') {
|
||||
$PAGE->set_pagelayout('frametop');
|
||||
$PAGE->activityheader->set_description(resource_get_intro($resource, $cm, true));
|
||||
resource_print_header($resource, $cm, $course);
|
||||
resource_print_heading($resource, $cm, $course);
|
||||
resource_print_intro($resource, $cm, $course);
|
||||
echo $OUTPUT->footer();
|
||||
die;
|
||||
|
||||
@ -208,17 +201,12 @@ function resource_get_clicktodownload($file, $revision) {
|
||||
* @return does not return
|
||||
*/
|
||||
function resource_print_workaround($resource, $cm, $course, $file) {
|
||||
global $CFG, $OUTPUT, $USER;
|
||||
global $CFG, $OUTPUT, $PAGE;
|
||||
|
||||
// Let the module handle the display.
|
||||
$PAGE->activityheader->set_description(resource_get_intro($resource, $cm, true));
|
||||
|
||||
resource_print_header($resource, $cm, $course);
|
||||
resource_print_heading($resource, $cm, $course, true);
|
||||
|
||||
// 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);
|
||||
|
||||
resource_print_intro($resource, $cm, $course, true);
|
||||
|
||||
$resource->mainfile = $file->get_filename();
|
||||
echo '<div class="resourceworkaround">';
|
||||
@ -270,23 +258,6 @@ function resource_print_header($resource, $cm, $course) {
|
||||
echo $OUTPUT->header();
|
||||
}
|
||||
|
||||
/**
|
||||
* Print resource heading.
|
||||
* @param object $resource
|
||||
* @param object $cm
|
||||
* @param object $course
|
||||
* @param bool $notused This variable is no longer used
|
||||
* @return void
|
||||
*/
|
||||
function resource_print_heading($resource, $cm, $course, $notused = false) {
|
||||
global $OUTPUT, $PAGE;
|
||||
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
echo $OUTPUT->heading(format_string($resource->name), 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets details of the file to cache in course cache to be displayed using {@link resource_get_optional_details()}
|
||||
*
|
||||
@ -415,16 +386,14 @@ function resource_get_optional_details($resource, $cm) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Print resource introduction.
|
||||
* Get resource introduction.
|
||||
*
|
||||
* @param object $resource
|
||||
* @param object $cm
|
||||
* @param object $course
|
||||
* @param bool $ignoresettings print even if not specified in modedit
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function resource_print_intro($resource, $cm, $course, $ignoresettings=false) {
|
||||
global $OUTPUT;
|
||||
|
||||
function resource_get_intro(object $resource, object $cm, bool $ignoresettings = false): string {
|
||||
$options = empty($resource->displayoptions) ? [] : (array) unserialize_array($resource->displayoptions);
|
||||
|
||||
$extraintro = resource_get_optional_details($resource, $cm);
|
||||
@ -433,17 +402,18 @@ function resource_print_intro($resource, $cm, $course, $ignoresettings=false) {
|
||||
$extraintro = html_writer::tag('p', $extraintro, array('class' => 'resourcedetails'));
|
||||
}
|
||||
|
||||
$content = "";
|
||||
if ($ignoresettings || !empty($options['printintro']) || $extraintro) {
|
||||
$gotintro = trim(strip_tags($resource->intro));
|
||||
if ($gotintro || $extraintro) {
|
||||
echo $OUTPUT->box_start('mod_introbox', 'resourceintro');
|
||||
if ($gotintro) {
|
||||
echo format_module_intro('resource', $resource, $cm->id);
|
||||
$content = format_module_intro('resource', $resource, $cm->id);
|
||||
}
|
||||
echo $extraintro;
|
||||
echo $OUTPUT->box_end();
|
||||
$content .= $extraintro;
|
||||
}
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -454,12 +424,10 @@ function resource_print_intro($resource, $cm, $course, $ignoresettings=false) {
|
||||
* @return void, does not return
|
||||
*/
|
||||
function resource_print_tobemigrated($resource, $cm, $course) {
|
||||
global $DB, $OUTPUT;
|
||||
|
||||
global $DB, $OUTPUT, $PAGE;
|
||||
$PAGE->activityheader->set_description(resource_get_intro($resource, $cm));
|
||||
$resource_old = $DB->get_record('resource_old', array('oldid'=>$resource->id));
|
||||
resource_print_header($resource, $cm, $course);
|
||||
resource_print_heading($resource, $cm, $course);
|
||||
resource_print_intro($resource, $cm, $course);
|
||||
echo $OUTPUT->notification(get_string('notmigrated', 'resource', $resource_old->type));
|
||||
echo $OUTPUT->footer();
|
||||
die;
|
||||
@ -473,12 +441,11 @@ function resource_print_tobemigrated($resource, $cm, $course) {
|
||||
* @return void, does not return
|
||||
*/
|
||||
function resource_print_filenotfound($resource, $cm, $course) {
|
||||
global $DB, $OUTPUT;
|
||||
global $DB, $OUTPUT, $PAGE;
|
||||
|
||||
$resource_old = $DB->get_record('resource_old', array('oldid'=>$resource->id));
|
||||
$PAGE->activityheader->set_description(resource_get_intro($resource, $cm));
|
||||
resource_print_header($resource, $cm, $course);
|
||||
resource_print_heading($resource, $cm, $course);
|
||||
resource_print_intro($resource, $cm, $course);
|
||||
if ($resource_old) {
|
||||
echo $OUTPUT->notification(get_string('notmigrated', 'resource', $resource_old->type));
|
||||
} else {
|
||||
|
5
mod/resource/upgrade.txt
Normal file
5
mod/resource/upgrade.txt
Normal file
@ -0,0 +1,5 @@
|
||||
This files describes API changes in the quiz code.
|
||||
|
||||
=== 4.0 ===
|
||||
|
||||
* Functions resource_print_heading and resource_print_intro have been deprecated in favour for the activity header.
|
@ -86,12 +86,13 @@ if (empty($noheader)) {
|
||||
|
||||
$PAGE->set_title("$course->shortname: ".format_string($scorm->name));
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->activityheader->set_attrs([
|
||||
'hidecompletion' => true,
|
||||
'description' => ''
|
||||
]);
|
||||
$PAGE->navbar->add($strreport, new moodle_url('/mod/scorm/report.php', array('id' => $cm->id)));
|
||||
|
||||
echo $OUTPUT->header();
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
echo $OUTPUT->heading(format_string($scorm->name));
|
||||
}
|
||||
}
|
||||
|
||||
// Open the selected Scorm report and display it.
|
||||
|
@ -136,17 +136,9 @@ if (empty($preventskip) && empty($launch) && (has_capability('mod/scorm:skipview
|
||||
|
||||
$PAGE->set_title($pagetitle);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
// Let the module handle the display.
|
||||
$PAGE->activityheader->set_description('');
|
||||
echo $OUTPUT->header();
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
echo $OUTPUT->heading(format_string($scorm->name));
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
if (!empty($action) && confirm_sesskey() && has_capability('mod/scorm:deleteownresponses', $contextmodule)) {
|
||||
if ($action == 'delete') {
|
||||
$confirmurl = new moodle_url($PAGE->url, array('action' => 'deleteconfirm'));
|
||||
|
@ -94,15 +94,16 @@
|
||||
|
||||
$PAGE->set_title("$course->shortname: ".format_string($survey->name));
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->activityheader->set_attrs([
|
||||
'hidecompletion' => true,
|
||||
'description' => ''
|
||||
]);
|
||||
|
||||
// Activate the secondary nav tab.
|
||||
navigation_node::override_active_url(new moodle_url('/mod/survey/report.php', ['id' => $id, 'action' => 'summary']));
|
||||
|
||||
$actionbar = new \mod_survey\output\actionbar($id, $action, $url);
|
||||
echo $OUTPUT->header();
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
echo $OUTPUT->heading(format_string($survey->name));
|
||||
}
|
||||
$renderer = $PAGE->get_renderer('mod_survey');
|
||||
echo $renderer->response_actionbar($actionbar);
|
||||
|
||||
|
@ -70,15 +70,12 @@ if ($surveyalreadydone) {
|
||||
$strsurvey = get_string("modulename", "survey");
|
||||
$PAGE->set_title($survey->name);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
echo $OUTPUT->header();
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
echo $OUTPUT->heading(format_string($survey->name));
|
||||
// No need to show the description if the survey is done and a graph page is to be shown.
|
||||
if ($surveyalreadydone && $showscales) {
|
||||
$PAGE->activityheader->set_description('');
|
||||
}
|
||||
|
||||
// Render the activity information.
|
||||
$completiondetails = \core_completion\cm_completion_details::get_instance($cm, $USER->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($cm, $USER->id);
|
||||
echo $OUTPUT->activity_information($cm, $completiondetails, $activitydates);
|
||||
echo $OUTPUT->header();
|
||||
|
||||
// Check to see if groups are being used in this survey.
|
||||
if ($groupmode = groups_get_activity_groupmode($cm)) { // Groups are being used.
|
||||
@ -119,7 +116,6 @@ if ($surveyalreadydone) {
|
||||
|
||||
} else {
|
||||
|
||||
echo $OUTPUT->box(format_module_intro('survey', $survey, $cm->id), 'generalbox', 'intro');
|
||||
echo $OUTPUT->spacer(array('height' => 30, 'width' => 1), true); // Should be done with CSS instead.
|
||||
|
||||
$questions = survey_get_questions($survey);
|
||||
@ -147,7 +143,6 @@ echo '<div>';
|
||||
echo "<input type=\"hidden\" name=\"id\" value=\"$id\" />";
|
||||
echo "<input type=\"hidden\" name=\"sesskey\" value=\"".sesskey()."\" />";
|
||||
|
||||
echo $OUTPUT->box(format_module_intro('survey', $survey, $cm->id), 'generalbox boxaligncenter bowidthnormal', 'intro');
|
||||
echo '<div>'. get_string('allquestionrequireanswer', 'survey'). '</div>';
|
||||
|
||||
// Get all the major questions in order.
|
||||
|
59
mod/url/deprecatedlib.php
Normal file
59
mod/url/deprecatedlib.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?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/>.
|
||||
|
||||
/**
|
||||
* List of deprecated mod_url functions.
|
||||
*
|
||||
* @package mod_url
|
||||
* @copyright 2021 Peter D
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
/**
|
||||
* Print url heading.
|
||||
*
|
||||
* @deprecated since 4.0
|
||||
* @param object $url
|
||||
* @param object $cm
|
||||
* @param object $course
|
||||
* @param bool $notused This variable is no longer used.
|
||||
* @return void
|
||||
*/
|
||||
function url_print_heading($url, $cm, $course, $notused = false) {
|
||||
global $OUTPUT;
|
||||
debugging('url_print_heading is deprecated. Handled by activity_header now.', DEBUG_DEVELOPER);
|
||||
echo $OUTPUT->heading(format_string($url->name), 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print url introduction.
|
||||
*
|
||||
* @deprecated since 4.0
|
||||
* @param object $url
|
||||
* @param object $cm
|
||||
* @param object $course
|
||||
* @param bool $ignoresettings print even if not specified in modedit
|
||||
* @return void
|
||||
*/
|
||||
function url_print_intro($url, $cm, $course, $ignoresettings=false) {
|
||||
global $OUTPUT;
|
||||
debugging('url_print_intro is deprecated. Handled by activity_header now.', DEBUG_DEVELOPER);
|
||||
if ($intro = url_get_intro($url, $cm, $ignoresettings)) {
|
||||
echo $OUTPUT->box_start('mod_introbox', 'urlintro');
|
||||
echo $intro;
|
||||
echo $OUTPUT->box_end();
|
||||
}
|
||||
}
|
@ -172,37 +172,22 @@ function url_print_header($url, $cm, $course) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Print url heading.
|
||||
* Get url introduction.
|
||||
*
|
||||
* @param object $url
|
||||
* @param object $cm
|
||||
* @param object $course
|
||||
* @param bool $notused This variable is no longer used.
|
||||
* @return void
|
||||
*/
|
||||
function url_print_heading($url, $cm, $course, $notused = false) {
|
||||
global $OUTPUT;
|
||||
echo $OUTPUT->heading(format_string($url->name), 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print url introduction.
|
||||
* @param object $url
|
||||
* @param object $cm
|
||||
* @param object $course
|
||||
* @param bool $ignoresettings print even if not specified in modedit
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function url_print_intro($url, $cm, $course, $ignoresettings=false) {
|
||||
global $OUTPUT;
|
||||
|
||||
function url_get_intro(object $url, object $cm, bool $ignoresettings = false): string {
|
||||
$options = empty($url->displayoptions) ? [] : (array) unserialize_array($url->displayoptions);
|
||||
if ($ignoresettings or !empty($options['printintro'])) {
|
||||
if (trim(strip_tags($url->intro))) {
|
||||
echo $OUTPUT->box_start('mod_introbox', 'urlintro');
|
||||
echo format_module_intro('url', $url, $cm->id);
|
||||
echo $OUTPUT->box_end();
|
||||
return format_module_intro('url', $url, $cm->id);
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -219,9 +204,11 @@ function url_display_frame($url, $cm, $course) {
|
||||
|
||||
if ($frame === 'top') {
|
||||
$PAGE->set_pagelayout('frametop');
|
||||
$PAGE->activityheader->set_attrs([
|
||||
'description' => url_get_intro($url, $cm),
|
||||
'title' => format_string($url->name)
|
||||
]);
|
||||
url_print_header($url, $cm, $course);
|
||||
url_print_heading($url, $cm, $course);
|
||||
url_print_intro($url, $cm, $course);
|
||||
echo $OUTPUT->footer();
|
||||
die;
|
||||
|
||||
@ -268,20 +255,9 @@ EOF;
|
||||
function url_print_workaround($url, $cm, $course) {
|
||||
global $OUTPUT, $PAGE, $USER;
|
||||
|
||||
$PAGE->activityheader->set_description(url_get_intro($url, $cm, true));
|
||||
url_print_header($url, $cm, $course);
|
||||
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
url_print_heading($url, $cm, $course, true);
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
url_print_intro($url, $cm, $course, true);
|
||||
|
||||
$fullurl = url_get_full_url($url, $cm, $course);
|
||||
|
||||
$display = url_get_final_display_type($url);
|
||||
@ -316,7 +292,7 @@ function url_print_workaround($url, $cm, $course) {
|
||||
* @return does not return
|
||||
*/
|
||||
function url_display_embed($url, $cm, $course) {
|
||||
global $PAGE, $OUTPUT, $USER;
|
||||
global $PAGE, $OUTPUT;
|
||||
|
||||
$mimetype = resourcelib_guess_url_mimetype($url->externalurl);
|
||||
$fullurl = url_get_full_url($url, $cm, $course);
|
||||
@ -346,21 +322,11 @@ function url_display_embed($url, $cm, $course) {
|
||||
$code = resourcelib_embed_general($fullurl, $title, $clicktoopen, $mimetype);
|
||||
}
|
||||
|
||||
$PAGE->activityheader->set_description(url_get_intro($url, $cm));
|
||||
url_print_header($url, $cm, $course);
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
url_print_heading($url, $cm, $course);
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
echo $code;
|
||||
|
||||
url_print_intro($url, $cm, $course);
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
die;
|
||||
}
|
||||
|
5
mod/url/upgrade.txt
Normal file
5
mod/url/upgrade.txt
Normal file
@ -0,0 +1,5 @@
|
||||
This files describes API changes in the quiz code.
|
||||
|
||||
=== 4.0 ===
|
||||
|
||||
* Functions url_print_heading and url_print_intro have been deprecated in favour for the activity header.
|
@ -57,11 +57,8 @@ $PAGE->set_url('/mod/url/view.php', array('id' => $cm->id));
|
||||
// Do not use PARAM_URL here, it is too strict and does not support general URIs!
|
||||
$exturl = trim($url->externalurl);
|
||||
if (empty($exturl) or $exturl === 'http://') {
|
||||
$PAGE->activityheader->set_description(url_get_intro($url, $cm));
|
||||
url_print_header($url, $cm, $course);
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
url_print_heading($url, $cm, $course);
|
||||
}
|
||||
url_print_intro($url, $cm, $course);
|
||||
notice(get_string('invalidstoredurl', 'url'), new moodle_url('/course/view.php', array('id'=>$cm->course)));
|
||||
die;
|
||||
}
|
||||
|
@ -89,20 +89,9 @@ $PAGE->navbar->add(format_string(get_string('wikifiles', 'wiki')));
|
||||
$PAGE->set_secondary_active_tab('modulepage');
|
||||
|
||||
echo $OUTPUT->header();
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
echo $OUTPUT->heading(format_string($wiki->name));
|
||||
}
|
||||
|
||||
// Render the activity information.
|
||||
$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);
|
||||
|
||||
$renderer = $PAGE->get_renderer('mod_wiki');
|
||||
|
||||
echo $OUTPUT->box(format_module_intro('wiki', $wiki, $PAGE->cm->id), 'generalbox', 'intro');
|
||||
|
||||
$actionbar = new \mod_wiki\output\action_bar($pageid, $PAGE->url);
|
||||
echo $renderer->render_action_bar($actionbar);
|
||||
|
||||
|
@ -79,6 +79,9 @@ $PAGE->set_heading($course->fullname);
|
||||
$PAGE->navbar->add(format_string(get_string('wikifiles', 'wiki')), $CFG->wwwroot . '/mod/wiki/files.php?pageid=' . $pageid);
|
||||
$PAGE->navbar->add(format_string($title));
|
||||
$PAGE->set_secondary_active_tab('modulepage');
|
||||
$PAGE->activityheader->set_attrs([
|
||||
'hidecompletion' => true
|
||||
]);
|
||||
|
||||
$data = new stdClass();
|
||||
$data->returnurl = $returnurl;
|
||||
@ -98,8 +101,6 @@ if ($mform->is_cancelled()) {
|
||||
}
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(format_string($wiki->name));
|
||||
echo $OUTPUT->box(format_module_intro('wiki', $wiki, $PAGE->cm->id), 'generalbox', 'intro');
|
||||
echo $OUTPUT->box_start('generalbox');
|
||||
$mform->display();
|
||||
echo $OUTPUT->box_end();
|
||||
|
@ -125,7 +125,7 @@ abstract class page_wiki {
|
||||
* This method prints the top of the page.
|
||||
*/
|
||||
function print_header() {
|
||||
global $OUTPUT, $PAGE, $CFG, $USER, $SESSION;
|
||||
global $OUTPUT, $PAGE, $SESSION;
|
||||
|
||||
$PAGE->set_heading($PAGE->course->fullname);
|
||||
|
||||
@ -138,12 +138,6 @@ abstract class page_wiki {
|
||||
$this->create_navbar();
|
||||
|
||||
echo $OUTPUT->header();
|
||||
$wiki = $PAGE->activityrecord;
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
echo $OUTPUT->heading(format_string($wiki->name));
|
||||
}
|
||||
|
||||
echo $this->wikioutput->wiki_info();
|
||||
|
||||
if (!empty($this->page)) {
|
||||
echo $this->action_bar($this->page->id, $PAGE->url);
|
||||
|
@ -234,9 +234,21 @@ class mod_wiki_renderer extends plugin_renderer_base {
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the wiki activity information and intro
|
||||
*
|
||||
* @return string
|
||||
* @deprecated since 4.0. Now handled in PAGE's activity header
|
||||
*/
|
||||
public function wiki_info() {
|
||||
global $USER;
|
||||
|
||||
debugging(
|
||||
'wiki_info() is deprecated. Output is handled within the $PAGE->activityheader instead.',
|
||||
DEBUG_DEVELOPER
|
||||
);
|
||||
|
||||
// Display any activity information (eg completion requirements / dates).
|
||||
$cminfo = cm_info::create($this->page->cm);
|
||||
$completiondetails = \core_completion\cm_completion_details::get_instance($cminfo, $USER->id);
|
||||
|
@ -1,5 +1,7 @@
|
||||
This files describes API changes in /mod/wiki/*,
|
||||
information provided here is intended especially for developers.
|
||||
=== 4.0 ===
|
||||
* wiki_info has been deprecated. Output will be handled within the $PAGE->activityheader instead.
|
||||
|
||||
=== 3.8 ===
|
||||
* The following functions have been finally deprecated and can not be used anymore:
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user