diff --git a/amd/build/configure_block.min.js b/amd/build/configure_block.min.js index ba3e197..0126a95 100644 --- a/amd/build/configure_block.min.js +++ b/amd/build/configure_block.min.js @@ -1,2 +1,11 @@ -define ("block_dashboardchart/configure_block",["exports","jquery"],function(a,b){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.init=void 0;b=function(a){return a&&a.__esModule?a:{default:a}}(b);var c=function(){function a(){var a=(0,b.default)("#id_config_dashboardcharttype :selected").val();if("grades"==a){document.getElementById("courseleaderboard_configs").style.display="block"}else{document.getElementById("courseleaderboard_configs").style.display="none"}}a();(0,b.default)("#id_config_dashboardcharttype").on("change",function(){a()})};a.init=c}); -//# sourceMappingURL=configure_block.min.js.map +define("block_dashboardchart/configure_block",["exports","jquery"],(function(_exports,_jquery){var obj; +/** + * Edit form class + * + * @package block_dashboardchart + * @copyright 2022 Brain Station 23 Ltd. + * @author Brain Station 23 Ltd. + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_jquery=(obj=_jquery)&&obj.__esModule?obj:{default:obj};_exports.init=function(){function mangeCourseInputField(){(0,_jquery.default)("#id_config_dashboardcharttype :selected").val()}mangeCourseInputField(),(0,_jquery.default)("#id_config_dashboardcharttype").on("change",(function(){mangeCourseInputField()}))}})); + +//# sourceMappingURL=configure_block.min.js.map \ No newline at end of file diff --git a/amd/build/configure_block.min.js.map b/amd/build/configure_block.min.js.map index 88883b6..411e0fc 100644 --- a/amd/build/configure_block.min.js.map +++ b/amd/build/configure_block.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/configure_block.js"],"names":["init","mangeCourseInputField","dbcharttype","val","document","getElementById","style","display","on"],"mappings":"8JAwBA,uDAEO,GAAMA,CAAAA,CAAI,CAAG,UAAM,CAIxB,QAASC,CAAAA,CAAT,EAAiC,CAC/B,GAAIC,CAAAA,CAAW,CAAG,cAAE,yCAAF,EAA6CC,GAA7C,EAAlB,CACA,GAAmB,QAAf,EAAAD,CAAJ,CAA6B,CAC3BE,QAAQ,CAACC,cAAT,CAAwB,2BAAxB,EAAqDC,KAArD,CAA2DC,OAA3D,CACE,OACH,CAHD,IAGO,CACLH,QAAQ,CAACC,cAAT,CAAwB,2BAAxB,EAAqDC,KAArD,CAA2DC,OAA3D,CACE,MACH,CACF,CACDN,CAAqB,GAErB,cAAE,+BAAF,EAAmCO,EAAnC,CAAsC,QAAtC,CAAgD,UAAY,CAC1DP,CAAqB,EACtB,CAFD,CAGD,CAnBM,C","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 * Edit form class\n *\n * * @package block_dashboardchart\n * * @copyright 2021 Brain Station 23\n * * @author Brainstation23\n * * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport $ from \"jquery\";\n\nexport const init = () => {\n /**\n * Manage course input\n */\n function mangeCourseInputField() {\n var dbcharttype = $(\"#id_config_dashboardcharttype :selected\").val();\n if (dbcharttype == \"grades\") {\n document.getElementById(\"courseleaderboard_configs\").style.display =\n \"block\";\n } else {\n document.getElementById(\"courseleaderboard_configs\").style.display =\n \"none\";\n }\n }\n mangeCourseInputField();\n\n $(\"#id_config_dashboardcharttype\").on(\"change\", function () {\n mangeCourseInputField();\n });\n};\n"],"file":"configure_block.min.js"} \ No newline at end of file +{"version":3,"file":"configure_block.min.js","sources":["../src/configure_block.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 * Edit form class\n *\n * @package block_dashboardchart\n * @copyright 2022 Brain Station 23 Ltd.\n * @author Brain Station 23 Ltd.\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport $ from \"jquery\";\n\nexport const init = () => {\n /**\n * Manage course input\n */\n function mangeCourseInputField() {\n var dbcharttype = $(\"#id_config_dashboardcharttype :selected\").val();\n }\n mangeCourseInputField();\n\n $(\"#id_config_dashboardcharttype\").on(\"change\", function () {\n mangeCourseInputField();\n });\n};\n"],"names":["_jquery","mangeCourseInputField","$","val","on"],"mappings":";;;;;;;;kFAwBAA,aAAAA,yDAEoB,WAIlB,SAASC,yBACW,EAAAC,QAAAA,SAAE,2CAA2CC,KAChE,CACDF,yBAEA,EAAAC,QAAAA,SAAE,iCAAiCE,GAAG,UAAU,WAC9CH"} \ No newline at end of file diff --git a/amd/src/configure_block.js b/amd/src/configure_block.js index 72b5651..64828ed 100644 --- a/amd/src/configure_block.js +++ b/amd/src/configure_block.js @@ -30,13 +30,6 @@ export const init = () => { */ function mangeCourseInputField() { var dbcharttype = $("#id_config_dashboardcharttype :selected").val(); - if (dbcharttype == "grades") { - document.getElementById("courseleaderboard_configs").style.display = - "block"; - } else { - document.getElementById("courseleaderboard_configs").style.display = - "none"; - } } mangeCourseInputField(); diff --git a/block_dashboardchart.php b/block_dashboardchart.php index a73085a..8f4f183 100644 --- a/block_dashboardchart.php +++ b/block_dashboardchart.php @@ -100,8 +100,6 @@ public function make_custom_content() { $dashboardtype = $this->make_category_course_table($datalimit); } else if ($this->config->dashboardcharttype == 'login') { $dashboardtype = $this->make_login_table($datalimit); - } else if ($this->config->dashboardcharttype == 'grades') { - $dashboardtype = $this->make_course_grade_table($datalimit); } else if ($this->config->dashboardcharttype == 'active_courses') { $dashboardtype = $this->make_most_active_courses_table($datalimit); } else { @@ -262,53 +260,6 @@ public function make_course_student_table($datalimit) { get_string('mostactive_desc', 'block_dashboardchart')); } - /** - * Getting data within a limit - * @param int $datalimit - * @return string - * @throws dml_exception - */ - public function make_course_grade_table($datalimit) { - global $DB, $USER; - - $courseid = $this->config->courseid; - if ($courseid == null) { - return 'select a course to show grade data'; - } - $userid = $USER->id; - $sql = "SELECT round(gg.rawgrade,2) as grade, gi.itemname - FROM {grade_grades} as gg - JOIN {grade_items} as gi on gi.courseid={$courseid} - WHERE gg.itemid=gi.id AND gg.userid={$userid} AND (gg.rawgrade) is not null"; - - $records = $DB->get_records_sql($sql, null, 0, $datalimit); - - $series = []; - $labels = []; - - foreach ($records as $data) { - $series[] = $data->grade; - } - - $sql = "SELECT itemname FROM {grade_items} where courseid={$courseid} and itemname is not null"; - - $records = $DB->get_records_sql($sql, null, 0, $datalimit); - - foreach ($records as $data) { - $labels[] = $data->itemname; - } - while (count($series) < count($labels)) { - $series[] = 0; - } - - $sql = "SELECT fullname FROM {course} where id={$courseid}"; - $coursename = $DB->get_record_sql($sql, null, 0, $datalimit); - - return $this->display_graph($series, $labels, - get_string('earnedgrades', 'block_dashboardchart'), - $coursename->fullname); - } - /** * Display graph. * @param float[] $seriesvalue diff --git a/edit_form.php b/edit_form.php index 0a32a7f..438629b 100644 --- a/edit_form.php +++ b/edit_form.php @@ -54,7 +54,6 @@ protected function specific_definition($mform) { $dashboardcharttype[""] = get_string('dashboardcharttype:select', 'block_dashboardchart'); $dashboardcharttype["coursewiseenrollment"] = get_string('dashboardcharttype:coursewiseenrollment', 'block_dashboardchart'); $dashboardcharttype["category"] = get_string('dashboardcharttype:category', 'block_dashboardchart'); - $dashboardcharttype["grades"] = get_string('dashboardcharttype:grades', 'block_dashboardchart'); $dashboardcharttype["active_courses"] = get_string('dashboardcharttype:active_courses', 'block_dashboardchart'); if (is_siteadmin($USER->id)) { $dashboardcharttype["login"] = get_string('dashboardcharttype:login', 'block_dashboardchart'); diff --git a/lang/en/block_dashboardchart.php b/lang/en/block_dashboardchart.php index 9d0e5f2..fed1efa 100644 --- a/lang/en/block_dashboardchart.php +++ b/lang/en/block_dashboardchart.php @@ -52,12 +52,11 @@ $string['dashboardcharttype:discussionpost'] = 'Forum Discussion Leaderboard'; $string['dashboardcharttype:category'] = 'Courses in category'; $string['dashboardcharttype:login'] = 'Logins per day'; -$string['dashboardcharttype:grades'] = 'Show grade'; $string['dashboardcharttype:active_courses'] = 'Most Active courses'; $string['dashboardcharttype:learner_teacher'] = 'Learners and teachers enrolled per category'; -$string['earnedgrades'] = 'Earned Grades'; $string['graphtype'] = 'Select preferred Graph type:'; +$string['gradedata'] = 'select a course to show grade data'; $string['horizontal'] = 'Horizontal Bar'; $string['leaderboardtypewarning'] = 'Something wrong'; $string['line'] = 'Line Chart';