ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilPortfolioExercise.php
Go to the documentation of this file.
1<?php
2
24{
25 protected int $user_id;
26 protected int $obj_id;
27 protected ilTree $tree;
28
29 public function __construct(
30 int $a_user_id,
31 int $a_obj_id
32 ) {
33 global $DIC;
34
35 $this->tree = $DIC->repositoryTree();
36 $this->user_id = $a_user_id;
37 $this->obj_id = $a_obj_id;
38 }
39
40 public function getAssignmentsOfPortfolio(): array
41 {
45
46 $assignments = [];
47
49 // #0022794
50 if (count($exercises) === 0) {
51 $exercises = ilExSubmission::findUserFiles($user_id, $obj_id . ".sec");
52 }
53 if (count($exercises) === 0) {
54 $exercises = ilExSubmission::findUserFiles($user_id, $obj_id . ".zip");
55 }
56 if ($exercises) {
57 foreach ($exercises as $exercise) {
58 // #9988
59 $active_ref = false;
60 foreach (ilObject::_getAllReferences($exercise["obj_id"]) as $ref_id) {
61 if (!$tree->isDeleted($ref_id)) {
62 $active_ref = true;
63 break;
64 }
65 }
66 if ($active_ref) {
67 $assignments[] = [
68 "exc_id" => $exercise["obj_id"],
69 "ass_id" => $exercise["ass_id"]
70 ];
71 }
72 }
73 }
74 return $assignments;
75 }
76}
static findUserFiles(int $a_user_id, string $a_filetitle)
Check if given file was assigned Used in Blog/Portfolio.
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_user_id, int $a_obj_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
global $DIC
Definition: shib_login.php:26