Situation:
I had several times the need to change the page design in popup windows.
Problem:
There is no way to determine if a page is loaded in a popup window. (As far as I know).
Solution after a longer chat Eloy proposed:
A function in weblib.php
/**
- Returns true if the page is displayed in a popup window.
- Gets the information from the URL parameter inpopup.
* - @return boolean
* - TODO Use a central function to create the popup calls allover Moodle and
- TODO In the moment only works with resources and probably questions.
*/
function is_in_popup() {
$inpopup = optional_param('inpopup', '', PARAM_BOOL);
return ($inpopup);
}
In the theme header and footer you can then get the status with
<?php $inpopup = is_in_popup(); ?>
and add a class to body or the "page" div or write a different header or footer when in a popup window.