forked from ILIAS-eLearning/ILIAS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Delete test skill data when deleting competences
- Loading branch information
Showing
15 changed files
with
516 additions
and
6 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
Modules/Test/classes/Skills/Service/class.SkillInternalManagerService.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of ILIAS, a powerful learning management system | ||
* published by ILIAS open source e-Learning e.V. | ||
* | ||
* ILIAS is licensed with the GPL-3.0, | ||
* see https://www.gnu.org/licenses/gpl-3.0.en.html | ||
* You should have received a copy of said license along with the | ||
* source code, too. | ||
* | ||
* If this is not the case or you just want to try ILIAS, you'll find | ||
* us at: | ||
* https://www.ilias.de | ||
* https://github.com/ILIAS-eLearning | ||
* | ||
******************************************************************** | ||
*/ | ||
|
||
namespace ILIAS\Test\Skills; | ||
|
||
/** | ||
* @author Thomas Famula <[email protected]> | ||
*/ | ||
class SkillInternalManagerService | ||
{ | ||
public function getSkillDeletionManager(): TestSkillDeletionManager | ||
{ | ||
return new TestSkillDeletionManager(); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
Modules/Test/classes/Skills/Service/class.SkillInternalRepoService.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of ILIAS, a powerful learning management system | ||
* published by ILIAS open source e-Learning e.V. | ||
* | ||
* ILIAS is licensed with the GPL-3.0, | ||
* see https://www.gnu.org/licenses/gpl-3.0.en.html | ||
* You should have received a copy of said license along with the | ||
* source code, too. | ||
* | ||
* If this is not the case or you just want to try ILIAS, you'll find | ||
* us at: | ||
* https://www.ilias.de | ||
* https://github.com/ILIAS-eLearning | ||
* | ||
******************************************************************** | ||
*/ | ||
|
||
namespace ILIAS\Test\Skills; | ||
|
||
/** | ||
* @author Thomas Famula <[email protected]> | ||
*/ | ||
class SkillInternalRepoService | ||
{ | ||
public function getTestSkillRepo(): TestSkillDBRepository | ||
{ | ||
return new TestSkillDBRepository(); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
Modules/Test/classes/Skills/Service/class.SkillInternalService.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of ILIAS, a powerful learning management system | ||
* published by ILIAS open source e-Learning e.V. | ||
* | ||
* ILIAS is licensed with the GPL-3.0, | ||
* see https://www.gnu.org/licenses/gpl-3.0.en.html | ||
* You should have received a copy of said license along with the | ||
* source code, too. | ||
* | ||
* If this is not the case or you just want to try ILIAS, you'll find | ||
* us at: | ||
* https://www.ilias.de | ||
* https://github.com/ILIAS-eLearning | ||
* | ||
******************************************************************** | ||
*/ | ||
|
||
namespace ILIAS\Test\Skills; | ||
|
||
/** | ||
* @author Thomas Famula <[email protected]> | ||
*/ | ||
class SkillInternalService | ||
{ | ||
public function __construct() | ||
{ | ||
} | ||
|
||
public function repo(): SkillInternalRepoService | ||
{ | ||
return new SkillInternalRepoService(); | ||
} | ||
|
||
public function manager(): SkillInternalManagerService | ||
{ | ||
return new SkillInternalManagerService(); | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
Modules/Test/classes/Skills/class.TestSkillDBRepository.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of ILIAS, a powerful learning management system | ||
* published by ILIAS open source e-Learning e.V. | ||
* | ||
* ILIAS is licensed with the GPL-3.0, | ||
* see https://www.gnu.org/licenses/gpl-3.0.en.html | ||
* You should have received a copy of said license along with the | ||
* source code, too. | ||
* | ||
* If this is not the case or you just want to try ILIAS, you'll find | ||
* us at: | ||
* https://www.ilias.de | ||
* https://github.com/ILIAS-eLearning | ||
* | ||
******************************************************************** | ||
*/ | ||
|
||
namespace ILIAS\Test\Skills; | ||
|
||
/** | ||
* @author Thomas Famula <[email protected]> | ||
*/ | ||
class TestSkillDBRepository | ||
{ | ||
protected \ilDBInterface $db; | ||
|
||
public function __construct( | ||
\ilDBInterface $db = null | ||
) { | ||
global $DIC; | ||
|
||
$this->db = ($db) ?: $DIC->database(); | ||
} | ||
|
||
public function removeForSkill(int $skill_node_id, bool $is_reference): void | ||
{ | ||
if (!$is_reference) { | ||
$this->db->manipulate("DELETE FROM tst_skl_thresholds " . | ||
" WHERE skill_base_fi = " . $this->db->quote($skill_node_id, "integer")); | ||
} else { | ||
$this->db->manipulate("DELETE FROM tst_skl_thresholds " . | ||
" WHERE skill_tref_fi = " . $this->db->quote($skill_node_id, "integer")); | ||
} | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
Modules/Test/classes/Skills/class.TestSkillDeletionManager.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of ILIAS, a powerful learning management system | ||
* published by ILIAS open source e-Learning e.V. | ||
* | ||
* ILIAS is licensed with the GPL-3.0, | ||
* see https://www.gnu.org/licenses/gpl-3.0.en.html | ||
* You should have received a copy of said license along with the | ||
* source code, too. | ||
* | ||
* If this is not the case or you just want to try ILIAS, you'll find | ||
* us at: | ||
* https://www.ilias.de | ||
* https://github.com/ILIAS-eLearning | ||
* | ||
******************************************************************** | ||
*/ | ||
|
||
namespace ILIAS\Test\Skills; | ||
|
||
/** | ||
* @author Thomas Famula <[email protected]> | ||
*/ | ||
class TestSkillDeletionManager | ||
{ | ||
protected TestSkillDBRepository $test_skill_repo; | ||
|
||
public function __construct( | ||
TestSkillDBRepository $test_skill_repo = null | ||
) { | ||
global $DIC; | ||
|
||
$this->test_skill_repo = ($test_skill_repo) | ||
?: $DIC->skills()->internalTest()->repo()->getTestSkillRepo(); | ||
} | ||
|
||
public function removeTestSkillsForSkill(int $skill_node_id, bool $is_reference = false): void | ||
{ | ||
$this->test_skill_repo->removeForSkill($skill_node_id, $is_reference); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of ILIAS, a powerful learning management system | ||
* published by ILIAS open source e-Learning e.V. | ||
* | ||
* ILIAS is licensed with the GPL-3.0, | ||
* see https://www.gnu.org/licenses/gpl-3.0.en.html | ||
* You should have received a copy of said license along with the | ||
* source code, too. | ||
* | ||
* If this is not the case or you just want to try ILIAS, you'll find | ||
* us at: | ||
* https://www.ilias.de | ||
* https://github.com/ILIAS-eLearning | ||
* | ||
******************************************************************** | ||
*/ | ||
|
||
/** | ||
* @author Thomas Famula <[email protected]> | ||
*/ | ||
class ilTestAppEventListener implements ilAppEventListener | ||
{ | ||
/** | ||
* @inheritDoc | ||
*/ | ||
public static function handleEvent(string $a_component, string $a_event, array $a_parameter): void | ||
{ | ||
global $DIC; | ||
|
||
$test_skill_deletion_manager = $DIC->skills()->internalTest()->manager()->getSkillDeletionManager(); | ||
|
||
switch ($a_component) { | ||
case "Services/Skill": | ||
switch ($a_event) { | ||
case "deleteSkill": | ||
$test_skill_deletion_manager->removeTestSkillsForSkill( | ||
$a_parameter["node_id"], | ||
$a_parameter["is_reference"] | ||
); | ||
break; | ||
} | ||
break; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
Modules/TestQuestionPool/classes/Skills/Service/class.SkillInternalManagerService.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of ILIAS, a powerful learning management system | ||
* published by ILIAS open source e-Learning e.V. | ||
* | ||
* ILIAS is licensed with the GPL-3.0, | ||
* see https://www.gnu.org/licenses/gpl-3.0.en.html | ||
* You should have received a copy of said license along with the | ||
* source code, too. | ||
* | ||
* If this is not the case or you just want to try ILIAS, you'll find | ||
* us at: | ||
* https://www.ilias.de | ||
* https://github.com/ILIAS-eLearning | ||
* | ||
******************************************************************** | ||
*/ | ||
|
||
namespace ILIAS\TestQuestionPool\Skills; | ||
|
||
/** | ||
* @author Thomas Famula <[email protected]> | ||
*/ | ||
class SkillInternalManagerService | ||
{ | ||
public function getSkillDeletionManager(): TestQuestionPoolSkillDeletionManager | ||
{ | ||
return new TestQuestionPoolSkillDeletionManager(); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
Modules/TestQuestionPool/classes/Skills/Service/class.SkillInternalRepoService.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of ILIAS, a powerful learning management system | ||
* published by ILIAS open source e-Learning e.V. | ||
* | ||
* ILIAS is licensed with the GPL-3.0, | ||
* see https://www.gnu.org/licenses/gpl-3.0.en.html | ||
* You should have received a copy of said license along with the | ||
* source code, too. | ||
* | ||
* If this is not the case or you just want to try ILIAS, you'll find | ||
* us at: | ||
* https://www.ilias.de | ||
* https://github.com/ILIAS-eLearning | ||
* | ||
******************************************************************** | ||
*/ | ||
|
||
namespace ILIAS\TestQuestionPool\Skills; | ||
|
||
/** | ||
* @author Thomas Famula <[email protected]> | ||
*/ | ||
class SkillInternalRepoService | ||
{ | ||
public function getTestQuestionPoolSkillRepo(): TestQuestionPoolSkillDBRepository | ||
{ | ||
return new TestQuestionPoolSkillDBRepository(); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
Modules/TestQuestionPool/classes/Skills/Service/class.SkillInternalService.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of ILIAS, a powerful learning management system | ||
* published by ILIAS open source e-Learning e.V. | ||
* | ||
* ILIAS is licensed with the GPL-3.0, | ||
* see https://www.gnu.org/licenses/gpl-3.0.en.html | ||
* You should have received a copy of said license along with the | ||
* source code, too. | ||
* | ||
* If this is not the case or you just want to try ILIAS, you'll find | ||
* us at: | ||
* https://www.ilias.de | ||
* https://github.com/ILIAS-eLearning | ||
* | ||
******************************************************************** | ||
*/ | ||
|
||
namespace ILIAS\TestQuestionPool\Skills; | ||
|
||
/** | ||
* @author Thomas Famula <[email protected]> | ||
*/ | ||
class SkillInternalService | ||
{ | ||
public function __construct() | ||
{ | ||
} | ||
|
||
public function repo(): SkillInternalRepoService | ||
{ | ||
return new SkillInternalRepoService(); | ||
} | ||
|
||
public function manager(): SkillInternalManagerService | ||
{ | ||
return new SkillInternalManagerService(); | ||
} | ||
} |
Oops, something went wrong.