ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilExcRepoObjAssignmentInfo.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5include_once("./Modules/Exercise/RepoObjectAssignment/interfaces/interface.ilExcRepoObjAssignmentInfoInterface.php");
6
13{
17 protected $id;
18
22 protected $ref_ids;
23
27 protected $title;
28
32 protected $ass_types;
33
38
42 protected $exc_title;
43
47 protected $exc_id;
48
55 protected function __construct(
56 $a_assignment_id,
57 $a_assignment_title,
58 $a_ref_ids,
60 $a_exc_id,
61 $a_exc_title
62 ) {
63 $this->id = $a_assignment_id;
64 $this->title = $a_assignment_title;
65 $this->ref_ids = $a_ref_ids;
66 $this->ass_types = ilExAssignmentTypes::getInstance();
67 $this->is_user_submission = $is_user_submission;
68 $this->exc_id = $a_exc_id;
69 $this->exc_title = $a_exc_title;
70 }
71
72
76 public function getId()
77 {
78 return $this->id;
79 }
80
84 public function getTitle()
85 {
86 return $this->title;
87 }
88
89
93 public function getLinks()
94 {
95 $links = [];
96 foreach ($this->ref_ids as $ref_id) {
97 $links[$ref_id] = ilLink::_getLink($ref_id, "exc", array(), "_" . $this->id);
98 }
99 return $links;
100 }
101
105 public function isUserSubmission()
106 {
108 }
109
113 public function getExerciseId()
114 {
115 return $this->exc_id;
116 }
117
121 public function getExerciseTitle()
122 {
123 return $this->exc_title;
124 }
125
129 public function getReadableRefIds()
130 {
131 return $this->ref_ids;
132 }
133
134
142 public static function getInfo($a_ref_id, $a_user_id)
143 {
144 global $DIC;
145
146 $access = $DIC->access();
147
148 include_once("./Modules/Exercise/AssignmentTypes/classes/class.ilExAssignmentTypes.php");
150
151 $repos_ass_type_ids = $ass_types->getIdsForSubmissionType(ilExSubmission::TYPE_REPO_OBJECT);
152 include_once("./Modules/Exercise/classes/class.ilExSubmission.php");
153 $submissions = ilExSubmission::getSubmissionsForFilename($a_ref_id, $repos_ass_type_ids);
154
155 $ass_info = array();
156 foreach ($submissions as $s) {
157 $ass_type = $ass_types->getById($s["type"]);
158
159 // @todo note: this currently only works, if submissions are assigned to the team (like team wikis)
160 // get team of user
161 include_once "Modules/Exercise/classes/class.ilExAssignmentTeam.php";
162 $team = ilExAssignmentTeam::getInstanceByUserId($s["ass_id"], $a_user_id);
163 $is_user_submission = ($team->getId() > 0 && $team->getId() == $s["team_id"])
164 ? true
165 : false;
166
167
168 // determine all readable ref ids of the exercise
170 $readable_ref_ids = array();
171 foreach ($ref_ids as $ref_id) {
172 if ($a_user_id > 0 && !$access->checkAccessOfUser($a_user_id, "read", "", $ref_id)) {
173 continue;
174 }
175 $readable_ref_ids[] = $ref_id;
176 }
177 $ass_info[] = new self(
178 $s["ass_id"],
179 $s["title"],
180 $readable_ref_ids,
182 $s["exc_id"],
183 ilObject::_lookupTitle($s["exc_id"])
184 );
185 }
186 return $ass_info;
187 }
188}
An exception for terminatinating execution or to throw for unit testing.
static getInstanceByUserId($a_assignment_id, $a_user_id, $a_create_on_demand=false)
static getInstance()
Get instance.
static getSubmissionsForFilename($a_filename, $a_assignment_types=array())
Get assignment return entries for a filename.
Repository object assignment information.
isUserSubmission()
Check if this object has been submitted by the user provided or its team.If not, the repository objec...
getTitle()
Get assignment title.int assignment id
getId()
Get assignment id.int assignment id
getReadableRefIds()
Get readable ref IDs.int[]
__construct( $a_assignment_id, $a_assignment_title, $a_ref_ids, $is_user_submission, $a_exc_id, $a_exc_title)
Constructor.
static getInfo($a_ref_id, $a_user_id)
Get all info objects for a ref id of an repo object.
getLinks()
Get readable link urls to the assignment (key is the ref id)string[] assignment link url
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
$links
$s
Definition: pwgen.php:45
global $DIC
Definition: saml.php:7