ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\Exercise\TutorFeedbackFile\TutorFeedbackFileManager Class Reference
+ Collaboration diagram for ILIAS\Exercise\TutorFeedbackFile\TutorFeedbackFileManager:

Public Member Functions

 __construct (int $ass_id, InternalRepoService $repo, InternalDomainService $domain, \ilExcTutorFeedbackFileStakeholder $stakeholder, \ilExcTutorTeamFeedbackFileStakeholder $team_stakeholder, TutorFeedbackFileObserver $file_observer)
 
 getStakeholder ()
 
 addObserver ()
 
 sendNotification (string $rcid, string $rid)
 
 hasCollection (int $participant_id)
 
 count (int $participant_id)
 
 getFeedbackTitle (int $participant_id)
 
 getCollectionIdString (int $participant_id)
 
 createCollection (int $participant_id)
 
 deleteCollection (int $participant_id)
 
 getFiles (int $participant_id)
 
 deliver (int $participant_id, string $file)
 

Protected Member Functions

 getLegacyFeedbackId (int $participant_id)
 

Protected Attributes

TutorFeedbackFileObserver $file_observer
 
int $ass_id
 
ILIAS FileUpload FileUpload $upload
 
ilExAssignmentTypeInterface $type
 
InternalDomainService $domain
 
TutorFeedbackFileRepositoryInterface $repo
 
ResourceStakeholder $stakeholder
 

Detailed Description

Definition at line 29 of file TutorFeedbackFileManager.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Exercise\TutorFeedbackFile\TutorFeedbackFileManager::__construct ( int  $ass_id,
InternalRepoService  $repo,
InternalDomainService  $domain,
\ilExcTutorFeedbackFileStakeholder  $stakeholder,
\ilExcTutorTeamFeedbackFileStakeholder  $team_stakeholder,
TutorFeedbackFileObserver  $file_observer 
)

Definition at line 39 of file TutorFeedbackFileManager.php.

References ILIAS\Exercise\TutorFeedbackFile\TutorFeedbackFileManager\$ass_id, $DIC, ILIAS\Exercise\TutorFeedbackFile\TutorFeedbackFileManager\$domain, ILIAS\Exercise\TutorFeedbackFile\TutorFeedbackFileManager\$file_observer, ILIAS\Exercise\TutorFeedbackFile\TutorFeedbackFileManager\$stakeholder, ilExAssignmentTypes\getInstance(), ilExAssignment\lookupType(), ILIAS\Exercise\InternalRepoService\tutorFeedbackFile(), ILIAS\Exercise\InternalRepoService\tutorFeedbackFileTeam(), and ILIAS\Repository\upload().

46  {
47  global $DIC;
48 
49  $this->upload = $DIC->upload();
50 
51  $this->file_observer = $file_observer;
53  $this->type = $types->getById(\ilExAssignment::lookupType($ass_id));
54  if ($this->type->usesTeams()) {
55  $this->repo = $repo->tutorFeedbackFileTeam();
56  $this->stakeholder = $team_stakeholder;
57  } else {
58  $this->repo = $repo->tutorFeedbackFile();
59  $this->stakeholder = $stakeholder;
60  }
61  $this->domain = $domain;
62  $this->ass_id = $ass_id;
63  }
static lookupType(int $a_id)
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ addObserver()

ILIAS\Exercise\TutorFeedbackFile\TutorFeedbackFileManager::addObserver ( )

Definition at line 70 of file TutorFeedbackFileManager.php.

70  : void
71  {
72  $this->domain->resourceStorage()->events()->attach(
73  $this->file_observer,
74  Event::COLLECTION_RESOURCE_ADDED
75  );
76  }

◆ count()

ILIAS\Exercise\TutorFeedbackFile\TutorFeedbackFileManager::count ( int  $participant_id)

Definition at line 140 of file TutorFeedbackFileManager.php.

References ILIAS\Exercise\TutorFeedbackFile\TutorFeedbackFileManager\hasCollection().

140  : int
141  {
142  if ($this->hasCollection($participant_id)) {
143  // IRSS
144  return $this->repo->count($this->ass_id, $participant_id);
145  }
146  return 0;
147  }
+ Here is the call graph for this function:

