gjb2048 / moodle-theme_essential

The Essential Moodle Theme
https://gjb2048.github.io/moodle-theme_essential/
GNU General Public License v3.0
91 stars 120 forks source link

Slide Show broken after upgrade from Moodle 2.8 to 2.9 #578

Closed ghost closed 8 years ago

ghost commented 8 years ago

Hi everyone. I followed the directions exactly for upgrading. The latest 2.9 version of this plugin was installed and was happy to see so many things fixed. But one thing broke badly - it is the slide show! With one item the screen appears to work correctly. With any more than that the items appear consecutively on the screen.

Tried deleting all the items in the show which shows the default images properly and they cycle. Reloaded my images/text/etc. and it breaks again.

At a loss....

gjb2048 commented 8 years ago

Hi,

I was testing things today so I know the slideshow works in Moodle 2.9, therefore please provide:

Screen shot of the issue. Setting values for the slide show. Moodle version. Essential version. Details of the upgrade instructions you followed. Details of other contributed plugins installed. Details of custom JS / CSS you have. Details of any errors that show in the 'console' tab - press F12 in the browser.

ghost commented 8 years ago

Hi Gareth - I can give you temporary access to look yourself at the site if easier.... Andy

On Tue, Dec 8, 2015 at 4:21 PM, Gareth J Barnard notifications@github.com wrote:

Hi,

I was testing things today so I know the slideshow works in Moodle 2.9, therefore please provide:

Screen shot of the issue. Setting values for the slide show. Moodle version. Essential version. Details of the upgrade instructions you followed. Details of other contributed plugins installed. Details of custom JS / CSS you have. Details of any errors that show in the 'console' tab - press F12 in the browser.

— Reply to this email directly or view it on GitHub https://github.com/gjb2048/moodle-theme_essential/issues/578#issuecomment-163036657 .

Andrew M. Walding CellStream, Inc. Tel & Fax: 866-659-1014 Cell: 214-405-3708 Skype ID: awalding Twitter: @awalding http://www.cellstream.com http://www.netscionline.com

gjb2048 commented 8 years ago

Hi Andy,

Thank you but that is moving into the realm of bespoke support. If the site is public and I can see it with the problem without logging on then I will look at it. If you want me to login and hunt around when I cannot replicate locally then that would need to be remunerated support.

Or I might know the answer from the answers to the questions.

Kind regards,

Gareth

ghost commented 8 years ago

No no intention for support. I will take all the respective screen shots and gather the info you request. No problem.

Sent from my iPhone

On Dec 8, 2015, at 6:27 PM, Gareth J Barnard notifications@github.com wrote:

Hi Andy,

Thank you but that is moving into the realm of bespoke support. If the site is public and I can see it with the problem without logging on then I will look at it. If you want me to login and hunt around when I cannot replicate locally then that would need to be remunerated support.

Or I might know the answer from the answers to the questions.

Kind regards,

Gareth

— Reply to this email directly or view it on GitHub.

ghost commented 8 years ago

Hi Gareth - I am getting a message size exceeded error when I try to attach the screen shots.

Option 1: I break this into multiple messages Option 2: give me an email that will not have such a limit.

Let me know. Andy

On Tue, Dec 8, 2015 at 4:21 PM, Gareth J Barnard notifications@github.com wrote:

Hi,

I was testing things today so I know the slideshow works in Moodle 2.9, therefore please provide:

Screen shot of the issue. Setting values for the slide show. Moodle version. Essential version. Details of the upgrade instructions you followed. Details of other contributed plugins installed. Details of custom JS / CSS you have. Details of any errors that show in the 'console' tab - press F12 in the browser.

— Reply to this email directly or view it on GitHub https://github.com/gjb2048/moodle-theme_essential/issues/578#issuecomment-163036657 .

Andrew M. Walding CellStream, Inc. Tel & Fax: 866-659-1014 Cell: 214-405-3708 Skype ID: awalding Twitter: @awalding http://www.cellstream.com http://www.netscionline.com

gjb2048 commented 8 years ago

Hi Andy,

I would like to keep things here. You could convert the images to jpg's and post one per comment.

Cheers,

Gareth

ghost commented 8 years ago

I believe Fernando Alcedo has also provided you info on this.

Cap1 is the Plugins overview that gives you some answers. There is no custom JS/CSS. The details of the errors have been provided by Fernando. The upgrade steps I followed are in cap2. The moodle version is shown in cap3. The slide show settings are shown in cap4. The result is shown in cap5.

Sorry for the way snagit scrolls and the title bar keeps scrolling with it. Let me know how else I can help. Andy

On Wed, Dec 9, 2015 at 7:34 AM, Gareth J Barnard notifications@github.com wrote:

Hi Andy,

I would like to keep things here. You could convert the images to jpg's and post one per comment.

Cheers,

Gareth

— Reply to this email directly or view it on GitHub https://github.com/gjb2048/moodle-theme_essential/issues/578#issuecomment-163234281 .

Andrew M. Walding CellStream, Inc. Tel & Fax: 866-659-1014 Cell: 214-405-3708 Skype ID: awalding Twitter: @awalding http://www.cellstream.com http://www.netscionline.com

ghost commented 8 years ago

OK - have spun my wheels for 30 minutes on the other two captures....the jpg files are even bigger than the png's. Perhaps if I set up a dropbox share??

i-school commented 8 years ago

You can use imgur.com to upload the pictures

gjb2048 commented 8 years ago

No information from Fernando.

dschwa commented 8 years ago

I have Essential running on 3.0, test site. No problem with slideshow.

Other minor issues Garrett knows about, but otherwise runs fine.

Don Schwartz

3-bits commented 8 years ago

Gareth, the site was upgraded as usual from 2.8 to 2.9.3. I just added some updated plugins like yours and the process was finished successfully. But the slideshow display the images one below the other. Using Essential 2.9.1.3 (Build: 2015062413)

Looks like the js are not loaded corectly. Verifying the code from the 'Source Code' page I can see several errors but not sure if they are relevant for this issue.

gjb2048 commented 8 years ago

What errors please?

gjb2048 commented 8 years ago

Might be related: https://moodle.org/mod/forum/discuss.php?d=324509#p1303432

3-bits commented 8 years ago

Yes, it is possible. These are the errors in the code. Looks like the sliudeshow JS and some other libraries are not loaded.

151209_164414

gjb2048 commented 8 years ago

Ok, how did this bit of wrong code get there? ->

<css font-awesome.min.css"="" rel="stylesheet" id="yui_3_17_2_2_1449676069563_232">
3-bits commented 8 years ago

No idea. That could break the code and do not load the body styles. The curious is that FA icons are working well

gjb2048 commented 8 years ago

The fontawesome CSS is built into essential.css which has been loaded before the breakage.

ghost commented 8 years ago

Check 3bits....sorry

ghost commented 8 years ago

Might be - I did do the Purge all caches...several times...

ghost commented 8 years ago

Sent....

gjb2048 commented 8 years ago

cap1_2

gjb2048 commented 8 years ago

cap4_2

gjb2048 commented 8 years ago

