ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilGlossaryObjDeletionHandler.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
22 use ILIAS\Glossary;
23 
28 {
29  protected Glossary\InternalDomainService $domain_service;
30 
31  public function __construct()
32  {
33  global $DIC;
34 
35  $this->domain_service = $DIC->glossary()->internal()->domain();
36  }
37 
38  public function processObjectDeletion(int $obj_id, string $obj_type): void
39  {
40  if ($obj_type == "usr" && ilObject::_lookupType($obj_id) == "usr") {
41  $flashcard_manager = $this->domain_service->flashcard(0, $obj_id);
42  $flashcard_manager->deleteAllUserEntries();
43  }
44  if ($obj_type == "glo" && ilObject::_lookupType($obj_id) == "glo") {
45  $flashcard_manager = $this->domain_service->flashcard((int) current(\ilObject::_getAllReferences($obj_id)));
46  $flashcard_manager->deleteAllGlossaryEntries();
47  }
48  }
49 
50  public function processTermDeletion(int $term_id): void
51  {
52  $flashcard_manager = $this->domain_service->flashcard();
53  $flashcard_manager->deleteAllTermEntries($term_id);
54  }
55 }
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: feed.php:28
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)