ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilBlogExercise.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
11{
15 protected $user;
16
17 protected $node_id; // [int]
18
22 protected $tree;
23
24 public function __construct($a_node_id)
25 {
26 global $DIC;
27
28 $this->tree = $DIC->repositoryTree();
29 $this->user = $DIC->user();
30 $this->node_id = $a_node_id;
31 }
32
36 public function getAssignmentsOfBlog()
37 {
41
42 $assignments = [];
43
44 $exercises = ilExSubmission::findUserFiles($user->getId(), $node_id);
45 // #0022794
46 if (!$exercises) {
47 $exercises = ilExSubmission::findUserFiles($user->getId(), $node_id . ".sec");
48 }
49 if ($exercises) {
50 foreach ($exercises as $exercise) {
51 // #9988
52 $active_ref = false;
53 foreach (ilObject::_getAllReferences($exercise["obj_id"]) as $ref_id) {
54 if (!$tree->isSaved($ref_id)) {
55 $active_ref = true;
56 break;
57 }
58 }
59 if ($active_ref) {
60 $assignments[] = [
61 "exc_id" => $exercise["obj_id"],
62 "ass_id" => $exercise["ass_id"]
63 ];
64 }
65 }
66 }
67 return $assignments;
68 }
69}
user()
Definition: user.php:4
An exception for terminatinating execution or to throw for unit testing.
static findUserFiles($a_user_id, $a_filetitle)
Check if given file was assigned.
static _getAllReferences($a_id)
get all reference ids of object
$DIC
Definition: xapitoken.php:46