◆ createCollection()

ILIAS\Exercise\TutorFeedbackFile\TutorFeedbackFileManager::createCollection ( int  $participant_id)

Definition at line 166 of file TutorFeedbackFileManager.php.

166  : void
167  {
168  $this->repo->createCollection($this->ass_id, $participant_id);
169  }

◆ deleteCollection()

ILIAS\Exercise\TutorFeedbackFile\TutorFeedbackFileManager::deleteCollection ( int  $participant_id)

Definition at line 171 of file TutorFeedbackFileManager.php.

171  : void
172  {
173  $this->repo->deleteCollection(
174  $this->ass_id,
175  $participant_id,
176  $this->stakeholder
177  );
178  }

◆ deliver()

ILIAS\Exercise\TutorFeedbackFile\TutorFeedbackFileManager::deliver ( int  $participant_id,
string  $file 
)

Definition at line 191 of file TutorFeedbackFileManager.php.

191  : void
192  {
193  $assignment = $this->domain->assignment()->getAssignment($this->ass_id);
194  if ($assignment->notStartedYet()) {
195  return;
196  }
197 
198  if ($this->repo->hasCollection($this->ass_id, $participant_id)) {
199  // IRSS
200  $this->repo->deliverFile($this->ass_id, $participant_id, $file);
201  }
202  }

◆ getCollectionIdString()

ILIAS\Exercise\TutorFeedbackFile\TutorFeedbackFileManager::getCollectionIdString ( int  $participant_id)

Definition at line 161 of file TutorFeedbackFileManager.php.

Referenced by ILIAS\Exercise\TutorFeedbackFile\TutorFeedbackFileManager\hasCollection().

161  : string
162  {
163  return $this->repo->getIdStringForAssIdAndUserId($this->ass_id, $participant_id);
164  }
+ Here is the caller graph for this function:

◆ getFeedbackTitle()

ILIAS\Exercise\TutorFeedbackFile\TutorFeedbackFileManager::getFeedbackTitle ( int  $participant_id)

Definition at line 149 of file TutorFeedbackFileManager.php.

References ilObjUser\_lookupName().

149  : string
150  {
151  $title = $this->domain->lng()->txt('exc_fb_files');
152  if ($this->type->usesTeams()) {
153  $name = \ilObjUser::_lookupName($participant_id);
154  return $title . ": " . $name["lastname"] . ", " . $name["firstname"];
155  } else {
156  $name = \ilObjUser::_lookupName($participant_id);
157  return $title . ": " . $name["lastname"] . ", " . $name["firstname"];
158  }
159  }
static _lookupName(int $a_user_id)
lookup user name
+ Here is the call graph for this function:

◆ getFiles()

ILIAS\Exercise\TutorFeedbackFile\TutorFeedbackFileManager::getFiles ( int  $participant_id)

Definition at line 180 of file TutorFeedbackFileManager.php.

References ILIAS\Repository\IRSS\ResourceInformation\getTitle().

180  : array
181  {
182  $files = [];
183  if ($this->repo->hasCollection($this->ass_id, $participant_id)) {
184  $files = array_map(function (ResourceInformation $info): string {
185  return $info->getTitle();
186  }, iterator_to_array($this->repo->getCollectionResourcesInfo($this->ass_id, $participant_id)));
187  }
188  return $files;
189  }
+ Here is the call graph for this function:

◆ getLegacyFeedbackId()

ILIAS\Exercise\TutorFeedbackFile\TutorFeedbackFileManager::getLegacyFeedbackId ( int  $participant_id)
protected

Definition at line 127 of file TutorFeedbackFileManager.php.

127  : string
128  {
129  if ($this->type->usesTeams()) {
130  $team_id = $this->domain->team()->getTeamForMember($this->ass_id, $participant_id);
131  if (is_null($team_id)) {
132  throw new \ilExerciseException("Team for user " . $participant_id . " in assignment " . $this->ass_id . " not found.");
133  }
134  return "t" . $team_id;
135  } else {
136  return (string) $participant_id;
137  }
138  }

◆ getStakeholder()

ILIAS\Exercise\TutorFeedbackFile\TutorFeedbackFileManager::getStakeholder ( )

