Skip to content

Commit

Permalink
Fixed Naming convention in plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
waleedhassan5 committed Dec 23, 2024
1 parent 26cbe5a commit 9fcbb2d
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 44 deletions.
12 changes: 6 additions & 6 deletions classes/task/cleanup_students.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@
* Scheduled task for managing student accounts lifecycle.
*
* This task handles the automated process of disabling and/or deleting student accounts
* based on configured criteria within the tool_disable_delete_students plugin.
* based on configured criteria within the disable_delete_students plugin.
*
* @package tool_disable_delete_students
* @package disable_delete_students
* @copyright 2024 onwards Catalyst IT {@link http://www.catalyst-eu.net/}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author Waleed ul hassan <[email protected]>
*/

namespace tool_disable_delete_students\task;
namespace disable_delete_students\task;

/**
* Scheduled task class for cleaning up student accounts.
*
* @package tool_disable_delete_students
* @package disable_delete_students
*/
class cleanup_students extends \core\task\scheduled_task {

Expand All @@ -42,7 +42,7 @@ class cleanup_students extends \core\task\scheduled_task {
* @throws \coding_exception
*/
public function get_name() {
return get_string('taskname', 'tool_disable_delete_students');
return get_string('taskname', 'disable_delete_students');
}

/**
Expand All @@ -54,6 +54,6 @@ public function get_name() {
* @return void
*/
public function execute() {
\tool_disable_delete_students\util::process_student_accounts();
\disable_delete_students\util::process_student_accounts();
}
}
10 changes: 5 additions & 5 deletions classes/util.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
* - Processing account disabling and deletion based on configured rules
* - Handling role-based exclusions
*
* @package tool_disable_delete_students
* @package disable_delete_students
* @copyright 2024 onwards Catalyst IT {@link http://www.catalyst-eu.net/}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author Waleed ul hassan <[email protected]>
*/

namespace tool_disable_delete_students;
namespace disable_delete_students;

defined('MOODLE_INTERNAL') || die();

Expand Down Expand Up @@ -82,9 +82,9 @@ public static function has_excluded_roles(int $userid): bool {
public static function process_student_accounts() {
global $DB, $CFG;

$disableaftercourseend = get_config('tool_disable_delete_students', 'disable_after_course_end');
$disableaftercreation = get_config('tool_disable_delete_students', 'disable_after_creation');
$deleteaftermonths = get_config('tool_disable_delete_students', 'delete_after_months');
$disableaftercourseend = get_config('disable_delete_students', 'disable_after_course_end');
$disableaftercreation = get_config('disable_delete_students', 'disable_after_creation');
$deleteaftermonths = get_config('disable_delete_students', 'delete_after_months');

// Get all active student accounts.
$sql = "SELECT DISTINCT u.*
Expand Down
8 changes: 4 additions & 4 deletions db/tasks.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,24 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Scheduled task definitions for the tool_disable_delete_students plugin.
* Scheduled task definitions for the disable_delete_students plugin.
*
* This file contains the configuration for scheduled tasks related to
* the management of student accounts, specifically for disabling accounts
* based on defined criteria.
*
* @package tool_disable_delete_students
* @package disable_delete_students
* @copyright 2024 onwards Catalyst IT {@link http://www.catalyst-eu.net/}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author Waleed ul hassan <[email protected]>
*/

defined('MOODLE_INTERNAL') || die();

// Define the scheduled tasks for the tool_disable_delete_students plugin.
// Define the scheduled tasks for the disable_delete_students plugin.
$tasks = [
[
'classname' => 'tool_disable_delete_students\task\cleanup_students',
'classname' => 'disable_delete_students\task\cleanup_students',
'blocking' => 0,
'minute' => '0',
'hour' => '0',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Language strings for the tool_disable_delete_students plugin.
* Language strings for the disable_delete_students plugin.
*
* This file contains the language strings used in the plugin for managing
* student account lifecycle operations, including disabling and deleting
* accounts based on defined criteria.
*
* @package tool_disable_delete_students
* @package disable_delete_students
* @copyright 2024 onwards Catalyst IT {@link http://www.catalyst-eu.net/}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author Waleed ul hassan <[email protected]>
Expand Down
24 changes: 12 additions & 12 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Settings for the tool_disable_delete_students plugin.
* Settings for the disable_delete_students plugin.
*
* @package tool_disable_delete_students
* @package disable_delete_students
* @copyright 2024 onwards Catalyst IT {@link http://www.catalyst-eu.net/}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author Waleed ul hassan <[email protected]>
Expand All @@ -26,32 +26,32 @@
defined('MOODLE_INTERNAL') || die;

if ($hassiteconfig) {
$settings = new admin_settingpage('tool_disable_delete_students', get_string('pluginname', 'tool_disable_delete_students'));
$settings = new admin_settingpage('disable_delete_students', get_string('pluginname', 'disable_delete_students'));
$ADMIN->add('tools', $settings);

// Days after course end to disable account.
$settings->add(new admin_setting_configtext(
'tool_disable_delete_students/disable_after_course_end',
get_string('disable_after_course_end', 'tool_disable_delete_students'),
get_string('disable_after_course_end_desc', 'tool_disable_delete_students'),
'disable_delete_students/disable_after_course_end',
get_string('disable_after_course_end', 'disable_delete_students'),
get_string('disable_after_course_end_desc', 'disable_delete_students'),
21,
PARAM_INT
));

// Days after creation to disable account.
$settings->add(new admin_setting_configtext(
'tool_disable_delete_students/disable_after_creation',
get_string('disable_after_creation', 'tool_disable_delete_students'),
get_string('disable_after_creation_desc', 'tool_disable_delete_students'),
'disable_delete_students/disable_after_creation',
get_string('disable_after_creation', 'disable_delete_students'),
get_string('disable_after_creation_desc', 'disable_delete_students'),
45,
PARAM_INT
));

// Months after course end to delete account.
$settings->add(new admin_setting_configtext(
'tool_disable_delete_students/delete_after_months',
get_string('delete_after_months', 'tool_disable_delete_students'),
get_string('delete_after_months_desc', 'tool_disable_delete_students'),
'disable_delete_students/delete_after_months',
get_string('delete_after_months', 'disable_delete_students'),
get_string('delete_after_months_desc', 'disable_delete_students'),
6,
PARAM_INT
));
Expand Down
16 changes: 8 additions & 8 deletions tests/cleanup_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Unit tests for the tool_disable_delete_students plugin.
* Unit tests for the disable_delete_students plugin.
*
* @package tool_disable_delete_students
* @package disable_delete_students
* @category test
* @copyright 2024 Catalyst IT {@link http://www.catalyst-eu.net/}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_disable_delete_students;
namespace disable_delete_students;

/**
* Unit tests for the tool_disable_delete_students plugin.
* Unit tests for the disable_delete_students plugin.
*
* The tests include:
* - Verification of excluded roles
Expand All @@ -35,7 +35,7 @@
* - Ensuring users with excluded roles are not affected
* - Handling of students enrolled in multiple courses
*
* @package tool_disable_delete_students
* @package disable_delete_students
* @category test
* @copyright 2024 Catalyst IT {@link http://www.catalyst-eu.net/}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
Expand All @@ -59,9 +59,9 @@ protected function setUp(): void {
parent::setUp();
$this->resetAfterTest(true);
// Set plugin configurations.
set_config('disable_after_course_end', 21, 'tool_disable_delete_students');
set_config('disable_after_creation', 45, 'tool_disable_delete_students');
set_config('delete_after_months', 6, 'tool_disable_delete_students');
set_config('disable_after_course_end', 21, 'disable_delete_students');
set_config('disable_after_creation', 45, 'disable_delete_students');
set_config('delete_after_months', 6, 'disable_delete_students');

// Retrieve system roles.
$this->studentrole = $DB->get_record('role', ['shortname' => 'student']);
Expand Down
8 changes: 4 additions & 4 deletions tests/generator/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Generator for the tool_disable_delete_students plugin.
* Generator for the disable_delete_students plugin.
*
* This class provides methods for creating test courses and users
* with specific roles for testing purposes.
*
* @package tool_disable_delete_students
* @package disable_delete_students
* @copyright 2024 onwards Catalyst IT {@link http://www.catalyst-eu.net/}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author Waleed ul hassan <[email protected]>
Expand All @@ -29,10 +29,10 @@
/**
* Tool disable_delete_students generator
*
* @package tool_disable_delete_students
* @package disable_delete_students
* @category test
*/
class tool_disable_delete_students_generator extends testing_module_generator {
class disable_delete_students_generator extends testing_module_generator {
/**
* Create a test course with specific settings.
*
Expand Down
6 changes: 3 additions & 3 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Version information for the tool_disable_delete_students plugin.
* Version information for the disable_delete_students plugin.
*
* @package tool_disable_delete_students
* @package disable_delete_students
* @copyright 2024 onwards Catalyst IT {@link http://www.catalyst-eu.net/}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author Waleed ul hassan <[email protected]>
Expand All @@ -28,6 +28,6 @@

$plugin->version = 2024021500;
$plugin->requires = 2022112800; // Moodle 4.1
$plugin->component = 'tool_disable_delete_students';
$plugin->component = 'disable_delete_students';
$plugin->maturity = MATURITY_STABLE;
$plugin->release = '1.0';

0 comments on commit 9fcbb2d

Please sign in to comment.