1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-24 09:55:33 +02:00

MDL-75034 reportbuilder: move classes into consistent namespace.

Use `reportbuilder` level two namespace for report related classes
(entities, system reports, etc) within components and sub-systems.
This commit is contained in:
Paul Holden 2022-09-12 16:59:26 +01:00
parent cc4fec275f
commit b3828cebd2
17 changed files with 64 additions and 20 deletions
admin
classes/reportbuilder
datasource
local
entities
systemreports
tasklogs.php
cohort/classes/reportbuilder
course/classes/reportbuilder
lib/db
report/configlog
classes/reportbuilder/local
db
index.phpversion.php
reportbuilder

@ -18,10 +18,10 @@ declare(strict_types=1);
namespace core_admin\reportbuilder\datasource;
use core_admin\reportbuilder\local\entities\task_log;
use core_reportbuilder\datasource;
use core_reportbuilder\local\entities\user;
use core_reportbuilder\local\filters\select;
use core_admin\local\entities\task_log;
/**
* Task logs datasource

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace core_admin\local\entities;
namespace core_admin\reportbuilder\local\entities;
use core_reportbuilder\local\filters\date;
use core_reportbuilder\local\filters\duration;

@ -14,10 +14,10 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace core_admin\local\systemreports;
namespace core_admin\reportbuilder\local\systemreports;
use context_system;
use core_admin\local\entities\task_log;
use core_admin\reportbuilder\local\entities\task_log;
use core_reportbuilder\local\entities\user;
use core_reportbuilder\local\report\action;
use lang_string;

@ -25,7 +25,7 @@
require_once(__DIR__ . '/../config.php');
require_once("{$CFG->libdir}/adminlib.php");
use core_admin\local\systemreports\task_logs;
use core_admin\reportbuilder\local\systemreports\task_logs;
use core_reportbuilder\system_report_factory;
$PAGE->set_url(new \moodle_url('/admin/tasklogs.php'));

@ -18,8 +18,7 @@ declare(strict_types=1);
namespace core_cohort\reportbuilder\datasource;
use core_cohort\local\entities\cohort;
use core_cohort\local\entities\cohort_member;
use core_cohort\reportbuilder\local\entities\{cohort, cohort_member};
use core_reportbuilder\datasource;
use core_reportbuilder\local\entities\user;

@ -16,7 +16,7 @@
declare(strict_types=1);
namespace core_cohort\local\entities;
namespace core_cohort\reportbuilder\local\entities;
use context;
use context_helper;

@ -16,7 +16,7 @@
declare(strict_types=1);
namespace core_cohort\local\entities;
namespace core_cohort\reportbuilder\local\entities;
use lang_string;
use core_reportbuilder\local\entities\base;

@ -18,7 +18,7 @@ declare(strict_types=1);
namespace core_course\reportbuilder\datasource;
use core_course\local\entities\course_category;
use core_course\reportbuilder\local\entities\course_category;
use core_reportbuilder\datasource;
use core_reportbuilder\local\entities\course;
use core_reportbuilder\local\helpers\database;

@ -18,7 +18,7 @@ declare(strict_types=1);
namespace core_course\reportbuilder\datasource;
use core_course\local\entities\course_category;
use core_course\reportbuilder\local\entities\course_category;
use core_course\reportbuilder\local\entities\access;
use core_course\reportbuilder\local\entities\completion;
use core_course\reportbuilder\local\entities\enrolment;

@ -16,7 +16,7 @@
declare(strict_types=1);
namespace core_course\local\entities;
namespace core_course\reportbuilder\local\entities;
use context_coursecat;
use context_helper;

@ -83,4 +83,10 @@ $renamedclasses = [
'core_question\\form\\tags' => 'qbank_tagquestion\\form\\tags_form',
'context_to_string_translator' => 'core_question\\local\\bank\\context_to_string_translator',
'question_edit_contexts' => 'core_question\\local\\bank\\question_edit_contexts',
// Since Moodle 4.1.
'core_admin\\local\\systemreports\\task_logs' => 'core_admin\\reportbuilder\\local\\systemreports\\task_logs',
'core_admin\\local\\entities\\task_log' => 'core_admin\\reportbuilder\\local\\entities\\task_log',
'core_course\\local\\entities\\course_category' => 'core_course\\reportbuilder\\local\\entities\\course_category',
'core_cohort\\local\\entities\\cohort' => 'core_cohort\\reportbuilder\\local\\entities\\cohort',
'core_cohort\\local\\entities\\cohort_member' => 'core_cohort\\reportbuilder\\local\\entities\\cohort_member',
];

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace report_configlog\local\entities;
namespace report_configlog\reportbuilder\local\entities;
use lang_string;
use core_reportbuilder\local\entities\base;

@ -14,12 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace report_configlog\local\systemreports;
namespace report_configlog\reportbuilder\local\systemreports;
use context_system;
use report_configlog\local\entities\config_change as config_change_entity;
use report_configlog\reportbuilder\local\entities\config_change;
use core_reportbuilder\system_report;
use core_reportbuilder\local\entities\user as user_entity;
use core_reportbuilder\local\entities\user;
use stdClass;
/**
@ -36,14 +36,14 @@ class config_changes extends system_report {
*/
protected function initialise(): void {
// Our main entity, it contains all of the column definitions that we need.
$entitymain = new config_change_entity();
$entitymain = new config_change();
$entitymainalias = $entitymain->get_table_alias('config_log');
$this->set_main_table('config_log', $entitymainalias);
$this->add_entity($entitymain);
// We can join the "user" entity to our "main" entity using standard SQL JOIN.
$entityuser = new user_entity();
$entityuser = new user();
$entityuseralias = $entityuser->get_table_alias('user');
$this->add_entity($entityuser
->add_join("LEFT JOIN {user} {$entityuseralias} ON {$entityuseralias}.id = {$entitymainalias}.userid")

@ -0,0 +1,33 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This file contains mappings for classes that have been renamed so that they meet the requirements of the autoloader.
*
* @package report_configlog
* @copyright 2022 Paul Holden <paulh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$renamedclasses = [
// Since Moodle 4.1.
'report_configlog\\local\\systemreports\\config_changes' =>
'report_configlog\\reportbuilder\\local\\systemreports\\config_changes',
'report_configlog\\local\\entities\\config_change' =>
'report_configlog\\reportbuilder\\local\\entities\\config_change',
];

@ -25,7 +25,7 @@
use core_reportbuilder\system_report_factory;
use core_reportbuilder\local\filters\text;
use report_configlog\local\systemreports\config_changes;
use report_configlog\reportbuilder\local\systemreports\config_changes;
require(__DIR__.'/../../config.php');
require_once($CFG->libdir.'/adminlib.php');

@ -25,6 +25,6 @@
defined('MOODLE_INTERNAL') || die;
$plugin->version = 2022041900; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2022091500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2022041200; // Requires this Moodle version.
$plugin->component = 'report_configlog'; // Full name of the plugin (used for diagnostics)

@ -12,6 +12,12 @@ Information provided here is intended especially for developers.
* New external methods for retrieving custom report data:
- `core_reportbuilder_list_reports`
- `core_reportbuilder_view_report`
* For consistency, the following entity classes have moved namespace (usage of previous namespace will generate debugging):
- `core_admin\{ => reportbuilder}\local\entities\task_log`
- `core_cohort\{ => reportbuilder}\local\entities\cohort`
- `core_cohort\{ => reportbuilder}\local\entities\cohort_member`
- `core_course\{ => reportbuilder}\local\entities\course_category`
- `report_configlog\{ => reportbuilder}\local\entities\config_change`
* 'set_default_per_page' and 'get_default_per_page' methods have been added to \local\report\base class
to manage the default displayed rows per page.
* Added two new methods in the datasource class: