ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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 
11 {
15  protected $id;
16 
20  protected $ref_ids;
21 
25  protected $title;
26 
30  protected $ass_types;
31 
36 
40  protected $exc_title;
41 
45  protected $exc_id;
46 
53  protected function __construct(
54  $a_assignment_id,
55  $a_assignment_title,
56  $a_ref_ids,
58  $a_exc_id,
59  $a_exc_title
60  ) {
61  $this->id = $a_assignment_id;
62  $this->title = $a_assignment_title;
63  $this->ref_ids = $a_ref_ids;
64  $this->ass_types = ilExAssignmentTypes::getInstance();
65  $this->is_user_submission = $is_user_submission;
66  $this->exc_id = $a_exc_id;
67  $this->exc_title = $a_exc_title;
68  }
69 
70 
74  public function getId()
75  {
76  return $this->id;
77  }
78 
82  public function getTitle()
83  {
84  return $this->title;
85  }
86 
87 
91  public function getLinks()
92  {
93  $links = [];
94  foreach ($this->ref_ids as $ref_id) {
95  $links[$ref_id] = ilLink::_getLink($ref_id, "exc", array(), "_" . $this->id);
96  }
97  return $links;
98  }
99 
103  public function isUserSubmission()
104  {
106  }
107 
111  public function getExerciseId()
112  {
113  return $this->exc_id;
114  }
115 
119  public function getExerciseTitle()
120  {
121  return $this->exc_title;
122  }
123 
127  public function getReadableRefIds()
128  {
129  return $this->ref_ids;
130  }
131 
132 
140  public static function getInfo($a_ref_id, $a_user_id)
141  {
142  global $DIC;
143 
144  $access = $DIC->access();
145 
147 
148  $repos_ass_type_ids = $ass_types->getIdsForSubmissionType(ilExSubmission::TYPE_REPO_OBJECT);
149  $submissions = ilExSubmission::getSubmissionsForFilename($a_ref_id, $repos_ass_type_ids);
150 
151  $ass_info = array();
152  foreach ($submissions as $s) {
153  $ass_type = $ass_types->getById($s["type"]);
154 
155  // @todo note: this currently only works, if submissions are assigned to the team (like team wikis)
156  // get team of user
157  $team = ilExAssignmentTeam::getInstanceByUserId($s["ass_id"], $a_user_id);
158  $is_user_submission = ($team->getId() > 0 && $team->getId() == $s["team_id"])
159  ? true
160  : false;
161 
162 
163  // determine all readable ref ids of the exercise
164  $ref_ids = ilObject::_getAllReferences($s["exc_id"]);
165  $readable_ref_ids = array();
166  foreach ($ref_ids as $ref_id) {
167  if ($a_user_id > 0 && !$access->checkAccessOfUser($a_user_id, "read", "", $ref_id)) {
168  continue;
169  }
170  $readable_ref_ids[] = $ref_id;
171  }
172  $ass_info[] = new self(
173  $s["ass_id"],
174  $s["title"],
175  $readable_ref_ids,
177  $s["exc_id"],
178  ilObject::_lookupTitle($s["exc_id"])
179  );
180  }
181  return $ass_info;
182  }
183 }
getTitle()
Get assignment title.int assignment id
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
Repository object assignment information.
__construct( $a_assignment_id, $a_assignment_title, $a_ref_ids, $is_user_submission, $a_exc_id, $a_exc_title)
Constructor.
isUserSubmission()
Check if this object has been submitted by the user provided or its team.If not, the repository objec...
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.
getReadableRefIds()
Get readable ref IDs.int[]
getLinks()
Get readable link urls to the assignment (key is the ref id)string[] assignment link url ...
$DIC
Definition: xapitoken.php:46
static getInfo($a_ref_id, $a_user_id)
Get all info objects for a ref id of an repo object.
getId()
Get assignment id.int assignment id
getExerciseTitle()
Get exercise title.string