ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilExcRepoObjAssignmentInfo.php
Go to the documentation of this file.
1<?php
2
25{
26 protected int $id;
27
31 protected array $ref_ids;
32
33 protected string $title;
35 protected bool $is_user_submission;
36 protected string $exc_title;
37 protected int $exc_id;
38
42 protected function __construct(
43 int $a_assignment_id,
44 string $a_assignment_title,
45 array $a_ref_ids,
47 int $a_exc_id,
48 string $a_exc_title
49 ) {
50 $this->id = $a_assignment_id;
51 $this->title = $a_assignment_title;
52 $this->ref_ids = $a_ref_ids;
53 $this->ass_types = ilExAssignmentTypes::getInstance();
54 $this->is_user_submission = $is_user_submission;
55 $this->exc_id = $a_exc_id;
56 $this->exc_title = $a_exc_title;
57 }
58
59
60 public function getId(): int
61 {
62 return $this->id;
63 }
64
65 public function getTitle(): string
66 {
67 return $this->title;
68 }
69
73 public function getLinks(): array
74 {
75 $links = [];
76 foreach ($this->ref_ids as $ref_id) {
77 $links[$ref_id] = ilLink::_getLink($ref_id, "exc", array(), "_" . $this->id);
78 }
79 return $links;
80 }
81
82 public function isUserSubmission(): bool
83 {
85 }
86
87 public function getExerciseId(): int
88 {
89 return $this->exc_id;
90 }
91
92 public function getExerciseTitle(): string
93 {
94 return $this->exc_title;
95 }
96
100 public function getReadableRefIds(): array
101 {
102 return $this->ref_ids;
103 }
104
113 public static function getInfo(int $a_ref_id, int $a_user_id): array
114 {
115 global $DIC;
116
117 $access = $DIC->access();
118
120
122 $submissions1 = ilExSubmission::getSubmissionsForFilename($a_ref_id, $repos_ass_type_ids);
123 $submissions2 = ilExSubmission::getSubmissionsForFilename($a_ref_id . ".zip", $repos_ass_type_ids);
124 $submissions = array_merge($submissions1, $submissions2);
125 $ass_info = array();
126 foreach ($submissions as $s) {
127 //$ass_type = $ass_types->getById($s["type"]);
128
129 // @todo note: this currently only works, if submissions are assigned to the team (like team wikis)
130 // get team of user
131 $team = ilExAssignmentTeam::getInstanceByUserId($s["ass_id"], $a_user_id);
132 $is_user_submission = $team->getId() > 0 && $team->getId() == $s["team_id"];
133
134 // determine all readable ref ids of the exercise
136 $readable_ref_ids = array();
137 foreach ($ref_ids as $ref_id) {
138 if ($a_user_id > 0 && !$access->checkAccessOfUser($a_user_id, "read", "", $ref_id)) {
139 continue;
140 }
141 $readable_ref_ids[] = $ref_id;
142 }
143 $ass_info[] = new self(
144 $s["ass_id"],
145 $s["title"],
146 $readable_ref_ids,
148 $s["exc_id"],
149 ilObject::_lookupTitle($s["exc_id"])
150 );
151 }
152 return $ass_info;
153 }
154}
static getInstanceByUserId(int $a_assignment_id, int $a_user_id, bool $a_create_on_demand=false)
getIdsForSubmissionType(string $a_submission_type)
Get assignment type IDs for given submission type.
static getSubmissionsForFilename(string $a_filename, array $a_assignment_types=array())
Get assignment return entries for a filename.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInfo(int $a_ref_id, int $a_user_id)
Get all info objects for a ref id of an repo object.
isUserSubmission()
Check if this object has been submitted by the user provided or its team.
__construct(int $a_assignment_id, string $a_assignment_title, array $a_ref_ids, bool $is_user_submission, int $a_exc_id, string $a_exc_title)
static _getAllReferences(int $id)
get all reference ids for object ID
static _lookupTitle(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:66
global $DIC
Definition: shib_login.php:26