moodle-an-hochschulen / moodle-local_staticpage

Moodle plugin which displays static information pages which exist outside any course, imprint or faq pages for example, complete with Moodle navigation and theme
GNU General Public License v3.0
46 stars 28 forks source link

Feature request: Raw output for embedding a page as "Site policy URL" #28

Closed py-steph closed 6 years ago

py-steph commented 7 years ago

It would be very smart if one could yous a static file for showing a site policy and use the same html data for configuring a site polica url in the section "Administration => Security => sitepolicy" . But one need a raw page view without all the moodle stuff. May be one could code a new php-file to use a urls like this: http://www.yourmoodle.com/local/staticpage/view_raw.php?page=[pagename] I will what i can for doing that job, if you could provide me with some basic information.

abias commented 7 years ago

Hi Stephan,

this is an interesting thought. I think it would be fairly easy to copy the existing view.php file to a view_raw.php file which does not output any layout elements.

However, I hesitate to include this into the plugin because of strategy reasons.

  1. In our local Moodle instance, we have placed a small file called /nutzungsvereinbarung.php (german for "user policy agreement"):
    
    <?php

// Get config.php require_once('config.php');

// Fetch context $context = \context_system::instance();

// Set content $PAGE->set_context ($context);

// Get filearea $fs = get_file_storage();

// Get language based document $file = $fs->get_file($context->id, 'local_staticpage', 'documents', 0, '/', 'nutzungsvereinbarung.html');

// If no file is found, quit with error message if (!$file) { print_error('pagenotfound', 'local_staticpage'); }

// Get file content $filecontents = $file->get_content();

// Outpult file content (and fix double encoded UTF-8 chars) echo utf8_decode(format_text($filecontents));

?>


This file is referenced in Moodle's user policy URL setting. Please feel free to take this code, change the filename of your user policy HTML file and do the same like we do.

2. The solution with the custom file is only an intermediate solution for us. We have created https://tracker.moodle.org/browse/MDL-46553 and have already worked out a first solution, but we didn't manage to finish it yet because of other priorities. Basically, as soon as this is allowed to land in Moodle core, the whole user policy page configuration will be easier.

Thanks,
Alex
abias commented 7 years ago

Stephen, I'd also like to point you to https://tracker.moodle.org/browse/MDL-60721

abias commented 6 years ago

As Moodle core will soon revamp the whole site policy management and as we don't have any plans to implement this feature request in local_staticpage, I will now close this issue.

Thanks, Alex