19 declare(strict_types=1);
59 $access = $this->domain->access();
60 $exmem = new \ilExerciseMembers($exercise);
62 $tmp_file = tmpfile();
63 $tmp_location = stream_get_meta_data($tmp_file)[
'uri'];
64 $zip = new \ZipArchive();
65 $res = $zip->open($tmp_location, \ZipArchive::OVERWRITE);
68 $base_name = trim(str_replace(
" ",
"_", $assignment->
getTitle() .
"_" . $assignment->
getId()));
69 $base_name =
"multi_feedback_" . $this->
toAscii($base_name);
72 $mems = $exmem->getMembers();
74 $mems = $access->filterUserIdsByRbacOrPositionOfCurrentUser(
75 'edit_submissions_grades',
76 'edit_submissions_grades',
80 foreach ($mems as $mem) {
82 $subdir = $name[
"lastname"] .
"_" . $name[
"firstname"] .
"_" . $name[
"login"] .
"_" . $name[
"user_id"];
83 $subdir = $this->
toAscii($subdir);
84 $zip->addEmptyDir($base_name .
"/" . $subdir);
87 $ret = new \StdClass();
88 $ret->content = file_get_contents($tmp_location);
89 $ret->filename = $base_name .
".zip";
98 $this->repo->deleteCurrent($ass_id, $tutor_id, $this->stakeholder);
99 return $this->repo->importFromUploadResult(
109 $exmem = new \ilExerciseMembers($exc);
110 $mems = $exmem->getMembers();
112 return $this->repo->getFiles($ass_id, $tutor_id, $mems);
117 return md5($user_id .
":" . $filename);
126 $notification = $this->domain->notification($exc->
getRefId());
127 foreach ($this->
getFiles($exc, $ass_id, $tutor_id) as $file) {
129 $md5 = $this->
getFileMd5((
int) $file[
"user_id"], $file[
"file"]);
131 $target_collection = $this->participant_repo->getCollection($ass_id, $user_id);
132 if ($target_collection) {
133 $this->repo->addFileFromZipToCollection(
138 $this->user_feedback_stakeholder
142 $ass = new \ilExAssignment($ass_id);
143 $submission = new \ilExSubmission($ass, $user_id);
144 $feedback_id = $submission->getFeedbackId();
145 $noti_rec_ids = $submission->getUserIds();
149 foreach ($noti_rec_ids as $user_id) {
150 $member_status = $ass->getMemberStatus($user_id);
151 $member_status->setFeedback(
true);
152 $member_status->update();
155 $notification->sendFeedbackNotification(
TutorFeedbackZipRepository $repo
__construct(InternalRepoService $repo, InternalDomainService $domain, \ilExcTutorFeedbackZipStakeholder $stakeholder, \ilExcTutorFeedbackFileStakeholder $user_feedback_stakeholder)
getFiles(\ilObjExercise $exc, int $ass_id, int $tutor_id)
Class ilFileServicesPolicy.
getFileMd5(int $user_id, string $filename)
static _lookupName(int $a_user_id)
lookup user name
InternalDomainService $domain
saveMultiFeedbackFiles(\ilObjExercise $exc, int $ass_id, int $tutor_id, array $file_md5s)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getMultiFeedbackStructureFile(\ilExAssignment $assignment, \ilObjExercise $exercise)
toAscii(string $filename)
importFromUploadResult(int $ass_id, int $tutor_id, UploadResult $result)
ilExcTutorFeedbackZipStakeholder $stakeholder
TutorFeedbackFileRepository $participant_repo
ilExcTutorFeedbackFileStakeholder $user_feedback_stakeholder