ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilGlossaryObjDeletionHandler.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 use ILIAS\Glossary;
22 
27 {
28  protected Glossary\InternalDomainService $domain_service;
29 
30  public function __construct()
31  {
32  global $DIC;
33 
34  $this->domain_service = $DIC->glossary()->internal()->domain();
35  }
36 
37  public function processObjectDeletion(int $obj_id, string $obj_type): void
38  {
39  if ($obj_type == "usr" && ilObject::_lookupType($obj_id) == "usr") {
40  $flashcard_manager = $this->domain_service->flashcard(0, $obj_id);
41  $flashcard_manager->deleteAllUserEntries();
42  }
43  if ($obj_type == "glo" && ilObject::_lookupType($obj_id) == "glo") {
44  $flashcard_manager = $this->domain_service->flashcard((int) current(\ilObject::_getAllReferences($obj_id)));
45  $flashcard_manager->deleteAllGlossaryEntries();
46  }
47  }
48 
49  public function processTermDeletion(int $term_id): void
50  {
51  $flashcard_manager = $this->domain_service->flashcard();
52  $flashcard_manager->deleteAllTermEntries($term_id);
53  }
54 }
Glossary InternalDomainService $domain_service
processObjectDeletion(int $obj_id, string $obj_type)
static _getAllReferences(int $id)
get all reference ids for object ID
global $DIC
Definition: shib_login.php:22
static _lookupType(int $id, bool $reference=false)