ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilPortfolioExercise.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{
12 protected $user_id; // [int]
13 protected $obj_id; // [int]
14
18 protected $tree;
19
25 public function __construct(int $a_user_id, int $a_obj_id)
26 {
27 global $DIC;
28
29 $this->tree = $DIC->repositoryTree();
30 $this->user_id = $a_user_id;
31 $this->obj_id = $a_obj_id;
32 }
33
34
38 public function getAssignmentsOfPortfolio() : array
39 {
43
44 $assignments = [];
45
47 // #0022794
48 if (!$exercises) {
49 $exercises = ilExSubmission::findUserFiles($user_id, $obj_id . ".sec");
50 }
51 if ($exercises) {
52 foreach ($exercises as $exercise) {
53 // #9988
54 $active_ref = false;
55 foreach (ilObject::_getAllReferences($exercise["obj_id"]) as $ref_id) {
56 if (!$tree->isSaved($ref_id)) {
57 $active_ref = true;
58 break;
59 }
60 }
61 if ($active_ref) {
62 $assignments[] = [
63 "exc_id" => $exercise["obj_id"],
64 "ass_id" => $exercise["ass_id"]
65 ];
66 }
67 }
68 }
69 return $assignments;
70 }
71}
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
Exercise info for portfolios.
__construct(int $a_user_id, int $a_obj_id)
ilPortfolioExercise constructor.
$DIC
Definition: xapitoken.php:46