Moove theme debug

Moove theme debug

by Dorian C -
Number of replies: 13

Moodle 3.7.2+
Moove 3.7.0
Boost navigation fumbling v3.7-r3
OpenMeetings 4.0.2

Hi everyone, i am getting the below error on some occasions when DEBUG mode is on.

When using single format course, that is an error to all users EXCEPT main admin.
When adding OpenMeetings to any course, that course stays broken even after i remove the activity...

Any idea what might cause this?

  • line 4051 of /lib/navigationlib.php: call to navigation_node_collection->add()
  • line 359 of /theme/moove/lib.php: call to flat_navigation->add()
  • line 278 of /theme/moove/lib.php: call to theme_moove_rebuildcoursesections()
  • line 76 of /theme/moove/layout/incourse.php: call to theme_moove_extend_flat_navigation()
  • line 1374 of /lib/outputrenderers.php: call to include()
  • line 1304 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
  • line 1961 of /lib/setuplib.php: call to core_renderer->header()
  • line 65 of /mod/feedback/view.php: call to bootstrap_renderer->__call()

Average of ratings: -
In reply to Dorian C

Re: Moove theme debug

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

That's just a stack trace.  You've not stated the actual error.

In reply to Gareth J Barnard

Re: Moove theme debug

by Dorian C -

So debug shows when i have boost nav fumbling switched on by removing some root nodes.
When all nodes are on, and nothing is missing from the navbar, there are no debug messages.

OR when manually comment out the calendar in the lib.php and place instead $options->calendar = false; to hide the nodes.

Line 4051 in /lib/navigationlib.php
$result = parent::add($node, $beforekey);


How can i investigate the error further?

In reply to Dorian C

Re: Moove theme debug

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Ok, but what is the error?  Before the stack trace there is usually a line starting 'Error:... '.

In reply to Gareth J Barnard

Re: Moove theme debug

by Dorian C -
Hi Gareth, thanks for responding promptly... there is no error, above message is the only one i get...

Looks like i manage to sort it out...

Line 4051 in /lib/navigationlib.php
$result = parent::add($node, $beforekey);

I replaced $beforekey with only $key

Debug message is gone, and navbar is not broken anymore...
In reply to Dorian C

Re: Moove theme debug

by Aleksandro Figueiredo -
I have the same problem, with a slight variation in the lines shown:

line 278 of /theme/moove/lib.php: call to theme_moove_rebuildcoursesections()
line 73 of /theme/moove/layout/course.php: call to theme_moove_extend_flat_navigation()
line 1374 of /lib/outputrenderers.php: call to include()
line 1304 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
line 244 of /course/view.php: call to core_renderer→header()

I made the change indicated above, but had the following error (5 times):

Notice: Undefined variable: key in /home/pensandoeducacao/www/moodle/lib/navigationlib.php on line 4051

If I make the same change in the top line, 4050 → public function add (navigation_node $node, $beforekey = null) {- changing $beforekey for $key, the error comes back with a few more lines:

line 278 of /theme/moove/lib.php: call to theme_moove_rebuildcoursesections()
line 76 of /theme/moove/layout/incourse.php: call to theme_moove_extend_flat_navigation()
line 1374 of /lib/outputrenderers.php: call to include()
line 1304 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
line 1941 of /lib/setuplib.php: call to core_renderer->header()
line 158 of /mod/url/locallib.php: call to bootstrap_renderer->__call()
line 326 of /mod/url/locallib.php: call to url_print_header()
line 99 of /mod/url/view.php: call to url_display_embed()

Any idea on how to solve this?

Moodle 3.8+ (Build: 20191122)
Moove (theme_moove_moodle38_2019111800)
In reply to Aleksandro Figueiredo

Re: Moove theme debug

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Ok, I don't know what you've done to mess up the core code in navigationlib.php, but that code should be:

    /**
     * Override the parent so we can set a label for this collection if it has not been set yet.
     *
     * @param navigation_node $node Node to add
     * @param string $beforekey If specified, adds before a node with this key,
     *   otherwise adds at end
     * @return navigation_node Added node
     */
    public function add(navigation_node $node, $beforekey=null) {
        $result = parent::add($node, $beforekey);
        // Extend the parent to get a name for the collection of nodes if required.
        if (empty($this->collectionlabel)) {
            if ($node instanceof flat_navigation_node) {
                $this->set_collectionlabel($node->get_collectionlabel());
            }
        }

        return $result;
    }
    

Ok... so, red herring with:

$flatnav->add($coursesections, $participantsitem->key);

in Moove.  So undo the core changes.

As 'key' is a public attribute in the class 'navigation_node', then I think you've somehow broken the navigationlib.php core file.  Replace it with a fresh copy from Moodle.org or GitHub - get the same version of Moodle as you're using.

In reply to Gareth J Barnard

Re: Moove theme debug

by Aleksandro Figueiredo -
Dear Gareth,

I made the change indicated by Nije Bitno above. As I had saved the original navigationlib.php, I returned the file to moodle / lib.

When I sign in with a non-admin user, the following lines appear when I access a course:

line 278 of /theme/moove/lib.php: call to theme_moove_rebuildcoursesections()
line 73 of /theme/moove/layout/course.php: call to theme_moove_extend_flat_navigation()
line 1374 of /lib/outputrenderers.php: call to include()
line 1304 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
line 244 of /course/view.php: call to core_renderer→header()

That's the only problem, the main course page appears normally, but when I try to access the first course resource, these lines appear:

line 278 of /theme/moove/lib.php: call to theme_moove_rebuildcoursesections()
line 76 of /theme/moove/layout/incourse.php: call to theme_moove_extend_flat_navigation()
line 1374 of /lib/outputrenderers.php: call to include()
line 1304 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
line 1941 of /lib/setuplib.php: call to core_renderer->header()
line 158 of /mod/url/locallib.php: call to bootstrap_renderer->__call()
line 326 of /mod/url/locallib.php: call to url_print_header()
line 99 of /mod/url/view.php: call to url_display_embed()

Besides that, everything seems to be working normally.
In reply to Aleksandro Figueiredo

Re: Moove theme debug

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Ok, tried to replicate and cannot:

  1. Created a single activity format course.
  2. Added a student to it.
  3. Logged in as the student.
  4. Switched to Moove theme.

Developer debugging is on and even removed 'moodle/course:viewparticipants' capability for students which removes the 'Participants' from the flat menu and put it back.

In reply to Gareth J Barnard

Re: Moove theme debug

by Aleksandro Figueiredo -

Yesterday I had a problem with the installation of the format_tiles plugin, which deconfigured the look of the site, which was just a list of links, and needed to restore the entire environment backup. (This is another problem, I will research and, if necessary, I will open another topic.)

Today I did what you suggested and had no problem entering as a student. However, if access as a visitor the problem continues. (I have a free course that can be accessed as a visitor.)


In reply to Aleksandro Figueiredo

Re: Moove theme debug

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
Ok, I've enabled guest access on the same course I set-up for the test, logged in as guest and still cannot replicate!
In reply to Gareth J Barnard

Re: Moove theme debug

by Aleksandro Figueiredo -

The lines cited only appear when I enable “display debug messages” in debbuging, they do not appear when I disable it. My concern is that this is a mistake that can disrupt the user experience. Since there are apparently no errors outside the message display, I will disable the display when I finish setting up Moodle and start posting the courses.

I left IT many years ago. But as I worked for many years as a developer, I like to understand what is happening. My goal is to know Moodle as much as possible so I can provide the best learning experience for my prospective students.