diff --git a/course/amd/build/local/activitychooser/exporter.min.js b/course/amd/build/local/activitychooser/exporter.min.js index 2059c4b8382..e1e0c861db7 100644 --- a/course/amd/build/local/activitychooser/exporter.min.js +++ b/course/amd/build/local/activitychooser/exporter.min.js @@ -6,6 +6,6 @@ define("core_course/local/activitychooser/exporter",["exports","core/str"],(func * @copyright 2025 Ferran Recio * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -const activityCategories=["activities","resources"];let allStrings=null;loadNecessaryStrings();async function loadNecessaryStrings(){if(null!==allStrings)return allStrings;allStrings={};const stringToLoad=[{key:"all",component:"core"},{key:"favourites",component:"core"},{key:"recommended",component:"core"},{key:"recommended_help",component:"core_course"},...activityCategories.map((key=>({key:key,component:"core"}))),...activityCategories.map((key=>({key:key+"_help",component:"core"})))],loadedStrings=await(0,_str.getStrings)(stringToLoad);return stringToLoad.forEach(((_ref,index)=>{let{key:key}=_ref;allStrings[key]=loadedStrings[index]})),allStrings}return _exports.default=class{getTabData(tabId,filteredModules,tabLabel){let tabHelp=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const result={tabId:tabId,active:arguments.length>4&&void 0!==arguments[4]&&arguments[4],items:filteredModules,displayed:filteredModules.length>0,tabLabel:tabLabel};return tabHelp&&(result.tabHelp=tabHelp),result}normaliseModulesData(modulesData){if(modulesData instanceof Map)modulesData=Array.from(modulesData.values());else if(!Array.isArray(modulesData))throw new Error("Invalid modules data format. Expected an array or a Map.");return modulesData}async getModChooserTemplateData(modulesData){modulesData=this.normaliseModulesData(modulesData);const allStrings=await loadNecessaryStrings(),favouriteTab=await this.getFavouriteTabData(modulesData),tabs=[{...this.getTabData("all",modulesData,allStrings.all,null,!favouriteTab.displayed),hasSearchResults:!0},favouriteTab,{...this.getTabData("recommended",modulesData.filter((mod=>!0===mod.recommended)),allStrings.recommended,allStrings.recommended_help),separator:!0}];return activityCategories.forEach(((category,index)=>{const categoryModules=modulesData.filter((mod=>mod.archetype==index));0!==categoryModules.length&&tabs.push(this.getTabData(category,categoryModules,allStrings[category],allStrings[category+"_help"]))})),{modules:modulesData,tabs:tabs}}async getFavouriteTabData(modulesData){modulesData=this.normaliseModulesData(modulesData);const allStrings=await loadNecessaryStrings(),favouriteModules=modulesData.filter((mod=>!0===mod.favourite));return this.getTabData("favourites",favouriteModules,allStrings.favourites,null,favouriteModules.length>0)}getSearchResultData(resultsModulesData){return{searchresultsnumber:(resultsModulesData=this.normaliseModulesData(resultsModulesData)).length,searchresults:resultsModulesData}}countTabItems(tabData){var _tabData$items$length,_tabData$items;return null!==(_tabData$items$length=null===(_tabData$items=tabData.items)||void 0===_tabData$items?void 0:_tabData$items.length)&&void 0!==_tabData$items$length?_tabData$items$length:0}},_exports.default})); +const activityCategories=["administration","assessment","collaboration","communication","content","interactivecontent"];let allStrings=null;loadNecessaryStrings();async function loadNecessaryStrings(){if(null!==allStrings)return allStrings;allStrings={};const stringToLoad=[{key:"all",component:"core"},{key:"favourites",component:"core"},{key:"recommended",component:"core"},{key:"recommended_help",component:"core_course"},...activityCategories.map((key=>({key:"mod_purpose_"+key,component:"core_course"}))),...activityCategories.map((key=>({key:"mod_purpose_"+key+"_help",component:"core_course"})))],loadedStrings=await(0,_str.getStrings)(stringToLoad);return stringToLoad.forEach(((_ref,index)=>{let{key:key}=_ref;allStrings[key]=loadedStrings[index]})),allStrings}return _exports.default=class{getTabData(tabId,filteredModules,tabLabel){let tabHelp=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const result={tabId:tabId,active:arguments.length>4&&void 0!==arguments[4]&&arguments[4],items:filteredModules,displayed:filteredModules.length>0,tabLabel:tabLabel};return tabHelp&&(result.tabHelp=tabHelp),result}normaliseModulesData(modulesData){if(modulesData instanceof Map)modulesData=Array.from(modulesData.values());else if(!Array.isArray(modulesData))throw new Error("Invalid modules data format. Expected an array or a Map.");return modulesData}async getModChooserTemplateData(modulesData){modulesData=this.normaliseModulesData(modulesData);const allStrings=await loadNecessaryStrings(),favouriteTab=await this.getFavouriteTabData(modulesData),tabs=[{...this.getTabData("all",modulesData,allStrings.all,null,!favouriteTab.displayed),hasSearchResults:!0},favouriteTab,{...this.getTabData("recommended",modulesData.filter((mod=>!0===mod.recommended)),allStrings.recommended,allStrings.recommended_help),separator:!0}];return activityCategories.forEach((category=>{const categoryModules=modulesData.filter((mod=>mod.purpose==category));0!==categoryModules.length&&tabs.push(this.getTabData(category,categoryModules,allStrings["mod_purpose_"+category],allStrings["mod_purpose_"+category+"_help"]))})),{modules:modulesData,tabs:tabs}}async getFavouriteTabData(modulesData){modulesData=this.normaliseModulesData(modulesData);const allStrings=await loadNecessaryStrings(),favouriteModules=modulesData.filter((mod=>!0===mod.favourite));return this.getTabData("favourites",favouriteModules,allStrings.favourites,null,favouriteModules.length>0)}getSearchResultData(resultsModulesData){return{searchresultsnumber:(resultsModulesData=this.normaliseModulesData(resultsModulesData)).length,searchresults:resultsModulesData}}countTabItems(tabData){var _tabData$items$length,_tabData$items;return null!==(_tabData$items$length=null===(_tabData$items=tabData.items)||void 0===_tabData$items?void 0:_tabData$items.length)&&void 0!==_tabData$items$length?_tabData$items$length:0}},_exports.default})); //# sourceMappingURL=exporter.min.js.map \ No newline at end of file diff --git a/course/amd/build/local/activitychooser/exporter.min.js.map b/course/amd/build/local/activitychooser/exporter.min.js.map index bea713a366c..79326021b13 100644 --- a/course/amd/build/local/activitychooser/exporter.min.js.map +++ b/course/amd/build/local/activitychooser/exporter.min.js.map @@ -1 +1 @@ -{"version":3,"file":"exporter.min.js","sources":["../../../src/local/activitychooser/exporter.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Module to generate template data for the activity chooser.\n *\n * @module core_course/local/activitychooser/exporter\n * @copyright 2025 Ferran Recio \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {getStrings} from 'core/str';\n\nconst activityCategories = ['activities', 'resources'];\n\nlet allStrings = null;\n\nloadNecessaryStrings();\n\nexport default class {\n /**\n * A tab data structure.\n *\n * @typedef {object} TabData\n * @property {String} tabId the tab ID\n * @property {Boolean} active whether the tab is active or not\n * @property {Array} items the filtered modules to be displayed in the tab\n * @property {Boolean} displayed whether the tab is displayed or not\n * @property {String} tabLabel the tab label\n * @property {String|null} tabHelp the help text for the tab (optional)\n */\n\n /**\n * Generate a tab data object for the activity chooser.\n *\n * @private\n * @param {String} tabId Tab ID.\n * @param {Array} filteredModules Filtered modules to be displayed in the tab.\n * @param {String} tabLabel Tab label.\n * @param {String|null} tabHelp Help text for the tab (optional).\n * @param {Boolean} active Whether the tab is active or not.\n * @return {TabData} Tab data object.\n */\n getTabData(tabId, filteredModules, tabLabel, tabHelp = null, active = false) {\n const result = {\n tabId: tabId,\n active: active,\n items: filteredModules,\n displayed: filteredModules.length > 0,\n tabLabel,\n };\n if (tabHelp) {\n result.tabHelp = tabHelp;\n }\n return result;\n }\n\n /**\n * Normalise the modules data to be used in the chooser.\n *\n * The modulesData can be a plain array or a Map. This method will convert it to a\n * plain array of objects.\n *\n * @param {Array|Map} modulesData Modules data to be used in the chooser.\n * @return {Array} Normalised modules data.\n */\n normaliseModulesData(modulesData) {\n if (modulesData instanceof Map) {\n modulesData = Array.from(modulesData.values());\n } else if (!Array.isArray(modulesData)) {\n throw new Error('Invalid modules data format. Expected an array or a Map.');\n }\n return modulesData;\n }\n\n /**\n * Fetch the chooser template data for a specific section.\n *\n * @param {Array|Map} modulesData Modules data to be used in the chooser.\n * @return {Promise} Promise resolved with the template data.\n */\n async getModChooserTemplateData(modulesData) {\n modulesData = this.normaliseModulesData(modulesData);\n const allStrings = await loadNecessaryStrings();\n const favouriteTab = await this.getFavouriteTabData(modulesData);\n\n const tabs = [\n {\n ...this.getTabData(\n 'all',\n modulesData,\n allStrings.all,\n null,\n !favouriteTab.displayed,\n ),\n hasSearchResults: true, // The all tab will also show search results.\n },\n favouriteTab,\n {\n ...this.getTabData(\n 'recommended',\n modulesData.filter(mod => mod.recommended === true),\n allStrings.recommended,\n allStrings.recommended_help\n ),\n separator: true, // Add a separator before the purpose categories.\n },\n ];\n\n activityCategories.forEach((category, index) => {\n const categoryModules = modulesData.filter(mod => mod.archetype == index);\n if (categoryModules.length === 0) {\n return;\n }\n tabs.push(\n this.getTabData(\n category,\n categoryModules,\n allStrings[category],\n allStrings[category + '_help']\n )\n );\n });\n\n return {\n modules: modulesData,\n tabs,\n };\n }\n\n /**\n * Get the favourite tab data.\n *\n * @param {Array|Map} modulesData Modules data to be used in the chooser.\n * @return {Promise} Promise resolved with the template data.\n */\n async getFavouriteTabData(modulesData) {\n modulesData = this.normaliseModulesData(modulesData);\n const allStrings = await loadNecessaryStrings();\n\n // We need to deconstruct the modules data to ensure it is an array.\n const favouriteModules = modulesData.filter(\n mod => {\n return mod.favourite === true;\n }\n );\n\n return this.getTabData(\n 'favourites',\n favouriteModules,\n allStrings.favourites,\n null,\n favouriteModules.length > 0,\n );\n }\n\n /**\n * Get the search result template data.\n *\n * @param {Array|Map} resultsModulesData Modules data to be used in the chooser.\n * @return {Object} The template data.\n */\n getSearchResultData(resultsModulesData) {\n resultsModulesData = this.normaliseModulesData(resultsModulesData);\n return {\n 'searchresultsnumber': resultsModulesData.length,\n 'searchresults': resultsModulesData,\n };\n }\n\n /**\n * Get the number of items in a tab.\n *\n * @param {TabData} tabData The tab data.\n * @return {Number} The number of items in the tab.\n */\n countTabItems(tabData) {\n return tabData.items?.length ?? 0;\n }\n\n}\n\n/**\n * Load the necessary strings for the activity chooser.\n *\n * @return {Promise} Promise resolved with the loaded strings.\n */\nasync function loadNecessaryStrings() {\n if (allStrings !== null) {\n return allStrings;\n }\n allStrings = {};\n\n const stringToLoad = [\n {key: 'all', component: 'core'},\n {key: 'favourites', component: 'core'},\n {key: 'recommended', component: 'core'},\n {key: 'recommended_help', component: 'core_course'},\n ...activityCategories.map(\n (key) => ({\n key: key,\n component: 'core',\n })\n ),\n ...activityCategories.map(\n (key) => ({\n key: key + '_help',\n component: 'core',\n })\n ),\n ];\n\n const loadedStrings = await getStrings(stringToLoad);\n stringToLoad.forEach(({key}, index) => {\n allStrings[key] = loadedStrings[index];\n });\n return allStrings;\n}\n"],"names":["activityCategories","allStrings","loadNecessaryStrings","stringToLoad","key","component","map","loadedStrings","forEach","index","getTabData","tabId","filteredModules","tabLabel","tabHelp","result","active","items","displayed","length","normaliseModulesData","modulesData","Map","Array","from","values","isArray","Error","this","favouriteTab","getFavouriteTabData","tabs","all","hasSearchResults","filter","mod","recommended","recommended_help","separator","category","categoryModules","archetype","push","modules","favouriteModules","favourite","favourites","getSearchResultData","resultsModulesData","countTabItems","tabData","_tabData$items"],"mappings":";;;;;;;;MAyBMA,mBAAqB,CAAC,aAAc,iBAEtCC,WAAa,KAEjBC,sCA0KeA,0BACQ,OAAfD,kBACOA,WAEXA,WAAa,SAEPE,aAAe,CACjB,CAACC,IAAK,MAAOC,UAAW,QACxB,CAACD,IAAK,aAAcC,UAAW,QAC/B,CAACD,IAAK,cAAeC,UAAW,QAChC,CAACD,IAAK,mBAAoBC,UAAW,kBAClCL,mBAAmBM,KACjBF,OACGA,IAAKA,IACLC,UAAW,cAGhBL,mBAAmBM,KACjBF,OACGA,IAAKA,IAAM,QACXC,UAAW,YAKjBE,oBAAsB,mBAAWJ,qBACvCA,aAAaK,SAAQ,MAAQC,aAAPL,IAACA,UACnBH,WAAWG,KAAOG,cAAcE,UAE7BR,yCA7KPS,WAAWC,MAAOC,gBAAiBC,cAAUC,+DAAU,WAC7CC,OAAS,CACXJ,MAAOA,MACPK,+DACAC,MAAOL,gBACPM,UAAWN,gBAAgBO,OAAS,EACpCN,SAAAA,iBAEAC,UACAC,OAAOD,QAAUA,SAEdC,OAYXK,qBAAqBC,gBACbA,uBAAuBC,IACvBD,YAAcE,MAAMC,KAAKH,YAAYI,eAClC,IAAKF,MAAMG,QAAQL,mBAChB,IAAIM,MAAM,mEAEbN,4CASqBA,aAC5BA,YAAcO,KAAKR,qBAAqBC,mBAClCpB,iBAAmBC,uBACnB2B,mBAAqBD,KAAKE,oBAAoBT,aAE9CU,KAAO,CACT,IACOH,KAAKlB,WACJ,MACAW,YACApB,WAAW+B,IACX,MACCH,aAAaX,WAElBe,kBAAkB,GAEtBJ,aACA,IACOD,KAAKlB,WACJ,cACAW,YAAYa,QAAOC,MAA2B,IAApBA,IAAIC,cAC9BnC,WAAWmC,YACXnC,WAAWoC,kBAEfC,WAAW,WAInBtC,mBAAmBQ,SAAQ,CAAC+B,SAAU9B,eAC5B+B,gBAAkBnB,YAAYa,QAAOC,KAAOA,IAAIM,WAAahC,QACpC,IAA3B+B,gBAAgBrB,QAGpBY,KAAKW,KACDd,KAAKlB,WACD6B,SACAC,gBACAvC,WAAWsC,UACXtC,WAAWsC,SAAW,cAK3B,CACHI,QAAStB,YACTU,KAAAA,gCAUkBV,aACtBA,YAAcO,KAAKR,qBAAqBC,mBAClCpB,iBAAmBC,uBAGnB0C,iBAAmBvB,YAAYa,QACjCC,MAC6B,IAAlBA,IAAIU,mBAIZjB,KAAKlB,WACR,aACAkC,iBACA3C,WAAW6C,WACX,KACAF,iBAAiBzB,OAAS,GAUlC4B,oBAAoBC,0BAET,sBADPA,mBAAqBpB,KAAKR,qBAAqB4B,qBAED7B,qBACzB6B,oBAUzBC,cAAcC,8GACHA,QAAQjC,uCAARkC,eAAehC,8DAAU"} \ No newline at end of file +{"version":3,"file":"exporter.min.js","sources":["../../../src/local/activitychooser/exporter.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Module to generate template data for the activity chooser.\n *\n * @module core_course/local/activitychooser/exporter\n * @copyright 2025 Ferran Recio \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {getStrings} from 'core/str';\n\nconst activityCategories = [\n 'administration',\n 'assessment',\n 'collaboration',\n 'communication',\n 'content',\n 'interactivecontent',\n];\n\nlet allStrings = null;\n\nloadNecessaryStrings();\n\nexport default class {\n /**\n * A tab data structure.\n *\n * @typedef {object} TabData\n * @property {String} tabId the tab ID\n * @property {Boolean} active whether the tab is active or not\n * @property {Array} items the filtered modules to be displayed in the tab\n * @property {Boolean} displayed whether the tab is displayed or not\n * @property {String} tabLabel the tab label\n * @property {String|null} tabHelp the help text for the tab (optional)\n */\n\n /**\n * Generate a tab data object for the activity chooser.\n *\n * @private\n * @param {String} tabId Tab ID.\n * @param {Array} filteredModules Filtered modules to be displayed in the tab.\n * @param {String} tabLabel Tab label.\n * @param {String|null} tabHelp Help text for the tab (optional).\n * @param {Boolean} active Whether the tab is active or not.\n * @return {TabData} Tab data object.\n */\n getTabData(tabId, filteredModules, tabLabel, tabHelp = null, active = false) {\n const result = {\n tabId: tabId,\n active: active,\n items: filteredModules,\n displayed: filteredModules.length > 0,\n tabLabel,\n };\n if (tabHelp) {\n result.tabHelp = tabHelp;\n }\n return result;\n }\n\n /**\n * Normalise the modules data to be used in the chooser.\n *\n * The modulesData can be a plain array or a Map. This method will convert it to a\n * plain array of objects.\n *\n * @param {Array|Map} modulesData Modules data to be used in the chooser.\n * @return {Array} Normalised modules data.\n */\n normaliseModulesData(modulesData) {\n if (modulesData instanceof Map) {\n modulesData = Array.from(modulesData.values());\n } else if (!Array.isArray(modulesData)) {\n throw new Error('Invalid modules data format. Expected an array or a Map.');\n }\n return modulesData;\n }\n\n /**\n * Fetch the chooser template data for a specific section.\n *\n * @param {Array|Map} modulesData Modules data to be used in the chooser.\n * @return {Promise} Promise resolved with the template data.\n */\n async getModChooserTemplateData(modulesData) {\n modulesData = this.normaliseModulesData(modulesData);\n const allStrings = await loadNecessaryStrings();\n const favouriteTab = await this.getFavouriteTabData(modulesData);\n\n const tabs = [\n {\n ...this.getTabData(\n 'all',\n modulesData,\n allStrings.all,\n null,\n !favouriteTab.displayed,\n ),\n hasSearchResults: true, // The all tab will also show search results.\n },\n favouriteTab,\n {\n ...this.getTabData(\n 'recommended',\n modulesData.filter(mod => mod.recommended === true),\n allStrings.recommended,\n allStrings.recommended_help\n ),\n separator: true, // Add a separator before the purpose categories.\n },\n ];\n\n activityCategories.forEach((category) => {\n const categoryModules = modulesData.filter(mod => mod.purpose == category);\n if (categoryModules.length === 0) {\n return;\n }\n tabs.push(\n this.getTabData(\n category,\n categoryModules,\n allStrings['mod_purpose_' + category],\n allStrings['mod_purpose_' + category + '_help']\n )\n );\n });\n\n return {\n modules: modulesData,\n tabs,\n };\n }\n\n /**\n * Get the favourite tab data.\n *\n * @param {Array|Map} modulesData Modules data to be used in the chooser.\n * @return {Promise} Promise resolved with the template data.\n */\n async getFavouriteTabData(modulesData) {\n modulesData = this.normaliseModulesData(modulesData);\n const allStrings = await loadNecessaryStrings();\n\n // We need to deconstruct the modules data to ensure it is an array.\n const favouriteModules = modulesData.filter(\n mod => {\n return mod.favourite === true;\n }\n );\n\n return this.getTabData(\n 'favourites',\n favouriteModules,\n allStrings.favourites,\n null,\n favouriteModules.length > 0,\n );\n }\n\n /**\n * Get the search result template data.\n *\n * @param {Array|Map} resultsModulesData Modules data to be used in the chooser.\n * @return {Object} The template data.\n */\n getSearchResultData(resultsModulesData) {\n resultsModulesData = this.normaliseModulesData(resultsModulesData);\n return {\n 'searchresultsnumber': resultsModulesData.length,\n 'searchresults': resultsModulesData,\n };\n }\n\n /**\n * Get the number of items in a tab.\n *\n * @param {TabData} tabData The tab data.\n * @return {Number} The number of items in the tab.\n */\n countTabItems(tabData) {\n return tabData.items?.length ?? 0;\n }\n\n}\n\n/**\n * Load the necessary strings for the activity chooser.\n *\n * @return {Promise} Promise resolved with the loaded strings.\n */\nasync function loadNecessaryStrings() {\n if (allStrings !== null) {\n return allStrings;\n }\n allStrings = {};\n\n const stringToLoad = [\n {key: 'all', component: 'core'},\n {key: 'favourites', component: 'core'},\n {key: 'recommended', component: 'core'},\n {key: 'recommended_help', component: 'core_course'},\n ...activityCategories.map(\n (key) => ({\n key: 'mod_purpose_' + key,\n component: 'core_course',\n })\n ),\n ...activityCategories.map(\n (key) => ({\n key: 'mod_purpose_' + key + '_help',\n component: 'core_course',\n })\n ),\n ];\n\n const loadedStrings = await getStrings(stringToLoad);\n stringToLoad.forEach(({key}, index) => {\n allStrings[key] = loadedStrings[index];\n });\n return allStrings;\n}\n"],"names":["activityCategories","allStrings","loadNecessaryStrings","stringToLoad","key","component","map","loadedStrings","forEach","index","getTabData","tabId","filteredModules","tabLabel","tabHelp","result","active","items","displayed","length","normaliseModulesData","modulesData","Map","Array","from","values","isArray","Error","this","favouriteTab","getFavouriteTabData","tabs","all","hasSearchResults","filter","mod","recommended","recommended_help","separator","category","categoryModules","purpose","push","modules","favouriteModules","favourite","favourites","getSearchResultData","resultsModulesData","countTabItems","tabData","_tabData$items"],"mappings":";;;;;;;;MAyBMA,mBAAqB,CACvB,iBACA,aACA,gBACA,gBACA,UACA,0BAGAC,WAAa,KAEjBC,sCA0KeA,0BACQ,OAAfD,kBACOA,WAEXA,WAAa,SAEPE,aAAe,CACjB,CAACC,IAAK,MAAOC,UAAW,QACxB,CAACD,IAAK,aAAcC,UAAW,QAC/B,CAACD,IAAK,cAAeC,UAAW,QAChC,CAACD,IAAK,mBAAoBC,UAAW,kBAClCL,mBAAmBM,KACjBF,OACGA,IAAK,eAAiBA,IACtBC,UAAW,qBAGhBL,mBAAmBM,KACjBF,OACGA,IAAK,eAAiBA,IAAM,QAC5BC,UAAW,mBAKjBE,oBAAsB,mBAAWJ,qBACvCA,aAAaK,SAAQ,MAAQC,aAAPL,IAACA,UACnBH,WAAWG,KAAOG,cAAcE,UAE7BR,yCA7KPS,WAAWC,MAAOC,gBAAiBC,cAAUC,+DAAU,WAC7CC,OAAS,CACXJ,MAAOA,MACPK,+DACAC,MAAOL,gBACPM,UAAWN,gBAAgBO,OAAS,EACpCN,SAAAA,iBAEAC,UACAC,OAAOD,QAAUA,SAEdC,OAYXK,qBAAqBC,gBACbA,uBAAuBC,IACvBD,YAAcE,MAAMC,KAAKH,YAAYI,eAClC,IAAKF,MAAMG,QAAQL,mBAChB,IAAIM,MAAM,mEAEbN,4CASqBA,aAC5BA,YAAcO,KAAKR,qBAAqBC,mBAClCpB,iBAAmBC,uBACnB2B,mBAAqBD,KAAKE,oBAAoBT,aAE9CU,KAAO,CACT,IACOH,KAAKlB,WACJ,MACAW,YACApB,WAAW+B,IACX,MACCH,aAAaX,WAElBe,kBAAkB,GAEtBJ,aACA,IACOD,KAAKlB,WACJ,cACAW,YAAYa,QAAOC,MAA2B,IAApBA,IAAIC,cAC9BnC,WAAWmC,YACXnC,WAAWoC,kBAEfC,WAAW,WAInBtC,mBAAmBQ,SAAS+B,iBAClBC,gBAAkBnB,YAAYa,QAAOC,KAAOA,IAAIM,SAAWF,WAClC,IAA3BC,gBAAgBrB,QAGpBY,KAAKW,KACDd,KAAKlB,WACD6B,SACAC,gBACAvC,WAAW,eAAiBsC,UAC5BtC,WAAW,eAAiBsC,SAAW,cAK5C,CACHI,QAAStB,YACTU,KAAAA,gCAUkBV,aACtBA,YAAcO,KAAKR,qBAAqBC,mBAClCpB,iBAAmBC,uBAGnB0C,iBAAmBvB,YAAYa,QACjCC,MAC6B,IAAlBA,IAAIU,mBAIZjB,KAAKlB,WACR,aACAkC,iBACA3C,WAAW6C,WACX,KACAF,iBAAiBzB,OAAS,GAUlC4B,oBAAoBC,0BAET,sBADPA,mBAAqBpB,KAAKR,qBAAqB4B,qBAED7B,qBACzB6B,oBAUzBC,cAAcC,8GACHA,QAAQjC,uCAARkC,eAAehC,8DAAU"} \ No newline at end of file diff --git a/course/amd/src/local/activitychooser/exporter.js b/course/amd/src/local/activitychooser/exporter.js index 94769dc4e4c..7fd378de721 100644 --- a/course/amd/src/local/activitychooser/exporter.js +++ b/course/amd/src/local/activitychooser/exporter.js @@ -23,7 +23,14 @@ import {getStrings} from 'core/str'; -const activityCategories = ['activities', 'resources']; +const activityCategories = [ + 'administration', + 'assessment', + 'collaboration', + 'communication', + 'content', + 'interactivecontent', +]; let allStrings = null; @@ -119,8 +126,8 @@ export default class { }, ]; - activityCategories.forEach((category, index) => { - const categoryModules = modulesData.filter(mod => mod.archetype == index); + activityCategories.forEach((category) => { + const categoryModules = modulesData.filter(mod => mod.purpose == category); if (categoryModules.length === 0) { return; } @@ -128,8 +135,8 @@ export default class { this.getTabData( category, categoryModules, - allStrings[category], - allStrings[category + '_help'] + allStrings['mod_purpose_' + category], + allStrings['mod_purpose_' + category + '_help'] ) ); }); @@ -210,14 +217,14 @@ async function loadNecessaryStrings() { {key: 'recommended_help', component: 'core_course'}, ...activityCategories.map( (key) => ({ - key: key, - component: 'core', + key: 'mod_purpose_' + key, + component: 'core_course', }) ), ...activityCategories.map( (key) => ({ - key: key + '_help', - component: 'core', + key: 'mod_purpose_' + key + '_help', + component: 'core_course', }) ), ]; diff --git a/course/tests/behat/activity_chooser.feature b/course/tests/behat/activity_chooser.feature index 41103c89089..c6190ce3800 100644 --- a/course/tests/behat/activity_chooser.feature +++ b/course/tests/behat/activity_chooser.feature @@ -214,20 +214,37 @@ Feature: Display and choose from the available activities in course When I click on "Resources" "link" in the "Add an activity or resource" "dialogue" And "Clear search input" "button" should not be visible And the field "search" matches value "" - And I should see "Book" in the "resources" "core_course > Activity chooser tab" + And I should see "Book" in the "content" "core_course > Activity chooser tab" Scenario: Teacher gets the base case for the Activity Chooser tab mode When I open the activity chooser Then I should see "Assignment" in the "all" "core_course > Activity chooser tab" And I should see "Book" in the "all" "core_course > Activity chooser tab" - # Activities tab. - And I click on "Activities" "link" in the "Add an activity or resource" "dialogue" - And I should see "Assignment" in the "activities" "core_course > Activity chooser tab" - And I should not see "Book" in the "all" "core_course > Activity chooser tab" + # Assessment tab. + And I click on "Assessment" "link" in the "Add an activity or resource" "dialogue" + And I should see "Activities that allow evaluation and measurement of student" in the "Add an activity or resource" "dialogue" + And "Book" "link" should not exist in the "assessment" "core_course > Activity chooser tab" + And "Assignment" "link" should exist in the "assessment" "core_course > Activity chooser tab" + # Collaboration tab. + And I click on "Collaboration" "link" in the "Add an activity or resource" "dialogue" + And I should see "Tools for collaborative learning" in the "Add an activity or resource" "dialogue" + And "Assignment" "link" should not exist in the "collaboration" "core_course > Activity chooser tab" + And "Database" "link" should exist in the "collaboration" "core_course > Activity chooser tab" + # Communication tab. + And I click on "Communication" "link" in the "Add an activity or resource" "dialogue" + And I should see "Activities that facilitate real-time communication" in the "Add an activity or resource" "dialogue" + And "Database" "link" should not exist in the "communication" "core_course > Activity chooser tab" + And "Choice" "link" should exist in the "communication" "core_course > Activity chooser tab" # Resources tab. And I click on "Resources" "link" in the "Add an activity or resource" "dialogue" - And I should see "Book" in the "resources" "core_course > Activity chooser tab" - And I should not see "Assignment" in the "resources" "core_course > Activity chooser tab" + And I should see "Activities and tools to organise and display course materials" in the "Add an activity or resource" "dialogue" + And "Choice" "link" should not exist in the "content" "core_course > Activity chooser tab" + And "File" "link" should exist in the "content" "core_course > Activity chooser tab" + # Interactive content tab. + And I click on "Interactive content" "link" in the "Add an activity or resource" "dialogue" + And I should see "Engaging interactive activities" in the "Add an activity or resource" "dialogue" + And "File" "link" should not exist in the "interactivecontent" "core_course > Activity chooser tab" + And "H5P" "link" should exist in the "interactivecontent" "core_course > Activity chooser tab" Scenario: Teacher can navigate through activity chooser in Topics format course When I open the activity chooser diff --git a/lang/en/course.php b/lang/en/course.php index ee266db072e..c3a5ec862f6 100644 --- a/lang/en/course.php +++ b/lang/en/course.php @@ -96,6 +96,18 @@ $string['filterlastactive'] = 'Last ({$a->last})'; $string['gradetopassnotset'] = 'This course does not have a grade to pass set. It may be set in the grade item of the course (Gradebook setup).'; $string['hideendedcoursestask'] = 'Hide courses on end date'; $string['informationformodule'] = 'Information about the {$a} activity'; +$string['mod_purpose_administration'] = 'Administration'; +$string['mod_purpose_administration_help'] = 'Tools to help the teacher in managing the course progress.'; +$string['mod_purpose_assessment'] = 'Assessment'; +$string['mod_purpose_assessment_help'] = 'Activities that allow evaluation and measurement of student understanding and performance, including individual and collaborative assessment, and peer assessment.'; +$string['mod_purpose_collaboration'] = 'Collaboration'; +$string['mod_purpose_collaboration_help'] = 'Tools for collaborative learning that encourages knowledge sharing, discussion, and teamwork among learners.'; +$string['mod_purpose_communication'] = 'Communication'; +$string['mod_purpose_communication_help'] = 'Activities that facilitate real-time communication, asynchronous interactions, and feedback collection.'; +$string['mod_purpose_content'] = 'Resources'; +$string['mod_purpose_content_help'] = 'Activities and tools to organise and display course materials like documents, web links, and multimedia.'; +$string['mod_purpose_interactivecontent'] = 'Interactive content'; +$string['mod_purpose_interactivecontent_help'] = 'Engaging interactive activities that encourage active learner participation.'; $string['module'] = 'Activity'; $string['namewithlink'] = 'Category name with link'; $string['nocourseactivity'] = 'Not enough course activity between the start and the end of the course'; diff --git a/lang/en/deprecated.txt b/lang/en/deprecated.txt index 66bd6723046..2d59acd9918 100644 --- a/lang/en/deprecated.txt +++ b/lang/en/deprecated.txt @@ -84,3 +84,5 @@ unlockverbose,core_grades aiusagestats,core_hub maxsectionslimit,core maxsectionaddmessage,core_courseformat +activities_help,core +resources_help,core diff --git a/lang/en/moodle.php b/lang/en/moodle.php index 2b0db7e3aed..a2ac8d7f5ec 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -31,7 +31,6 @@ $string['actionsmenu'] = 'Actions menu'; $string['active'] = 'Active'; $string['activeusers'] = 'Active users'; $string['activities'] = 'Activities'; -$string['activities_help'] = 'Activities, such as forums, quizzes and wikis, enable interactive content to be added to the course.'; $string['activity'] = 'Activity'; $string['activityclipboard'] = 'Moving this activity: {$a}'; $string['activityicon'] = '{$a} icon'; @@ -1875,7 +1874,6 @@ $string['resourcedisplaynew'] = 'New window'; $string['resourcedisplayopen'] = 'Open'; $string['resourcedisplaypopup'] = 'In pop-up'; $string['resources'] = 'Resources'; -$string['resources_help'] = 'Resource types enable almost any kind of web content to be inserted into the course.'; $string['resultsfound'] = '{$a} results found'; $string['restore'] = 'Restore'; $string['restorecancelled'] = 'Restore cancelled'; @@ -2492,4 +2490,6 @@ $string['registrationcontactyes'] = 'Yes, provide a form for other Moodlers to c $string['failedtaskcontexturlname'] = 'Status report'; // Deprecated since Moodle 5.1. +$string['activities_help'] = 'Activities, such as forums, quizzes and wikis, enable interactive content to be added to the course.'; $string['maxsectionslimit'] = 'Cannot create new section as it would exceed the maximum number of sections allowed for this course ({$a}).'; +$string['resources_help'] = 'Resource types enable almost any kind of web content to be inserted into the course.';