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

HTML Block on Static Pages #50

Open lfe011969 opened 3 years ago

lfe011969 commented 3 years ago

Per the following verbiage on the Static Pages plugin page (https://moodle.org/plugins/pluginversion.php?id=11257), it should be possible to show different HTML blocks on different static pages:

Add blocks to static pages The local_staticpage plugin was not intended to show blocks on the static pages. However, it is possible. You have to enable page editing somewhere else in Moodle (on your MyMoodle page or on a course page, for example) and go to your static page. Now you see the standard "Add block" menu and can add blocks to the static page. Additionally, if you click on the block's gear icon, you can control if the block is shown only on the static page the block was added to or on all static pages.

However, whenever I add an HTML block to an individual page, it shows up on all static pages. The options for selecting where the block is displayed are:

  1. local-staticpage-view
  2. local-staticpage-view*
  3. local-staticpage-*
  4. local-*
  5. Any page

I currently have each of the HTML blocks set to option 1 (local-staticpage-view) but it doesn't seem to matter as I've tried each of the options containing the phrase 'staticpage' and all HTML blocks show up for every static page. Hoping this is not something to do with our Theme since we don't want to change that.

If it is not a theme-related issue, then I would like to request this functionality be implemented so that individual static pages can have different HTML (and possibly other) blocks.

For reference, the static pages for our site are open to the public and can be viewed here: https://apprenticemoodle.com/local/staticpage/view.php?page=Youth-Builders https://apprenticemoodle.com/local/staticpage/view.php?page=book-info

The HTML block at the top of each page should only be shown on the first link's page while the second HTML block should be shown only on the second link's page.

christianwolters commented 3 years ago

Hi @lfe011969,

thank you for raising this issue and your examples.

After a short investigation this may due to the implicit setting of the pagetype by the Moodle Page API.

First idea: I may be able to provide a fix by setting an explizit page type, suffixing the exisiting one with the document name. However, this would break if the document title changes. Furthermore if deleting a document without deleting the blocks first, the blocks from this static page would be orphaned in the database.

I'll be getting back to this.

Cheers Christian

dolivervl commented 3 years ago

Any solutions ?