ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilSkillObjDeletionHandler.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
24
32{
33 protected int $obj_id = 0;
34 protected string $obj_type = "";
40
41 public function __construct(int $obj_id, string $obj_type)
42 {
43 global $DIC;
44
45 $this->obj_type = $obj_type;
46 $this->obj_id = $obj_id;
47 $this->profile_manager = $DIC->skills()->internal()->manager()->getProfileManager();
48 $this->profile_completion_manager = $DIC->skills()->internal()->manager()->getProfileCompletionManager();
49 $this->personal_manager = $DIC->skills()->internal()->manager()->getPersonalSkillManager();
50 $this->assigned_material_manager = $DIC->skills()->internal()->manager()->getAssignedMaterialManager();
51 $this->usage_manager = $DIC->skills()->internal()->manager()->getUsageManager();
52 }
53
54 public function processDeletion(): void
55 {
56 if ($this->obj_type == "usr" && ilObject::_lookupType($this->obj_id) == "usr") {
57 $this->personal_manager->removePersonalSkillsForUser($this->obj_id);
58 $this->assigned_material_manager->removeAssignedMaterialsForUser($this->obj_id);
59 $this->profile_manager->removeUserFromAllProfiles($this->obj_id);
60 $this->profile_completion_manager->deleteEntriesForUser($this->obj_id);
62 return;
63 } elseif ($this->obj_type == "role" && ilObject::_lookupType($this->obj_id) == "role") {
64 $this->profile_manager->removeRoleFromAllProfiles($this->obj_id);
65 return;
66 } elseif ($this->obj_type == "crs" && ilObject::_lookupType($this->obj_id) == "crs") {
67 foreach (ilContainerReference::_getAllReferences($this->obj_id) as $ref_id) {
68 if ($ref_id != 0) {
69 $this->profile_manager->deleteProfilesFromObject($ref_id);
70 }
71 }
72 } elseif ($this->obj_type == "grp" && ilObject::_lookupType($this->obj_id) == "grp") {
73 foreach (ilContainerReference::_getAllReferences($this->obj_id) as $ref_id) {
74 if ($ref_id != 0) {
75 $this->profile_manager->deleteProfilesFromObject($ref_id);
76 }
77 }
78 }
79 $this->usage_manager->removeUsagesFromObject($this->obj_id);
80 }
81}
static removeAllUserData(int $a_user_id)
static _lookupType(int $id, bool $reference=false)
static _getAllReferences(int $id)
get all reference ids for object ID
Handles deletion of (user) objects.
Personal AssignedMaterialManager $assigned_material_manager
__construct(int $obj_id, string $obj_type)
Personal PersonalSkillManager $personal_manager
Profile SkillProfileManager $profile_manager
Profile SkillProfileCompletionManager $profile_completion_manager
$ref_id
Definition: ltiauth.php:66
global $DIC
Definition: shib_login.php:26