From 4ac64a4cb5f1b2e23583a2affd3337cb8adbc6fa Mon Sep 17 00:00:00 2001 From: Luuk Verhoeven Date: Mon, 18 Dec 2023 12:27:20 +0100 Subject: [PATCH] Refactor for MOODLE41 & PHP 7.4 --- block_configurable_reports.php | 13 +++++++++++++ classes/github.php | 9 +++++---- component.class.php | 12 +++++++----- components/calcs/average/form.php | 3 ++- components/calcs/average/plugin.class.php | 13 +++++++++---- components/calcs/component.class.php | 9 ++++++--- components/calcs/max/plugin.class.php | 2 +- components/calcs/percent/form.php | 2 +- components/calcs/sum/plugin.class.php | 4 ++-- components/cohorts/plugin.class.php | 2 +- components/competencyframeworks/plugin.class.php | 2 +- .../filters/coursecategories/plugin.class.php | 2 +- components/filters/coursemodules/plugin.class.php | 2 +- components/filters/courses/plugin.class.php | 2 +- components/filters/fcoursefield/plugin.class.php | 2 +- .../filters/fsearchuserfield/plugin.class.php | 4 ++-- components/filters/fuserfield/plugin.class.php | 8 ++++---- components/filters/searchtext/plugin.class.php | 2 +- components/filters/yearhebrew/plugin.class.php | 2 +- components/filters/yearnumeric/plugin.class.php | 2 +- 20 files changed, 61 insertions(+), 36 deletions(-) diff --git a/block_configurable_reports.php b/block_configurable_reports.php index 90867b0a..2741a820 100755 --- a/block_configurable_reports.php +++ b/block_configurable_reports.php @@ -15,6 +15,17 @@ // along with Moodle. If not, see . /** + * Configurable Reports a Moodle block for creating customizable reports + * + * @copyright 2020 Juan Leyva + * @package block_configurable_reports + * @author Juan leyva + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +/** + * Class block_configurable_reports + * * @package block_configurable_reports * @author Juan leyva */ @@ -160,6 +171,8 @@ public function get_content() { } /** + * Cron + * * @return bool */ public function cron(): bool { diff --git a/classes/github.php b/classes/github.php index 5d7eed3b..4c05de6c 100644 --- a/classes/github.php +++ b/classes/github.php @@ -15,11 +15,12 @@ // along with Moodle. If not, see . /** - * Github helper class + * GitHub helper class * - * @package block_configurable_reports - * @author Juan leyva - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright 2020 Juan Leyva + * @package block_configurable_reports + * @author Juan leyva + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace block_configurable_reports; diff --git a/component.class.php b/component.class.php index 2aba21f2..1af16c9e 100755 --- a/component.class.php +++ b/component.class.php @@ -15,17 +15,19 @@ // along with Moodle. If not, see . /** - * @package block_configurablereports - * @author Juan leyva - * @date 2009 + * Configurable Reports a Moodle block for creating customizable reports + * + * @copyright 2020 Juan Leyva + * @package block_configurable_reports + * @author Juan leyva + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** * Class component_base * - * @package block_configurablereports + * @package block_configurable_reports * @author Juan leyva - * @date 2009 */ abstract class component_base { diff --git a/components/calcs/average/form.php b/components/calcs/average/form.php index 0f081c3f..b53a04c1 100755 --- a/components/calcs/average/form.php +++ b/components/calcs/average/form.php @@ -15,6 +15,8 @@ // along with Moodle. If not, see . /** + * Configurable Reports a Moodle block for creating customizable reports + * * @package block_configurable_reports * @author Juan leyva * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later @@ -28,7 +30,6 @@ * Class average_form * * @package block_configurable_reports - * * @author Juan leyva */ class average_form extends moodleform { diff --git a/components/calcs/average/plugin.class.php b/components/calcs/average/plugin.class.php index 523fdf5d..d6897a93 100755 --- a/components/calcs/average/plugin.class.php +++ b/components/calcs/average/plugin.class.php @@ -15,9 +15,12 @@ // along with Moodle. If not, see . /** - * @package block_configurable_reports - * @author Juan leyva - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Configurable Reports a Moodle block for creating customizable reports + * + * @copyright 2020 Juan Leyva + * @package block_configurable_reports + * @author Juan leyva + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** @@ -70,7 +73,7 @@ public function summary(object $data): string { $reportclass = new $reportclassname($this->report); $components = cr_unserialize($this->report->components); - $config = (isset($components['customsql']['config'])) ? $components['customsql']['config'] : new stdclass; + $config = $components['customsql']['config'] ?? new stdclass; if (isset($config->querysql)) { @@ -96,6 +99,8 @@ public function summary(object $data): string { } /** + * Execute + * * @param $rows * @return float */ diff --git a/components/calcs/component.class.php b/components/calcs/component.class.php index c53a2ca7..636e8826 100755 --- a/components/calcs/component.class.php +++ b/components/calcs/component.class.php @@ -15,9 +15,12 @@ // along with Moodle. If not, see . /** - * @package block_configurable_reports - * @author Juan leyva - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * Configurable Reports a Moodle block for creating customizable reports + * + * @copyright 2020 Juan Leyva + * @package block_configurable_reports + * @author Juan leyva + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** diff --git a/components/calcs/max/plugin.class.php b/components/calcs/max/plugin.class.php index cafd2391..d5da09fe 100755 --- a/components/calcs/max/plugin.class.php +++ b/components/calcs/max/plugin.class.php @@ -105,7 +105,7 @@ public function summary(object $data): string { /** * Execute * - * @param $rows + * @param array $rows * @return float|int|string */ public function execute($rows) { diff --git a/components/calcs/percent/form.php b/components/calcs/percent/form.php index 0a8f2329..26483f4d 100644 --- a/components/calcs/percent/form.php +++ b/components/calcs/percent/form.php @@ -20,6 +20,7 @@ * @copyright 2020 Juan Leyva * @package block_configurable_reports * @author David Pesce + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die; @@ -31,7 +32,6 @@ * * @package block_configurable_reports * @author David Pesce - * / */ class percent_form extends moodleform { diff --git a/components/calcs/sum/plugin.class.php b/components/calcs/sum/plugin.class.php index 1c8cd9e0..42dc11ec 100755 --- a/components/calcs/sum/plugin.class.php +++ b/components/calcs/sum/plugin.class.php @@ -50,7 +50,7 @@ public function init(): void { * @return string */ public function summary(object $data): string { - global $DB, $CFG; + global $CFG; if ($this->report->type !== 'sql') { $components = cr_unserialize($this->report->components); @@ -102,7 +102,7 @@ public function summary(object $data): string { /** * Execute * - * @param $rows + * @param array $rows * @return float|int|string */ public function execute($rows) { diff --git a/components/cohorts/plugin.class.php b/components/cohorts/plugin.class.php index 56b684a4..effaacda 100644 --- a/components/cohorts/plugin.class.php +++ b/components/cohorts/plugin.class.php @@ -57,7 +57,7 @@ public function summary(object $data): string { /** * execute * - * @param $finalelements + * @param string $finalelements * @param $data * @return array|string|string[] */ diff --git a/components/competencyframeworks/plugin.class.php b/components/competencyframeworks/plugin.class.php index 52cba38a..e216aabe 100644 --- a/components/competencyframeworks/plugin.class.php +++ b/components/competencyframeworks/plugin.class.php @@ -60,7 +60,7 @@ public function summary(object $data): string { /** * execute * - * @param $finalelements + * @param string $finalelements * @param $data * @return array|string|string[] */ diff --git a/components/filters/coursecategories/plugin.class.php b/components/filters/coursecategories/plugin.class.php index 74a6c9ac..1e208668 100755 --- a/components/filters/coursecategories/plugin.class.php +++ b/components/filters/coursecategories/plugin.class.php @@ -58,7 +58,7 @@ public function summary(object $data): string { /** * Execute * - * @param $finalelements + * @param string $finalelements * @param $data * @return mixed */ diff --git a/components/filters/coursemodules/plugin.class.php b/components/filters/coursemodules/plugin.class.php index 769102e4..46daed93 100755 --- a/components/filters/coursemodules/plugin.class.php +++ b/components/filters/coursemodules/plugin.class.php @@ -58,7 +58,7 @@ public function summary(object $data): string { /** * Execute * - * @param $finalelements + * @param string $finalelements * @return array|mixed|string|string[] */ public function execute($finalelements) { diff --git a/components/filters/courses/plugin.class.php b/components/filters/courses/plugin.class.php index 974dbef6..1e0fcb88 100755 --- a/components/filters/courses/plugin.class.php +++ b/components/filters/courses/plugin.class.php @@ -58,7 +58,7 @@ public function summary(object $data): string { /** * Execute * - * @param $finalelements + * @param string $finalelements * @return array|string|string[] */ public function execute($finalelements) { diff --git a/components/filters/fcoursefield/plugin.class.php b/components/filters/fcoursefield/plugin.class.php index 66d3a03d..a56351f5 100755 --- a/components/filters/fcoursefield/plugin.class.php +++ b/components/filters/fcoursefield/plugin.class.php @@ -58,7 +58,7 @@ public function summary(object $data): string { /** * Execute * - * @param $finalelements + * @param string $finalelements * @param $data * @return int[]|mixed|string[] */ diff --git a/components/filters/fsearchuserfield/plugin.class.php b/components/filters/fsearchuserfield/plugin.class.php index 9c745f96..4b36c82d 100755 --- a/components/filters/fsearchuserfield/plugin.class.php +++ b/components/filters/fsearchuserfield/plugin.class.php @@ -55,7 +55,7 @@ public function summary(object $data): string { /** * execute * - * @param $finalelements + * @param string $finalelements * @param $data * @return array|int[]|mixed|string|string[] */ @@ -68,7 +68,7 @@ public function execute($finalelements, $data) { } /** - * @param $finalelements + * @param string $finalelements * @param object $data * @return array|string|string[] */ diff --git a/components/filters/fuserfield/plugin.class.php b/components/filters/fuserfield/plugin.class.php index 797b4050..68e0d341 100755 --- a/components/filters/fuserfield/plugin.class.php +++ b/components/filters/fuserfield/plugin.class.php @@ -58,7 +58,7 @@ public function summary(object $data): string { /** * Execute * - * @param $finalelements + * @param string $finalelements * @param $data * @return array|int[]|mixed|string|string[] */ @@ -73,7 +73,7 @@ public function execute($finalelements, $data) { /** * execute_sql * - * @param $finalelements + * @param string $finalelements * @param $data * @return array|mixed|string|string[] */ @@ -96,7 +96,7 @@ private function execute_sql($finalelements, $data) { /** * execute_users * - * @param $finalelements + * @param string $finalelements * @param $data * @return array|int[]|mixed|string[] */ @@ -219,7 +219,7 @@ public function print_filter(MoodleQuickForm $mform, $formdata = false): void { * * @param $filtersearchtext * @param $filterstrmatch - * @param $finalelements + * @param string $finalelements * @return array|mixed|string|string[] */ private function sql_replace($filtersearchtext, $filterstrmatch, $finalelements) { diff --git a/components/filters/searchtext/plugin.class.php b/components/filters/searchtext/plugin.class.php index cd755836..b9c41f47 100644 --- a/components/filters/searchtext/plugin.class.php +++ b/components/filters/searchtext/plugin.class.php @@ -118,7 +118,7 @@ public function print_filter(MoodleQuickForm $mform, $formdata = false): void { * * @param $filtersearchtext * @param $filterstrmatch - * @param $finalelements + * @param string $finalelements * @return array|mixed|string|string[] */ private function sql_replace($filtersearchtext, $filterstrmatch, $finalelements) { diff --git a/components/filters/yearhebrew/plugin.class.php b/components/filters/yearhebrew/plugin.class.php index bb0ddde5..89afede6 100755 --- a/components/filters/yearhebrew/plugin.class.php +++ b/components/filters/yearhebrew/plugin.class.php @@ -58,7 +58,7 @@ public function summary(object $data): string { /** * Execute * - * @param $finalelements + * @param string $finalelements * @return array|string|string[] */ public function execute($finalelements) { diff --git a/components/filters/yearnumeric/plugin.class.php b/components/filters/yearnumeric/plugin.class.php index b33499da..1d5b3d39 100755 --- a/components/filters/yearnumeric/plugin.class.php +++ b/components/filters/yearnumeric/plugin.class.php @@ -58,7 +58,7 @@ public function summary(object $data): string { /** * Execute * - * @param $finalelements + * @param string $finalelements * @return array|string|string[] */ public function execute($finalelements) {