Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lbplanner/classes/helpers/config_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static function add_customfield(): void {
}
}
/**
* Adds a customfield to moodle for each activity where teachers can select GK EK or both.
* Removes a customfield from moodle for each activity where teachers can select GK EK or both.
*
* @throws \coding_exception
* @throws \moodle_exception
Expand Down
13 changes: 11 additions & 2 deletions lbplanner/classes/helpers/course_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@ public static function get_all_eduplanner_courses(bool $onlyenrolled=true): arra
ue.status = :active
AND e.status = :enabled
AND ue.timestart <= :now
AND c.enddate > :courseexpiredate
AND ue.timeend >= :now
AND (
c.enddate > :courseexpiredate
OR c.enddate = 0
)
AND ti.tagid = :lbptagid
AND ti.itemtype = 'course'",
[
Expand All @@ -123,7 +127,12 @@ public static function get_all_eduplanner_courses(bool $onlyenrolled=true): arra
$mdlcourses = $DB->get_records_sql("
SELECT c.* FROM {course} c
INNER JOIN {tag_instance} ti ON (ti.itemid = c.id)
WHERE c.enddate > :courseexpiredate AND ti.tagid = :lbptagid AND ti.itemtype = 'course'",
WHERE (
c.enddate > :courseexpiredate
OR c.enddate = 0
)
AND ti.tagid = :lbptagid
AND ti.itemtype = 'course'",
[
"courseexpiredate" => $courseexpiredate,
"lbptagid" => $lbptag->id,
Expand Down
8 changes: 5 additions & 3 deletions lbplanner/db/uninstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,19 @@
*
* @package local_lbplanner
* @subpackage db
* @copyright 2024 NecodeIT
* @copyright 2025 NecodeIT
* @license https://creativecommons.org/licenses/by-nc-sa/4.0/ CC-BY-NC-SA 4.0 International or later
*/

use local_lbplanner\helpers\config_helper;

use local_lbplanner\helpers\{config_helper, course_helper};

/**
* Runs when plugin is uninstalled
*/
function xmldb_local_lbplanner_uninstall() {
config_helper::remove_customfield();

$tag = core_tag_tag::get_by_name(core_tag_collection::get_default(), course_helper::EDUPLANNER_TAG, strictness:MUST_EXIST);
core_tag_tag::delete_tags($tag->id);
}

Loading