59 $this->
user = $DIC->user();
60 $this->db = $DIC->database();
61 $this->lng = $DIC->language();
62 $this->ctrl = $DIC->ctrl();
65 $this->assignment = $a_ass;
69 $this->user_id = $a_user_id;
70 $this->is_tutor = (bool) $a_is_tutor;
71 $this->public_submissions = (bool) $a_public_submissions;
79 $this->team = $a_team;
83 if ($this->assignment->getPeerReview()) {
90 return $this->assignment->getAssignmentType()->getSubmissionType();
138 if ($this->peer_review) {
139 $valid = $this->peer_review->isFeedbackValidForPassed($user_id);
156 return $this->team->getMembers();
160 return array($this->user_id);
166 return "t" . $this->team->getId();
174 return (
bool)
sizeof($this->
getFiles(null,
true));
180 if (
sizeof($files)) {
181 return array_pop($files);
188 $this->state->isSubmissionAllowed());
198 $this->public_submissions) {
203 if ($this->peer_review) {
205 foreach ($this->peer_review->getPeerReviewsByPeerId($this->getUserId()) as $giver) {
206 if ($giver[
"giver_id"] ==
$ilUser->getId()) {
222 if ($this->assignment->hasTeam() &&
223 !$this->team->getId()) {
236 return in_array($a_user_id, $this->
getUserIds());
248 return ($this->peer_review &&
249 $this->peer_review->hasPeerReviewAccess($this->user_id));
260 $max <=
sizeof($this->
getFiles())) {
274 $dl = $this->state->getOfficialDeadline();
276 return ($dl && $dl < time());
281 return new ilFSStorageExercise($this->assignment->getExerciseId(), $this->assignment->getId());
291 if ($this->ass_type->isSubmissionAssignedToTeam()) {
292 $storage_id = $this->
getTeam()->getId();
303 public function uploadFile($a_http_post_files, $unzip =
false)
311 if ($this->ass_type->isSubmissionAssignedToTeam()) {
312 $team_id = $this->
getTeam()->getId();
323 $deliver_result = $this->
initStorage()->uploadFile($a_http_post_files, $storage_id, $unzip);
325 if ($deliver_result) {
326 $next_id =
$ilDB->nextId(
"exc_returned");
328 "INSERT INTO exc_returned " .
329 "(returned_id, obj_id, user_id, filename, filetitle, mimetype, ts, ass_id, late, team_id) " .
330 "VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
331 $ilDB->quote($next_id,
"integer"),
332 $ilDB->quote($this->assignment->getExerciseId(),
"integer"),
334 $ilDB->quote($deliver_result[
"fullname"],
"text"),
336 $ilDB->quote($deliver_result[
"mimetype"],
"text"),
338 $ilDB->quote($this->assignment->getId(),
"integer"),
339 $ilDB->quote($this->isLate(),
"integer"),
340 $ilDB->quote($team_id,
"integer")
345 $this->team->writeLog(
347 $a_http_post_files[
"name"]
375 $max_num = $this->assignment->getMaxFile();
377 $current_num =
sizeof($this->
getFiles());
378 $zip_num =
sizeof($filearray[
"file"]);
379 if ($current_num + $zip_num > $max_num) {
386 foreach ($filearray[
"file"] as $key =>
$filename) {
388 $a_http_post_files[
"type"] =
"other";
389 $a_http_post_files[
"tmp_name"] = $filearray[
"path"][$key] .
"/" .
$filename;
390 $a_http_post_files[
"error"] = 0;
391 $a_http_post_files[
"size"] = filesize($filearray[
"path"][$key] .
"/" .
$filename);
393 if (!$this->
uploadFile($a_http_post_files,
true)) {
412 $ilDB = $DIC->database();
415 $path = $storage->getAbsoluteSubmissionPath();
419 $query =
"SELECT * FROM exc_returned WHERE ass_id = " .
420 $ilDB->quote($a_ass_id,
"integer");
424 if (
$ass_type->isSubmissionAssignedToTeam()) {
425 $storage_id = $row[
"team_id"];
427 $storage_id = $row[
"user_id"];
430 $row[
"timestamp"] = $row[
"ts"];
431 $row[
"filename"] = $path .
"/" . $storage_id .
"/" . basename($row[
"filename"]);
435 return $delivered ? $delivered : array();
442 $ilDB = $DIC->database();
445 $path = $storage->getAbsoluteSubmissionPath();
449 $query =
"SELECT * FROM exc_returned WHERE ass_id = " .
450 $ilDB->quote($a_ass_id,
"integer") .
451 " AND user_id IN (" . implode(
',', $a_users) .
")";
455 if (
$ass_type->isSubmissionAssignedToTeam()) {
456 $storage_id = $row[
"team_id"];
458 $storage_id = $row[
"user_id"];
461 $row[
"timestamp"] = $row[
"ts"];
462 $row[
"filename"] = $path .
"/" . $storage_id .
"/" . basename($row[
"filename"]);
466 return $delivered ? $delivered : array();
477 public function getFiles(array $a_file_ids = null, $a_only_valid =
false, $a_min_timestamp = null)
481 $sql =
"SELECT * FROM exc_returned" .
488 $sql .=
" AND " .
$ilDB->in(
"returned_id", $a_file_ids,
false,
"integer");
491 if ($a_min_timestamp) {
492 $sql .=
" AND ts > " .
$ilDB->quote($a_min_timestamp,
"timestamp");
497 $delivered_files = array();
499 $path = $this->
initStorage()->getAbsoluteSubmissionPath();
505 !(trim($row[
"atext"]))) {
509 $row[
"owner_id"] = $row[
"user_id"];
510 $row[
"timestamp"] = $row[
"ts"];
511 $row[
"timestamp14"] = substr($row[
"ts"], 0, 4) .
512 substr($row[
"ts"], 5, 2) . substr($row[
"ts"], 8, 2) .
513 substr($row[
"ts"], 11, 2) . substr($row[
"ts"], 14, 2) .
514 substr($row[
"ts"], 17, 2);
516 if ($this->
getAssignment()->getAssignmentType()->isSubmissionAssignedToTeam()) {
517 $storage_id = $row[
"team_id"];
519 $storage_id = $row[
"user_id"];
523 $row[
"filename"] = $path .
524 "/" . $storage_id .
"/" . basename($row[
"filename"]);
527 if (is_file($row[
"filename"]) || (!$this->assignment->getAssignmentType()->usesFileUpload())) {
528 array_push($delivered_files, $row);
533 return $delivered_files;
553 $q =
"SELECT exc_returned.returned_id AS id " .
554 "FROM exc_usr_tutor, exc_returned " .
555 "WHERE exc_returned.ass_id = exc_usr_tutor.ass_id " .
556 " AND exc_returned.user_id = exc_usr_tutor.usr_id " .
557 " AND exc_returned.ass_id = " .
$ilDB->quote($this->
getAssignment()->getId(),
"integer") .
559 " AND exc_usr_tutor.tutor_id = " .
$ilDB->quote($tutor,
"integer") .
560 " AND exc_usr_tutor.download_time < exc_returned.ts ";
562 $new_up_set =
$ilDB->query($q);
565 while ($new_up_rec =
$ilDB->fetchAssoc($new_up_set)) {
566 $new_up[] = $new_up_rec[
"id"];
582 $ilDB = $DIC->database();
584 $set =
$ilDB->query(
"SELECT obj_id" .
585 " FROM exc_returned" .
586 " WHERE returned_id = " .
$ilDB->quote($a_returned_id,
"integer"));
587 $row =
$ilDB->fetchAssoc($set);
588 return (
int) $row[
"obj_id"];
603 $ilDB = $DIC->database();
605 $set =
$ilDB->query(
"SELECT obj_id, ass_id" .
606 " FROM exc_returned" .
607 " WHERE user_id = " .
$ilDB->quote($a_user_id,
"integer") .
608 " AND filetitle = " .
$ilDB->quote($a_filetitle,
"text"));
610 while ($row =
$ilDB->fetchAssoc($set)) {
611 $res[$row[
"ass_id"]] = $row;
619 foreach ($this->
getFiles() as $item) {
620 $files[] = $item[
"returned_id"];
622 if (
sizeof($files)) {
641 if (!
sizeof($file_id_array)) {
645 if (count($file_id_array)) {
647 " WHERE " .
$ilDB->in(
"returned_id", $file_id_array,
false,
"integer") .
651 $result_array = array();
653 $row[
"timestamp"] = $row[
"ts"];
654 array_push($result_array, $row);
658 $ilDB->manipulate(
"DELETE FROM exc_returned" .
659 " WHERE " .
$ilDB->in(
"returned_id", $file_id_array,
false,
"integer") .
663 $path = $this->
initStorage()->getAbsoluteSubmissionPath();
664 foreach ($result_array as $key => $value) {
665 if ($value[
"filename"]) {
667 $this->team->writeLog(
673 if ($this->
getAssignment()->getAssignmentType()->isSubmissionAssignedToTeam()) {
674 $storage_id = $value[
"team_id"];
676 $storage_id = $value[
"user_id"];
679 $filename = $path .
"/" . $storage_id .
"/" . basename($value[
"filename"]);
698 $submission =
new self($ass, $a_user_id);
699 $submission->deleteAllFiles();
702 $team = $submission->getTeam();
704 $team->removeTeamMember($a_user_id);
708 $member_status = $ass->getMemberStatus($a_user_id);
709 $member_status->setStatus(
"notgraded");
710 $member_status->update();
719 $q =
"SELECT download_time FROM exc_usr_tutor WHERE " .
721 $ilDB->in(
"usr_id", $a_user_ids,
"",
"integer") .
" AND " .
722 " tutor_id = " .
$ilDB->quote(
$ilUser->getId(),
"integer");
723 $lu_set =
$ilDB->query($q);
724 $lu_rec =
$ilDB->fetchAssoc($lu_set);
725 return $lu_rec[
"download_time"];
728 public function downloadFiles(array $a_file_ids = null, $a_only_new =
false, $a_peer_review_mask_filename =
false)
734 $is_team = $this->assignment->hasTeam();
737 $download_time = null;
742 if ($this->is_tutor) {
746 if ($a_peer_review_mask_filename) {
749 foreach ($this->peer_review->getPeerReviewsByGiver(
$ilUser->getId()) as $idx => $item) {
750 if ($item[
"peer_id"] == $this->
getUserId()) {
760 $files = $this->
getFiles($a_file_ids,
false, $download_time);
762 if (
sizeof($files) == 1) {
763 $file = array_pop($files);
765 switch ($this->assignment->getType()) {
770 $this->assignment->getTitle() .
" - " .
771 $file[
"filetitle"][
"firstname"] .
" " .
772 $file[
"filetitle"][
"lastname"] .
" (" .
773 $file[
"filetitle"][
"login"] .
").zip";
779 $this->assignment->getTitle() .
" (Team " . $this->
getTeam()->getId() .
").zip";
786 if ($a_peer_review_mask_filename) {
787 $suffix = array_pop(explode(
".", $file[
"filetitle"]));
788 $file[
"filetitle"] = $this->assignment->getTitle() .
"_peer" . $peer_id .
"." . $suffix;
789 } elseif ($file[
"late"]) {
790 $file[
"filetitle"] =
$lng->txt(
"exc_late_submission") .
" - " .
794 $this->
downloadSingleFile($file[
"user_id"], $file[
"filename"], $file[
"filetitle"], $file[
"team_id"]);
796 $array_files = array();
797 foreach ($files as $seq => $file) {
798 if ($this->assignment->getAssignmentType()->isSubmissionAssignedToTeam()) {
799 $storage_id = $file[
"team_id"];
801 $storage_id = $file[
"user_id"];
804 $src = basename($file[
"filename"]);
805 if ($a_peer_review_mask_filename) {
806 $suffix = array_pop(explode(
".", $src));
807 $tgt = $this->assignment->getTitle() .
"_peer" . $peer_id .
808 "_" . (++$seq) .
"." . $suffix;
810 $array_files[$storage_id][] = array(
815 $array_files[$storage_id][] = array(
817 "late" => $file[
"late"]
841 $exc_id = $this->assignment->getExerciseId();
842 $ass_id = $this->assignment->getId();
846 "DELETE FROM exc_usr_tutor " .
847 "WHERE ass_id = %s AND usr_id = %s AND tutor_id = %s",
848 array(
"integer",
"integer",
"integer"),
849 array($ass_id, $user_id,
$ilUser->getId())
853 "INSERT INTO exc_usr_tutor (ass_id, obj_id, usr_id, tutor_id, download_time) VALUES " .
854 "(%s, %s, %s, %s, %s)",
855 array(
"integer",
"integer",
"integer",
"integer",
"timestamp"),
863 if ($this->ass_type->isSubmissionAssignedToTeam()) {
864 $storage_id = $a_team_id;
866 $storage_id = $a_user_id;
870 "/" . $storage_id .
"/" . basename(
$filename);
879 $path = $this->
initStorage()->getAbsoluteSubmissionPath();
886 $tmpzipfile = $tmpfile .
".zip";
892 $deliverFilename = str_replace(
" ",
"_", $assTitle);
893 if ($a_user_id > 0 && !$a_multi_user) {
895 $deliverFilename .=
"_" . $userName[
"lastname"] .
"_" . $userName[
"firstname"];
897 $deliverFilename .=
"_files";
899 $orgDeliverFilename = trim($deliverFilename);
902 chdir($tmpdir .
"/" . $deliverFilename);
905 $parsed_files = $duplicates = array();
906 foreach ($a_filenames as $storage_id => $files) {
907 $pathname = $path .
"/" . $storage_id;
911 if (isset($filename[
"tgt"])) {
912 $newFilename = $filename[
"tgt"];
913 $filename = $filename[
"src"];
915 $late = $filename[
"late"];
916 $filename = $filename[
"src"];
919 $newFilename = trim($filename);
920 $pos = strpos($newFilename,
"_");
921 if ($pos !==
false) {
922 $newFilename = substr($newFilename, $pos + 1);
925 $chkName = strtolower($newFilename);
926 if (array_key_exists($chkName, $duplicates)) {
927 $suffix = strrpos($newFilename,
".");
928 $newFilename = substr($newFilename, 0, $suffix) .
929 " (" . (++$duplicates[$chkName]) .
")" .
930 substr($newFilename, $suffix);
932 $duplicates[$chkName] = 1;
936 $newFilename =
$lng->txt(
"exc_late_submission") .
" - " .
942 $newFilename = $tmpdir . DIRECTORY_SEPARATOR . $deliverFilename . DIRECTORY_SEPARATOR . $newFilename;
944 $oldFilename = $pathname . DIRECTORY_SEPARATOR .
$filename;
945 if (!copy($oldFilename, $newFilename)) {
946 echo
'Could not copy ' . $oldFilename .
' to ' . $newFilename;
948 touch($newFilename, filectime($oldFilename));
949 $parsed_files[] =
ilUtil::escapeShellArg($deliverFilename . DIRECTORY_SEPARATOR . basename($newFilename));
976 $lng = $DIC->language();
983 $savepath = $storage->getAbsoluteSubmissionPath();
991 if (!is_dir($savepath)) {
997 $tmpdir = $storage->getTempPath();
1003 foreach (array_keys($members) as $id) {
1004 $directory = $savepath . DIRECTORY_SEPARATOR . $id;
1007 if ($dirsize > disk_free_space($tmpdir)) {
1018 $team_dirs = array();
1021 foreach ($members as $id => $item) {
1022 $user = $item[
"name"];
1023 $user_files = $item[
"files"];
1024 $sourcedir = $savepath . DIRECTORY_SEPARATOR . $id;
1025 if (!is_dir($sourcedir)) {
1031 if (is_array($team_map) &&
1032 array_key_exists($id, $team_map)) {
1033 $team_id = $team_map[$id];
1034 if (!array_key_exists($team_id, $team_dirs)) {
1035 $team_dir =
$lng->txt(
"exc_team") .
" " . $team_id;
1037 $team_dirs[$team_id] = $team_dir;
1039 $team_dir = $team_dirs[$team_id] . DIRECTORY_SEPARATOR;
1046 if ($targetdir ==
"") {
1050 $targetdir = self::getDirectoryNameFromUserData($id);
1052 $targetdir = $team_dir . $targetdir;
1057 $sourcefiles = scandir($sourcedir);
1058 $duplicates = array();
1059 foreach ($sourcefiles as $sourcefile) {
1060 if ($sourcefile ==
"." || $sourcefile ==
"..") {
1064 $targetfile = trim(basename($sourcefile));
1065 $pos = strpos($targetfile,
"_");
1066 if ($pos !==
false) {
1067 $targetfile = substr($targetfile, $pos + 1);
1070 if ($a_ass->
getAssignmentType()->getSubmissionType() == self::TYPE_REPO_OBJECT) {
1073 $targetfile = $obj_type .
"_" . $obj_id .
".zip";
1078 if (array_key_exists($targetfile, $duplicates)) {
1079 $suffix = strrpos($targetfile,
".");
1080 $targetfile = substr($targetfile, 0, $suffix) .
1081 " (" . (++$duplicates[$targetfile]) .
")" .
1082 substr($targetfile, $suffix);
1084 $duplicates[$targetfile] = 1;
1088 if (is_array($user_files)) {
1089 foreach ($user_files as $file) {
1090 if (basename($file[
"filename"]) == $sourcefile) {
1091 if ($file[
"late"]) {
1092 $targetfile =
$lng->txt(
"exc_late_submission") .
" - " .
1101 $targetfile = $targetdir . DIRECTORY_SEPARATOR . $targetfile;
1102 $sourcefile = $sourcedir . DIRECTORY_SEPARATOR . $sourcefile;
1104 if (!copy($sourcefile, $targetfile)) {
1105 throw new ilExerciseException(
"Could not copy " . basename($sourcefile) .
" to '" . $targetfile .
"'.");
1108 touch($targetfile, filectime($sourcefile));
1114 unlink($targetfile);
1124 $path_final_zip_file = $to_path . DIRECTORY_SEPARATOR . $tmpzipfile;
1126 if (file_exists($tmpdir . DIRECTORY_SEPARATOR . $tmpzipfile)) {
1127 copy($tmpzipfile, $path_final_zip_file);
1135 unlink($path_final_zip_file);
1152 if ($this->
getAssignment()->getAssignmentType()->isSubmissionAssignedToTeam()) {
1153 $team_id = $this->
getTeam()->getId();
1154 $where =
" team_id = " .
$ilDB->quote($team_id,
"integer") .
" ";
1157 $where =
" " .
$ilDB->in(
"user_id", $this->
getUserIds(),
"",
"integer") .
" ";
1159 $where =
" user_id = " .
$ilDB->quote($this->
getUserId(),
"integer");
1178 $q =
"SELECT obj_id,user_id,ts FROM exc_returned" .
1179 " WHERE ass_id = " .
$ilDB->quote($this->assignment->getId(),
"integer") .
1181 " AND (filename IS NOT NULL OR atext IS NOT NULL)" .
1182 " AND ts IS NOT NULL" .
1183 " ORDER BY ts DESC";
1184 $usr_set =
$ilDB->query($q);
1185 $array =
$ilDB->fetchAssoc($usr_set);
1195 $this->db->setLimit(1);
1197 $q =
"SELECT web_dir_access_time FROM exc_returned" .
1198 " WHERE ass_id = " . $this->db->quote($this->assignment->getId(),
"integer") .
1199 " AND (filename IS NOT NULL OR atext IS NOT NULL)" .
1200 " AND web_dir_access_time IS NOT NULL" .
1202 " ORDER BY web_dir_access_time DESC";
1204 $res = $this->db->query($q);
1228 if ($this->
getAssignment()->getAssignmentType()->isSubmissionAssignedToTeam()) {
1230 $team_id = $this->
getTeam()->getId();
1243 if (count($subs) > 0) {
1244 throw new ilExerciseException(
"Repository object $a_wsp_id is already assigned to another assignment.");
1248 $next_id =
$ilDB->nextId(
"exc_returned");
1250 "INSERT INTO exc_returned " .
1251 "(returned_id, obj_id, user_id, filetitle, ass_id, ts, atext, late, team_id) " .
1252 "VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)",
1253 $ilDB->quote($next_id,
"integer"),
1254 $ilDB->quote($this->assignment->getExerciseId(),
"integer"),
1256 $ilDB->quote($a_wsp_id,
"text"),
1257 $ilDB->quote($this->assignment->getId(),
"integer"),
1259 $ilDB->quote($a_text,
"text"),
1261 $ilDB->quote($team_id,
"integer")
1277 $ilDB->manipulate(
"DELETE FROM exc_returned" .
1278 " WHERE obj_id = " .
$ilDB->quote($this->assignment->getExerciseId(),
"integer") .
1280 " AND ass_id = " .
$ilDB->quote($this->assignment->getId(),
"integer") .
1281 " AND returned_id = " .
$ilDB->quote($a_returned_id,
"integer"));
1297 if (!trim($a_text)) {
1305 $files = array_shift($files);
1306 $id = $files[
"returned_id"];
1308 $ilDB->manipulate(
"UPDATE exc_returned" .
1309 " SET atext = " .
$ilDB->quote($a_text,
"text") .
1311 ", late = " .
$ilDB->quote($this->
isLate(),
"integer") .
1312 " WHERE returned_id = " .
$ilDB->quote($id,
"integer"));
1330 $result[
"files"][
"count"] =
"---";
1346 $result[
"last_submission"][
"txt"] =
$lng->txt(
"exc_last_submission");
1347 $result[
"last_submission"][
"value"] = $last_sub;
1350 $ilCtrl->setParameterByClass(
"ilexsubmissionfilegui",
"member_id", $this->
getUserId());
1353 switch ($this->assignment->getType()) {
1361 foreach ($all_files as $file) {
1362 if ($file[
"late"]) {
1368 $result[
"files"][
"txt"] =
$lng->txt(
"exc_files_returned");
1370 $result[
"files"][
"txt"] .=
' - <span class="warning">' .
$lng->txt(
"exc_late_submission") .
" (" . $late_files .
")</span>";
1372 $sub_cnt = count($all_files);
1374 if (count($new) > 0) {
1375 $sub_cnt .=
" " . sprintf(
$lng->txt(
"cnt_new"), count($new));
1378 $result[
"files"][
"count"] = $sub_cnt;
1382 $result[
"files"][
"download_url"] =
1383 $ilCtrl->getLinkTargetByClass(
"ilexsubmissionfilegui",
"downloadReturned");
1385 if (count($new) <= 0) {
1386 $result[
"files"][
"download_txt"] =
$lng->txt(
"exc_tbl_action_download_files");
1388 $result[
"files"][
"download_txt"] =
$lng->txt(
"exc_tbl_action_download_all_files");
1392 if (count($new) > 0) {
1393 $result[
"files"][
"download_new_url"] =
1394 $ilCtrl->getLinkTargetByClass(
"ilexsubmissionfilegui",
"downloadNewReturned");
1396 $result[
"files"][
"download_new_txt"] =
$lng->txt(
"exc_tbl_action_download_new_files");
1402 $result[
"files"][
"txt"] =
$lng->txt(
"exc_blog_returned");
1405 $blogs = array_pop($blogs);
1406 if ($blogs && substr($blogs[
"filename"], -1) !=
"/") {
1407 if ($blogs[
"late"]) {
1408 $result[
"files"][
"txt"] .=
' - <span class="warning">' .
$lng->txt(
"exc_late_submission") .
"</span>";
1411 $result[
"files"][
"count"] = 1;
1413 $result[
"files"][
"download_url"] =
1414 $ilCtrl->getLinkTargetByClass(
"ilexsubmissionfilegui",
"downloadReturned");
1416 $result[
"files"][
"download_txt"] =
$lng->txt(
"exc_tbl_action_download_files");
1422 $result[
"files"][
"txt"] =
$lng->txt(
"exc_portfolio_returned");
1425 $portfolios = array_pop($portfolios);
1426 if ($portfolios && substr($portfolios[
"filename"], -1) !=
"/") {
1427 if ($portfolios[
"late"]) {
1428 $result[
"files"][
"txt"] .=
' - <span class="warning">' .
$lng->txt(
"exc_late_submission") .
"</span>";
1431 $result[
"files"][
"count"] = 1;
1433 $result[
"files"][
"download_url"] =
1434 $ilCtrl->getLinkTargetByClass(
"ilexsubmissionfilegui",
"downloadReturned");
1436 $result[
"files"][
"download_txt"] =
$lng->txt(
"exc_tbl_action_download_files");
1442 $result[
"files"][
"txt"] =
$lng->txt(
"exc_files_returned_text");
1445 $result[
"files"][
"count"] = 1;
1447 $files = array_shift($files);
1448 if (trim($files[
"atext"])) {
1449 if ($files[
"late"]) {
1450 $result[
"files"][
"txt"] .=
' - <span class="warning">' .
$lng->txt(
"exc_late_submission") .
"</span>";
1453 $result[
"files"][
"download_url"] =
1454 $ilCtrl->getLinkTargetByClass(
"ilexsubmissiontextgui",
"showAssignmentText");
1456 $result[
"files"][
"download_txt"] =
$lng->txt(
"exc_tbl_action_text_assignment_show");
1462 $result[
"files"][
"txt"] =
$lng->txt(
"exc_wiki_returned");
1465 $objs = array_pop($objs);
1466 if ($objs && substr($objs[
"filename"], -1) !=
"/") {
1467 if ($objs[
"late"]) {
1468 $result[
"files"][
"txt"] .=
' - <span class="warning">' .
$lng->txt(
"exc_late_submission") .
"</span>";
1471 $result[
"files"][
"count"] = 1;
1473 $result[
"files"][
"download_url"] =
1474 $ilCtrl->getLinkTargetByClass(
"ilexsubmissionfilegui",
"downloadReturned");
1476 $result[
"files"][
"download_txt"] =
$lng->txt(
"exc_tbl_action_download_files");
1482 $ilCtrl->setParameterByClass(
"ilexsubmissionfilegui",
"member_id",
"");
1498 $db = $DIC->database();
1500 $query =
"SELECT * FROM exc_returned r LEFT JOIN exc_assignment a" .
1501 " ON (r.ass_id = a.id) " .
1502 " WHERE r.filetitle = " .
$db->quote($a_filename,
"string");
1504 if (is_array($a_assignment_types) && count($a_assignment_types) > 0) {
1505 $query .=
" AND " .
$db->in(
"a.type", $a_assignment_types,
false,
"integer");
1510 while ($rec =
$db->fetchAssoc($set)) {
1526 trim($userName[
"lastname"]) .
"_" .
1527 trim($userName[
"firstname"]) .
"_" .
1528 trim($userName[
"login"]) .
"_" .
1529 $userName[
"user_id"]
1544 $ilDB = $DIC->database();
1546 $participants = array();
1547 $query =
"SELECT user_id FROM exc_returned WHERE ass_id = " .
1548 $ilDB->quote($a_ass_id,
"integer") .
1550 $ilDB->quote($a_exercise_id,
"integer");
1554 while ($row =
$ilDB->fetchAssoc(
$res)) {
1555 $participants[] = $row[
'user_id'];
1558 return $participants;
static _lookupName($a_user_id)
lookup user name
getStorageId()
Get storage id.
static deleteUser($a_exc_id, $a_user_id)
Delete all delivered files of user.
addResourceObject($a_wsp_id, $a_text=null)
Add personal resource or repository object (ref_id) to assigment.
lookupNewFiles($a_tutor=null)
Check how much files have been uploaded by the learner after the last download of the tutor...
static getAssignmentTeamMap($a_ass_id)
Get team structure for assignment.
getId()
Get assignment id.
static getMySQLTimestamp($a_ts)
Get MySQL timestamp in 4.1.x or higher format (yyyy-mm-dd hh:mm:ss) This function converts a timestam...
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
static downloadAllAssignmentFiles(ilExAssignment $a_ass, array $members, $to_path)
Download all submitted files of an assignment (all user)
Exercise assignment team.
static _lookupTitle($a_id)
lookup object title
static lookupExerciseIdForReturnedId($a_returned_id)
Get exercise from submission id (used in ilObjMediaObject)
static now()
Return current timestamp in Y-m-d H:i:s format.
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
downloadSingleFile($a_user_id, $filename, $filetitle, $a_team_id)
static getDirectoryNameFromUserData($a_user_id)
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
getLastDownloadTime(array $a_user_ids)
static getAssignmentParticipants(int $a_exercise_id, int $a_ass_id)
static getInstanceByIds($a_ass_id, $a_user_id=0)
Get instance by IDs (recommended for consumer code)
getExerciseId()
Get exercise id.
const TEAM_LOG_REMOVE_FILE
__construct(ilExAssignment $a_ass, $a_user_id, ilExAssignmentTeam $a_team=null, $a_is_tutor=false, $a_public_submissions=false)
foreach($_POST as $key=> $value) $res
uploadFile($a_http_post_files, $unzip=false)
Save submitted file of user.
isInTeam($a_user_id=null)
static getInstanceByUserId($a_assignment_id, $a_user_id, $a_create_on_demand=false)
static getInstance()
Get instance.
static _lookupObjId($a_id)
static getInstancesByExercise($a_exc_id)
getLastSubmission()
TODO -> get rid of getTableUserWhere and move to repository class Get the date of the last submission...
static processZipFile($a_directory, $a_file, $structure, $ref_id=null, $containerType=null, $tree=null, $access_handler=null)
unzips in given directory and processes uploaded zip for use as single files
downloadFiles(array $a_file_ids=null, $a_only_new=false, $a_peer_review_mask_filename=false)
static getSubmissionsForFilename($a_filename, $a_assignment_types=array())
Get assignment return entries for a filename.
static getAssignmentFilesByUsers(int $a_exc_id, int $a_ass_id, array $a_users)
static _lookupType($a_id, $a_reference=false)
lookup object type
static findUserFiles($a_user_id, $a_filetitle)
Check if given file was assigned.
getLastOpeningHTMLView()
TODO -> get rid of getTableUserWhere and move to repository class Get a mysql timestamp from the last...
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static ilTempnam($a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
static dirsize($directory)
get size of a directory or a file.
static utf8_encode($string)
utf8-encodes string if it is not a valid utf8-string.
downloadMultipleFiles($a_filenames, $a_user_id, $a_multi_user=false)
static lookupType($a_id)
Lookup type.
create()
Create directory.
processUploadedZipFile($fileTmp)
processes errorhandling etc for uploaded archive
static escapeShellArg($a_arg)
deleteResourceObject($a_returned_id)
Remove personal resource to assigment.
getTableUserWhere($a_team_mode=false)
Get user/team where clause.
Exercise submission //TODO: This class has to much static methods related to delivered "files"...
static recursive_dirscan($dir, &$arr)
Recursively scans a given directory and writes path and filename into referenced array.
static getAllAssignmentFiles($a_exc_id, $a_ass_id)
getAssignmentType()
Get assignment type.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
getFiles(array $a_file_ids=null, $a_only_valid=false, $a_min_timestamp=null)
Get submission items (not only files)
getDownloadedFilesInfoForTableGUIS($a_parent_obj, $a_parent_cmd=null)
updateTextSubmission($a_text)
Handle text assignment submissions.
static getValidFilename($a_filename)
Get valid filename.
static lookupTitle($a_id)
Lookup title.
updateTutorDownloadTime()
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
Class to report exception.
deleteSelectedFiles(array $file_id_array)
Deletes already delivered files.
Exercise exceptions class.