Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-72396

Allow easy setting of the active tab for the navigation views.

XMLWordPrintable

    • MOODLE_400_STABLE
    • MOODLE_400_STABLE
    • MDL-72396-master
    • Hide

      Prerequisites

      1. To test this changeset the primary and secondary nav should be available on your instance.
      2. Also, I have tested this on top of the changes made for MDL-71915.

      Steps to test for secondary nav

      1. Enable quiz module.
      2. Open the file mod/quiz/edit.php
      3. Now add the line:

         $PAGE->set_secondary_active_tab('questionbank'); 
        

      4. Now navigate to the edit page of the quiz module.
      5. You should see the "More" tab in the secondary nav activated (as "Question bank" tab is inside the More menu)
      6. Now change the line mentioned in step 3 to:

        $PAGE->set_secondary_active_tab('mod_quiz_useroverrides'); 
        

      7. And reload the page. You should see the "Overrides" tab in the secondary nav activated.

      Steps to test for primary nav

      1. Enable quiz module.
      2. Open the file mod/quiz/edit.php
      3. Now add the line:

         $PAGE->set_primary_active_tab('courses');

      4. Now navigate to the edit page of the quiz.
      5. You should see the primary nav activated for "Courses".
      6. Replace the line in step 3 to:

      $PAGE->set_primary_active_tab('myhome');
      

      # Now reload the edit page of the quiz module. You should see the primary nav activated for "Dashboard".

       

      Show
      Prerequisites To test this changeset the primary and secondary nav should be available on your instance. Also, I have tested this on top of the changes made for MDL-71915 . Steps to test for secondary nav Enable quiz module. Open the file mod/quiz/edit.php Now add the line: $PAGE->set_secondary_active_tab( 'questionbank' ); Now navigate to the edit page of the quiz module. You should see the "More" tab in the secondary nav activated (as "Question bank" tab is inside the More menu) Now change the line mentioned in step 3 to: $PAGE->set_secondary_active_tab( 'mod_quiz_useroverrides' ); And reload the page. You should see the "Overrides" tab in the secondary nav activated. Steps to test for primary nav Enable quiz module. Open the file mod/quiz/edit.php Now add the line: $PAGE->set_primary_active_tab( 'courses' ); Now navigate to the edit page of the quiz. You should see the primary nav activated for "Courses". Replace the line in step 3 to: $PAGE->set_primary_active_tab( 'myhome' ); # Now reload the edit page of the quiz module. You should see the primary nav activated for "Dashboard".  
    • 3
    • Navigation push 5, Navigation push 6

      Sometimes we want to highlight a tab in one of the navigation views when it does not match the set url for that navigation node.

      Currently making this work requires a lot of additional code and overwriting the views.

      To try and help third party developers (and ourselves) let's provide a simple method that can be called to set the active tab.

      Something like:

      $PAGE->set_secondary_active_tab($navkey);
      

      Where the navkey is the key given to the node that represents the tab we want active.
      This could be useful for the primary navigation as well.

            sujith Sujith Haridasan
            abgreeve Adrian Greeve
            Mihail Geshoski Mihail Geshoski
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Gladys Basiana Gladys Basiana
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 days, 2 hours, 43 minutes
                3d 2h 43m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.