Used 8-bit dithering to reduce image file size.

gjb2048 commented 8 years ago

At the moment I believe that this:

<css font-awesome.min.css"="" rel="stylesheet" id="yui_3_17_2_2_1449676069563_232">

is breaking it.

ghost commented 8 years ago

So just remove this line? Fernando - can you do it?

On Wed, Dec 9, 2015 at 10:02 AM, Gareth J Barnard notifications@github.com wrote:

At the moment I believe that this:

<css font-awesome.min.css"="" rel="stylesheet" id="yui_3_17_2_2_1449676069563_232">

is breaking it.

— Reply to this email directly or view it on GitHub https://github.com/gjb2048/moodle-theme_essential/issues/578#issuecomment-163304791 .

Andrew M. Walding CellStream, Inc. Tel & Fax: 866-659-1014 Cell: 214-405-3708 Skype ID: awalding Twitter: @awalding http://www.cellstream.com http://www.netscionline.com

3-bits commented 8 years ago

No, I can't find this line in the code. I guess is in the layout files but could be generated for some other file.

gjb2048 commented 8 years ago

When searching, ignore the yui id that is added by YUI.

ghost commented 8 years ago

Gareth - I just want to say how awesomely responsive you have been to helping us out. Thank you so much.

On Wed, Dec 9, 2015 at 10:57 AM, Gareth J Barnard notifications@github.com wrote:

Reopened #578 https://github.com/gjb2048/moodle-theme_essential/issues/578.

— Reply to this email directly or view it on GitHub https://github.com/gjb2048/moodle-theme_essential/issues/578#event-487159483 .

Andrew M. Walding CellStream, Inc. Tel & Fax: 866-659-1014 Cell: 214-405-3708 Skype ID: awalding Twitter: @awalding http://www.cellstream.com http://www.netscionline.com

gjb2048 commented 8 years ago

Hi Andy,

So this is a problem with your site and actually nothing to do with the theme?

Gareth

ghost commented 8 years ago

Sorry? No - it is only the essential theme that is broken...everything else is working.

On Wed, Dec 9, 2015 at 11:02 AM, Gareth J Barnard notifications@github.com wrote:

Hi Andy,

So this is a problem with your site and actually nothing to do with the theme?

Gareth

— Reply to this email directly or view it on GitHub https://github.com/gjb2048/moodle-theme_essential/issues/578#issuecomment-163325078 .

Andrew M. Walding CellStream, Inc. Tel & Fax: 866-659-1014 Cell: 214-405-3708 Skype ID: awalding Twitter: @awalding http://www.cellstream.com http://www.netscionline.com

gjb2048 commented 8 years ago

But... it does appear that rogue code is in the mark up of the page and even though everything else appears to be working it actually is not.

ghost commented 8 years ago

OK. Interesting. Fernando - do you know where to get rid of this? I am not sure what else is not working as Gareth is stating...Courses are ongoing and instructors have not reported any issues.

On Wed, Dec 9, 2015 at 11:05 AM, Gareth J Barnard notifications@github.com wrote:

But... it does appear that rogue code is in the mark up of the page and even though everything else appears to be working it actually is not.

— Reply to this email directly or view it on GitHub https://github.com/gjb2048/moodle-theme_essential/issues/578#issuecomment-163325737 .

Andrew M. Walding CellStream, Inc. Tel & Fax: 866-659-1014 Cell: 214-405-3708 Skype ID: awalding Twitter: @awalding http://www.cellstream.com http://www.netscionline.com

gjb2048 commented 8 years ago

Could you attach your /theme/essential/layout/includes/header.php file please. And in fact /theme/essential/classes/core_renderer.php too.

gjb2048 commented 8 years ago

Hi Andy,

Ok, the mark-up is broken, the browser can cope. The JS cannot. Hence appears to work but if when editing then will break.

G

ghost commented 8 years ago

Here is the header.php file: <?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/.

