ILIAS  release_8 Revision v8.23
class.ilSkillObjDeletionHandler.php
Go to the documentation of this file.
1 <?php
2 
22 
30 {
31  protected int $obj_id = 0;
32  protected string $obj_type = "";
35 
36  public function __construct(int $obj_id, string $obj_type)
37  {
38  global $DIC;
39 
40  $this->obj_type = $obj_type;
41  $this->obj_id = $obj_id;
42  $this->profile_manager = $DIC->skills()->internal()->manager()->getProfileManager();
43  $this->profile_completion_manager = $DIC->skills()->internal()->manager()->getProfileCompletionManager();
44  }
45 
46  public function processDeletion(): void
47  {
48  if ($this->obj_type == "usr" && ilObject::_lookupType($this->obj_id) == "usr") {
49  ilPersonalSkill::removeSkills($this->obj_id);
50  ilPersonalSkill::removeMaterials($this->obj_id);
51  $this->profile_manager->removeUserFromAllProfiles($this->obj_id);
52  $this->profile_completion_manager->deleteEntriesForUser($this->obj_id);
53  ilBasicSkill::removeAllUserData($this->obj_id);
54  }
55  if ($this->obj_type == "role" && ilObject::_lookupType($this->obj_id) == "role") {
56  $this->profile_manager->removeRoleFromAllProfiles($this->obj_id);
57  }
58  if ($this->obj_type == "crs" && ilObject::_lookupType($this->obj_id) == "crs") {
59  foreach (ilContainerReference::_getAllReferences($this->obj_id) as $ref_id) {
60  if ($ref_id != 0) {
61  $this->profile_manager->deleteProfilesFromObject($ref_id);
62  }
63  }
64  }
65  if ($this->obj_type == "grp" && ilObject::_lookupType($this->obj_id) == "grp") {
66  foreach (ilContainerReference::_getAllReferences($this->obj_id) as $ref_id) {
67  if ($ref_id != 0) {
68  $this->profile_manager->deleteProfilesFromObject($ref_id);
69  }
70  }
71  }
73  }
74 }
__construct(int $obj_id, string $obj_type)
static removeSkills(int $a_user_id)
static removeUsagesFromObject(int $a_obj_id)
Handles deletion of (user) objects.
static _getAllReferences(int $id)
get all reference ids for object ID
global $DIC
Definition: feed.php:28
$ref_id
Definition: ltiauth.php:67
SkillProfileCompletionManager $profile_completion_manager
static removeAllUserData(int $a_user_id)
static removeMaterials(int $a_user_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupType(int $id, bool $reference=false)