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;
73 include_once(
"./Modules/Exercise/classes/class.ilExcAssMemberState.php");
78 include_once
"Modules/Exercise/classes/class.ilExAssignmentTeam.php";
81 $this->team = $a_team;
85 if ($this->assignment->getPeerReview()) {
86 include_once
"Modules/Exercise/classes/class.ilExPeerReview.php";
93 return $this->assignment->getAssignmentType()->getSubmissionType();
141 if ($this->peer_review) {
142 $valid = $this->peer_review->isFeedbackValidForPassed($user_id);
159 return $this->team->getMembers();
163 return array($this->user_id);
169 return "t" . $this->team->getId();
177 return (
bool)
sizeof($this->
getFiles(null,
true));
191 $this->state->isSubmissionAllowed());
201 $this->public_submissions) {
206 if ($this->peer_review) {
208 foreach ($this->peer_review->getPeerReviewsByPeerId($this->getUserId()) as $giver) {
209 if ($giver[
"giver_id"] ==
$ilUser->getId()) {
225 if ($this->assignment->hasTeam() &&
226 !$this->team->getId()) {
239 return in_array($a_user_id, $this->
getUserIds());
251 return ($this->peer_review &&
252 $this->peer_review->hasPeerReviewAccess($this->user_id));
263 $max <=
sizeof($this->
getFiles())) {
277 $dl = $this->state->getOfficialDeadline();
279 return ($dl && $dl < time());
284 include_once(
"./Modules/Exercise/classes/class.ilFSStorageExercise.php");
285 return new ilFSStorageExercise($this->assignment->getExerciseId(), $this->assignment->getId());
295 if ($this->ass_type->isSubmissionAssignedToTeam()) {
296 $storage_id = $this->
getTeam()->getId();
307 public function uploadFile($a_http_post_files, $unzip =
false)
315 if ($this->ass_type->isSubmissionAssignedToTeam()) {
316 $team_id = $this->
getTeam()->getId();
327 $deliver_result = $this->
initStorage()->uploadFile($a_http_post_files, $storage_id, $unzip);
329 if ($deliver_result) {
330 $next_id =
$ilDB->nextId(
"exc_returned");
332 "INSERT INTO exc_returned " .
333 "(returned_id, obj_id, user_id, filename, filetitle, mimetype, ts, ass_id, late, team_id) " .
334 "VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
335 $ilDB->quote($next_id,
"integer"),
336 $ilDB->quote($this->assignment->getExerciseId(),
"integer"),
338 $ilDB->quote($deliver_result[
"fullname"],
"text"),
340 $ilDB->quote($deliver_result[
"mimetype"],
"text"),
342 $ilDB->quote($this->assignment->getId(),
"integer"),
343 $ilDB->quote($this->isLate(),
"integer"),
344 $ilDB->quote($team_id,
"integer")
349 $this->team->writeLog(
351 $a_http_post_files[
"name"]
372 include_once(
"Services/Utilities/classes/class.ilFileUtils.php");
381 $max_num = $this->assignment->getMaxFile();
383 $current_num =
sizeof($this->
getFiles());
384 $zip_num =
sizeof($filearray[
"file"]);
385 if ($current_num + $zip_num > $max_num) {
394 $a_http_post_files[
"type"] =
"other";
395 $a_http_post_files[
"tmp_name"] = $filearray[
"path"][
$key] .
"/" .
$filename;
396 $a_http_post_files[
"error"] = 0;
397 $a_http_post_files[
"size"] = filesize($filearray[
"path"][
$key] .
"/" .
$filename);
399 if (!$this->
uploadFile($a_http_post_files,
true)) {
418 $ilDB = $DIC->database();
420 $query =
"SELECT * FROM exc_returned" .
421 " WHERE ass_id = " .
$ilDB->quote($a_ass_id,
"integer") .
422 " AND (filename IS NOT NULL OR atext IS NOT NULL)" .
423 " AND ts IS NOT NULL";
432 $ilDB = $DIC->database();
434 include_once(
"./Modules/Exercise/classes/class.ilFSStorageExercise.php");
436 $path = $storage->getAbsoluteSubmissionPath();
438 include_once(
"./Modules/Exercise/AssignmentTypes/classes/class.ilExAssignmentTypes.php");
441 $query =
"SELECT * FROM exc_returned WHERE ass_id = " .
442 $ilDB->quote($a_ass_id,
"integer");
446 if (
$ass_type->isSubmissionAssignedToTeam()) {
447 $storage_id =
$row[
"team_id"];
449 $storage_id =
$row[
"user_id"];
453 $row[
"filename"] =
$path .
"/" . $storage_id .
"/" . basename(
$row[
"filename"]);
457 return $delivered ? $delivered : array();
464 $ilDB = $DIC->database();
467 $path = $storage->getAbsoluteSubmissionPath();
471 $query =
"SELECT * FROM exc_returned WHERE ass_id = " .
472 $ilDB->quote($a_ass_id,
"integer") .
473 " AND user_id IN (" . implode(
',', $a_users) .
")";
477 if (
$ass_type->isSubmissionAssignedToTeam()) {
478 $storage_id =
$row[
"team_id"];
480 $storage_id =
$row[
"user_id"];
484 $row[
"filename"] =
$path .
"/" . $storage_id .
"/" . basename(
$row[
"filename"]);
488 return $delivered ? $delivered : array();
499 public function getFiles(array $a_file_ids = null, $a_only_valid =
false, $a_min_timestamp = null)
503 $sql =
"SELECT * FROM exc_returned" .
510 $sql .=
" AND " .
$ilDB->in(
"returned_id", $a_file_ids,
false,
"integer");
513 if ($a_min_timestamp) {
514 $sql .=
" AND ts > " .
$ilDB->quote($a_min_timestamp,
"timestamp");
519 $delivered_files = array();
527 !(trim(
$row[
"atext"]))) {
533 $row[
"timestamp14"] = substr(
$row[
"ts"], 0, 4) .
534 substr(
$row[
"ts"], 5, 2) . substr(
$row[
"ts"], 8, 2) .
535 substr(
$row[
"ts"], 11, 2) . substr(
$row[
"ts"], 14, 2) .
536 substr(
$row[
"ts"], 17, 2);
538 if ($this->
getAssignment()->getAssignmentType()->isSubmissionAssignedToTeam()) {
539 $storage_id =
$row[
"team_id"];
541 $storage_id =
$row[
"user_id"];
546 "/" . $storage_id .
"/" . basename(
$row[
"filename"]);
549 if (is_file(
$row[
"filename"]) || (!$this->assignment->getAssignmentType()->usesFileUpload())) {
550 array_push($delivered_files,
$row);
555 return $delivered_files;
575 $q =
"SELECT exc_returned.returned_id AS id " .
576 "FROM exc_usr_tutor, exc_returned " .
577 "WHERE exc_returned.ass_id = exc_usr_tutor.ass_id " .
578 " AND exc_returned.user_id = exc_usr_tutor.usr_id " .
579 " AND exc_returned.ass_id = " .
$ilDB->quote($this->
getAssignment()->getId(),
"integer") .
581 " AND exc_usr_tutor.tutor_id = " .
$ilDB->quote($tutor,
"integer") .
582 " AND exc_usr_tutor.download_time < exc_returned.ts ";
584 $new_up_set =
$ilDB->query($q);
587 while ($new_up_rec =
$ilDB->fetchAssoc($new_up_set)) {
588 $new_up[] = $new_up_rec[
"id"];
604 $ilDB = $DIC->database();
606 $set =
$ilDB->query(
"SELECT obj_id" .
607 " FROM exc_returned" .
608 " WHERE returned_id = " .
$ilDB->quote($a_returned_id,
"integer"));
610 return (
int)
$row[
"obj_id"];
625 $ilDB = $DIC->database();
627 $set =
$ilDB->query(
"SELECT obj_id, ass_id" .
628 " FROM exc_returned" .
629 " WHERE user_id = " .
$ilDB->quote($a_user_id,
"integer") .
630 " AND filetitle = " .
$ilDB->quote($a_filetitle,
"text"));
641 foreach ($this->
getFiles() as $item) {
642 $files[] = $item[
"returned_id"];
663 if (!
sizeof($file_id_array)) {
667 if (count($file_id_array)) {
669 " WHERE " .
$ilDB->in(
"returned_id", $file_id_array,
false,
"integer") .
673 $result_array = array();
676 array_push($result_array,
$row);
680 $ilDB->manipulate(
"DELETE FROM exc_returned" .
681 " WHERE " .
$ilDB->in(
"returned_id", $file_id_array,
false,
"integer") .
686 foreach ($result_array as
$key => $value) {
687 if ($value[
"filename"]) {
689 $this->team->writeLog(
695 if ($this->
getAssignment()->getAssignmentType()->isSubmissionAssignedToTeam()) {
696 $storage_id = $value[
"team_id"];
698 $storage_id = $value[
"user_id"];
701 $filename =
$path .
"/" . $storage_id .
"/" . basename($value[
"filename"]);
717 include_once(
"./Modules/Exercise/classes/class.ilExAssignment.php");
720 $submission =
new self($ass, $a_user_id);
721 $submission->deleteAllFiles();
724 $team = $submission->getTeam();
726 $team->removeTeamMember($a_user_id);
730 $member_status = $ass->getMemberStatus($a_user_id);
731 $member_status->setStatus(
"notgraded");
732 $member_status->update();
741 $q =
"SELECT download_time FROM exc_usr_tutor WHERE " .
743 $ilDB->in(
"usr_id", $a_user_ids,
"",
"integer") .
" AND " .
744 " tutor_id = " .
$ilDB->quote(
$ilUser->getId(),
"integer");
745 $lu_set =
$ilDB->query($q);
746 $lu_rec =
$ilDB->fetchAssoc($lu_set);
747 return $lu_rec[
"download_time"];
750 public function downloadFiles(array $a_file_ids = null, $a_only_new =
false, $a_peer_review_mask_filename =
false)
756 $is_team = $this->assignment->hasTeam();
759 $download_time = null;
764 if ($this->is_tutor) {
768 if ($a_peer_review_mask_filename) {
771 foreach ($this->peer_review->getPeerReviewsByGiver(
$ilUser->getId()) as $idx => $item) {
772 if ($item[
"peer_id"] == $this->
getUserId()) {
784 if (
sizeof(
$files) == 1) {
785 $file = array_pop(
$files);
787 switch ($this->assignment->getType()) {
792 $this->assignment->getTitle() .
" - " .
793 $file[
"filetitle"][
"firstname"] .
" " .
794 $file[
"filetitle"][
"lastname"] .
" (" .
795 $file[
"filetitle"][
"login"] .
").zip";
801 $this->assignment->getTitle() .
" (Team " . $this->
getTeam()->getId() .
").zip";
808 if ($a_peer_review_mask_filename) {
809 $suffix = array_pop(explode(
".", $file[
"filetitle"]));
810 $file[
"filetitle"] = $this->assignment->getTitle() .
"_peer" . $peer_id .
"." . $suffix;
811 } elseif ($file[
"late"]) {
812 $file[
"filetitle"] =
$lng->txt(
"exc_late_submission") .
" - " .
816 $this->
downloadSingleFile($file[
"user_id"], $file[
"filename"], $file[
"filetitle"], $file[
"team_id"]);
818 $array_files = array();
819 foreach (
$files as $seq => $file) {
820 if ($this->assignment->getAssignmentType()->isSubmissionAssignedToTeam()) {
821 $storage_id = $file[
"team_id"];
823 $storage_id = $file[
"user_id"];
826 $src = basename($file[
"filename"]);
827 if ($a_peer_review_mask_filename) {
828 $suffix = array_pop(explode(
".", $src));
829 $tgt = $this->assignment->getTitle() .
"_peer" . $peer_id .
830 "_" . (++$seq) .
"." . $suffix;
832 $array_files[$storage_id][] = array(
837 $array_files[$storage_id][] = array(
839 "late" => $file[
"late"]
863 $exc_id = $this->assignment->getExerciseId();
864 $ass_id = $this->assignment->getId();
868 "DELETE FROM exc_usr_tutor " .
869 "WHERE ass_id = %s AND usr_id = %s AND tutor_id = %s",
870 array(
"integer",
"integer",
"integer"),
871 array($ass_id, $user_id,
$ilUser->getId())
875 "INSERT INTO exc_usr_tutor (ass_id, obj_id, usr_id, tutor_id, download_time) VALUES " .
876 "(%s, %s, %s, %s, %s)",
877 array(
"integer",
"integer",
"integer",
"integer",
"timestamp"),
885 if ($this->ass_type->isSubmissionAssignedToTeam()) {
886 $storage_id = $a_team_id;
888 $storage_id = $a_user_id;
892 "/" . $storage_id .
"/" . basename(
$filename);
908 $tmpzipfile = $tmpfile .
".zip";
914 $deliverFilename = str_replace(
" ",
"_", $assTitle);
915 if ($a_user_id > 0 && !$a_multi_user) {
917 $deliverFilename .=
"_" . $userName[
"lastname"] .
"_" . $userName[
"firstname"];
919 $deliverFilename .=
"_files";
921 $orgDeliverFilename = trim($deliverFilename);
924 chdir($tmpdir .
"/" . $deliverFilename);
927 $parsed_files = $duplicates = array();
928 foreach ($a_filenames as $storage_id =>
$files) {
929 $pathname =
$path .
"/" . $storage_id;
933 if (isset($filename[
"tgt"])) {
934 $newFilename = $filename[
"tgt"];
935 $filename = $filename[
"src"];
937 $late = $filename[
"late"];
938 $filename = $filename[
"src"];
941 $newFilename = trim($filename);
942 $pos = strpos($newFilename,
"_");
943 if ($pos !==
false) {
944 $newFilename = substr($newFilename, $pos + 1);
947 $chkName = strtolower($newFilename);
948 if (array_key_exists($chkName, $duplicates)) {
949 $suffix = strrpos($newFilename,
".");
950 $newFilename = substr($newFilename, 0, $suffix) .
951 " (" . (++$duplicates[$chkName]) .
")" .
952 substr($newFilename, $suffix);
954 $duplicates[$chkName] = 1;
958 $newFilename =
$lng->txt(
"exc_late_submission") .
" - " .
964 $newFilename = $tmpdir . DIRECTORY_SEPARATOR . $deliverFilename . DIRECTORY_SEPARATOR . $newFilename;
966 $oldFilename = $pathname . DIRECTORY_SEPARATOR .
$filename;
967 if (!copy($oldFilename, $newFilename)) {
968 echo 'Could not copy ' . $oldFilename .
' to ' . $newFilename;
970 touch($newFilename, filectime($oldFilename));
971 $parsed_files[] =
ilUtil::escapeShellArg($deliverFilename . DIRECTORY_SEPARATOR . basename($newFilename));
998 $lng = $DIC->language();
1000 include_once(
"./Modules/Exercise/classes/class.ilFSStorageExercise.php");
1007 $savepath = $storage->getAbsoluteSubmissionPath();
1015 if (!is_dir($savepath)) {
1021 $tmpdir = $storage->getTempPath();
1027 foreach (array_keys($members) as
$id) {
1028 $directory = $savepath . DIRECTORY_SEPARATOR .
$id;
1031 if ($dirsize > disk_free_space($tmpdir)) {
1042 $team_dirs = array();
1045 foreach ($members as $id => $item) {
1046 $user = $item[
"name"];
1047 $user_files = $item[
"files"];
1048 $sourcedir = $savepath . DIRECTORY_SEPARATOR .
$id;
1049 if (!is_dir($sourcedir)) {
1055 if (is_array($team_map) &&
1056 array_key_exists($id, $team_map)) {
1057 $team_id = $team_map[
$id];
1058 if (!array_key_exists($team_id, $team_dirs)) {
1059 $team_dir =
$lng->txt(
"exc_team") .
" " . $team_id;
1061 $team_dirs[$team_id] = $team_dir;
1063 $team_dir = $team_dirs[$team_id] . DIRECTORY_SEPARATOR;
1070 if ($targetdir ==
"") {
1074 $targetdir = self::getDirectoryNameFromUserData($id);
1076 $targetdir = $team_dir . $targetdir;
1081 $sourcefiles = scandir($sourcedir);
1082 $duplicates = array();
1083 foreach ($sourcefiles as $sourcefile) {
1084 if ($sourcefile ==
"." || $sourcefile ==
"..") {
1088 $targetfile = trim(basename($sourcefile));
1089 $pos = strpos($targetfile,
"_");
1090 if ($pos !==
false) {
1091 $targetfile = substr($targetfile, $pos + 1);
1094 if ($a_ass->
getAssignmentType()->getSubmissionType() == self::TYPE_REPO_OBJECT) {
1097 $targetfile = $obj_type .
"_" . $obj_id .
".zip";
1102 if (array_key_exists($targetfile, $duplicates)) {
1103 $suffix = strrpos($targetfile,
".");
1104 $targetfile = substr($targetfile, 0, $suffix) .
1105 " (" . (++$duplicates[$targetfile]) .
")" .
1106 substr($targetfile, $suffix);
1108 $duplicates[$targetfile] = 1;
1112 if (is_array($user_files)) {
1113 foreach ($user_files as $file) {
1114 if (basename($file[
"filename"]) == $sourcefile) {
1115 if ($file[
"late"]) {
1116 $targetfile =
$lng->txt(
"exc_late_submission") .
" - " .
1125 $targetfile = $targetdir . DIRECTORY_SEPARATOR . $targetfile;
1126 $sourcefile = $sourcedir . DIRECTORY_SEPARATOR . $sourcefile;
1128 if (!copy($sourcefile, $targetfile)) {
1129 include_once
"Modules/Exercise/exceptions/class.ilExerciseException.php";
1130 throw new ilExerciseException(
"Could not copy " . basename($sourcefile) .
" to '" . $targetfile .
"'.");
1133 touch($targetfile, filectime($sourcefile));
1139 unlink($targetfile);
1149 $path_final_zip_file = $to_path . DIRECTORY_SEPARATOR . $tmpzipfile;
1151 if (file_exists($tmpdir . DIRECTORY_SEPARATOR . $tmpzipfile)) {
1152 copy($tmpzipfile, $path_final_zip_file);
1160 unlink($path_final_zip_file);
1177 if ($this->
getAssignment()->getAssignmentType()->isSubmissionAssignedToTeam()) {
1178 $team_id = $this->
getTeam()->getId();
1179 $where =
" team_id = " .
$ilDB->quote($team_id,
"integer") .
" ";
1182 $where =
" " .
$ilDB->in(
"user_id", $this->
getUserIds(),
"",
"integer") .
" ";
1184 $where =
" user_id = " .
$ilDB->quote($this->
getUserId(),
"integer");
1202 $q =
"SELECT obj_id,user_id,ts FROM exc_returned" .
1203 " WHERE ass_id = " .
$ilDB->quote($this->assignment->getId(),
"integer") .
1205 " AND (filename IS NOT NULL OR atext IS NOT NULL)" .
1206 " AND ts IS NOT NULL" .
1207 " ORDER BY ts DESC";
1208 $usr_set =
$ilDB->query($q);
1209 $array =
$ilDB->fetchAssoc($usr_set);
1230 if ($this->
getAssignment()->getAssignmentType()->isSubmissionAssignedToTeam()) {
1232 $team_id = $this->
getTeam()->getId();
1245 if (count($subs) > 0) {
1246 throw new ilExerciseException(
"Repository object $a_wsp_id is already assigned to another assignment.");
1250 $next_id =
$ilDB->nextId(
"exc_returned");
1252 "INSERT INTO exc_returned " .
1253 "(returned_id, obj_id, user_id, filetitle, ass_id, ts, atext, late, team_id) " .
1254 "VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)",
1255 $ilDB->quote($next_id,
"integer"),
1256 $ilDB->quote($this->assignment->getExerciseId(),
"integer"),
1258 $ilDB->quote($a_wsp_id,
"text"),
1259 $ilDB->quote($this->assignment->getId(),
"integer"),
1261 $ilDB->quote($a_text,
"text"),
1263 $ilDB->quote($team_id,
"integer")
1279 $ilDB->manipulate(
"DELETE FROM exc_returned" .
1280 " WHERE obj_id = " .
$ilDB->quote($this->assignment->getExerciseId(),
"integer") .
1282 " AND ass_id = " .
$ilDB->quote($this->assignment->getId(),
"integer") .
1283 " AND returned_id = " .
$ilDB->quote($a_returned_id,
"integer"));
1299 if (!trim($a_text)) {
1310 $ilDB->manipulate(
"UPDATE exc_returned" .
1311 " SET atext = " .
$ilDB->quote($a_text,
"text") .
1313 ", late = " .
$ilDB->quote($this->
isLate(),
"integer") .
1314 " WHERE returned_id = " .
$ilDB->quote(
$id,
"integer"));
1333 $result[
"files"][
"count"] =
"---";
1349 $result[
"last_submission"][
"txt"] =
$lng->txt(
"exc_last_submission");
1350 $result[
"last_submission"][
"value"] = $last_sub;
1353 $ilCtrl->setParameterByClass(
"ilexsubmissionfilegui",
"member_id", $this->
getUserId());
1356 switch ($this->assignment->getType()) {
1364 foreach ($all_files as $file) {
1365 if ($file[
"late"]) {
1371 $result[
"files"][
"txt"] =
$lng->txt(
"exc_files_returned");
1373 $result[
"files"][
"txt"] .=
' - <span class="warning">' .
$lng->txt(
"exc_late_submission") .
" (" . $late_files .
")</span>";
1375 $sub_cnt = count($all_files);
1377 if (count($new) > 0) {
1378 $sub_cnt .=
" " . sprintf(
$lng->txt(
"cnt_new"), count($new));
1381 $result[
"files"][
"count"] = $sub_cnt;
1385 $result[
"files"][
"download_url"] =
1386 $ilCtrl->getLinkTargetByClass(
"ilexsubmissionfilegui",
"downloadReturned");
1388 if (count($new) <= 0) {
1389 $result[
"files"][
"download_txt"] =
$lng->txt(
"exc_tbl_action_download_files");
1391 $result[
"files"][
"download_txt"] =
$lng->txt(
"exc_tbl_action_download_all_files");
1395 if (count($new) > 0) {
1396 $result[
"files"][
"download_new_url"] =
1397 $ilCtrl->getLinkTargetByClass(
"ilexsubmissionfilegui",
"downloadNewReturned");
1399 $result[
"files"][
"download_new_txt"] =
$lng->txt(
"exc_tbl_action_download_new_files");
1405 $result[
"files"][
"txt"] =
$lng->txt(
"exc_blog_returned");
1408 $blogs = array_pop($blogs);
1409 if ($blogs && substr($blogs[
"filename"], -1) !=
"/") {
1410 if ($blogs[
"late"]) {
1411 $result[
"files"][
"txt"] .=
' - <span class="warning">' .
$lng->txt(
"exc_late_submission") .
"</span>";
1414 $result[
"files"][
"count"] = 1;
1416 $result[
"files"][
"download_url"] =
1417 $ilCtrl->getLinkTargetByClass(
"ilexsubmissionfilegui",
"downloadReturned");
1419 $result[
"files"][
"download_txt"] =
$lng->txt(
"exc_tbl_action_download_files");
1425 $result[
"files"][
"txt"] =
$lng->txt(
"exc_portfolio_returned");
1428 $portfolios = array_pop($portfolios);
1429 if ($portfolios && substr($portfolios[
"filename"], -1) !=
"/") {
1430 if ($portfolios[
"late"]) {
1431 $result[
"files"][
"txt"] .=
' - <span class="warning">' .
$lng->txt(
"exc_late_submission") .
"</span>";
1434 $result[
"files"][
"count"] = 1;
1436 $result[
"files"][
"download_url"] =
1437 $ilCtrl->getLinkTargetByClass(
"ilexsubmissionfilegui",
"downloadReturned");
1439 $result[
"files"][
"download_txt"] =
$lng->txt(
"exc_tbl_action_download_files");
1445 $result[
"files"][
"txt"] =
$lng->txt(
"exc_files_returned_text");
1448 $result[
"files"][
"count"] = 1;
1451 if (trim(
$files[
"atext"])) {
1453 $result[
"files"][
"txt"] .=
' - <span class="warning">' .
$lng->txt(
"exc_late_submission") .
"</span>";
1456 $result[
"files"][
"download_url"] =
1457 $ilCtrl->getLinkTargetByClass(
"ilexsubmissiontextgui",
"showAssignmentText");
1459 $result[
"files"][
"download_txt"] =
$lng->txt(
"exc_tbl_action_text_assignment_show");
1465 $result[
"files"][
"txt"] =
$lng->txt(
"exc_wiki_returned");
1468 $objs = array_pop($objs);
1469 if ($objs && substr($objs[
"filename"], -1) !=
"/") {
1470 if ($objs[
"late"]) {
1471 $result[
"files"][
"txt"] .=
' - <span class="warning">' .
$lng->txt(
"exc_late_submission") .
"</span>";
1474 $result[
"files"][
"count"] = 1;
1476 $result[
"files"][
"download_url"] =
1477 $ilCtrl->getLinkTargetByClass(
"ilexsubmissionfilegui",
"downloadReturned");
1479 $result[
"files"][
"download_txt"] =
$lng->txt(
"exc_tbl_action_download_files");
1485 $ilCtrl->setParameterByClass(
"ilexsubmissionfilegui",
"member_id",
"");
1501 $db = $DIC->database();
1503 $query =
"SELECT * FROM exc_returned r LEFT JOIN exc_assignment a" .
1504 " ON (r.ass_id = a.id) " .
1505 " WHERE r.filetitle = " .
$db->quote($a_filename,
"string");
1507 if (is_array($a_assignment_types) && count($a_assignment_types) > 0) {
1508 $query .=
" AND " .
$db->in(
"a.type", $a_assignment_types,
false,
"integer");
1513 while ($rec =
$db->fetchAssoc($set)) {
1529 trim($userName[
"lastname"]) .
"_" .
1530 trim($userName[
"firstname"]) .
"_" .
1531 trim($userName[
"login"]) .
"_" .
1532 $userName[
"user_id"]
1547 $ilDB = $DIC->database();
1549 $participants = array();
1550 $query =
"SELECT user_id FROM exc_returned WHERE ass_id = " .
1551 $ilDB->quote($a_ass_id,
"integer") .
1553 $ilDB->quote($a_exercise_id,
"integer");
1558 $participants[] =
$row[
'user_id'];
1561 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...
if(!array_key_exists('StateId', $_REQUEST)) $id
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)
static hasAnySubmissions($a_ass_id)
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()
Get the date of the last submission of a user for the assignment.
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.
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.