/**

require_once(\theme_essential\toolbox::get_include_file('pagesettings'));

echo $OUTPUT->doctype(); ?> <html <?php echo $OUTPUT->htmlattributes(); ?> class="no-js">

<?php echo $OUTPUT->page_title(); ?> standard_head_html(); ?>

<body <?php echo $OUTPUT->body_attributes($bodyclasses); ?>>

<?php echo $OUTPUT->standard_top_of_body_html(); ?>

On Wed, Dec 9, 2015 at 11:10 AM, Gareth J Barnard notifications@github.com wrote:

Could you attach your /theme/essential/layout/includes/header.php file please. And in fact /theme/essential/classes/core_renderer.php too.

— Reply to this email directly or view it on GitHub https://github.com/gjb2048/moodle-theme_essential/issues/578#issuecomment-163327287 .

Andrew M. Walding CellStream, Inc. Tel & Fax: 866-659-1014 Cell: 214-405-3708 Skype ID: awalding Twitter: @awalding http://www.cellstream.com http://www.netscionline.com

ghost commented 8 years ago

Here is the core_rendered.php:

<?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/.

/**

"; return $notification; }

/**

$output = $this->container_end_all(true);

$footer = $this->opencontainers->pop('header/footer');

// Provide some performance info if required $performanceinfo = ''; if (defined('MDL_PERF') || (!empty($CFG->perfdebug) and $CFG->perfdebug > 7)) { $perf = get_performance_info(); if (defined('MDL_PERFTOLOG') && !function_exists('register_shutdown_function')) { error_log("PERF: " . $perf['txt']); } if (defined('MDL_PERFTOFOOT') || debugging() || $CFG->perfdebug

7) { $performanceinfo = $this->performance_output($perf, \theme_essential\toolbox::get_setting('perfinfo')); } }

$footer = str_replace($this->unique_performance_info_token, $performanceinfo, $footer); $footer = str_replace($this->unique_end_html_token, $this->page->requires->get_end_code(), $footer); $this->page->set_state(moodle_page::STATE_DONE); $info = '';

return $output . $footer . $info; }

/**

if (empty($custommenuitems) && !empty($CFG->custommenuitems)) { $custommenuitems = $CFG->custommenuitems; } $custommenu = new custom_menu($custommenuitems, current_language()); return $this->render_custom_menu($custommenu); }

/**

$content = '

'; return $content; }

/**

if ($menunode->has_children()) {

if ($level == 1) {
    $class = 'dropdown';
} else {
    $class = 'dropdown-submenu';
}

if ($menunode === $this->language) {
    $class .= ' langmenu';
}
$content = html_writer::start_tag('li', array('class' =>

$class));

// If the child has menus render it as a sub menu.
$submenucount++;
if ($menunode->get_url() !== null) {
    $url = $menunode->get_url();
} else {
    $url = '#cm_submenu_' . $submenucount;
}
$content .= html_writer::start_tag('a', array('href' => $url,

'class' => 'dropdown-toggle', 'data-toggle' => 'dropdown', 'title' => $menunode->get_title())); $content .= $menunode->get_text(); if ($level == 1) { $content .= ''; } $content .= ''; $content .= '

'; } else { // Also, if the node's text matches '####', add a class so we can treat it as a divider. $content = ''; if (preg_match("/^#+$/", $menunode->get_text())) { // This is a divider. $content = html_writer::start_tag('li', array('class' => 'divider')); } else { $content = html_writer::start_tag('li'); // The node doesn't have children so produce a final menuitem. $class = ''; if ($menunode->get_url() !== null) { $url = $menunode->get_url(); $class = $url->get_param('essentialcolours'); } else { $url = '#'; } $content .= html_writer::link($url, $menunode->get_text(), array('title' => $menunode->get_title(), 'class' => $class)); } $content .= html_writer::end_tag('li'); } return $content; }

/**

$addlangmenu = true; $langs = get_string_manager()->get_list_of_translations(); if (count($langs) < 2 or empty($CFG->langmenu) or ($this->page->course != SITEID and !empty($this->page->course->lang)) ) { $addlangmenu = false; }

if ($addlangmenu) { $strlang = get_string('language'); $currentlang = current_language(); if (isset($langs[$currentlang])) { $currentlang = $langs[$currentlang]; } else { $currentlang = $strlang; } $this->language = $langmenu->add('' . $currentlang, new moodle_url('#'), $strlang, 100); foreach ($langs as $langtype => $langname) { $this->language->add('' . $langname, new moodle_url($this->page->url, array('lang' => $langtype)), $langname); } } return $this->render_custom_menu($langmenu); }

/**

$coursemenu = new custom_menu();

$hasdisplaymycourses = \theme_essential\toolbox::get_setting('displaymycourses'); if (isloggedin() && !isguestuser() && $hasdisplaymycourses) { $mycoursetitle = \theme_essential\toolbox::get_setting('mycoursetitle'); if ($mycoursetitle == 'module') { $branchtitle = get_string('mymodules', 'theme_essential'); } else if ($mycoursetitle == 'unit') { $branchtitle = get_string('myunits', 'theme_essential'); } else if ($mycoursetitle == 'class') { $branchtitle = get_string('myclasses', 'theme_essential'); } else { $branchtitle = get_string('mycourses', 'theme_essential'); } $branchlabel = '' . $branchtitle; $branchurl = new moodle_url(''); $branchsort = 200;

$branch = $coursemenu->add($branchlabel, $branchurl,

$branchtitle, $branchsort);

$hometext = get_string('myhome');
$homelabel = html_writer::tag('i', '', array('class' => 'fa

fa-home')).html_writer::tag('span', ' '.$hometext); $branch->add($homelabel, new moodle_url('/my/index.php'), $hometext);

// Get 'My courses' sort preference from admin config.
if (!$sortorder = $CFG->navsortmycoursessort) {
    $sortorder = 'sortorder';
}

// Retrieve courses and add them to the menu when they are

visible $numcourses = 0; if ($courses = enrol_get_my_courses(NULL, $sortorder . ' ASC')) { foreach ($courses as $course) { if ($course->visible) { $branch->add('' . format_string($course->fullname), new moodle_url('/course/view.php?id=' . $course->id), format_string($course->shortname)); $numcourses += 1; } else if (has_capability('moodle/course:viewhiddencourses', context_course::instance($course->id))) { $branchtitle = format_string($course->shortname); $branchlabel = '<i class="fa fa-eye-slash">' . format_string($course->fullname) . ''; $branchurl = new moodle_url('/course/view.php', array('id' =>$course->id)); $branch->add($branchlabel, $branchurl, $branchtitle); $numcourses += 1; } } } if ($numcourses == 0 || empty($courses)) { $noenrolments = get_string('noenrolments', 'theme_essential'); $branch->add('' . $noenrolments . '', new moodle_url('#'), $noenrolments); } } return $this->render_custom_menu($coursemenu); }

/**

if (!isguestuser()) { $alternativethemes = array(); foreach (range(1, 4) as $alternativethemenumber) { if (\theme_essential\toolbox::get_setting('enablealternativethemecolors' . $alternativethemenumber)) { $alternativethemes[] = $alternativethemenumber; } } if (!empty($alternativethemes)) { $branchtitle = get_string('themecolors', 'theme_essential'); $branchlabel = '' . $branchtitle; $branchurl = new moodle_url('#'); $branchsort = 300; $branch = $colourmenu->add($branchlabel, $branchurl, $branchtitle, $branchsort);

    $defaultthemecolorslabel = get_string('defaultcolors',

'theme_essential'); $branch->add('' . $defaultthemecolorslabel, new moodle_url($this->page->url, array('essentialcolours' => 'default')), $defaultthemecolorslabel); foreach ($alternativethemes as $alternativethemenumber) { if (\theme_essential\toolbox::get_setting('alternativethemename' . $alternativethemenumber)) { $alternativethemeslabel = \theme_essential\toolbox::get_setting('alternativethemename' . $alternativethemenumber); } else { $alternativethemeslabel = get_string('alternativecolors', 'theme_essential', $alternativethemenumber); } $branch->add('' . $alternativethemeslabel, new moodle_url($this->page->url, array('essentialcolours' => 'alternative' . $alternativethemenumber)), $alternativethemeslabel); } } } return $this->render_custom_menu($colourmenu); }

/**

if (!isguestuser()) { if (isset($this->page->course->id) && $this->page->course->id > 1) { $activitystreammenu = new custom_menu(); $branchtitle = get_string('thiscourse', 'theme_essential'); $branchlabel = ''.$branchtitle; $branchurl = new moodle_url('#'); $branch = $activitystreammenu->add($branchlabel, $branchurl, $branchtitle, 10002); $branchtitle = get_string('people', 'theme_essential'); $branchlabel = ''.$branchtitle; $branchurl = new moodle_url('/user/index.php', array('id' => $this->page->course->id)); $branch->add($branchlabel, $branchurl, $branchtitle, 100003); $branchtitle = get_string('grades'); $branchlabel = ''.$branchtitle; $branchurl = new moodle_url('/grade/report/index.php', array('id' => $this->page->course->id)); $branch->add($branchlabel, $branchurl, $branchtitle, 100004);

    $data = $this->get_course_activities();
    foreach ($data as $modname => $modfullname) {
        if ($modname === 'resources') {
            $icon = $this->pix_icon('icon', '', 'mod_page',

array('class' => 'icon')); $branch->add($icon.$modfullname, new moodle_url('/course/resources.php', array('id' => $this->page->course->id))); } else { $icon = ''; $branch->add($icon.$modfullname, new moodle_url('/mod/'.$modname.'/index.php', array('id' => $this->page->course->id))); } } return $this->render_custom_menu($activitystreammenu); } } return ''; }

private function get_course_activities() { // A copy of block_activity_modules. $course = $this->page->course; $content = new stdClass(); $modinfo = get_fast_modinfo($course); $course = course_get_format($course)->get_course(); $modfullnames = array(); $archetypes = array();

foreach ($modinfo->get_section_info_all() as $section =>

$thissection) { if (((!empty($course->numsections)) and ($section > $course->numsections)) or (empty($modinfo->sections[$section]))) { // This is a stealth section or is empty. continue; } foreach ($modinfo->sections[$thissection->section] as $modnumber) { $cm = $modinfo->cms[$modnumber]; // Exclude activities which are not visible or have no link (=label). if (!$cm->uservisible or !$cm->has_view()) { continue; } if (array_key_exists($cm->modname, $modfullnames)) { continue; } if (!array_key_exists($cm->modname, $archetypes)) { $archetypes[$cm->modname] = plugin_supports('mod', $cm->modname, FEATURE_MOD_ARCHETYPE, MOD_ARCHETYPE_OTHER); } if ($archetypes[$cm->modname] == MOD_ARCHETYPE_RESOURCE) { if (!array_key_exists('resources', $modfullnames)) { $modfullnames['resources'] = get_string('resources'); } } else { $modfullnames[$cm->modname] = $cm->modplural; } } } core_collator::asort($modfullnames);

return $modfullnames;

}

/**

if (!isloggedin() || isguestuser() || empty($CFG->messaging)) { return false; }

$messages = $this->get_user_messages(); $totalmessages = count($messages['messages']);

if (empty($totalmessages)) { $messagemenuicon = html_writer::tag('i', '', array('class' => 'fa fa-envelope-o')); $messagetitle = get_string('nomessagesfound', 'theme_essential'); $messagemenutext = html_writer::span($messagemenuicon); $messagemenu->add( $messagemenutext, new moodle_url('/message/index.php', array('viewing' => 'recentconversations')), $messagetitle, 9999 ); } else {

if (empty($messages['newmessages'])) {
    $messagemenuicon = html_writer::tag('i', '', array('class'

=> 'fa fa-envelope-o')); } else { $messagemenuicon = html_writer::tag('i', '', array('class' => 'fa fa-envelope')); } $messagetitle = get_string('unreadmessages', 'message', $messages['newmessages']);

$messagemenutext = html_writer::tag('span',

$messages['newmessages']) . $messagemenuicon; $messagesubmenu = $messagemenu->add( $messagemenutext, new moodle_url('/message/index.php', array('viewing' => 'recentconversations')), $messagetitle, 9999 );

foreach ($messages['messages'] as $message) {
    $addclass = 'read';
    $iconadd = '-o';

    if ($message->unread) {
        $addclass = 'unread';
        $iconadd = '';
    }
    if ($message->type === 'notification') {
        $messagecontent = html_writer::start_div('notification

' . $addclass); $messagecontent .= html_writer::tag('i', '', array('class' => 'fa fa-info-circle icon')); $messagecontent .= html_writer::start_span('msg-time'); $messagecontent .= html_writer::tag('i', '', array('class' => 'fa fa-comment' . $iconadd)); $messagecontent .= $this->get_time_difference($message->date); $messagecontent .= html_writer::end_span(); $messagecontent .= html_writer::span(htmlspecialchars($message->text, ENT_COMPAT | ENT_HTML401, 'UTF-8'), 'notification-text'); $messagecontent .= html_writer::end_div(); } else { if (!is_object($message->from) || !empty($message->from->deleted)) { continue; } $senderpicture = new user_picture($message->from); $senderpicture->link = false; $senderpicture->size = 60;

        $messagecontent = html_writer::start_div('message ' .

$addclass); $messagecontent .= html_writer::start_span('msg-picture') . $this->render($senderpicture) . html_writer::end_span(); $messagecontent .= html_writer::start_span('msg-body'); $messagecontent .= html_writer::start_span('msg-time'); $messagecontent .= html_writer::tag('i', '', array('class' => 'fa fa-comments' . $iconadd)); $messagecontent .= $this->get_time_difference($message->date); $messagecontent .= html_writer::end_span(); $messagecontent .= html_writer::span($message->from->firstname, 'msg-sender'); $messagecontent .= html_writer::span(htmlspecialchars($message->text, ENT_COMPAT | ENT_HTML401, 'UTF-8'), 'msg-text'); $messagecontent .= html_writer::end_span(); $messagecontent .= html_writer::end_div(); }

    $messagesubmenu->add($messagecontent, $message->url,

htmlspecialchars($message->text, ENT_COMPAT | ENT_HTML401, 'UTF-8')); } } return $this->render_custom_menu($messagemenu); }

/**

$newmessagesql = "SELECT id, smallmessage, useridfrom, useridto, timecreated, fullmessageformat, notification, contexturl FROM {message} WHERE useridto = :userid ORDER BY timecreated DESC";

$messages = $DB->get_records_sql($newmessagesql, array('userid' => $USER->id), 0, $maxmessages); $messagelist['newmessages'] = count($messages);

foreach ($messages as $message) { $messagelist['messages'][] = $this->process_message($message); }

if ($messagelist['newmessages'] < $maxmessages) { $maxmessages = 5 - $messagelist['newmessages'];

$readmessagesql = "SELECT id, smallmessage, useridfrom,

useridto, timecreated, timeread, fullmessageformat, notification, contexturl FROM {message_read} WHERE useridto = :userid ORDER BY timecreated DESC";

$messages = $DB->get_records_sql($readmessagesql,

array('userid' => $USER->id), 0, $maxmessages);

foreach ($messages as $message) {
    if (!$message->notification) {
        $messagelist['messages'][] =

$this->process_message($message); } } }

return $messagelist;

}

/**

if ($message->notification || $message->useridfrom < 1) { $messagecontent->text = $message->smallmessage; $messagecontent->type = 'notification'; $messagecontent->url = new moodle_url($message->contexturl); if (empty($message->contexturl)) { $messagecontent->url = new moodle_url('/message/index.php', array('user1' => $USER->id, 'viewing' => 'recentnotifications')); } } else { $messagecontent->type = 'message'; if ($message->fullmessageformat == FORMAT_HTML) { $message->smallmessage = html_to_text($message->smallmessage); } if (strlen($message->smallmessage) > 18) { $messagecontent->text = substr($message->smallmessage, 0, 15) . '...'; } else { $messagecontent->text = $message->smallmessage; } $messagecontent->from = $DB->get_record('user', array('id' => $message->useridfrom)); $messagecontent->url = new moodle_url('/message/index.php', array('user1' => $USER->id, 'user2' => $message->useridfrom)); }

$options = new stdClass(); $options->para = false; $messagecontent->text = format_text($messagecontent->text, FORMAT_PLAIN, $options);

$messagecontent->date = $message->timecreated; $messagecontent->unread = empty($message->timeread); return $messagecontent; }

/**

// To Calculate the time difference in Years... $years = 60 * 60 * 24 * 365;

// To Calculate the time difference in Months... $months = 60 * 60 * 24 * 30;

// To Calculate the time difference in Days... $days = 60 * 60 * 24;

// To Calculate the time difference in Hours... $hours = 60 * 60;

// To Calculate the time difference in Minutes... $minutes = 60;

if (intval($time_difference / $years) > 1) { return get_string('ago', 'core_message', intval($time_difference / $years) . ' ' . get_string('years')); } else if (intval($time_difference / $years) > 0) { return get_string('ago', 'core_message', intval($time_difference / $years) . ' ' . get_string('year')); } else if (intval($time_difference / $months) > 1) { return get_string('ago', 'core_message', intval($time_difference / $months) . ' ' . get_string('months')); } else if (intval(($time_difference / $months)) > 0) { return get_string('ago', 'core_message', intval($time_difference / $months) . ' ' . get_string('month')); } else if (intval(($time_difference / $days)) > 1) { return get_string('ago', 'core_message', intval($time_difference / $days) . ' ' . get_string('days')); } else if (intval(($time_difference / $days)) > 0) { return get_string('ago', 'core_message', intval($time_difference / $days) . ' ' . get_string('day')); } else if (intval(($time_difference / $hours)) > 1) { return get_string('ago', 'core_message', intval($time_difference / $hours) . ' ' . get_string('hours')); } else if (intval(($time_difference / $hours)) > 0) { return get_string('ago', 'core_message', intval($time_difference / $hours) . ' ' . get_string('hour')); } else if (intval(($time_difference / $minutes)) > 1) { return get_string('ago', 'core_message', intval($time_difference / $minutes) . ' ' . get_string('minutes')); } else if (intval(($time_difference / $minutes)) > 0) { return get_string('ago', 'core_message', intval($time_difference / $minutes) . ' ' . get_string('minute')); } else if (intval(($time_difference)) > 20) { return get_string('ago', 'core_message', intval($time_difference) . ' ' . get_string('seconds')); } else { return get_string('ago', 'core_message', get_string('few', 'theme_essential') . get_string('seconds')); } }

/**

/**

global $USER, $CFG, $DB, $SESSION; $loginurl = get_login_url();

$usermenu = html_writer::start_tag('ul', array('class' => 'nav')); $usermenu .= html_writer::start_tag('li', array('class' => 'dropdown'));

if (!isloggedin()) { if ($this->page->pagelayout != 'login') { $userpic = '' . get_string('login') . ''; $usermenu .= html_writer::link($loginurl, $userpic, array('class' => 'loginurl')); } } else if (isguestuser()) { $userurl = new moodle_url('#'); $userpic = parent::user_picture($USER, array('link' => false)); $caret = ''; $userclass = array('class' => 'dropdown-toggle', 'data-toggle' => 'dropdown'); $usermenu .= html_writer::link($userurl, $userpic . get_string('guest') . $caret, $userclass);

// Render direct logout link
$usermenu .= html_writer::start_tag('ul', array('class' =>

'dropdown-menu pull-right')); $branchlabel = '' . get_string('logout') . ''; $branchurl = new moodle_url('/login/logout.php?sesskey=' . sesskey()); $usermenu .= html_writer::tag('li', html_writer::link($branchurl, $branchlabel));

// Render Help Link
$usermenu .= $this->theme_essential_render_helplink();

$usermenu .= html_writer::end_tag('ul');

} else { $course = $this->page->course; $context = context_course::instance($course->id);

// Output Profile link
$userurl = new moodle_url('#');
$userpic = parent::user_picture($USER, array('link' => false));
$caret = '<i class="fa fa-caret-right"></i>';
$userclass = array('class' => 'dropdown-toggle', 'data-toggle'

=> 'dropdown');

if (!empty($USER->alternatename)) {
    $usermenu .= html_writer::link($userurl, $userpic .

$USER->alternatename . $caret, $userclass); } else { $usermenu .= html_writer::link($userurl, $userpic . $USER->firstname . $caret, $userclass); }

// Start dropdown menu items
$usermenu .= html_writer::start_tag('ul', array('class' =>

'dropdown-menu pull-right'));

if (\core\session\manager::is_loggedinas()) {
    $realuser = \core\session\manager::get_realuser();
    $branchlabel = '<em><i class="fa fa-key"></i>' .

fullname($realuser, true) . get_string('loggedinas', 'theme_essential') . fullname($USER, true) . ''; } else { $branchlabel = '' . fullname($USER, true) . ''; } $branchurl = new moodle_url('/user/profile.php', array('id' => $USER->id)); $usermenu .= html_writer::tag('li', html_writer::link($branchurl, $branchlabel));

if (is_mnet_remote_user($USER) && $idprovider =

$DB->get_record('mnet_host', array('id' => $USER->mnethostid))) { $branchlabel = '' . get_string('loggedinfrom', 'theme_essential') . $idprovider->name . ''; $branchurl = new moodle_url($idprovider->wwwroot); $usermenu .= html_writer::tag('li', html_writer::link($branchurl, $branchlabel)); }

if (is_role_switched($course->id)) { // Has switched roles
    $branchlabel = '<em><i class="fa fa-users"></i>' .

get_string('switchrolereturn') . ''; $branchurl = new moodle_url('/course/switchrole.php', array('id' => $course->id, 'sesskey' => sesskey(), 'switchrole' => 0, 'returnurl' => $this->page->url->out_as_local_url(false))); $usermenu .= html_writer::tag('li', html_writer::link($branchurl, $branchlabel)); }

// Add preferences submenu
$usermenu .=

$this->theme_essential_render_preferences($context);

$usermenu .= html_writer::empty_tag('hr', array('class' =>

'sep'));

// Output Calendar link if user is allowed to edit own calendar

entries if (has_capability('moodle/calendar:manageownentries', $context)) { $branchlabel = '' . get_string('pluginname', 'block_calendar_month') . ''; $branchurl = new moodle_url('/calendar/view.php'); $usermenu .= html_writer::tag('li', html_writer::link($branchurl, $branchlabel)); }

// Check if messaging is enabled.
if (!empty($CFG->messaging)) {
    $branchlabel = '<em><i class="fa fa-envelope"></i>' .

get_string('pluginname', 'block_messages') . ''; $branchurl = new moodle_url('/message/index.php'); $usermenu .= html_writer::tag('li', html_writer::link($branchurl, $branchlabel)); }

// Check if user is allowed to manage files
if (has_capability('moodle/user:manageownfiles', $context)) {
    $branchlabel = '<em><i class="fa fa-file"></i>' .

get_string('privatefiles', 'block_private_files') . ''; $branchurl = new moodle_url('/user/files.php'); $usermenu .= html_writer::tag('li', html_writer::link($branchurl, $branchlabel)); }

// Check if user is allowed to view discussions
if (has_capability('mod/forum:viewdiscussion', $context)) {
    $branchlabel = '<em><i class="fa fa-list-alt"></i>' .

get_string('forumposts', 'mod_forum') . ''; $branchurl = new moodle_url('/mod/forum/user.php', array('id' => $USER->id)); $usermenu .= html_writer::tag('li', html_writer::link($branchurl, $branchlabel));

    $branchlabel = '<em><i class="fa fa-list"></i>' .

get_string('discussions', 'mod_forum') . ''; $branchurl = new moodle_url('/mod/forum/user.php', array('id' => $USER->id, 'mode' => 'discussions')); $usermenu .= html_writer::tag('li', html_writer::link($branchurl, $branchlabel));

    $usermenu .= html_writer::empty_tag('hr', array('class' =>

'sep')); }

// Output user grade links course sensitive, workaround for

frontpage, selecting first enrolled course if ($course->id == SITEID) { $branchlabel = '' . get_string('mygrades', 'theme_essential') . ''; $branchurl = new moodle_url('/grade/report/overview/index.php' , array('id' => $course->id, 'userid' => $USER->id)); $usermenu .= html_writer::tag('li', html_writer::link($branchurl, $branchlabel)); } else { if (has_capability('gradereport/overview:view', $context)) { $branchlabel = '' . get_string('mygrades', 'theme_essential') . ''; $branchurl = new moodle_url('/grade/report/overview/index.php' , array('id' => $course->id, 'userid' => $USER->id)); $usermenu .= html_writer::tag('li', html_writer::link($branchurl, $branchlabel)); }

    if (has_capability('gradereport/user:view', $context)) {
        // In Course also output Course grade links
        $branchlabel = '<em><i class="fa fa-list-alt"></i>' .

get_string('coursegrades', 'theme_essential') . ''; $branchurl = new moodle_url('/grade/report/user/index.php' , array('id' => $course->id, 'userid' => $USER->id)); $usermenu .= html_writer::tag('li', html_writer::link($branchurl, $branchlabel)); } }

// Check if badges are enabled.
if (!empty($CFG->enablebadges) &&

has_capability('moodle/badges:manageownbadges', $context)) { $branchlabel = '' . get_string('badges') . ''; $branchurl = new moodle_url('/badges/mybadges.php'); $usermenu .= html_writer::tag('li', html_writer::link($branchurl, $branchlabel)); } $usermenu .= html_writer::empty_tag('hr', array('class' => 'sep'));

// Render direct logout link
$branchlabel = '<em><i class="fa fa-sign-out"></i>' .

get_string('logout') . ''; if (\core\session\manager::is_loggedinas()) { $branchurl = new moodle_url('/course/loginas.php', array('id' => $course->id, 'sesskey' => sesskey())); } else { $branchurl = new moodle_url('/login/logout.php', array('sesskey' => sesskey())); } $usermenu .= html_writer::tag('li', html_writer::link($branchurl, $branchlabel));

// Render Help Link
$usermenu .= $this->theme_essential_render_helplink();

$usermenu .= html_writer::end_tag('ul');

}

$usermenu .= html_writer::end_tag('li'); $usermenu .= html_writer::end_tag('ul');

return $usermenu; }

/**

if (\theme_essential\toolbox::get_setting('helplinktype') === '1') { if (\theme_essential\toolbox::get_setting('helplink') && filter_var(\theme_essential\toolbox::get_setting('helplink'), FILTER_VALIDATE_EMAIL)) { $branchurl = 'mailto:' . \theme_essential\toolbox::get_setting('helplink') . '?cc=' . $USER->email; } else if ($CFG->supportemail && filter_var($CFG->supportemail, FILTER_VALIDATE_EMAIL)) { $branchurl = 'mailto:' . $CFG->supportemail . '?cc=' . $USER->email; } else { if (is_siteadmin()) { $branchurl = preg_replace("(https?:)", "", $CFG->wwwroot).'/admin/settings.php?section=theme_essential_header'; } $branchlabel = '' . get_string('invalidemail') . ''; } }

if (\theme_essential\toolbox::get_setting('helplinktype') === '2') { if (\theme_essential\toolbox::get_setting('helplink') && filter_var(\theme_essential\toolbox::get_setting('helplink'), FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED)) { $branchurl = \theme_essential\toolbox::get_setting('helplink'); $target = '_blank'; } else if ((!\theme_essential\toolbox::get_setting('helplink')) && (filter_var($CFG->supportpage, FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED))) { $branchurl = $CFG->supportpage; $target = '_blank'; } else { if (is_siteadmin()) { $branchurl = preg_replace("(https?:)", "", $CFG->wwwroot).'/admin/settings.php?section=theme_essential_header'; } $branchlabel = '' . get_string('invalidurl', 'error') . ''; }

}

return html_writer::tag('li', html_writer::link($branchurl, $branchlabel, array('target' => $target))); }

/**

$branchlabel = '' . get_string('user', 'moodle') . ''; $branchurl = new moodle_url('/user/preferences.php', array('userid' => $USER->id)); $preferences .= html_writer::tag('li', html_writer::link($branchurl, $branchlabel)); // Check if user is allowed to edit profile if (has_capability('moodle/user:editownprofile', $context)) { $branchlabel = '' . get_string('editmyprofile') . ''; $branchurl = new moodle_url('/user/edit.php', array('id' => $USER->id)); $preferences .= html_writer::tag('li', html_writer::link($branchurl, $branchlabel)); } if (has_capability('moodle/user:changeownpassword', $context)) { $branchlabel = '' . get_string('changepassword') . ''; $branchurl = new moodle_url('/login/change_password.php'); $preferences .= html_writer::tag('li', html_writer::link($branchurl, $branchlabel)); } if (has_capability('moodle/user:editownmessageprofile', $context)) { $branchlabel = '' . get_string('message', 'message') . ''; $branchurl = new moodle_url('/message/edit.php', array('id' => $USER->id)); $preferences .= html_writer::tag('li', html_writer::link($branchurl, $branchlabel)); } if ($CFG->enableblogs) { $branchlabel = '' . get_string('blog', 'blog') . ''; $branchurl = new moodle_url('/blog/preferences.php'); $preferences .= html_writer::tag('li', html_writer::link($branchurl, $branchlabel)); } if ($CFG->enablebadges && has_capability('moodle/badges:manageownbadges', $context)) { $branchlabel = '' . get_string('badgepreferences', 'theme_essential') . ''; $branchurl = new moodle_url('/badges/preferences.php'); $preferences .= html_writer::tag('li', html_writer::link($branchurl, $branchlabel)); } $preferences .= html_writer::end_tag('ul'); $preferences .= html_writer::end_tag('li'); return $preferences; }

/**

/**

/*

public function render_pix_icon(pix_icon $icon) { if (self::replace_moodle_icon($icon->pix)) { if (!isset($icon->attributes['alt'])) { $icon->attributes['alt'] = ''; } $newicon = self::replace_moodle_icon($icon->pix, $icon->attributes['alt']) . parent::render_pix_icon($icon) . ""; return $newicon; } else { return parent::render_pix_icon($icon); } }

private static function replace_moodle_icon($icon, $alt = false) { $icons = array( 'add' => 'plus', 'book' => 'book', 'chapter' => 'file', 'docs' => 'question-circle', 'generate' => 'gift', 'i/marker' => 'lightbulb-o', 'i/dragdrop' => 'arrows', 'i/loading' => 'refresh fa-spin fa-2x', 'i/loading_small' => 'refresh fa-spin', 'i/backup' => 'cloud-download', 'i/checkpermissions' => 'user', 'i/edit' => 'pencil', 'i/enrolusers' => 'user-plus', 'i/filter' => 'filter', 'i/grades' => 'table', 'i/group' => 'group', 'i/groupn' => 'user', 'i/groupv' => 'user-plus', 'i/groups' => 'user-secret', 'i/hide' => 'eye', 'i/import' => 'upload', 'i/move_2d' => 'arrows', 'i/navigationitem' => 'file', 'i/outcomes' => 'magic', 'i/preview' => 'search', 'i/publish' => 'globe', 'i/reload' => 'refresh', 'i/report' => 'list-alt', 'i/restore' => 'cloud-upload', 'i/return' => 'repeat', 'i/roles' => 'user', 'i/cohort' => 'users', 'i/scales' => 'signal', 'i/settings' => 'cogs', 'i/show' => 'eye-slash', 'i/switchrole' => 'random', 'i/user' => 'user', 'i/users' => 'user', 't/right' => 'arrow-right', 't/left' => 'arrow-left', 't/edit_menu' => 'cogs', 'i/withsubcat' => 'indent', 'i/permissions' => 'key', 'i/assignroles' => 'lock', 't/assignroles' => 'lock', 't/cohort' => 'users', 't/delete' => 'times-circle', 't/edit' => 'cog', 't/hide' => 'eye', 't/show' => 'eye-slash', 't/up' => 'arrow-up', 't/down' => 'arrow-down', 't/copy' => 'copy', 't/block_to_dock' => 'caret-square-o-left', 't/sort' => 'sort', 't/sort_asc' => 'sort-asc', 't/sort_desc' => 'sort-desc', 't/grades' => 'th-list', 't/preview' => 'search' ); if (array_key_exists($icon, $icons)) { return "<i class=\"fa fa-$icons[$icon] icon\" title=\"$alt\">"; } else { return false; } }

/**

public function edit_button(moodle_url $url) { $url->param('sesskey', sesskey()); if ($this->page->user_is_editing()) { $url->param('edit', 'off'); $btn = 'btn-danger'; $title = get_string('turneditingoff'); $icon = 'fa-power-off'; } else { $url->param('edit', 'on'); $btn = 'btn-success'; $title = get_string('turneditingon'); $icon = 'fa-edit'; } return html_writer::tag('a', html_writer::start_tag('i', array('class' => $icon . ' fa fa-fw')) . html_writer::end_tag('i') . $title, array('href' => $url, 'class' => 'btn ' . $btn, 'title' => $title)); }

public function render_social_network($socialnetwork) { if (\theme_essential\toolbox::get_setting($socialnetwork)) { $icon = $socialnetwork; if ($socialnetwork === 'googleplus') { $icon = 'google-plus'; } else if ($socialnetwork === 'website') { $icon = 'globe'; } else if ($socialnetwork === 'ios') { $icon = 'apple'; } else if ($socialnetwork === 'winphone') { $icon = 'windows'; } $socialhtml = html_writer::start_tag('li'); $socialhtml .= html_writer::start_tag('button', array('type' => "button", 'class' => 'socialicon ' . $socialnetwork, 'onclick' => "window.open('" . \theme_essential\toolbox::get_setting($socialnetwork) . "')", 'title' => get_string($socialnetwork, 'theme_essential'), )); $socialhtml .= html_writer::start_tag('i', array('class' => 'fa fa-' . $icon)); $socialhtml .= html_writer::end_tag('i'); $socialhtml .= html_writer::start_span('sr-only') . html_writer::end_span(); $socialhtml .= html_writer::end_tag('button'); $socialhtml .= html_writer::end_tag('li');

  return $socialhtml;

} else {
  return false;
}

}

/**

$attributes = array( 'id' => 'block-region-' . pregreplace('#[^a-zA-Z0-9-]+#', '-', $displayregion), 'class' => join(' ', $classes), 'data-blockregion' => $displayregion, 'data-droptarget' => '1' );

if ($this->page->blocks->region_has_content($displayregion, $this)) { if ($footer > 0) { $attributes['class'] .= ' footer-blocks'; $editing = $this->page->user_is_editing(); if ($editing) { $attributes['class'] .= ' footer-edit'; } $output = html_writer::tag($tag, $this->essential_blocks_for_region($displayregion, $footer, $editing), $attributes); } else { $output = html_writer::tag($tag, $this->blocks_for_region($displayregion), $attributes); } } else { $output = ''; }

return $output; }

/**

$blockcount = count($blockcontents);

if ($blockcount >= 1) { if (!$editing) { $output .= html_writer::start_tag('div', array('class' => 'row-fluid')); } $blocks = $this->page->blocks->get_blocks_for_region($region); $lastblock = null; $zones = array(); foreach ($blocks as $block) { $zones[] = $block->title; }

/*
 * When editing we want all the blocks to be the same as

side-pre / side-post so set by CSS: * aside.footer-edit .block { * .footer-fluid-span(3); * } / if (($blocksperrow > 4) || ($editing)) { $blocksperrow = 4; // Will result in a 'span3' when more than one row. } $rows = $blockcount / $blocksperrow; // Maximum blocks per row.

if (!$editing) {
    if ($rows <= 1) {
        $span = 12 / $blockcount;
        if ($span < 1) {
            // Should not happen but a fail safe - block will

be small so good for screen shots when this happens. $span = 1; } } else { $span = 12 / $blocksperrow; } }

$currentblockcount = 0;
$currentrow = 0;
$currentrequiredrow = 1;
foreach ($blockcontents as $bc) {

    if (!$editing) { // Using CSS and special 'span3' only when

editing. $currentblockcount++; if ($currentblockcount > ($currentrequiredrow * $blocksperrow)) { // Tripping point. $currentrequiredrow++; // Break... $output .= html_writer::end_tag('div'); $output .= html_writer::start_tag('div', array('class' => 'row-fluid')); // Recalculate span if needed... $remainingblocks = $blockcount - ($currentblockcount - 1); if ($remainingblocks < $blocksperrow) { $span = 12 / $remainingblocks; if ($span < 1) { // Should not happen but a fail safe - block will be small so good for screen shots when this happens. $span = 1; } } }

        if ($currentrow < $currentrequiredrow) {
            $currentrow = $currentrequiredrow;
        }

        // 'desktop-first-column' done in CSS with

':first-of-type' and ':nth-of-type'. // 'spanX' done in CSS with calculated special width class as fixed at 'span3' for all. $bc->attributes['class'] .= ' span' . $span; }

    if ($bc instanceof block_contents) {
        $output .= $this->block($bc, $region);
        $lastblock = $bc->title;
    } else if ($bc instanceof block_move_target) {
        $output .= $this->block_move_target($bc, $zones,

$lastblock); } else { throw new coding_exception('Unexpected type of thing (' . get_class($bc) . ') found in list of block contents.'); } } if (!$editing) { $output .= html_writer::end_tag('div'); } }

return $output; }

public function standard_footer_html() { $output = parent::standard_footer_html(); $output .= html_writer::start_tag('div', array ('class' => 'themecredit')). get_string('credit', 'theme_essential'). html_writer::link('//about.me/gjbarnard', 'Gareth J Barnard', array('target' => '_blank')). html_writer::end_tag('div');

return $output;

}

// Essential custom bits. public function essential_marketing_button($spot) { $o = ''; $url = \theme_essential\toolbox::get_setting('marketing'.$spot.'buttonurl'); if (!empty($url)) { $url = '<a href="'.$url.'" '; $url .= 'target="'.\theme_essential\toolbox::get_setting('marketing'.$spot.'target').'" class="marketing-button">'; $url .= \theme_essential\toolbox::get_setting('marketing'.$spot.'buttontext', true); $url .= ''; } $edit = $this->essential_edit_button('theme_essential_frontpage'); if ((!empty($url)) || (!empty($edit))) { $o = '

'.$url.$edit.'
'; }

return $o;

}

public function essential_edit_button($section) { global $CFG; if ($this->page->user_is_editing() && is_siteadmin()) { $url = preg_replace("(https?:)", "", $CFG->wwwroot . '/admin/settings.php?section='); return '' . get_string('edit') . ''; } return null; }

public function get_title($location) { global $CFG, $SITE; $title = ''; if ($location === 'navbar') { $url = preg_replace("(https?:)", "", $CFG->wwwroot); switch (\theme_essential\toolbox::get_setting('navbartitle')) { case 0: return false; break; case 1: $title = '' . format_string($SITE->fullname, true, array('context' => context_course::instance(SITEID))) . ''; break; case 2: $title = '' . format_string($SITE->shortname, true, array('context' => context_course::instance(SITEID))) . ''; break; default: $title = '' . format_string($SITE->shortname, true, array('context' => context_course::instance(SITEID))) . ''; break; } } else if ($location === 'header') { switch (\theme_essential\toolbox::get_setting('headertitle')) { case 0: return false; break; case 1: $title = '

' . format_string($SITE->fullname, true, array('context' => context_course::instance(SITEID))) . '

'; break; case 2: $title = '

' . format_string($SITE->shortname, true, array('context' => context_course::instance(SITEID))) . '

'; break; case 3: $title = '

' . format_string($SITE->fullname, true, array('context' => context_course::instance(SITEID))) . '

'; $title .= '

' . strip_tags($SITE->summary) . '

'; break; case 4: $title = '

' . format_string($SITE->shortname, true, array('context' => context_course::instance(SITEID))) . '

'; $title .= '

' . strip_tags($SITE->summary) . '

'; break; default: break; } } return $title; }

/**

ghost commented 8 years ago

OK - so is this something I can fix?

On Wed, Dec 9, 2015 at 11:13 AM, Gareth J Barnard notifications@github.com wrote:

Hi Andy,

Ok, the mark-up is broken, the browser can cope. The JS cannot. Hence appears to work but if when editing then will break.

G

— Reply to this email directly or view it on GitHub https://github.com/gjb2048/moodle-theme_essential/issues/578#issuecomment-163328221 .

Andrew M. Walding CellStream, Inc. Tel & Fax: 866-659-1014 Cell: 214-405-3708 Skype ID: awalding Twitter: @awalding http://www.cellstream.com http://www.netscionline.com

gjb2048 commented 8 years ago

Thanks. I cannot see the error. As looking at your site it happens around the $OUTPUT->standard_head_html() call which has not been overridden by the renderer. Therefore please look in /lib/outputrenderers.php too at that method.

And could you zip up your theme and email it to me please.

ghost commented 8 years ago

Here it is:

On Wed, Dec 9, 2015 at 11:19 AM, Gareth J Barnard notifications@github.com wrote:

Thanks. I cannot see the error. As looking at your site it happens around the $OUTPUT->standard_head_html() call which has not been overridden by the renderer. Therefore please look in /lib/outputrenderers.php too at that method.

And could you zip up your theme and email it to me please.

— Reply to this email directly or view it on GitHub https://github.com/gjb2048/moodle-theme_essential/issues/578#issuecomment-163329772 .

Andrew M. Walding CellStream, Inc. Tel & Fax: 866-659-1014 Cell: 214-405-3708 Skype ID: awalding Twitter: @awalding http://www.cellstream.com http://www.netscionline.com

gjb2048 commented 8 years ago

Hi Andy,

GitHub does not allow ZIP files as attachments, hence the eMail request :)

G

ghost commented 8 years ago

Your prior message re: OUTPUT went just over my head. So can you be more specific? I am not a total nub but pretty close!!! :-)

On Wed, Dec 9, 2015 at 11:23 AM, Andrew Walding awalding@gmail.com wrote:

Here it is:

On Wed, Dec 9, 2015 at 11:19 AM, Gareth J Barnard < notifications@github.com> wrote:

Thanks. I cannot see the error. As looking at your site it happens around the $OUTPUT->standard_head_html() call which has not been overridden by the renderer. Therefore please look in /lib/outputrenderers.php too at that method.

And could you zip up your theme and email it to me please.

— Reply to this email directly or view it on GitHub https://github.com/gjb2048/moodle-theme_essential/issues/578#issuecomment-163329772 .

Andrew M. Walding CellStream, Inc. Tel & Fax: 866-659-1014 Cell: 214-405-3708 Skype ID: awalding Twitter: @awalding http://www.cellstream.com http://www.netscionline.com

Andrew M. Walding CellStream, Inc. Tel & Fax: 866-659-1014 Cell: 214-405-3708 Skype ID: awalding Twitter: @awalding http://www.cellstream.com http://www.netscionline.com

ghost commented 8 years ago

OK - I am a nub...

On Wed, Dec 9, 2015 at 11:24 AM, Gareth J Barnard notifications@github.com wrote:

Hi Andy,

GitHub does not allow ZIP files as attachments, hence the eMail request :)

G

— Reply to this email directly or view it on GitHub https://github.com/gjb2048/moodle-theme_essential/issues/578#issuecomment-163331087 .

Andrew M. Walding CellStream, Inc. Tel & Fax: 866-659-1014 Cell: 214-405-3708 Skype ID: awalding Twitter: @awalding http://www.cellstream.com http://www.netscionline.com

gjb2048 commented 8 years ago

Thanks for the zip file Andy, I can find nothing wrong with the files by searching all of them for the string 'font-awesome' which would have picked something up.

3-bits commented 8 years ago

I go to remove the theme and reinstall again. I rewrited the old files with the new and maybe this is the problem.

gjb2048 commented 8 years ago

You mean that you overwrote the files instead of removing the folder and putting in the new folder / files?

3-bits commented 8 years ago

Sorry, I was wrong. Sometimes I move the files if the theme used is compatible.

In this case the upgrade included several plugins and all were uploaded together in one file and copied in the moodle folder before start the upgrade process.

I checked the files and any contains the string so I guess it is generated in some render.

Now testing the same files in my test environment to know if I can get the same string of code.

gjb2048 commented 8 years ago

It could also easily be broken JS that is injecting it.

3-bits commented 8 years ago

I just tested in my moodle29 environement the same files and working well.

So the problem could be a 3rd party plugin that breaks the code. Even the site uses the same plugins maybe some of the upgraded is now breaking the theme.

I go to setup the same environment and see what happens.

gjb2048 commented 8 years ago

Just looked at http://cellstream.com/netsci/ and there appears to be only one slide rendered.