No -- Thank You! This makes one of my two problems go away. As far as posting issues, I will be sure to do so in the future. As a Newbie I'm still learning my way around the community.
Thanks again,
Rod Wolford
No -- Thank You! This makes one of my two problems go away. As far as posting issues, I will be sure to do so in the future. As a Newbie I'm still learning my way around the community.
Thanks again,
Rod Wolford
Hi Rod,
Sorry I forgot to answer to your second problem!
The only solution that I have is a little trick on your theme because the tab display can not modify the layout of other pages.
The trick is to add in the theme a condition that said: if the param "embed" in the URL exists and is set to 1 force the layout to embed (Of course you need to have a embedded layout in your theme)
In your theme, file renderers.php, in the constructor, add:
public function __construct(\moodle_page $page, $target)
{
//Force embedded layout if param embed is active
$embed = optional_param('embed', 0, PARAM_INT);
if($embed == 1)
{
$page->set_pagelayout('embedded');
}
parent::__construct($page, $target);
}
And you just have to call the page with an extra param embed=1 in the URL like http://mymoodle/mod/page/view.php?id=123&embed=1
I hope this will help you!
Nicolas Bretin
Hi Nicolas,
Sorry I didn't answer sooner. I was busy trying to get other parts of our site ready for testers to review.
Initially, I opted out of using the Tabs Display because I couldn't solve the emedding issue. Instead, I used a pop-up window that users would flip to while answering questions using the ALT + TAB keys. A very unsatisfying solution.
However, now that this fall back position is operational for the current review, I have turned to your recommendation as I know it will provide superior results. Unfortunately, I am unable to make it work ... YET!
I wanted to attach three screen shots, but even zipped, they were too big (187 kb). So here is a link, if you are interested.
http://www.fofcom.com/public/display_tabs_3_screens.pdf
Screen 1) Shows that the Demo in the Tab displays perfectly since you fixed the ability to embed Director Shockwave. Thank you!
Screen 2) Shows what Quiz Question 1 looks like using your solution above. Not perfect because of the red in the header, but probably fixable.
Screen 3) However, when using the submit button, it returns to the new screen with sidebars embedded again. I'm sure this means that the "embed" option needs to be added to the link on the submit button. And then on all subsequent buttons. I have reviewed the source html for the pages, but to me it is not clear how this can be done easily. Seems some sort of global property is needed.
Any thoughts? Of course, even if I am unable in this instance to get resolution, I will continue to work toward an eventual answer because I think the Tabs Display provides the best solution. Thanks again for your help.
Regards,
Rod
Hi Rod,
Screen 2: You can add specific css in your theme for the embedded page like:
body.pagelayout-embedded h2{
//your css
}
Screen 3: This is a though one... you can't really update (in the proper way) the links of your page through the theme. It is why it will be great that moodle integrate a solution to do that.
Hope this will help you!
Nicolas
WOW!
Screen 2 response was something like what I figured could be done. Mostly uncomplicated and possible for a newbie like me.
As for Screen 3, the response is probably what I expected, but maybe a bit too complex for me at this moment.
I can see how a javascript could be used to say "if it is URL X or URL Y then embed = 1" but that would become a problem child very quickly.
I vaguely understand the cookie concept. I have done some basic cookie making and destroying, but I am not much of a baker! This would take me some time to figure out, but might be worth trying just for the learning. Though I can see the changing back and forth would present nearly the same problem as the javascript solution, though more generalized and so better, maybe?
I don't know anything about the "$_SERVER['HTTP_REFERER']" concept or how to use it. I will investigate it a little. It would be added into one of the existing php files, I assume? Maybe a combination of this idea and either the javascript or cookie concept could be worked together. For example, if this command returns the embed = 1 in the url, it adds a cookie???
Also, maybe just an appropriate question type needs to be added to the Moodle question or quiz options? Anyway, this all remains a bit beyond me right now. But I will continue to look for the answer and at least you have added some light on the path!
Would be great if Moodle would make something like this possible. It seems like it would be an obvious benefit. And I still love your Tab Display plugin. Just will have to use it in more limited conditions for the time being.
Thanks again for you guidance.
Rod Wolford
An example of Javascript for moodle to do that will be:
YUI().use('node', 'querystring',
function(Y)
{
//Load on the document is ready
Y.on('domready', function()
{
//You can do the same thing with forms so it will be Y.all('form') and var url = node.get('action');
Y.all('a').each(function(node)
{
var url = node.get('href');
var page = url.split('?');
var paramsurl = '';
//Exclude urls that contains #
if(url.indexOf('#') == -1)
{
//If there is already params set the params
if(page.length > 1)
{
paramsurl = page[1];
}
page = page[0];
//Get an object from the url
var params = Y.QueryString.parse(paramsurl);
//Set the embed=1
params.embed = 1;
//Reconstruct the url
url = page + '?' + Y.QueryString.stringify(params);
//Then update the attribute
node.set('href', url);
}
});
});
});
Read the comment in order to reproduce that for other elements like forms.
You just have to put this javascript on your embed template, in that way you will have all your links with the embed param
For the $_SERVER['HTTP_REFERER'], you just have to add a condition in your theme constructor like that
public function __construct(\moodle_page $page, $target)
{
//Here get the $_SERVER['HTTP_REFERER']
$prevembed=0;
//If embed available in the previous url set the $prevembed to 1 => the layout will be change to the embedded
if (str_pos($_SERVER['HTTP_REFERER'], 'embed=1')!==false)
{
$prevembed = 1;
}
//Force embedded layout if param embed is active
$embed = optional_param('embed', 0, PARAM_INT);
if($embed == 1 || $prevembed == 1)
{
$page->set_pagelayout('embedded');
}
parent::__construct($page, $target);
}
I want to thank you right now for this code. I have not used it yet. Hopefully some time during this week.
I will give you a report once done. With luck, the report will be simple: SUCCESS! But either way, I want you to know how it has worked out.
You have been very kind sharing this information.
Thank you,
Rod