diff --git a/admin/tool/brickfield/classes/analysis.php b/admin/tool/brickfield/classes/analysis.php index 67cb7139ddf38..eb5d2d0d8c0bf 100644 --- a/admin/tool/brickfield/classes/analysis.php +++ b/admin/tool/brickfield/classes/analysis.php @@ -37,6 +37,15 @@ class analysis { */ const ANALYSISBYREQUEST = '1'; + /** @var array Plugin types where only the intro but not content will be analysed.*/ + const CONTENT_NOT_ANALYSED = [ + 'mod_folder', + 'mod_imscp', + 'mod_resource', + 'mod_scorm', + 'mod_h5pactivity', + ]; + /** * Return the type of analysis being used (currently only request). * diff --git a/admin/tool/brickfield/classes/local/areas/mod_h5pactivity/intro.php b/admin/tool/brickfield/classes/local/areas/mod_h5pactivity/intro.php new file mode 100644 index 0000000000000..0d2b1e8e66857 --- /dev/null +++ b/admin/tool/brickfield/classes/local/areas/mod_h5pactivity/intro.php @@ -0,0 +1,45 @@ +. + +namespace tool_brickfield\local\areas\mod_h5pactivity; + +use tool_brickfield\local\areas\module_area_base; + +/** + * H5P intro observer. + * + * @package tool_brickfield + * @copyright 2024 onward: Brickfield Education Labs, www.brickfield.ie + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class intro extends module_area_base { + + /** + * Return the area table name. + * @return string + */ + public function get_tablename(): string { + return 'h5pactivity'; + } + + /** + * Return the area field name. + * @return string + */ + public function get_fieldname(): string { + return 'intro'; + } +} diff --git a/admin/tool/brickfield/classes/local/areas/mod_h5pactivity/name.php b/admin/tool/brickfield/classes/local/areas/mod_h5pactivity/name.php new file mode 100644 index 0000000000000..9aaab45d72852 --- /dev/null +++ b/admin/tool/brickfield/classes/local/areas/mod_h5pactivity/name.php @@ -0,0 +1,45 @@ +. + +namespace tool_brickfield\local\areas\mod_h5pactivity; + +use tool_brickfield\local\areas\module_area_base; + +/** + * H5P name observer. + * + * @package tool_brickfield + * @copyright 2024 onward: Brickfield Education Labs, www.brickfield.ie + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class name extends module_area_base { + + /** + * Return the area table name. + * @return string + */ + public function get_tablename(): string { + return 'h5pactivity'; + } + + /** + * Return the area field name. + * @return string + */ + public function get_fieldname(): string { + return 'name'; + } +} diff --git a/admin/tool/brickfield/classes/manager.php b/admin/tool/brickfield/classes/manager.php index cb606f00a49d8..f347e642fba64 100644 --- a/admin/tool/brickfield/classes/manager.php +++ b/admin/tool/brickfield/classes/manager.php @@ -796,13 +796,14 @@ public static function get_cm_summary_for_course(int $courseid): array { $sql = " SELECT area.cmid, + area.component, sum(errorcount) as numerrors, count(errorcount) as numchecks FROM {" . self::DB_AREAS . "} area JOIN {" . self::DB_CONTENT . "} ch ON ch.areaid = area.id AND ch.iscurrent = 1 JOIN {" . self::DB_RESULTS . "} res ON res.contentid = ch.id WHERE area.courseid = :courseid AND component != :component - GROUP BY cmid"; + GROUP BY cmid, component"; $params = [ 'courseid' => $courseid, diff --git a/blocks/accessreview/amd/build/module.min.js b/blocks/accessreview/amd/build/module.min.js index bb66a3b0c6f77..8022bdc69d591 100644 --- a/blocks/accessreview/amd/build/module.min.js +++ b/blocks/accessreview/amd/build/module.min.js @@ -6,6 +6,6 @@ define("block_accessreview/module",["exports","core/ajax","core/templates","core * @author Max Larkin * @copyright 2020 Brickfield Education Labs * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */(Templates);let toggleState=!0;const renderTemplate=(element,errorCount,checkCount,displayFormat,minViews,viewDelta)=>{const weight=parseInt((errorCount-minViews)/viewDelta*2),context={resultPassed:!errorCount,classList:"",passRate:{errorCount:errorCount,checkCount:checkCount,failureRate:Math.round(errorCount/checkCount*100)}};if(!element)return Promise.resolve();const elementClassList=["block_accessreview"];context.resultPassed?elementClassList.push("block_accessreview_success"):weight?elementClassList.push("block_accessreview_danger"):elementClassList.push("block_accessreview_warning");const showIcons="showicons"==displayFormat||"showboth"==displayFormat,showBackground="showbackground"==displayFormat||"showboth"==displayFormat;return showBackground&&!showIcons?(element.classList.add(...elementClassList,"alert"),Promise.resolve()):(showIcons&&!showBackground&&(context.classList=elementClassList.join(" ")),Templates.renderForPromise("block_accessreview/status",context).then((_ref=>{let{html:html,js:js}=_ref;Templates.appendNodeContents(element,html,js),showBackground&&element.classList.add(...elementClassList,"alert")})).catch())},showAccessMap=function(courseId,displayFormat){let updatePreference=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return Promise.all(fetchReviewData(courseId,updatePreference)).then((_ref2=>{let[sectionData,moduleData]=_ref2;const{minViews:minViews,viewDelta:viewDelta}=getErrorTotals(sectionData,moduleData);return sectionData.forEach((section=>{const element=document.querySelector("#section-".concat(section.section," .summary"));element&&renderTemplate(element,section.numerrors,section.numchecks,displayFormat,minViews,viewDelta)})),moduleData.forEach((module=>{const element=document.getElementById("module-".concat(module.cmid));element&&renderTemplate(element,module.numerrors,module.numchecks,displayFormat,minViews,viewDelta)})),document.querySelector(".icon-accessmap").classList.remove("fa-eye-slash"),document.querySelector(".icon-accessmap").classList.add("fa-eye"),{sectionData:sectionData,moduleData:moduleData}})).catch(_notification.exception)},toggleAccessMap=(courseId,displayFormat)=>{toggleState=!toggleState,toggleState?showAccessMap(courseId,displayFormat,!0):function(){let updatePreference=arguments.length>0&&void 0!==arguments[0]&&arguments[0];document.querySelectorAll(".block_accessreview_view").forEach((node=>node.remove()));const classList=["block_accessreview","block_accessreview_success","block_accessreview_warning","block_accessreview_danger","block_accessreview_view","alert"];document.querySelectorAll(".block_accessreview").forEach((node=>node.classList.remove(...classList))),updatePreference&&setToggleStatePreference(!1),document.querySelector(".icon-accessmap").classList.remove("fa-eye"),document.querySelector(".icon-accessmap").classList.add("fa-eye-slash")}(!0)},getErrorTotals=(sectionData,moduleData)=>{const totals={totalErrors:0,totalUsers:0,minViews:0,maxViews:0,viewDelta:0};return[].concat(sectionData,moduleData).forEach((item=>{totals.totalErrors+=item.numerrors,item.numerrorstotals.maxViews&&(totals.maxViews=item.numerrors),totals.totalUsers+=item.numchecks})),totals.viewDelta=totals.maxViews-totals.minViews+1,totals},getTogglePreferenceParams=toggleState=>({methodname:"core_user_update_user_preferences",args:{preferences:[{type:"block_accessreviewtogglestate",value:toggleState}]}}),setToggleStatePreference=toggleState=>(0,_ajax.call)([getTogglePreferenceParams(toggleState)]),fetchReviewData=function(courseid){let updatePreference=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const calls=[{methodname:"block_accessreview_get_section_data",args:{courseid:courseid}},{methodname:"block_accessreview_get_module_data",args:{courseid:courseid}}];return updatePreference&&calls.push(getTogglePreferenceParams(!0)),(0,_ajax.call)(calls)};_exports.init=(toggled,displayFormat,courseId)=>{toggleState=1==toggled,toggleState&&showAccessMap(courseId,displayFormat),((courseId,displayFormat)=>{document.addEventListener("click",(e=>{e.target.closest("#toggle-accessmap")&&(e.preventDefault(),toggleAccessMap(courseId,displayFormat))}))})(courseId,displayFormat)}})); + */(Templates);let toggleState=!0;const renderTemplate=function(element,item,displayFormat,minViews,viewDelta){let analysed=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];const weight=parseInt((item.numerrors-minViews)/viewDelta*2),context={resultPassed:!item.numerrors,classList:"",message:item.message};if(!element)return Promise.resolve();const elementClassList=["block_accessreview"];analysed?context.resultPassed?elementClassList.push("block_accessreview_success"):weight?elementClassList.push("block_accessreview_danger"):elementClassList.push("block_accessreview_warning"):elementClassList.push("block_accessreview_notanalysed");const showIcons="showicons"==displayFormat||"showboth"==displayFormat,showBackground="showbackground"==displayFormat||"showboth"==displayFormat;return showBackground&&!showIcons?(element.classList.add(...elementClassList,"alert"),Promise.resolve()):(showIcons&&!showBackground&&(context.classList=elementClassList.join(" ")),Templates.renderForPromise("block_accessreview/status",context).then((_ref=>{let{html:html,js:js}=_ref;Templates.appendNodeContents(element,html,js),showBackground&&element.classList.add(...elementClassList,"alert")})).catch())},showAccessMap=function(courseId,displayFormat){let updatePreference=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return Promise.all(fetchReviewData(courseId,updatePreference)).then((_ref2=>{let[sectionData,moduleData]=_ref2;const{minViews:minViews,viewDelta:viewDelta}=getErrorTotals(sectionData,moduleData);return sectionData.forEach((section=>{const element=document.querySelector("#section-".concat(section.section," .summary"));element&&renderTemplate(element,section,displayFormat,minViews,viewDelta)})),moduleData.forEach((module=>{const element=document.getElementById("module-".concat(module.cmid));element&&renderTemplate(element,module,displayFormat,minViews,viewDelta,module.analysed)})),document.querySelector(".icon-accessmap").classList.remove("fa-eye-slash"),document.querySelector(".icon-accessmap").classList.add("fa-eye"),{sectionData:sectionData,moduleData:moduleData}})).catch(_notification.exception)},toggleAccessMap=(courseId,displayFormat)=>{toggleState=!toggleState,toggleState?showAccessMap(courseId,displayFormat,!0):function(){let updatePreference=arguments.length>0&&void 0!==arguments[0]&&arguments[0];document.querySelectorAll(".block_accessreview_view").forEach((node=>node.remove()));const classList=["block_accessreview","block_accessreview_success","block_accessreview_warning","block_accessreview_danger","block_accessreview_view","alert"];document.querySelectorAll(".block_accessreview").forEach((node=>node.classList.remove(...classList))),updatePreference&&setToggleStatePreference(!1),document.querySelector(".icon-accessmap").classList.remove("fa-eye"),document.querySelector(".icon-accessmap").classList.add("fa-eye-slash")}(!0)},getErrorTotals=(sectionData,moduleData)=>{const totals={totalErrors:0,totalUsers:0,minViews:0,maxViews:0,viewDelta:0};return[].concat(sectionData,moduleData).forEach((item=>{totals.totalErrors+=item.numerrors,item.numerrorstotals.maxViews&&(totals.maxViews=item.numerrors),totals.totalUsers+=item.numchecks})),totals.viewDelta=totals.maxViews-totals.minViews+1,totals},getTogglePreferenceParams=toggleState=>({methodname:"core_user_update_user_preferences",args:{preferences:[{type:"block_accessreviewtogglestate",value:toggleState}]}}),setToggleStatePreference=toggleState=>(0,_ajax.call)([getTogglePreferenceParams(toggleState)]),fetchReviewData=function(courseid){let updatePreference=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const calls=[{methodname:"block_accessreview_get_section_data",args:{courseid:courseid}},{methodname:"block_accessreview_get_module_data",args:{courseid:courseid}}];return updatePreference&&calls.push(getTogglePreferenceParams(!0)),(0,_ajax.call)(calls)};_exports.init=(toggled,displayFormat,courseId)=>{toggleState=1==toggled,toggleState&&showAccessMap(courseId,displayFormat),((courseId,displayFormat)=>{document.addEventListener("click",(e=>{e.target.closest("#toggle-accessmap")&&(e.preventDefault(),toggleAccessMap(courseId,displayFormat))}))})(courseId,displayFormat)}})); //# sourceMappingURL=module.min.js.map \ No newline at end of file diff --git a/blocks/accessreview/amd/build/module.min.js.map b/blocks/accessreview/amd/build/module.min.js.map index dca3203930d16..41aa8270ba487 100644 --- a/blocks/accessreview/amd/build/module.min.js.map +++ b/blocks/accessreview/amd/build/module.min.js.map @@ -1 +1 @@ -{"version":3,"file":"module.min.js","sources":["../src/module.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 * Manager for the accessreview block.\n *\n * @module block_accessreview/module\n * @author Max Larkin \n * @copyright 2020 Brickfield Education Labs \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {call as fetchMany} from 'core/ajax';\nimport * as Templates from 'core/templates';\nimport {exception as displayError} from 'core/notification';\n\n/**\n * The number of colours used to represent the heatmap. (Indexed on 0.)\n * @type {number}\n */\nconst numColours = 2;\n\n/**\n * The toggle state of the heatmap.\n * @type {boolean}\n */\nlet toggleState = true;\n\n/**\n * Renders the HTML template onto a particular HTML element.\n * @param {HTMLElement} element The element to attach the HTML to.\n * @param {number} errorCount The number of errors on this module/section.\n * @param {number} checkCount The number of checks triggered on this module/section.\n * @param {String} displayFormat\n * @param {Number} minViews\n * @param {Number} viewDelta\n * @returns {Promise}\n */\nconst renderTemplate = (element, errorCount, checkCount, displayFormat, minViews, viewDelta) => {\n // Calculate a weight?\n const weight = parseInt((errorCount - minViews) / viewDelta * numColours);\n\n const context = {\n resultPassed: !errorCount,\n classList: '',\n passRate: {\n errorCount,\n checkCount,\n failureRate: Math.round(errorCount / checkCount * 100),\n },\n };\n\n if (!element) {\n return Promise.resolve();\n }\n\n const elementClassList = ['block_accessreview'];\n if (context.resultPassed) {\n elementClassList.push('block_accessreview_success');\n } else if (weight) {\n elementClassList.push('block_accessreview_danger');\n } else {\n elementClassList.push('block_accessreview_warning');\n }\n\n const showIcons = (displayFormat == 'showicons') || (displayFormat == 'showboth');\n const showBackground = (displayFormat == 'showbackground') || (displayFormat == 'showboth');\n\n if (showBackground && !showIcons) {\n // Only the background is displayed.\n // No need to display the template.\n // Note: The case where both the background and icons are shown is handled later to avoid jankiness.\n element.classList.add(...elementClassList, 'alert');\n\n return Promise.resolve();\n }\n\n if (showIcons && !showBackground) {\n context.classList = elementClassList.join(' ');\n }\n\n // The icons are displayed either with, or without, the background.\n return Templates.renderForPromise('block_accessreview/status', context)\n .then(({html, js}) => {\n Templates.appendNodeContents(element, html, js);\n\n if (showBackground) {\n element.classList.add(...elementClassList, 'alert');\n }\n\n return;\n })\n .catch();\n};\n\n/**\n * Applies the template to all sections and modules on the course page.\n *\n * @param {Number} courseId\n * @param {String} displayFormat\n * @param {Boolean} updatePreference\n * @returns {Promise}\n */\nconst showAccessMap = (courseId, displayFormat, updatePreference = false) => {\n // Get error data.\n return Promise.all(fetchReviewData(courseId, updatePreference))\n .then(([sectionData, moduleData]) => {\n // Get total data.\n const {minViews, viewDelta} = getErrorTotals(sectionData, moduleData);\n\n sectionData.forEach(section => {\n const element = document.querySelector(`#section-${section.section} .summary`);\n if (!element) {\n return;\n }\n\n renderTemplate(element, section.numerrors, section.numchecks, displayFormat, minViews, viewDelta);\n });\n\n moduleData.forEach(module => {\n const element = document.getElementById(`module-${module.cmid}`);\n if (!element) {\n return;\n }\n\n renderTemplate(element, module.numerrors, module.numchecks, displayFormat, minViews, viewDelta);\n });\n\n // Change the icon display.\n document.querySelector('.icon-accessmap').classList.remove(...['fa-eye-slash']);\n document.querySelector('.icon-accessmap').classList.add(...['fa-eye']);\n\n return {\n sectionData,\n moduleData,\n };\n })\n .catch(displayError);\n};\n\n\n/**\n * Hides or removes the templates from the HTML of the current page.\n *\n * @param {Boolean} updatePreference\n */\nconst hideAccessMap = (updatePreference = false) => {\n // Removes the added elements.\n document.querySelectorAll('.block_accessreview_view').forEach(node => node.remove());\n\n const classList = [\n 'block_accessreview',\n 'block_accessreview_success',\n 'block_accessreview_warning',\n 'block_accessreview_danger',\n 'block_accessreview_view',\n 'alert',\n ];\n\n // Removes the added classes.\n document.querySelectorAll('.block_accessreview').forEach(node => node.classList.remove(...classList));\n\n if (updatePreference) {\n setToggleStatePreference(false);\n }\n\n // Change the icon display.\n document.querySelector('.icon-accessmap').classList.remove(...['fa-eye']);\n document.querySelector('.icon-accessmap').classList.add(...['fa-eye-slash']);\n};\n\n\n/**\n * Toggles the heatmap on/off.\n *\n * @param {Number} courseId\n * @param {String} displayFormat\n */\nconst toggleAccessMap = (courseId, displayFormat) => {\n toggleState = !toggleState;\n if (!toggleState) {\n hideAccessMap(true);\n } else {\n showAccessMap(courseId, displayFormat, true);\n }\n};\n\n/**\n * Parses information on the errors, generating the min, max and totals.\n *\n * @param {Object[]} sectionData The error data for course sections.\n * @param {Object[]} moduleData The error data for course modules.\n * @returns {Object} An object representing the extra error information.\n */\nconst getErrorTotals = (sectionData, moduleData) => {\n const totals = {\n totalErrors: 0,\n totalUsers: 0,\n minViews: 0,\n maxViews: 0,\n viewDelta: 0,\n };\n\n [].concat(sectionData, moduleData).forEach(item => {\n totals.totalErrors += item.numerrors;\n if (item.numerrors < totals.minViews) {\n totals.minViews = item.numerrors;\n }\n\n if (item.numerrors > totals.maxViews) {\n totals.maxViews = item.numerrors;\n }\n totals.totalUsers += item.numchecks;\n });\n\n totals.viewDelta = totals.maxViews - totals.minViews + 1;\n\n return totals;\n};\n\nconst registerEventListeners = (courseId, displayFormat) => {\n document.addEventListener('click', e => {\n if (e.target.closest('#toggle-accessmap')) {\n e.preventDefault();\n toggleAccessMap(courseId, displayFormat);\n }\n });\n};\n\n/**\n * Set the user preference for the toggle value.\n *\n * @param {Boolean} toggleState\n * @returns {Promise}\n */\nconst getTogglePreferenceParams = toggleState => {\n return {\n methodname: 'core_user_update_user_preferences',\n args: {\n preferences: [{\n type: 'block_accessreviewtogglestate',\n value: toggleState,\n }],\n }\n };\n};\n\nconst setToggleStatePreference = toggleState => fetchMany([getTogglePreferenceParams(toggleState)]);\n\n/**\n * Fetch the review data.\n *\n * @param {Number} courseid\n * @param {Boolean} updatePreference\n * @returns {Promise[]}\n */\nconst fetchReviewData = (courseid, updatePreference = false) => {\n const calls = [\n {\n methodname: 'block_accessreview_get_section_data',\n args: {courseid}\n },\n {\n methodname: 'block_accessreview_get_module_data',\n args: {courseid}\n },\n ];\n\n if (updatePreference) {\n calls.push(getTogglePreferenceParams(true));\n }\n\n return fetchMany(calls);\n};\n\n/**\n * Setting up the access review module.\n * @param {number} toggled A number represnting the state of the review toggle.\n * @param {string} displayFormat A string representing the display format for icons.\n * @param {number} courseId The course ID.\n */\nexport const init = (toggled, displayFormat, courseId) => {\n // Settings consts.\n toggleState = toggled == 1;\n\n if (toggleState) {\n showAccessMap(courseId, displayFormat);\n }\n\n registerEventListeners(courseId, displayFormat);\n};\n"],"names":["toggleState","renderTemplate","element","errorCount","checkCount","displayFormat","minViews","viewDelta","weight","parseInt","context","resultPassed","classList","passRate","failureRate","Math","round","Promise","resolve","elementClassList","push","showIcons","showBackground","add","join","Templates","renderForPromise","then","_ref","html","js","appendNodeContents","catch","showAccessMap","courseId","updatePreference","all","fetchReviewData","_ref2","sectionData","moduleData","getErrorTotals","forEach","section","document","querySelector","numerrors","numchecks","module","getElementById","cmid","remove","displayError","toggleAccessMap","querySelectorAll","node","setToggleStatePreference","hideAccessMap","totals","totalErrors","totalUsers","maxViews","concat","item","getTogglePreferenceParams","methodname","args","preferences","type","value","courseid","calls","toggled","addEventListener","e","target","closest","preventDefault","registerEventListeners"],"mappings":"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"} \ No newline at end of file +{"version":3,"file":"module.min.js","sources":["../src/module.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 * Manager for the accessreview block.\n *\n * @module block_accessreview/module\n * @author Max Larkin \n * @copyright 2020 Brickfield Education Labs \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {call as fetchMany} from 'core/ajax';\nimport * as Templates from 'core/templates';\nimport {exception as displayError} from 'core/notification';\n\n/**\n * The number of colours used to represent the heatmap. (Indexed on 0.)\n * @type {number}\n */\nconst numColours = 2;\n\n/**\n * The toggle state of the heatmap.\n * @type {boolean}\n */\nlet toggleState = true;\n\n/**\n * Renders the HTML template onto a particular HTML element.\n * @param {HTMLElement} element The element to attach the HTML to.\n * @param {Object} item The accessibility checked item to render.\n * @param {String} displayFormat\n * @param {Number} minViews\n * @param {Number} viewDelta\n * @param {Boolean} analysed\n * @returns {Promise}\n */\nconst renderTemplate = (element, item, displayFormat, minViews, viewDelta, analysed = true) => {\n // Calculate a weight?\n const weight = parseInt((item.numerrors - minViews) / viewDelta * numColours);\n\n const context = {\n resultPassed: !item.numerrors,\n classList: '',\n message: item.message\n };\n\n if (!element) {\n return Promise.resolve();\n }\n\n const elementClassList = ['block_accessreview'];\n if (!analysed) {\n elementClassList.push('block_accessreview_notanalysed');\n } else if (context.resultPassed) {\n elementClassList.push('block_accessreview_success');\n } else if (weight) {\n elementClassList.push('block_accessreview_danger');\n } else {\n elementClassList.push('block_accessreview_warning');\n }\n\n const showIcons = (displayFormat == 'showicons') || (displayFormat == 'showboth');\n const showBackground = (displayFormat == 'showbackground') || (displayFormat == 'showboth');\n\n if (showBackground && !showIcons) {\n // Only the background is displayed.\n // No need to display the template.\n // Note: The case where both the background and icons are shown is handled later to avoid jankiness.\n element.classList.add(...elementClassList, 'alert');\n\n return Promise.resolve();\n }\n\n if (showIcons && !showBackground) {\n context.classList = elementClassList.join(' ');\n }\n\n // The icons are displayed either with, or without, the background.\n return Templates.renderForPromise('block_accessreview/status', context)\n .then(({html, js}) => {\n Templates.appendNodeContents(element, html, js);\n\n if (showBackground) {\n element.classList.add(...elementClassList, 'alert');\n }\n\n return;\n })\n .catch();\n};\n\n/**\n * Applies the template to all sections and modules on the course page.\n *\n * @param {Number} courseId\n * @param {String} displayFormat\n * @param {Boolean} updatePreference\n * @returns {Promise}\n */\nconst showAccessMap = (courseId, displayFormat, updatePreference = false) => {\n // Get error data.\n return Promise.all(fetchReviewData(courseId, updatePreference))\n .then(([sectionData, moduleData]) => {\n // Get total data.\n const {minViews, viewDelta} = getErrorTotals(sectionData, moduleData);\n\n sectionData.forEach(section => {\n const element = document.querySelector(`#section-${section.section} .summary`);\n if (!element) {\n return;\n }\n renderTemplate(element, section, displayFormat, minViews, viewDelta);\n });\n\n moduleData.forEach(module => {\n const element = document.getElementById(`module-${module.cmid}`);\n if (!element) {\n return;\n }\n renderTemplate(element, module, displayFormat, minViews, viewDelta, module.analysed);\n });\n\n // Change the icon display.\n document.querySelector('.icon-accessmap').classList.remove(...['fa-eye-slash']);\n document.querySelector('.icon-accessmap').classList.add(...['fa-eye']);\n\n return {\n sectionData,\n moduleData,\n };\n })\n .catch(displayError);\n};\n\n\n/**\n * Hides or removes the templates from the HTML of the current page.\n *\n * @param {Boolean} updatePreference\n */\nconst hideAccessMap = (updatePreference = false) => {\n // Removes the added elements.\n document.querySelectorAll('.block_accessreview_view').forEach(node => node.remove());\n\n const classList = [\n 'block_accessreview',\n 'block_accessreview_success',\n 'block_accessreview_warning',\n 'block_accessreview_danger',\n 'block_accessreview_view',\n 'alert',\n ];\n\n // Removes the added classes.\n document.querySelectorAll('.block_accessreview').forEach(node => node.classList.remove(...classList));\n\n if (updatePreference) {\n setToggleStatePreference(false);\n }\n\n // Change the icon display.\n document.querySelector('.icon-accessmap').classList.remove(...['fa-eye']);\n document.querySelector('.icon-accessmap').classList.add(...['fa-eye-slash']);\n};\n\n\n/**\n * Toggles the heatmap on/off.\n *\n * @param {Number} courseId\n * @param {String} displayFormat\n */\nconst toggleAccessMap = (courseId, displayFormat) => {\n toggleState = !toggleState;\n if (!toggleState) {\n hideAccessMap(true);\n } else {\n showAccessMap(courseId, displayFormat, true);\n }\n};\n\n/**\n * Parses information on the errors, generating the min, max and totals.\n *\n * @param {Object[]} sectionData The error data for course sections.\n * @param {Object[]} moduleData The error data for course modules.\n * @returns {Object} An object representing the extra error information.\n */\nconst getErrorTotals = (sectionData, moduleData) => {\n const totals = {\n totalErrors: 0,\n totalUsers: 0,\n minViews: 0,\n maxViews: 0,\n viewDelta: 0,\n };\n\n [].concat(sectionData, moduleData).forEach(item => {\n totals.totalErrors += item.numerrors;\n if (item.numerrors < totals.minViews) {\n totals.minViews = item.numerrors;\n }\n\n if (item.numerrors > totals.maxViews) {\n totals.maxViews = item.numerrors;\n }\n totals.totalUsers += item.numchecks;\n });\n\n totals.viewDelta = totals.maxViews - totals.minViews + 1;\n\n return totals;\n};\n\nconst registerEventListeners = (courseId, displayFormat) => {\n document.addEventListener('click', e => {\n if (e.target.closest('#toggle-accessmap')) {\n e.preventDefault();\n toggleAccessMap(courseId, displayFormat);\n }\n });\n};\n\n/**\n * Set the user preference for the toggle value.\n *\n * @param {Boolean} toggleState\n * @returns {Promise}\n */\nconst getTogglePreferenceParams = toggleState => {\n return {\n methodname: 'core_user_update_user_preferences',\n args: {\n preferences: [{\n type: 'block_accessreviewtogglestate',\n value: toggleState,\n }],\n }\n };\n};\n\nconst setToggleStatePreference = toggleState => fetchMany([getTogglePreferenceParams(toggleState)]);\n\n/**\n * Fetch the review data.\n *\n * @param {Number} courseid\n * @param {Boolean} updatePreference\n * @returns {Promise[]}\n */\nconst fetchReviewData = (courseid, updatePreference = false) => {\n const calls = [\n {\n methodname: 'block_accessreview_get_section_data',\n args: {courseid}\n },\n {\n methodname: 'block_accessreview_get_module_data',\n args: {courseid}\n },\n ];\n\n if (updatePreference) {\n calls.push(getTogglePreferenceParams(true));\n }\n\n return fetchMany(calls);\n};\n\n/**\n * Setting up the access review module.\n * @param {number} toggled A number represnting the state of the review toggle.\n * @param {string} displayFormat A string representing the display format for icons.\n * @param {number} courseId The course ID.\n */\nexport const init = (toggled, displayFormat, courseId) => {\n // Settings consts.\n toggleState = toggled == 1;\n\n if (toggleState) {\n showAccessMap(courseId, displayFormat);\n }\n\n registerEventListeners(courseId, displayFormat);\n};\n"],"names":["toggleState","renderTemplate","element","item","displayFormat","minViews","viewDelta","analysed","weight","parseInt","numerrors","context","resultPassed","classList","message","Promise","resolve","elementClassList","push","showIcons","showBackground","add","join","Templates","renderForPromise","then","_ref","html","js","appendNodeContents","catch","showAccessMap","courseId","updatePreference","all","fetchReviewData","_ref2","sectionData","moduleData","getErrorTotals","forEach","section","document","querySelector","module","getElementById","cmid","remove","displayError","toggleAccessMap","querySelectorAll","node","setToggleStatePreference","hideAccessMap","totals","totalErrors","totalUsers","maxViews","concat","numchecks","getTogglePreferenceParams","methodname","args","preferences","type","value","courseid","calls","toggled","addEventListener","e","target","closest","preventDefault","registerEventListeners"],"mappings":"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"} \ No newline at end of file diff --git a/blocks/accessreview/amd/src/module.js b/blocks/accessreview/amd/src/module.js index 6f9fc1858c19a..0eb9b70f3cb55 100644 --- a/blocks/accessreview/amd/src/module.js +++ b/blocks/accessreview/amd/src/module.js @@ -41,25 +41,21 @@ let toggleState = true; /** * Renders the HTML template onto a particular HTML element. * @param {HTMLElement} element The element to attach the HTML to. - * @param {number} errorCount The number of errors on this module/section. - * @param {number} checkCount The number of checks triggered on this module/section. + * @param {Object} item The accessibility checked item to render. * @param {String} displayFormat * @param {Number} minViews * @param {Number} viewDelta + * @param {Boolean} analysed * @returns {Promise} */ -const renderTemplate = (element, errorCount, checkCount, displayFormat, minViews, viewDelta) => { +const renderTemplate = (element, item, displayFormat, minViews, viewDelta, analysed = true) => { // Calculate a weight? - const weight = parseInt((errorCount - minViews) / viewDelta * numColours); + const weight = parseInt((item.numerrors - minViews) / viewDelta * numColours); const context = { - resultPassed: !errorCount, + resultPassed: !item.numerrors, classList: '', - passRate: { - errorCount, - checkCount, - failureRate: Math.round(errorCount / checkCount * 100), - }, + message: item.message }; if (!element) { @@ -67,7 +63,9 @@ const renderTemplate = (element, errorCount, checkCount, displayFormat, minViews } const elementClassList = ['block_accessreview']; - if (context.resultPassed) { + if (!analysed) { + elementClassList.push('block_accessreview_notanalysed'); + } else if (context.resultPassed) { elementClassList.push('block_accessreview_success'); } else if (weight) { elementClassList.push('block_accessreview_danger'); @@ -125,8 +123,7 @@ const showAccessMap = (courseId, displayFormat, updatePreference = false) => { if (!element) { return; } - - renderTemplate(element, section.numerrors, section.numchecks, displayFormat, minViews, viewDelta); + renderTemplate(element, section, displayFormat, minViews, viewDelta); }); moduleData.forEach(module => { @@ -134,8 +131,7 @@ const showAccessMap = (courseId, displayFormat, updatePreference = false) => { if (!element) { return; } - - renderTemplate(element, module.numerrors, module.numchecks, displayFormat, minViews, viewDelta); + renderTemplate(element, module, displayFormat, minViews, viewDelta, module.analysed); }); // Change the icon display. diff --git a/blocks/accessreview/classes/external/get_module_data.php b/blocks/accessreview/classes/external/get_module_data.php index 5c2e901fccde5..df9e153968ed8 100644 --- a/blocks/accessreview/classes/external/get_module_data.php +++ b/blocks/accessreview/classes/external/get_module_data.php @@ -21,6 +21,7 @@ use core_external\external_multiple_structure; use core_external\external_single_structure; use core_external\external_value; +use tool_brickfield\analysis; use tool_brickfield\manager; /** @@ -61,7 +62,21 @@ public static function execute(int $courseid) { require_capability('block/accessreview:view', $context); - return array_values(manager::get_cm_summary_for_course($courseid)); + $modules = array_values(manager::get_cm_summary_for_course($courseid)); + + // Add the relevant language strings to the response. + foreach ($modules as $module) { + $module->analysed = !in_array($module->component, analysis::CONTENT_NOT_ANALYSED); + if (!$module->analysed) { + $strid = "content_not_analysed:$module->component"; + $module->message = get_string($strid, 'block_accessreview', $module->numerrors); + } else if ($module->numerrors > 0) { + $module->message = get_string('status:errors', 'block_accessreview', ['errorCount' => $module->numerrors]); + } else { + $module->message = get_string('status:success', 'block_accessreview'); + } + } + return $modules; } /** @@ -74,8 +89,11 @@ public static function execute_returns() { new external_single_structure( [ 'cmid' => new external_value(PARAM_INT, 'ID'), + 'component' => new external_value(PARAM_TEXT, 'Component'), 'numerrors' => new external_value(PARAM_INT, 'Number of errors.'), 'numchecks' => new external_value(PARAM_INT, 'Number of checks.'), + 'message' => new external_value(PARAM_TEXT, 'Message'), + 'analysed' => new external_value(PARAM_BOOL, 'Analysed'), ] ) ); diff --git a/blocks/accessreview/classes/external/get_section_data.php b/blocks/accessreview/classes/external/get_section_data.php index 70601f851de06..4d0b6ba94c536 100644 --- a/blocks/accessreview/classes/external/get_section_data.php +++ b/blocks/accessreview/classes/external/get_section_data.php @@ -61,7 +61,16 @@ public static function execute($courseid) { require_capability('block/accessreview:view', $context); - return array_values(manager::get_section_summary_for_course($courseid)); + $sections = array_values(manager::get_section_summary_for_course($courseid)); + // Add language strings to the section data. + foreach ($sections as $section) { + if ($section->numerrors > 0) { + $section->message = get_string('status:errors', 'block_accessreview', ['errorCount' => $section->numerrors]); + } else { + $section->message = get_string('status:success', 'block_accessreview'); + } + } + return array_values($sections); } /** @@ -76,6 +85,7 @@ public static function execute_returns() { 'section' => new external_value(PARAM_INT, 'ID'), 'numerrors' => new external_value(PARAM_INT, 'Number of errors.'), 'numchecks' => new external_value(PARAM_INT, 'Number of checks.'), + 'message' => new external_value(PARAM_TEXT, 'Message.'), ] ) ); diff --git a/blocks/accessreview/lang/en/block_accessreview.php b/blocks/accessreview/lang/en/block_accessreview.php index 428d3577dbd25..beeb7172b2cee 100644 --- a/blocks/accessreview/lang/en/block_accessreview.php +++ b/blocks/accessreview/lang/en/block_accessreview.php @@ -28,6 +28,11 @@ $string['accessreview:addinstance'] = 'Add an accessibility review block'; $string['accessreview:view'] = 'View the accessibility review'; $string['checktypes'] = 'Types'; +$string['content_not_analysed:mod_folder'] = 'Folder description analysed. Folder contents not analysed. Error count: {$a}'; +$string['content_not_analysed:mod_h5pactivity'] = 'H5P content package description analysed. H5P content not analysed. Error count: {$a}'; +$string['content_not_analysed:mod_imscp'] = 'IMS content package description analysed. IMS content not analysed. Error count: {$a}'; +$string['content_not_analysed:mod_resource'] = 'File resource description analysed. File content not analysed. Error count: {$a}'; +$string['content_not_analysed:mod_scorm'] = 'SCORM description analysed. SCORM content not analysed. Error count: {$a}'; $string['errors'] = 'Errors'; $string['errordisplay'] = 'Display errors in this format'; $string['errorssummary'] = 'Accessibility review'; diff --git a/blocks/accessreview/styles.css b/blocks/accessreview/styles.css index fa5b4f787f48f..1f4eec41cfcde 100644 --- a/blocks/accessreview/styles.css +++ b/blocks/accessreview/styles.css @@ -19,6 +19,12 @@ box-shadow: 0 0 2px 2px #c97a0e; } +.block_accessreview_notanalysed, +.block_accessreview.block_accessreview_notanalysed.hasinfo { + background: #f7f7f7; + box-shadow: 0 0 2px 2px #c7c7c7; +} + .block_accessreview_table { border-bottom: 1px solid; border-color: #eee8e8; diff --git a/blocks/accessreview/templates/status.mustache b/blocks/accessreview/templates/status.mustache index ac55d5356558b..b37715570efc4 100644 --- a/blocks/accessreview/templates/status.mustache +++ b/blocks/accessreview/templates/status.mustache @@ -36,28 +36,17 @@ Example context (json): { "classList": "block_accessreview_danger", - "passRate": { - "checkCount": "60", - "errorCount": "12", - "failureRate": "20" - } + "message": "Failed - error count 1", + "resultPassed": false } }}
{{#resultPassed}} {{#pix}}t/pass, block_accessreview, {{#str}}status:successalt, block_accessreview{{/str}}{{/pix}} - {{#str}}status:success, block_accessreview, { - "errorCount": {{passRate.errorCount}}, - "checkCount": {{passRate.checkCount}}, - "failureRate": {{passRate.failureRate}} - }{{/str}} + {{message}} {{/resultPassed}} {{^resultPassed}} {{#pix}}t/fail, block_accessreview, {{#str}}status:errorsalt, block_accessreview{{/str}}{{/pix}} - {{#str}}status:errors, block_accessreview, { - "errorCount": {{passRate.errorCount}}, - "checkCount": {{passRate.checkCount}}, - "failureRate": {{passRate.failureRate}} - }{{/str}} + {{message}} {{/resultPassed}}