◆ hasCollection()

ILIAS\Exercise\TutorFeedbackFile\TutorFeedbackFileManager::hasCollection ( int  $participant_id)

Definition at line 122 of file TutorFeedbackFileManager.php.

References ILIAS\Exercise\TutorFeedbackFile\TutorFeedbackFileManager\getCollectionIdString().

Referenced by ILIAS\Exercise\TutorFeedbackFile\TutorFeedbackFileManager\count().

122  : bool
123  {
124  return ($this->getCollectionIdString($participant_id) !== "");
125  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendNotification()

ILIAS\Exercise\TutorFeedbackFile\TutorFeedbackFileManager::sendNotification ( string  $rcid,
string  $rid 
)

Definition at line 78 of file TutorFeedbackFileManager.php.

References $filename, $log, $ref_id, $user_id, ilObject\_getAllReferences(), ILIAS\Repository\int(), and ilExAssignment\lookupExerciseId().

78  : void
79  {
80  $log = $this->domain->log();
81  $log->debug("Ass id: " . $this->ass_id);
82 
83  $exc_id = \ilExAssignment::lookupExerciseId($this->ass_id);
84  $ref_id = (int) current(\ilObject::_getAllReferences($exc_id));
85 
86  $log->debug("Ref id: " . $ref_id);
87 
88  if ($ref_id === 0) {
89  return;
90  }
91  $log->debug("Get notification");
92  $notification = $this->domain->notification($ref_id);
93  $log->debug("Get participant");
94  $part_id = $this->repo->getParticipantIdForRcid($this->ass_id, $rcid);
95  $log->debug("Get filename");
96  $filename = $this->repo->getFilenameForRid($this->ass_id, $part_id, $rid);
97  $log->debug("Get assignment");
98  $ass = new \ilExAssignment($this->ass_id);
99  $log->debug("Get submission");
100  $submission = new \ilExSubmission($ass, $part_id);
101  $feedback_id = $submission->getFeedbackId();
102  $noti_rec_ids = $submission->getUserIds();
103 
104  $log->debug("Feedback id: " . $feedback_id);
105  if ($feedback_id) {
106  if ($noti_rec_ids) {
107  foreach ($noti_rec_ids as $user_id) {
108  $member_status = $ass->getMemberStatus($user_id);
109  $member_status->setFeedback(true);
110  $member_status->update();
111  }
112 
113  $notification->sendFeedbackNotification(
114  $ass->getId(),
115  $noti_rec_ids,
116  $filename
117  );
118  }
119  }
120  }
static _getAllReferences(int $id)
get all reference ids for object ID
$ref_id
Definition: ltiauth.php:65
$log
Definition: result.php:32
$filename
Definition: buildRTE.php:78
static lookupExerciseId(int $a_ass_id)
+ Here is the call graph for this function:

Field Documentation

◆ $ass_id

int ILIAS\Exercise\TutorFeedbackFile\TutorFeedbackFileManager::$ass_id
protected

◆ $domain

InternalDomainService ILIAS\Exercise\TutorFeedbackFile\TutorFeedbackFileManager::$domain
protected

◆ $file_observer

TutorFeedbackFileObserver ILIAS\Exercise\TutorFeedbackFile\TutorFeedbackFileManager::$file_observer
protected

◆ $repo

TutorFeedbackFileRepositoryInterface ILIAS\Exercise\TutorFeedbackFile\TutorFeedbackFileManager::$repo
protected

Definition at line 36 of file TutorFeedbackFileManager.php.

◆ $stakeholder

ResourceStakeholder ILIAS\Exercise\TutorFeedbackFile\TutorFeedbackFileManager::$stakeholder
protected

◆ $type

ilExAssignmentTypeInterface ILIAS\Exercise\TutorFeedbackFile\TutorFeedbackFileManager::$type
protected

Definition at line 34 of file TutorFeedbackFileManager.php.

◆ $upload

ILIAS FileUpload FileUpload ILIAS\Exercise\TutorFeedbackFile\TutorFeedbackFileManager::$upload
protected

Definition at line 33 of file TutorFeedbackFileManager.php.


The documentation for this class was generated from the following file: