ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilBlogExercise.php
Go to the documentation of this file.
1 <?php
2 
24 {
25  protected ilObjUser $user;
26  protected int $node_id;
27  protected ilTree $tree;
28 
29  public function __construct(
30  int $a_node_id
31  ) {
32  global $DIC;
33 
34  $this->tree = $DIC->repositoryTree();
35  $this->user = $DIC->user();
36  $this->node_id = $a_node_id;
37  }
38 
39  public function getAssignmentsOfBlog(): array
40  {
41  $user = $this->user;
42  $node_id = $this->node_id;
43  $tree = $this->tree;
44 
45  $assignments = [];
46 
47  $exercises = ilExSubmission::findUserFiles($user->getId(), $node_id);
48  // #0022794
49  if (count($exercises) === 0) {
50  $exercises = ilExSubmission::findUserFiles($user->getId(), $node_id . ".sec");
51  }
52  if (count($exercises) === 0) {
53  $exercises = ilExSubmission::findUserFiles($user->getId(), $node_id . ".zip");
54  }
55  if ($exercises) {
56  foreach ($exercises as $exercise) {
57  // #9988
58  $active_ref = false;
59  foreach (ilObject::_getAllReferences($exercise["obj_id"]) as $ref_id) {
60  if (!$tree->isSaved($ref_id)) {
61  $active_ref = true;
62  break;
63  }
64  }
65  if ($active_ref) {
66  $assignments[] = [
67  "exc_id" => $exercise["obj_id"],
68  "ass_id" => $exercise["ass_id"]
69  ];
70  }
71  }
72  }
73  return $assignments;
74  }
75 }
isSaved(int $a_node_id)
Use method isDeleted.
static _getAllReferences(int $id)
get all reference ids for object ID
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(int $a_node_id)
global $DIC
Definition: feed.php:28
$ref_id
Definition: ltiauth.php:67
static findUserFiles(int $a_user_id, string $a_filetitle)
Check if given file was assigned Used in Blog/Portfolio.