Skip to content

Commit

Permalink
Refactor for MOODLE41 & PHP 7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
luukverhoeven committed Dec 18, 2023
1 parent 79d03ac commit 4ac64a4
Show file tree
Hide file tree
Showing 20 changed files with 61 additions and 36 deletions.
13 changes: 13 additions & 0 deletions block_configurable_reports.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Configurable Reports a Moodle block for creating customizable reports
*
* @copyright 2020 Juan Leyva <[email protected]>
* @package block_configurable_reports
* @author Juan leyva <http://www.twitter.com/jleyvadelgado>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

/**
* Class block_configurable_reports
*
* @package block_configurable_reports
* @author Juan leyva <http://www.twitter.com/jleyvadelgado>
*/
Expand Down Expand Up @@ -160,6 +171,8 @@ public function get_content() {
}

/**
* Cron
*
* @return bool
*/
public function cron(): bool {
Expand Down
9 changes: 5 additions & 4 deletions classes/github.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Github helper class
* GitHub helper class
*
* @package block_configurable_reports
* @author Juan leyva <http://www.twitter.com/jleyvadelgado>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @copyright 2020 Juan Leyva <[email protected]>
* @package block_configurable_reports
* @author Juan leyva <http://www.twitter.com/jleyvadelgado>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace block_configurable_reports;
Expand Down
12 changes: 7 additions & 5 deletions component.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,19 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* @package block_configurablereports
* @author Juan leyva <http://www.twitter.com/jleyvadelgado>
* @date 2009
* Configurable Reports a Moodle block for creating customizable reports
*
* @copyright 2020 Juan Leyva <[email protected]>
* @package block_configurable_reports
* @author Juan leyva <http://www.twitter.com/jleyvadelgado>
* @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 <http://www.twitter.com/jleyvadelgado>
* @date 2009
*/
abstract class component_base {

Expand Down
3 changes: 2 additions & 1 deletion components/calcs/average/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Configurable Reports a Moodle block for creating customizable reports
*
* @package block_configurable_reports
* @author Juan leyva <http://www.twitter.com/jleyvadelgado>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
Expand All @@ -28,7 +30,6 @@
* Class average_form
*
* @package block_configurable_reports
*
* @author Juan leyva <http://www.twitter.com/jleyvadelgado>
*/
class average_form extends moodleform {
Expand Down
13 changes: 9 additions & 4 deletions components/calcs/average/plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* @package block_configurable_reports
* @author Juan leyva <http://www.twitter.com/jleyvadelgado>
* @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 <[email protected]>
* @package block_configurable_reports
* @author Juan leyva <http://www.twitter.com/jleyvadelgado>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

/**
Expand Down Expand Up @@ -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)) {

Expand All @@ -96,6 +99,8 @@ public function summary(object $data): string {
}

/**
* Execute
*
* @param $rows
* @return float
*/
Expand Down
9 changes: 6 additions & 3 deletions components/calcs/component.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* @package block_configurable_reports
* @author Juan leyva <http://www.twitter.com/jleyvadelgado>
* @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 <[email protected]>
* @package block_configurable_reports
* @author Juan leyva <http://www.twitter.com/jleyvadelgado>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion components/calcs/max/plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function summary(object $data): string {
/**
* Execute
*
* @param $rows
* @param array $rows
* @return float|int|string
*/
public function execute($rows) {
Expand Down
2 changes: 1 addition & 1 deletion components/calcs/percent/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* @copyright 2020 Juan Leyva <[email protected]>
* @package block_configurable_reports
* @author David Pesce <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die;
Expand All @@ -31,7 +32,6 @@
*
* @package block_configurable_reports
* @author David Pesce <[email protected]>
* /
*/
class percent_form extends moodleform {

Expand Down
4 changes: 2 additions & 2 deletions components/calcs/sum/plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -102,7 +102,7 @@ public function summary(object $data): string {
/**
* Execute
*
* @param $rows
* @param array $rows
* @return float|int|string
*/
public function execute($rows) {
Expand Down
2 changes: 1 addition & 1 deletion components/cohorts/plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function summary(object $data): string {
/**
* execute
*
* @param $finalelements
* @param string $finalelements
* @param $data
* @return array|string|string[]
*/
Expand Down
2 changes: 1 addition & 1 deletion components/competencyframeworks/plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function summary(object $data): string {
/**
* execute
*
* @param $finalelements
* @param string $finalelements
* @param $data
* @return array|string|string[]
*/
Expand Down
2 changes: 1 addition & 1 deletion components/filters/coursecategories/plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function summary(object $data): string {
/**
* Execute
*
* @param $finalelements
* @param string $finalelements
* @param $data
* @return mixed
*/
Expand Down
2 changes: 1 addition & 1 deletion components/filters/coursemodules/plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion components/filters/courses/plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function summary(object $data): string {
/**
* Execute
*
* @param $finalelements
* @param string $finalelements
* @return array|string|string[]
*/
public function execute($finalelements) {
Expand Down
2 changes: 1 addition & 1 deletion components/filters/fcoursefield/plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function summary(object $data): string {
/**
* Execute
*
* @param $finalelements
* @param string $finalelements
* @param $data
* @return int[]|mixed|string[]
*/
Expand Down
4 changes: 2 additions & 2 deletions components/filters/fsearchuserfield/plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function summary(object $data): string {
/**
* execute
*
* @param $finalelements
* @param string $finalelements
* @param $data
* @return array|int[]|mixed|string|string[]
*/
Expand All @@ -68,7 +68,7 @@ public function execute($finalelements, $data) {
}

/**
* @param $finalelements
* @param string $finalelements
* @param object $data
* @return array|string|string[]
*/
Expand Down
8 changes: 4 additions & 4 deletions components/filters/fuserfield/plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function summary(object $data): string {
/**
* Execute
*
* @param $finalelements
* @param string $finalelements
* @param $data
* @return array|int[]|mixed|string|string[]
*/
Expand All @@ -73,7 +73,7 @@ public function execute($finalelements, $data) {
/**
* execute_sql
*
* @param $finalelements
* @param string $finalelements
* @param $data
* @return array|mixed|string|string[]
*/
Expand All @@ -96,7 +96,7 @@ private function execute_sql($finalelements, $data) {
/**
* execute_users
*
* @param $finalelements
* @param string $finalelements
* @param $data
* @return array|int[]|mixed|string[]
*/
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion components/filters/searchtext/plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion components/filters/yearhebrew/plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function summary(object $data): string {
/**
* Execute
*
* @param $finalelements
* @param string $finalelements
* @return array|string|string[]
*/
public function execute($finalelements) {
Expand Down
2 changes: 1 addition & 1 deletion components/filters/yearnumeric/plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function summary(object $data): string {
/**
* Execute
*
* @param $finalelements
* @param string $finalelements
* @return array|string|string[]
*/
public function execute($finalelements) {
Expand Down

0 comments on commit 4ac64a4

Please sign in to comment.