ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
UserEvent.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
23 class UserEvent
24 {
25  public function __construct(
26  protected \ILIAS\Exercise\InternalRepoService $repo,
27  protected \ILIAS\Exercise\InternalDomainService $domain
28  ) {
29  }
30 
31  public function handleDeletion(int $user_id): void
32  {
33  global $DIC;
34 
35  // get all exercises the user has submitted to
36  // todo move to repo layer
37  $db = $DIC->database();
38  $set = $db->queryF(
39  "SELECT DISTINCT obj_id FROM exc_returned " .
40  " WHERE user_id = %s ",
41  ["integer"],
42  [$user_id]
43  );
44  // remove all user submissions from these exercises
45  while ($rec = $db->fetchAssoc($set)) {
46  $exc_id = (int) $rec['obj_id'];
47  \ilExSubmission::deleteUser($exc_id, $user_id);
48  }
49  }
50 }
Interface Observer Contains several chained tasks and infos about them.
global $DIC
Definition: shib_login.php:26
handleDeletion(int $user_id)
Definition: UserEvent.php:31
__construct(protected \ILIAS\Exercise\InternalRepoService $repo, protected \ILIAS\Exercise\InternalDomainService $domain)
Definition: UserEvent.php:25
static deleteUser(int $a_exc_id, int $a_user_id)
Deletes already delivered files.