ÿØÿà JFIF    ÿÛ „  ( %!1"%)+...383-7(-.+  -%%--------+------------/----------------------------ÿÀ  ¶" ÿÄ     ÿÄ @    !1AQaq‘¡"±ÁÑð2’BRráS‚ñ3b¢CT²Ò #cÿÄ    ÿÄ '   1!AQ2a"‘±#ÿÚ   ? ò(/p‘—–¢·,M|¯G»R£üešT. ôŸEoCFñ‡ 4ÔkåóxR|µÁ¨ÓDà!Ç´µ˜‡p ÍQ‹§!þž^õWsŒy  åÁ§$á«%ºq˜™JyyË0y«^Ϗ -3ÃÏËÈ£Æ\P’ä„s&•‹Üs üô'àWt¹pñCp$bÚF`·7.^)¾!)ÒÙ˜–ÅÏš^h¾ø³·ìe±ŒaeÖ—Í,e=B}Jéߦ$$½—šÙÜCC¯¶è8β–Åkèwx LÉngT±æ¹£Ócœ¿Í/©Éÿ ‰ÚCÒ­mq;Tt¶–}0"zÖPcd1š­¤tˆ„ÐÓâqú[™öUCŠ2޿د­É(¸ßúçšmW,Ò ºf‹Ån™ÄLêÁ8üÁkÁ€L¥ÍuJ1œôrÂSŒÓöt!7EUíïb)AËi¬â-ÙHk8òÁiXYwÅ)O^"ÇØriÛô{»wRUKÙÏÚlÓ¬€‚’שT ] ªb—ÊîKC^×M“xùäñz¬zJ× {4[¹M'IÆeH1LCWÕ]œûº WDæà°OÅ‚¹c²ÞuA–rL`HšpCez‡V’— Ž‚Ë„–ñ­'µR0ÕÖ=À:±G»C\nÆÉ5*¢ †3šhQ4ýÒi$Õ1"Ü]¢p-q3zcQ$ªö¨¥æf›‘»´ÝÚHá„e²JÇ–iÊ:·à¬Øc5Åk»Laª*wi [0Ówk ¦a¦0Õ²ÅÅ‚T¸’³q:Æ<¹ú Ò˜Æ}2VE•Ѐp¡Ô3Úº …h³^LJºçì¥Ánó|˜ÖˆÎˆ+« ¦dø‘Mº–d\ªDðÛ„Ì×LÝ——Ð9Ç|•FèçVm™¨€™3õS–9Äå¢<̉Ìm¢±`·º˜&Z²ž Ë®D«¶»6™‰©­HÈ Àá«h­i³04æ’hxœi3ï¨(ÓL·†‹¶ËpŒ ƒÜÒ? :õdsÀ –3æÓ·Üjâ¬9—]8n¼&]I F£¼…ì–—Œ0v°LǐÅfÛ2TÖ’aµ˜N@ÖBSÏ^à´4-±°b×nÈÈœÆD=KdŒø…ÄÈK,›ÖR§fjü$^ÔÎ!„6^ s:Üun\ôkCÞò÷<—Lúl Í›G¹ÀPá¼Nc¡šÒ…ÙWͳœ±vÊáЄ×9‹P‰cEØ‘™›µŸP<×g1 º©Ø¬wiÁ^l5× I/';Ë+´Z‡ÓÄFÕp[Èð’ HÄ ó 9¬Dl4“é±Ï”V=^Hð;žLädÉa‚°Ë,#/Ž~²BÔÛ QãñQtIeórVB,ÏÂf‹4#Μc‹É3ZIÖ Œ¢¥·üxa‡Ãçè„jŠ[5 Ä!U?,3žÎ×…ðdÓ÷háŠA‰ìÄ4÷ÃÜZÃE{‰®+W\ZÍE[‰»µk»MÝ­`¢©†˜ÃV‹-f¢¡†¢a«eŠ%«Y¨©q%jâd,Ôq`) ¤¦…šˆ ¦E>0Ùb²t–Ÿ  ÷jsςҒKÈcø(é›;k(’#ôŒQ ™C> õ³M9óºÆµ¤çâ;uÀ)5>RÔ¸fÓ~Ȧ—’-$fe«"FâUˆÊwµPÏu w+"åÉó¨6s™Û9(À¨ù©hE°½†n`m~“@©›p!Vkhµ Á1šbEqqÊ@ºèl›2 –Yã%‘‚hÛ{a¶‡ÅÞM²¬çL34®Çl]®‹ŽØŒm'RÜe35æöˆ­Á­ cP9šeÁköo´L³Ì=p8]”‡B¶,šº|ɏdzXˆØk*ÇÚ{#ñ‰pã(€¶‡9ý'šÜ³½¯kƒ†Â’ëSOƒ•Å®H6+a¢µˆ‹Y¨b˜b+XˆÖ!°u!¢"µˆˆn2ˆ Å0Ä`Å Ô®c(ÓÜGº•Ä»Œ âWî%q.áÐÄ÷î%umÍ£+ÜQ,Vn¦-GphU¸¢X­&,Gt ·K¢ÅÅ·¥RÄÊÉbKn N­R2g$VµÕó Qr#–ÓZUÏð0ÎtÙÀœz ëöo“Îk¯n„T°"SÞ+³/…€½"ižãO%Í%&Δâ‘ËØ´IˆÓ°Ë‰ÞM3.™yçÁzit›`4C`k¢¼á!álÄï sÂ[×!¤l¾æo"ƒIÔ'@ªu)3›ô®“@Z à¾] üœ'‡4¸PÞkÁ-qÄH‰ÓÍBd´ÿ —¹°ÄA&ÊUC„öz‚‚RæŠtf¬>˜ÑidšEçÑL÷áý¡V±h§­c¿¥¨ƒ@g¼…Ýö^ÞËc.ž„æ“I[ ª+·zÐÒÚ,½Ð»¶€C›7jk$๖€Ž¾ÅÙpp¶ÍþéΤ ½ØÎŒq ñpæžÅ¥#Øâ49ÃÂK^MYV“,¶Éz_òæ:…;Õ«¦I3âJ£¤û5$7Èxün\â]Êe¯(Ÿ&Ž‹¶2<6Ćf× æ¢ƱqWı[(ÙÂŽç‚T7¨@ÈÉÍß‚ïÙ"&3TYlGށ†)†#5ŠA©^T2ÆÁ†)©†©†¤yGXÁ†©"†)©¼ÅV WS†#©]R–r‹q5ÕbâWþBh¯u+ªÅÄ×ü„nÑ^êkªÁj‰jeœWˆÕÕ`µDµ2Ì+Ä µDµµ5Ô{¤Þ0RF’H÷AÛ<ÊÁ§ ƈæ0Ñ£ê4 öÚµ[¬/1²€â<-¬šö²r×0o×w ´xÐÒË„ g01¬„åEM蛇Ã\6µE›‘fÙO k÷CºnÓ1`iîÒ² áÂ!ÑLÄÿ ³¬\õ*:M=Ç»c‹2[‰ØsÕLò\ŒK L^™üÄN\¶#» Ç\……ßïIœÉ$¸ÎñÍ®ÔHÇ Ûí/´>Li”„†g^$ 7NÍÑÑ2M2ªNg=k½Ð}Ÿl6‡ —JWˆ”ÞéT·+µ¦üÂFè¢Vs6ýÆ4»2+2IÝ9ô9®ÇGÙÇ1+Ä8;*Õ§ž½D*îÑWÚçá3Ma¤·ˆ¥t}š²Ü…Q+Æüµ8HíS”üxGéÁˆ¦Ël„éÈ 5 µÄƒ6äÜ(kIš¯S†fÖ&¸®×v|Äyˆ*禌Éù@7-®Ä[]ÎÖ¿ê`º…=:…žJVnݳvðÖKE¼‚ »mà ÷f®:Ë ™–4rð¡4` ܹçž~‹C=œ…¾Ïj|VDtK.ƒ"9 Ï ­–éXá³6WÒïIL-Ї Ç PK9\KwRR styles.cssnu[/* Imitate mobile grid for activity card. */ .block_site_main_menu .activity-item .activity-grid { grid-template-columns: min-content 1fr min-content min-content min-content; grid-template-rows: 1fr repeat(4, min-content); grid-template-areas: "icon name actions" "visibility visibility visibility" "dates dates dates" "completion completion completion" "altcontent altcontent altcontent" "afterlink afterlink afterlink" "availability availability availability"; } .block_site_main_menu .activity-item .activity-grid.noname-grid { grid-template-columns: 1fr min-content; grid-template-areas: "actions" "visibility" "altcontent" "groupmode" "afterlink" "completion" "availability"; } .block_site_main_menu .activity-item .activity-grid.noname-grid .activity-actions { justify-self: end; } /* Hide extra edit elements in block space. */ .block_site_main_menu .activity-groupmode-info { display: none; } PK9\w٢ db/access.phpnu[. /** * Site main menu block caps. * * @package block_site_main_menu * @copyright Mark Nelson * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); $capabilities = array( 'block/site_main_menu:addinstance' => array( 'riskbitmask' => RISK_SPAM | RISK_XSS, 'captype' => 'write', 'contextlevel' => CONTEXT_BLOCK, 'archetypes' => array( 'editingteacher' => CAP_ALLOW, 'manager' => CAP_ALLOW ), 'clonepermissionsfrom' => 'moodle/site:manageblocks' ), ); PK9\ª lang/en/block_site_main_menu.phpnu[. /** * Strings for component 'block_site_main_menu', language 'en', branch 'MOODLE_20_STABLE' * * @package block_site_main_menu * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ $string['pluginname'] = 'Main menu'; $string['site_main_menu:addinstance'] = 'Add a new main menu block'; $string['privacy:metadata'] = 'The Main menu block only shows data stored in other locations.'; PK9\9 version.phpnu[. /** * Version details * * @package block_site_main_menu * @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); $plugin->version = 2025041400; // The current plugin version (Date: YYYYMMDDXX). $plugin->requires = 2025040800; // Requires this Moodle version. $plugin->component = 'block_site_main_menu'; // Full name of the plugin (used for diagnostics) PK9\ՎTclasses/privacy/provider.phpnu[. /** * Privacy Subsystem implementation for block_site_main_menu. * * @package block_site_main_menu * @copyright 2018 Zig Tan * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace block_site_main_menu\privacy; defined('MOODLE_INTERNAL') || die(); /** * Privacy Subsystem for block_site_main_menu implementing null_provider. * * @copyright 2018 Zig Tan * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class provider implements \core_privacy\local\metadata\null_provider { /** * Get the language string identifier with the component's language * file to explain why this plugin stores no data. * * @return string */ public static function get_reason(): string { return 'privacy:metadata'; } } PK9\ О  classes/output/mainsection.phpnu[. namespace block_site_main_menu\output; use core_courseformat\base as courseformat; use renderable; use section_info; use templatable; /** * Class mainsection * * @package block_site_main_menu * @copyright 2024 Ferran Recio * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class mainsection implements renderable, templatable { /** * The class constructor. * * @param courseformat $format the course format instance * @param section_info $section the section to render */ public function __construct( /** @var courseformat $format the course format instance. */ protected courseformat $format, /** @var section_info $section the section to render. */ protected section_info $section, ) { } /** * Export for template. * * @param \renderer_base $output * @return array */ public function export_for_template(\renderer_base $output) { $format = $this->format; $course = $format->get_course(); $section = $this->section; $sectionoutputclass = $format->get_output_classname('content\\section\\cmlist'); $sectionoutput = new $sectionoutputclass($format, $section); $cmlist = $output->render($sectionoutput); return [ 'siteid' => $course->id, 'cmlist' => $cmlist, 'sectionid' => $section->id, 'sectionname' => $format->get_section_name($section), 'sectionnum' => $section->sectionnum, 'editing' => $format->show_editor(), ]; } } PK9\P templates/mainsection.mustachenu[{{! 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 . }} {{! @template block_site_main_menu/mainsection This mustache emulates a course single section structure inside a block. It requires to include several divs to emulate the structure of a course format. Example context (json): { "cmlist": "Sample", "siteid": 1, "sectionid": 1, "sectionname": "Sample", "sectionnum": 1, "editing": true } }}
{{! The section list is used by the content module to init the sections.}}
{{! The section need some bottom padding and margin for the dropzone. Otherwise the activities will cover the area. }}
{{#editing}} {{! The section header is used as a dropzone when the section is empty.}}
 
{{/editing}} {{{cmlist}}}
{{#js}} {{! The block should be fast to load, we only load the editor when needed.}} {{#editing}} require( [ 'core_courseformat/local/content', 'core_courseformat/courseeditor' ], function( Component, Courseeditor ) { {{! The block could be included static in other courses so we use Courseeditor.getCourseEditor. }} new Component({ element: document.getElementById('block_site_main_menu_section'), reactive: Courseeditor.getCourseEditor({{siteid}}), }); } ); {{/editing}} {{/js}} PK9\нt UPGRADING.mdnu[# block_site_main_menu Upgrade notes ## 5.0 ### Removed - 'Activity' selector in site_main_menu block has been deleted. For more information see [MDL-83733](https://tracker.moodle.org/browse/MDL-83733) PK9\5!!#tests/behat/edit_activities.featurenu[@block @block_site_main_menu Feature: Edit activities in main menu block In order to use main menu block As an admin I need to add and edit activities there @javascript Scenario: Edit name of acitivity in-place in site main menu block Given the following "activity" exists: | activity | forum | | course | Acceptance test site | | name | My forum name | | idnumber | forum | And the following "blocks" exist: | blockname | contextlevel | reference | pagetypepattern | defaultregion | | site_main_menu | System | 1 | site-index | side-pre | And I log in as "admin" And I am on site homepage And I turn editing mode on When I set the field "Edit title" in the "My forum name" "activity" to "New forum name" Then I should not see "My forum name" And I should see "New forum name" And I follow "New forum name" And I should not see "My forum name" And I should see "New forum name" @javascript Scenario: Activities in main menu block can be made available but not visible on a course page Given the following config values are set as admin: | allowstealth | 1 | And the following "blocks" exist: | blockname | contextlevel | reference | pagetypepattern | defaultregion | | site_main_menu | System | 1 | site-index | side-pre | And the following "activities" exist: | activity | course | section | name | | forum | Acceptance test site | 0 | Visible forum | | forum | Acceptance test site | 0 | My forum name | And I log in as "admin" And I am on site homepage And I turn editing mode on When I open "My forum name" actions menu And I choose "Availability > Make available but don't show on course page" in the open action menu Then I should see "Available but not shown on course page" in the "My forum name" "core_courseformat > Activity visibility" # Make sure that "Availability" dropdown in the edit menu has three options. And I open "My forum name" actions menu And I choose "Edit settings" in the open action menu And I expand all fieldsets And the "Availability" select box should contain "Show on course page" And the "Availability" select box should contain "Hide on course page" And the field "Availability" matches value "Make available but don't show on course page" And I press "Save and return to course" And I should see "Available but not shown on course page" in the "My forum name" "core_courseformat > Activity visibility" And I turn editing mode off And I should see "Available but not shown on course page" in the "My forum name" "core_courseformat > Activity visibility" And I log out And I should not see "My forum name" in the "Main menu" "block" And I should see "Visible forum" in the "Main menu" "block" @javascript Scenario: The move activity modal allow to move from the main menu block to the main content Given the following "activity" exists: | activity | forum | | course | Acceptance test site | | name | My forum name | | idnumber | forum | And the following "blocks" exist: | blockname | contextlevel | reference | pagetypepattern | defaultregion | | site_main_menu | System | 1 | site-index | side-pre | And I log in as "admin" And I am on site homepage And I turn editing mode on And I should see "My forum name" in the "block_site_main_menu_section" "region" And I should not see "My forum name" in the "region-main" "region" When I open "My forum name" actions menu And I click on "Move" "link" in the "My forum name" activity And I should see "My forum name" in the "Move activity" "dialogue" And I should see "Block" in the "Move activity" "dialogue" And I should see "Site" in the "Move activity" "dialogue" And I click on "Site" "link" in the "Move activity" "dialogue" Then I should see "My forum name" in the "region-main" "region" And I should not see "My forum name" in the "block_site_main_menu_section" "region" @javascript Scenario: The move activity modal allow to move from the main content to the main menu block Given the following "activity" exists: | activity | forum | | course | Acceptance test site | | name | My forum name | | idnumber | forum | | section | 1 | And the following "blocks" exist: | blockname | contextlevel | reference | pagetypepattern | defaultregion | | site_main_menu | System | 1 | site-index | side-pre | And I log in as "admin" And I am on site homepage And I turn editing mode on And I should not see "My forum name" in the "block_site_main_menu_section" "region" And I should see "My forum name" in the "region-main" "region" When I open "My forum name" actions menu And I click on "Move" "link" in the "My forum name" activity And I should see "My forum name" in the "Move activity" "dialogue" And I should see "Block" in the "Move activity" "dialogue" And I should see "Site" in the "Move activity" "dialogue" And I click on "Block" "link" in the "Move activity" "dialogue" Then I should not see "My forum name" in the "region-main" "region" And I should see "My forum name" in the "block_site_main_menu_section" "region" @javascript Scenario: Admin can delete an activity in the main menu block Given the following "activity" exists: | activity | forum | | course | Acceptance test site | | name | My forum name | | idnumber | forum | And the following "blocks" exist: | blockname | contextlevel | reference | pagetypepattern | defaultregion | | site_main_menu | System | 1 | site-index | side-pre | And I log in as "admin" And I am on site homepage And I turn editing mode on And I should see "My forum name" in the "block_site_main_menu_section" "region" When I open "My forum name" actions menu And I choose "Delete" in the open action menu And I click on "Delete" "button" in the "Delete activity?" "dialogue" Then I should not see "My forum name" in the "block_site_main_menu_section" "region" @javascript Scenario: Admin can duplicate an activity in the main menu block Given the following "activity" exists: | activity | forum | | course | Acceptance test site | | name | My forum name | | idnumber | forum | And the following "blocks" exist: | blockname | contextlevel | reference | pagetypepattern | defaultregion | | site_main_menu | System | 1 | site-index | side-pre | And I log in as "admin" And I am on site homepage And I turn editing mode on And I should see "My forum name" in the "block_site_main_menu_section" "region" When I open "My forum name" actions menu And I choose "Duplicate" in the open action menu Then I should see "My forum name (copy)" in the "block_site_main_menu_section" "region" @javascript Scenario: Admin can move right and left an activity in the main menu block Given the following "activity" exists: | activity | forum | | course | Acceptance test site | | name | My forum name | | idnumber | forum | And the following "blocks" exist: | blockname | contextlevel | reference | pagetypepattern | defaultregion | | site_main_menu | System | 1 | site-index | side-pre | And I log in as "admin" And I am on site homepage And I turn editing mode on And I should see "My forum name" in the "block_site_main_menu_section" "region" When I open "My forum name" actions menu And "Move right" "link" should be visible And "Move left" "link" should not be visible And I choose "Move right" in the open action menu Then I open "My forum name" actions menu And "Move right" "link" should not be visible And "Move left" "link" should be visible And I choose "Move left" in the open action menu And I open "My forum name" actions menu And "Move right" "link" should be visible And "Move left" "link" should not be visible PK9\##5tests/behat/behat_block_site_main_menu_deprecated.phpnu[. // NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php. require_once(__DIR__ . '/../../../../lib/behat/behat_deprecated_base.php'); use Behat\Mink\Element\NodeElement; use Behat\Mink\Exception\ExpectationException as ExpectationException; use Behat\Mink\Exception\DriverException as DriverException; use Behat\Mink\Exception\ElementNotFoundException as ElementNotFoundException; /** * Behat steps in plugin block_site_main_menu * * @package block_site_main_menu * @category test * @copyright 2024 Ferran Recio * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class behat_block_site_main_menu_deprecated extends behat_deprecated_base { /** * Returns the DOM node of the activity in the site menu block * * @todo MDL-78077 This will be deleted in Moodle 6.0. * @throws ElementNotFoundException Thrown by behat_base::find * @param string $activityname The activity name * @return NodeElement */ protected function get_site_menu_activity_node($activityname) { $activityname = behat_context_helper::escape($activityname); $xpath = "//*[contains(concat(' ',normalize-space(@class),' '),' block_site_main_menu ')]//li[contains(., $activityname)]"; return $this->find('xpath', $xpath); } /** * Clicks on the specified element of the activity. You should be in the course page with editing mode turned on. * * @todo MDL-78077 This will be deleted in Moodle 6.0. * @deprecated since 5.0 * * @Given /^I click on "(?P(?:[^"]|\\")*)" "(?P(?:[^"]|\\")*)" in the "(?P(?:[^"]|\\")*)" activity in site main menu block$/ * @param string $element * @param string $selectortype * @param string $activityname */ public function i_click_on_in_the_activity_in_site_main_menu_block($element, $selectortype, $activityname) { $this->deprecated_message([ 'behat_block_site_main_menu::i_click_on_in_the_activity_in_site_main_menu_block is deprecated', 'Use: I open ACTIVITYNAME actions menu & I choose OPTIONTEXT in the open action menu', ]); $element = $this->get_site_menu_activity_element($element, $selectortype, $activityname); $element->click(); } /** * Clicks on the specified element inside the activity container. * * @todo MDL-78077 This will be deleted in Moodle 6.0. * @throws ElementNotFoundException * @param string $element * @param string $selectortype * @param string $activityname * @return NodeElement */ protected function get_site_menu_activity_element($element, $selectortype, $activityname) { $activitynode = $this->get_site_menu_activity_node($activityname); $exception = new ElementNotFoundException($this->getSession(), "'{$element}' '{$selectortype}' in '{$activityname}'"); return $this->find($selectortype, $element, $exception, $activitynode); } /** * Checks that the specified activity's action menu contains an item. * * @todo MDL-78077 This will be deleted in Moodle 6.0. * @deprecated since 5.0 * * @Then /^"(?P(?:[^"]|\\")*)" activity in site main menu block should have "(?P(?:[^"]|\\")*)" editing icon$/ * @param string $activityname * @param string $iconname */ public function activity_in_site_main_menu_block_should_have_editing_icon($activityname, $iconname) { $this->deprecated_message([ 'behat_block_site_main_menu::activity_in_site_main_menu_block_should_have_editing_icon is deprecated', 'Use: I should see WHATEVER in the ACTIVITYNAME "activity"', ]); $activitynode = $this->get_site_menu_activity_node($activityname); $notfoundexception = new ExpectationException('"' . $activityname . '" doesn\'t have a "' . $iconname . '" editing icon', $this->getSession()); $this->find('named_partial', ['link', $iconname], $notfoundexception, $activitynode); } /** * Checks that the specified activity's action menu contains an item. * * @todo MDL-78077 This will be deleted in Moodle 6.0. * @deprecated since 5.0 * * @Then /^"(?P(?:[^"]|\\")*)" activity in site main menu block should not have "(?P(?:[^"]|\\")*)" editing icon$/ * @param string $activityname * @param string $iconname */ public function activity_in_site_main_menu_block_should_not_have_editing_icon($activityname, $iconname) { $this->deprecated_message([ 'behat_block_site_main_menu::activity_in_site_main_menu_block_should_not_have_editing_icon is deprecated', 'Use: I should not see WHATEVER in the ACTIVITYNAME "activity"', ]); $activitynode = $this->get_site_menu_activity_node($activityname); try { $this->find('named_partial', array('link', $iconname), false, $activitynode); throw new ExpectationException('"' . $activityname . '" has a "' . $iconname . '" editing icon when it should not', $this->getSession()); } catch (ElementNotFoundException $e) { // This is good, the menu item should not be there. } } /** * Checks that the specified activity is hidden. * * @todo MDL-78077 This will be deleted in Moodle 6.0. * @deprecated since 5.0 * * @Then /^"(?P(?:[^"]|\\")*)" activity in site main menu block should be hidden$/ * @param string $activityname */ public function activity_in_site_main_menu_block_should_be_hidden($activityname) { $this->deprecated_message([ 'behat_block_site_main_menu::activity_in_site_main_menu_block_should_be_hidden is deprecated', 'Use: I should see "Hidden from students" in the "ACTIVITYNAME" "core_courseformat > Activity visibility"', ]); $activitynode = $this->get_site_menu_activity_node($activityname); $exception = new ExpectationException('"' . $activityname . '" is not hidden', $this->getSession()); $this->find('named_partial', ['badge', get_string('hiddenfromstudents')], $exception, $activitynode); } /** * Checks that the specified activity is hidden. * * @todo MDL-78077 This will be deleted in Moodle 6.0. * @deprecated since 5.0 * * @Then /^"(?P(?:[^"]|\\")*)" activity in site main menu block should be available but hidden from course page$/ * @param string $activityname */ public function activity_in_site_main_menu_block_should_be_available_but_hidden_from_course_page($activityname) { $this->deprecated_message([ 'behat_block_site_main_menu::activity_in_site_main_menu_block_should_be_available_but_hidden_from_course_page is deprecated', 'Use: I should see "Available but not shown on course page" in the "ACTIVITYNAME" "core_courseformat > Activity visibility"', ]); $activitynode = $this->get_site_menu_activity_node($activityname); $exception = new ExpectationException('"' . $activityname . '" is not hidden but available', $this->getSession()); $this->find('named_partial', ['badge', get_string('hiddenoncoursepage')], $exception, $activitynode); } /** * Opens an activity actions menu if it is not already opened. * * @todo MDL-78077 This will be deleted in Moodle 6.0. * @deprecated since 5.0 * * @Given /^I open "(?P(?:[^"]|\\")*)" actions menu in site main menu block$/ * @throws DriverException The step is not available when Javascript is disabled * @param string $activityname */ public function i_open_actions_menu_in_site_main_menu_block($activityname) { $this->deprecated_message([ 'behat_block_site_main_menu::i_open_actions_menu_in_site_main_menu_block is deprecated', 'Use: I open "ACTIVITYNAME" actions menu', ]); $activityname = behat_context_helper::escape($activityname); $xpath = "//*[contains(concat(' ',normalize-space(@class),' '),' block_site_main_menu ')]//li[contains(., $activityname)]"; $this->execute('behat_action_menu::i_open_the_action_menu_in', [$xpath, 'xpath_element']); } } PK9\<tests/behat/add_url.featurenu[@block @block_site_main_menu Feature: Add URL to main menu block In order to add helpful resources for students As a admin I need to add URLs to the main menu block and check it works. Background: Given the following "courses" exist: | fullname | shortname | category | enablecompletion | | Course 1 | C1 | 0 | 1 | | Course 2 | C2 | 0 | | And the following "blocks" exist: | blockname | contextlevel | reference | pagetypepattern | defaultregion | | site_main_menu | System | 1 | site-index | side-pre | @javascript Scenario: Add a URL in menu block and ensure it appears Given I log in as "admin" And I am on site homepage And the following "activity" exists: | activity | url | | course | Acceptance test site | | name | reference link | | intro | mooooooooodle | | externalurl | http://www.moodle.com | | section | 0 | When I am on the "reference link" "url activity editing" page And I expand all fieldsets And I set the following fields to these values: | id_display | In pop-up | And I press "Save and return to course" And I turn editing mode on Then "reference link" "link" should exist in the "Main menu" "block" And "Add an activity or resource" "button" should exist in the "Main menu" "block" @javascript Scenario: Add a URL in menu block can appear in the entire site When I log in as "admin" And I am on site homepage And I turn editing mode on And I configure the "Main menu" block And I set the following fields to these values: | Page contexts | Display throughout the entire site | And I press "Save changes" And the following "activity" exists: | activity | url | | course | Acceptance test site | | name | reference link | | intro | mooooooooodle | | externalurl | http://www.moodle.com | | section | 0 | And I am on the "reference link" "url activity editing" page And I expand all fieldsets And I set the following fields to these values: | id_display | Embed | And I press "Save and return to course" Then I click on "reference link" "link" in the "Main menu" "block" And "reference link" "link" should exist in the "Main menu" "block" And I am on the "C1" "Course" page And "reference link" "link" should exist in the "Main menu" "block" And I navigate to "Badges > Add a new badge" in site administration And "reference link" "link" should exist in the "Main menu" "block" @javascript Scenario: Add a URL in menu block can appear in any front page When I log in as "admin" And I am on site homepage And I turn editing mode on And I configure the "Main menu" block And I set the following fields to these values: | Page contexts | Display on the site home and any pages added to the site home. | And I press "Save changes" And the following "activity" exists: | activity | url | | course | Acceptance test site | | name | reference link | | intro | mooooooooodle | | externalurl | http://www.moodle.com | | section | 0 | And I am on the "reference link" "url activity editing" page And I expand all fieldsets And I set the following fields to these values: | id_display | Embed | And I press "Save and return to course" Then I click on "reference link" "link" in the "Main menu" "block" And "reference link" "link" should exist in the "Main menu" "block" And I am on the "C1" "Course" page And "Main menu" "block" should not exist And I navigate to "Badges > Add a new badge" in site administration And "Main menu" "block" should not exist @javascript Scenario: When the "Main Menu" block is displayed throrought the entire site, adding an URL in a course results in adding it in the course and not in the frontpage Given I log in as "admin" And I am on site homepage And I turn editing mode on And I configure the "Main menu" block And I set the following fields to these values: | Page contexts | Display throughout the entire site | And I press "Save changes" When the following "activity" exists: | activity | url | | course | C2 | | name | reference link | | intro | mooooooooodle | | externalurl | http://www.moodle.com | | section | 0 | | showdescription | 1 | And I am on the "reference link" "url activity editing" page And I expand all fieldsets And I set the following fields to these values: | id_display | In pop-up | And I press "Save and return to course" Then "reference link" "link" should not exist in the "Main menu" "block" And I should see "mooooooooodle" in the "region-main" "region" PK9\ީ9  block_site_main_menu.phpnu[. defined('MOODLE_INTERNAL') || die(); require_once($CFG->dirroot . '/course/lib.php'); /** * Site main menu block. * * @package block_site_main_menu * @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class block_site_main_menu extends block_base { function init() { $this->title = get_string('pluginname', 'block_site_main_menu'); } function applicable_formats() { return array('site' => true); } function get_content() { if ($this->content !== NULL) { return $this->content; } $this->content = new stdClass(); $this->content->text = ''; $this->content->footer = ''; if (empty($this->instance)) { return $this->content; } $course = get_site(); course_create_sections_if_missing($course, 0); $format = course_get_format($course); $modinfo = $format->get_modinfo(); $section = $modinfo->get_section_info(0); $courserenderer = $format->get_renderer($this->page); $output = new block_site_main_menu\output\mainsection($format, $section); $this->content->text = $courserenderer->render($output); if ($this->page->course->id === SITEID) { $this->content->footer = $courserenderer->course_section_add_cm_control( course: $course, section: 0, sectionreturn: null, displayoptions: ['inblock' => true], ); } return $this->content; } } PK9\KwRR styles.cssnu[PK9\w٢ db/access.phpnu[PK9\ª  lang/en/block_site_main_menu.phpnu[PK9\9 version.phpnu[PK9\ՎTclasses/privacy/provider.phpnu[PK9\ О  classes/output/mainsection.phpnu[PK9\P V#templates/mainsection.mustachenu[PK9\нt -.UPGRADING.mdnu[PK9\5!!#9/tests/behat/edit_activities.featurenu[PK9\##5ZQtests/behat/behat_block_site_main_menu_deprecated.phpnu[PK9\<utests/behat/add_url.featurenu[PK9\ީ9  block_site_main_menu.phpnu[PK 1