ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.BlogExercise.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
28{
29 protected \ilObjUser $user;
30 protected int $node_id;
31 protected \ilTree $tree;
32
33 public function __construct(
34 int $a_node_id,
37 ) {
38 $this->tree = $tree;
39 $this->user = $user;
40 $this->node_id = $a_node_id;
41 }
42
43 public function getAssignmentsOfBlog(): array
44 {
48
49 $assignments = [];
50
51 $exercises = \ilExSubmission::findUserFiles($user->getId(), (string) $node_id);
52 // #0022794
53 if (count($exercises) === 0) {
54 $exercises = \ilExSubmission::findUserFiles($user->getId(), $node_id . ".sec");
55 }
56 if (count($exercises) === 0) {
57 $exercises = \ilExSubmission::findUserFiles($user->getId(), $node_id . ".zip");
58 }
59 if ($exercises) {
60 foreach ($exercises as $exercise) {
61 // #9988
62 $active_ref = false;
63 foreach (\ilObject::_getAllReferences($exercise["obj_id"]) as $ref_id) {
64 if (!$tree->isDeleted($ref_id)) {
65 $active_ref = true;
66 break;
67 }
68 }
69 if ($active_ref) {
70 $assignments[] = [
71 "exc_id" => $exercise["obj_id"],
72 "ass_id" => $exercise["ass_id"]
73 ];
74 }
75 }
76 }
77 return $assignments;
78 }
79}
__construct(int $a_node_id, \ilTree $tree, \ilObjUser $user)
static findUserFiles(int $a_user_id, string $a_filetitle)
Check if given file was assigned Used in Blog/Portfolio.
User class.
static _getAllReferences(int $id)
get all reference ids for object ID
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
isDeleted(int $a_node_id)
This is a wrapper for isSaved() with a more useful name.
$ref_id
Definition: ltiauth.php:66