29 $this->
setType(self::TYPE_UPLOAD);
65 $this->exc_id = $a_val;
85 $this->start_time = $a_val;
95 return $this->start_time;
105 $this->deadline = $a_val;
115 return $this->deadline;
125 $this->instruction = $a_val;
135 return $this->instruction;
145 $this->title = $a_val;
165 $this->mandatory = $a_val;
175 return $this->mandatory;
185 $this->order_nr = $a_val;
195 return $this->order_nr;
207 $this->type = (int)$a_value;
229 if(in_array((
int)$a_value, array(self::TYPE_UPLOAD, self::TYPE_BLOG,
230 self::TYPE_PORTFOLIO, self::TYPE_UPLOAD_TEAM)))
244 $set = $ilDB->query(
"SELECT * FROM exc_assignment ".
245 " WHERE id = ".$ilDB->quote($this->getId(),
"integer")
247 while ($rec = $ilDB->fetchAssoc($set))
274 $next_id = $ilDB->nextId(
"exc_assignment");
275 $ilDB->insert(
"exc_assignment", array(
276 "id" => array(
"integer", $next_id),
278 "time_stamp" => array(
"integer", $this->
getDeadline()),
280 "title" => array(
"text", $this->
getTitle()),
281 "start_time" => array(
"integer", $this->
getStartTime()),
282 "order_nr" => array(
"integer", $this->
getOrderNr()),
284 "type" => array(
"integer", $this->
getType())
286 $this->
setId($next_id);
288 $exc->updateAllUsersStatus();
299 $ilDB->update(
"exc_assignment",
302 "time_stamp" => array(
"integer", $this->
getDeadline()),
304 "title" => array(
"text", $this->
getTitle()),
305 "start_time" => array(
"integer", $this->
getStartTime()),
306 "order_nr" => array(
"integer", $this->
getOrderNr()),
308 "type" => array(
"integer", $this->
getType())
311 "id" => array(
"integer", $this->
getId()),
314 $exc->updateAllUsersStatus();
324 $ilDB->manipulate(
"DELETE FROM exc_assignment WHERE ".
325 " id = ".$ilDB->quote($this->getId(),
"integer")
328 $exc->updateAllUsersStatus();
339 $set = $ilDB->query(
"SELECT * FROM exc_assignment ".
340 " WHERE exc_id = ".$ilDB->quote($a_exc_id,
"integer").
341 " ORDER BY order_nr ASC");
345 while ($rec = $ilDB->fetchAssoc($set))
350 "exc_id" => $rec[
"exc_id"],
351 "deadline" => $rec[
"time_stamp"],
352 "instruction" => $rec[
"instruction"],
353 "title" => $rec[
"title"],
354 "start_time" => $rec[
"start_time"],
355 "order_val" => $order_val,
356 "mandatory" => $rec[
"mandatory"],
357 "type" => $rec[
"type"]
373 foreach ($ass_data as
$d)
377 $new_ass->setExerciseId($a_new_exc_id);
378 $new_ass->setTitle($d[
"title"]);
379 $new_ass->setDeadline($d[
"deadline"]);
380 $new_ass->setInstruction($d[
"instruction"]);
381 $new_ass->setMandatory($d[
"mandatory"]);
382 $new_ass->setOrderNr($d[
"order_val"]);
383 $new_ass->setStartTime($d[
"start_time"]);
384 $new_ass->setType($d[
"type"]);
388 include_once(
"./Modules/Exercise/classes/class.ilFSStorageExercise.php");
393 if (is_dir($old_storage->getPath()))
395 ilUtil::rCopy($old_storage->getPath(), $new_storage->getPath());
405 include_once(
"./Modules/Exercise/classes/class.ilFSStorageExercise.php");
407 return $storage->getFiles();
417 $set = $ilDB->query(
"SELECT MAX(order_nr) mnr FROM exc_assignment ".
418 " WHERE exc_id = ".$ilDB->quote($a_exc_id,
"integer")
420 while ($rec = $ilDB->fetchAssoc($set))
422 return (
int) $rec[
"mnr"];
436 $query =
"SELECT id FROM exc_assignment ".
437 "WHERE start_time <= ".$ilDB->quote(time(),
'integer').
' '.
438 "AND time_stamp >= ".$ilDB->quote(time(),
'integer').
' '.
439 "AND id = ".$ilDB->quote($a_ass_id,
'integer');
442 return $res->numRows() ?
true :
false;
449 private static function lookup($a_id, $a_field)
453 $set = $ilDB->query(
"SELECT ".$a_field.
" FROM exc_assignment ".
454 " WHERE id = ".$ilDB->quote($a_id,
"integer")
457 $rec = $ilDB->fetchAssoc($set);
459 return $rec[$a_field];
485 $result_order = array();
488 foreach ($a_order as $k => $v)
491 $ilDB->manipulate(
$t =
"UPDATE exc_assignment SET ".
492 " order_nr = ".$ilDB->quote($nr,
"integer").
493 " WHERE id = ".$ilDB->quote((
int) $k,
"integer").
494 " AND exc_id = ".$ilDB->quote((
int) $a_ex_id,
"integer")
507 $set = $ilDB->query(
"SELECT id FROM exc_assignment ".
508 " WHERE exc_id = ".$ilDB->quote($a_ex_id,
"integer").
509 " ORDER BY time_stamp ASC"
512 while ($rec = $ilDB->fetchAssoc($set))
514 $ilDB->manipulate(
"UPDATE exc_assignment SET ".
515 " order_nr = ".$ilDB->quote($nr,
"integer").
516 " WHERE id = ".$ilDB->quote($rec[
"id"],
"integer")
529 $set = $ilDB->query(
"SELECT count(*) cntm FROM exc_assignment ".
530 " WHERE exc_id = ".$ilDB->quote($a_ex_id,
"integer").
531 " AND mandatory = ".$ilDB->quote(1,
"integer")
533 $rec = $ilDB->fetchAssoc($set);
548 $set = $ilDB->query(
"SELECT ".$a_field.
" FROM exc_mem_ass_status ".
549 " WHERE ass_id = ".$ilDB->quote($a_ass_id,
"integer").
550 " AND usr_id = ".$ilDB->quote($a_user_id,
"integer")
552 $rec = $ilDB->fetchAssoc($set);
554 return $rec[$a_field];
564 $ilDB->manipulate(
"UPDATE exc_mem_ass_status SET ".
565 " ".$a_field.
" = ".$ilDB->quote($a_value, $a_type).
566 " WHERE ass_id = ".$ilDB->quote($a_ass_id,
"integer").
567 " AND usr_id = ".$ilDB->quote($a_user_id,
"integer")
599 "u_comment", $a_value,
"text");
616 "mark", $a_value,
"text");
639 $ilDB->manipulateF(
"UPDATE exc_mem_ass_status ".
640 "SET status = %s, status_time= %s ".
641 " WHERE ass_id = %s AND usr_id = %s AND status <> %s ",
642 array(
"text",
"timestamp",
"integer",
"integer",
"text"),
643 array($a_status,
ilUtil::now(), $a_ass_id, $a_user_id, $a_status));
688 $ilDB->manipulateF(
"UPDATE exc_mem_ass_status ".
689 "SET sent = %s, status_time= %s, sent_time = %s ".
690 " WHERE ass_id = %s AND usr_id = %s ",
691 array(
"integer",
"timestamp",
"timestamp",
"integer",
"integer"),
693 $a_ass_id, $a_user_id));
725 $ilDB->manipulateF(
"UPDATE exc_mem_ass_status ".
726 "SET returned = %s, status_time= %s ".
727 " WHERE ass_id = %s AND usr_id = %s",
728 array(
"integer",
"timestamp",
"integer",
"integer"),
730 $a_ass_id, $a_user_id));
762 $ilDB->manipulateF(
"UPDATE exc_mem_ass_status ".
763 "SET feedback = %s, status_time= %s, feedback_time = %s ".
764 " WHERE ass_id = %s AND usr_id = %s",
765 array(
"integer",
"timestamp",
"timestamp",
"integer",
"integer"),
767 $a_ass_id, $a_user_id));
830 $user_ids = array($a_user_id);
833 $result = $ilDB->query(
"SELECT returned_id FROM exc_returned".
834 " WHERE ass_id = ".$ilDB->quote($a_ass_id,
"integer").
835 " AND ".$ilDB->in(
"user_id", $user_ids,
"",
"integer"));
836 return $ilDB->numRows(
$result);
846 include_once(
"./Modules/Exercise/classes/class.ilFSStorageExercise.php");
849 $query =
"SELECT * FROM exc_returned WHERE ass_id = ".
850 $ilDB->quote($a_ass_id,
"integer");
853 while(
$row = $ilDB->fetchAssoc(
$res))
856 $row[
"filename"] = $fs->getAbsoluteSubmissionPath().
857 "/".$row[
"user_id"].
"/".basename(
$row[
"filename"]);
863 return $delivered ? $delivered : array();
876 $user_ids = array($a_user_id);
879 include_once(
"./Modules/Exercise/classes/class.ilFSStorageExercise.php");
882 $result = $ilDB->query(
"SELECT * FROM exc_returned".
883 " WHERE ass_id = ".$ilDB->quote($a_ass_id,
"integer").
884 " AND ".$ilDB->in(
"user_id", $user_ids,
"",
"integer"));
886 $delivered_files = array();
891 if($a_filter_empty_filename && !
$row[
"filename"])
897 $row[
"timestamp14"] = substr(
$row[
"ts"], 0, 4).
898 substr(
$row[
"ts"], 5, 2).substr(
$row[
"ts"], 8, 2).
899 substr(
$row[
"ts"], 11, 2).substr(
$row[
"ts"], 14, 2).
900 substr(
$row[
"ts"], 17, 2);
901 $row[
"filename"] = $fs->getAbsoluteSubmissionPath().
902 "/".$row[
"user_id"].
"/".basename(
$row[
"filename"]);
903 array_push($delivered_files,
$row);
908 return $delivered_files;
918 include_once(
"./Modules/Exercise/classes/class.ilFSStorageExercise.php");
921 if (count($file_id_array))
935 $user_ids = array($a_user_id);
938 $result = $ilDB->query(
"SELECT * FROM exc_returned".
939 " WHERE ".$ilDB->in(
"returned_id", $file_id_array,
false,
"integer").
940 " AND ".$ilDB->in(
"user_id", $user_ids,
"",
"integer"));
944 $result_array = array();
948 array_push($result_array,
$row);
952 $ilDB->manipulate(
"DELETE FROM exc_returned".
953 " WHERE ".$ilDB->in(
"returned_id", $file_id_array,
false,
"integer").
954 " AND ".$ilDB->in(
"user_id", $user_ids,
"",
"integer"));
957 foreach ($result_array as $key => $value)
959 if($value[
"filename"])
967 $filename = $fs->getAbsoluteSubmissionPath().
968 "/".$value[
"user_id"].
"/".basename($value[
"filename"]);
986 include_once(
"./Modules/Exercise/classes/class.ilFSStorageExercise.php");
988 $delete_ids = array();
991 $set = $ilDB->query(
"SELECT * FROM exc_returned ".
992 " WHERE obj_id = ".$ilDB->quote($a_exc_id,
"integer").
993 " AND user_id = ".$ilDB->quote($a_user_id,
"integer")
995 while ($rec = $ilDB->fetchAssoc($set))
997 $ass =
new self($rec[
"ass_id"]);
1002 if(
sizeof($team) > 1)
1004 $new_owner = array_pop($team);
1005 while($new_owner == $a_user_id &&
sizeof($team))
1007 $new_owner = array_pop($team);
1010 $ilDB->manipulate(
"UPDATE exc_returned".
1011 " SET user_id = ".$ilDB->quote($new_owner,
"integer").
1012 " WHERE returned_id = ".$ilDB->quote($rec[
"returned_id"],
"integer")
1020 $delete_ids[] = $rec[
"returned_id"];
1025 $filename = $fs->getAbsoluteSubmissionPath().
1026 "/".$a_user_id.
"/".basename($rec[
"filename"]);
1036 $ilDB->manipulate(
"DELETE FROM exc_returned".
1037 " WHERE ".$ilDB->in(
"returned_id", $delete_ids,
"",
"integer"));
1042 foreach(self::getAssignmentDataOfExercise($a_exc_id) as $item)
1046 $ass_ids[] = $item[
"id"];
1050 $ilDB->manipulate(
$d =
"DELETE FROM il_exc_team WHERE ".
1051 "user_id = ".$ilDB->quote($a_user_id,
"integer").
1052 " AND ".$ilDB->in(
"ass_id", $ass_ids,
"",
"integer")
1071 $user_ids = array($a_user_id);
1078 $q =
"SELECT download_time FROM exc_usr_tutor WHERE ".
1079 " ass_id = ".$ilDB->quote($a_ass_id,
"integer").
" AND ".
1080 $ilDB->in(
"usr_id", $user_ids,
"",
"integer").
" AND ".
1081 " tutor_id = ".$ilDB->quote($ilUser->getId(),
"integer");
1082 $lu_set = $ilDB->query($q);
1083 if ($lu_rec = $ilDB->fetchAssoc($lu_set))
1085 if ($lu_rec[
"download_time"] > 0)
1087 $and_str =
" AND ts > ".$ilDB->quote($lu_rec[
"download_time"],
"timestamp");
1092 foreach($user_ids as $user_id)
1097 $query =
"SELECT * FROM exc_returned".
1098 " WHERE ass_id = ".$ilDB->quote($a_ass_id,
"integer").
1099 " AND ".$ilDB->in(
"user_id", $user_ids,
"",
"integer").
1103 $count = $ilDB->numRows(
$result);
1108 switch(self::lookupType($a_ass_id))
1110 case self::TYPE_BLOG:
1111 case self::TYPE_PORTFOLIO:
1115 $row[
"filetitle"][
"firstname"].
" ".
1116 $row[
"filetitle"][
"lastname"].
" (".
1117 $row[
"filetitle"][
"login"].
").zip";
1125 $row[
"filename"],
$row[
"filetitle"]);
1127 else if ($count > 0)
1129 $array_files = array();
1132 $array_files[
$row[
"user_id"]][] = basename($row[
"filename"]);
1135 ($is_team ? null : $a_user_id), $is_team);
1153 $ilDB->manipulateF(
"DELETE FROM exc_usr_tutor ".
1154 "WHERE ass_id = %s AND usr_id = %s AND tutor_id = %s",
1155 array(
"integer",
"integer",
"integer"),
1156 array($a_ass_id, $a_user_id, $ilUser->getId()));
1158 $ilDB->manipulateF(
"INSERT INTO exc_usr_tutor (ass_id, obj_id, usr_id, tutor_id, download_time) VALUES ".
1159 "(%s, %s, %s, %s, %s)",
1160 array(
"integer",
"integer",
"integer",
"integer",
"timestamp"),
1161 array($a_ass_id, $a_exc_id, $a_user_id, $ilUser->getId(),
ilUtil::now()));
1171 if (count($array_file_id))
1179 $user_ids = array($a_user_id);
1182 $result = $ilDB->query(
"SELECT * FROM exc_returned WHERE ".
1183 $ilDB->in(
"returned_id", $array_file_id,
false,
"integer").
1184 " AND ".$ilDB->in(
"user_id", $user_ids,
"",
"integer"));
1187 $array_found = array();
1191 array_push($array_found,
$row);
1193 if (count($array_found) == 1)
1196 if(is_numeric($array_found[0][
"filetitle"]))
1204 $ass->getTitle().
" - ".
1205 $user_data[
"firstname"].
" ".
1206 $user_data[
"lastname"].
" (".
1207 $user_data[
"login"].
").zip";
1212 $array_found[0][
"filename"], $array_found[0][
"filetitle"]);
1216 $filenames = array();
1217 foreach ($array_found as $value)
1219 $filenames[$value[
"user_id"]][] = basename($value[
"filename"]);
1222 $filenames, ($is_team ? null : $a_user_id), $is_team);
1233 include_once(
"./Modules/Exercise/classes/class.ilFSStorageExercise.php");
1236 $filename = $fs->getAbsoluteSubmissionPath().
1239 require_once
"./Services/Utilities/classes/class.ilUtil.php";
1248 $a_user_id, $a_multi_user =
false)
1250 include_once(
"./Modules/Exercise/classes/class.ilFSStorageExercise.php");
1253 require_once
"./Services/Utilities/classes/class.ilUtil.php";
1259 $tmpzipfile = $tmpfile .
".zip";
1265 $deliverFilename = str_replace(
" ",
"_", $assTitle);
1266 if ($a_user_id > 0 && !$a_multi_user)
1269 $deliverFilename .=
"_".$userName[
"lastname"].
"_".$userName[
"firstname"];
1273 $deliverFilename .=
"_files";
1275 $orgDeliverFilename = trim($deliverFilename);
1278 chdir($tmpdir.
"/".$deliverFilename);
1281 $parsed_files = $duplicates = array();
1282 foreach ($array_filenames as $user_id => $files)
1284 $pathname = $fs->getAbsoluteSubmissionPath().
"/".$user_id;
1289 $newFilename = trim($filename);
1290 $pos = strpos($newFilename ,
"_");
1293 $newFilename= substr($newFilename, $pos + 1);
1296 $chkName = strtolower($newFilename);
1297 if(array_key_exists($chkName, $duplicates))
1299 $suffix = strrpos($newFilename,
".");
1300 $newFilename = substr($newFilename, 0, $suffix).
1301 " (".(++$duplicates[$chkName]).
")".
1302 substr($newFilename, $suffix);
1306 $duplicates[$chkName] = 1;
1308 $newFilename = $tmpdir.DIRECTORY_SEPARATOR.$deliverFilename.DIRECTORY_SEPARATOR.$newFilename;
1310 $oldFilename = $pathname.DIRECTORY_SEPARATOR.$filename;
1311 if (!copy ($oldFilename, $newFilename))
1313 echo
'Could not copy '.$oldFilename.
' to '.$newFilename;
1315 touch($newFilename, filectime($oldFilename));
1339 global
$lng, $ilObjDataCache, $ilias;
1341 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1342 include_once(
"./Modules/Exercise/classes/class.ilFSStorageExercise.php");
1349 $savepath = $storage->getAbsoluteSubmissionPath();
1357 if (!is_dir($savepath))
1363 chdir($storage->getTempPath());
1373 foreach ($members as $id => $object) {
1374 $directory = $savepath.DIRECTORY_SEPARATOR.$id;
1377 if ($dirsize > disk_free_space($tmpdir)) {
1388 foreach ($members as $id => $user)
1390 $sourcedir = $savepath.DIRECTORY_SEPARATOR.$id;
1391 if (!is_dir($sourcedir))
1395 if (array_key_exists($directory, $cache))
1399 if (array_key_exists($directory, $cache)) {
1401 $directory .=
"_".$id;
1405 $cache[$directory] = $directory;
1407 $sourcefiles = scandir($sourcedir);
1408 $duplicates = array();
1409 foreach ($sourcefiles as $sourcefile) {
1410 if ($sourcefile ==
"." || $sourcefile ==
"..")
1415 $targetfile = trim(basename($sourcefile));
1416 $pos = strpos($targetfile,
"_");
1419 $targetfile= substr($targetfile, $pos + 1);
1423 if(array_key_exists($targetfile, $duplicates))
1425 $suffix = strrpos($targetfile,
".");
1426 $targetfile = substr($targetfile, 0, $suffix).
1427 " (".(++$duplicates[$targetfile]).
")".
1428 substr($targetfile, $suffix);
1432 $duplicates[$targetfile] = 1;
1435 $targetfile = $directory.DIRECTORY_SEPARATOR.$targetfile;
1436 $sourcefile = $sourcedir.DIRECTORY_SEPARATOR.$sourcefile;
1438 if (!copy ($sourcefile, $targetfile))
1441 $ilias->raiseError(
'Could not copy '.basename($sourcefile).
" to '".$targetfile.
"'.",
1442 $ilias->error_obj->MESSAGE);
1447 touch($targetfile, filectime($sourcefile));
1454 unlink($targetfile);
1462 $tmpzipfile = $tmpfile .
".zip";
1471 ? strtolower($lng->txt(
"exc_assignment"))
1472 : $assTitle).
".zip",
"",
false,
true);
1483 $ilDB->manipulate(
"UPDATE exc_mem_ass_status".
1484 " SET notice = ".$ilDB->quote($a_notice,
"text").
1485 ",status_time= ".$ilDB->quote(
ilUtil::now(),
"timestamp").
1486 " WHERE ass_id = ".$ilDB->quote($a_ass_id,
"integer").
1487 " AND usr_id = ".$ilDB->quote($a_user_id,
"integer").
1488 " AND ".$ilDB->equalsNot(
"notice", $a_notice,
"text",
true));
1498 $query =
"SELECT DISTINCT(usr_id) as ud FROM exc_mem_ass_status ".
1499 "WHERE ass_id = ".$ilDB->quote($a_ass_id,
"integer").
" ".
1503 while(
$row = $ilDB->fetchObject(
$res))
1505 $usr_ids[] =
$row->ud;
1508 return $usr_ids ? $usr_ids : array();
1526 $user_ids = array($a_user_id);
1531 $q =
"SELECT obj_id,user_id,ts FROM exc_returned".
1532 " WHERE ass_id = ".$ilDB->quote($a_ass_id,
"integer").
1533 " AND ".$ilDB->in(
"user_id", $user_ids,
"",
"integer").
1534 " ORDER BY ts DESC";
1536 $usr_set = $ilDB->query($q);
1538 $array = $ilDB->fetchAssoc($usr_set);
1539 if ($array[
"ts"]==NULL)
1556 $q =
"SELECT count(*) AS cnt FROM exc_mem_ass_status".
1557 " WHERE NOT sent_time IS NULL".
1558 " AND ass_id = ".$ilDB->quote($a_ass_id,
"integer").
" ".
1560 $set = $ilDB->query($q);
1561 $rec = $ilDB->fetchAssoc($set);
1563 if ($rec[
"cnt"] > 0)
1585 $user_ids = array($member_id);
1588 $q=
"SELECT exc_mem_ass_status.status_time, exc_returned.ts ".
1589 "FROM exc_mem_ass_status, exc_returned ".
1590 "WHERE exc_mem_ass_status.status_time < exc_returned.ts ".
1591 "AND NOT exc_mem_ass_status.status_time IS NULL ".
1592 "AND exc_returned.ass_id = exc_mem_ass_status.ass_id ".
1593 "AND exc_returned.user_id = exc_mem_ass_status.usr_id ".
1594 "AND exc_returned.ass_id=".$ilDB->quote($ass_id,
"integer").
1595 " AND ".$ilDB->in(
"exc_returned.user_id", $user_ids,
"",
"integer");
1597 $usr_set = $ilDB->query($q);
1599 $array = $ilDB->fetchAssoc($usr_set);
1601 if (count($array)==0)
1624 $user_ids = array($member_id);
1627 $q =
"SELECT exc_returned.returned_id AS id ".
1628 "FROM exc_usr_tutor, exc_returned ".
1629 "WHERE exc_returned.ass_id = exc_usr_tutor.ass_id ".
1630 " AND exc_returned.user_id = exc_usr_tutor.usr_id ".
1631 " AND exc_returned.ass_id = ".$ilDB->quote($ass_id,
"integer").
1632 " AND ".$ilDB->in(
"exc_returned.user_id", $user_ids,
"",
"integer").
1633 " AND exc_usr_tutor.tutor_id = ".$ilDB->quote($ilUser->getId(),
"integer").
1634 " AND exc_usr_tutor.download_time < exc_returned.ts ";
1636 $new_up_set = $ilDB->query($q);
1639 while ($new_up_rec = $ilDB->fetchAssoc($new_up_set))
1641 $new_up[] = $new_up_rec[
"id"];
1657 $set = $ilDB->query(
"SELECT * FROM exc_members ".
1658 "WHERE obj_id = ".$ilDB->quote($a_exc_id,
"integer"));
1659 while($rec = $ilDB->fetchAssoc($set))
1666 $mem[$rec[
"usr_id"]] =
1668 "name" => $name[
"lastname"].
", ".$name[
"firstname"],
1670 "usr_id" => $rec[
"usr_id"],
1671 "lastname" => $name[
"lastname"],
1672 "firstname" => $name[
"firstname"]
1677 $q =
"SELECT * FROM exc_mem_ass_status ".
1678 "WHERE ass_id = ".$ilDB->quote($a_ass_id,
"integer");
1679 $set = $ilDB->query($q);
1680 while($rec = $ilDB->fetchAssoc($set))
1682 if (isset($mem[$rec[
"usr_id"]]))
1684 $mem[$rec[
"usr_id"]][
"sent_time"] = $rec[
"sent_time"];
1686 $mem[$rec[
"usr_id"]][
"status_time"] = $rec[
"status_time"];
1687 $mem[$rec[
"usr_id"]][
"feedback_time"] = $rec[
"feedback_time"];
1688 $mem[$rec[
"usr_id"]][
"notice"] = $rec[
"notice"];
1689 $mem[$rec[
"usr_id"]][
"status"] = $rec[
"status"];
1703 foreach ($ass_data as $ass)
1706 $ilDB->replace(
"exc_mem_ass_status", array(
1707 "ass_id" => array(
"integer", $ass[
"id"]),
1708 "usr_id" => array(
"integer", $a_user_id)
1710 "status" => array(
"text",
"notgraded")
1722 include_once(
"./Modules/Exercise/classes/class.ilExerciseMembers.php");
1724 $mems = $exmem->getMembers();
1726 foreach ($mems as $mem)
1728 $ilDB->replace(
"exc_mem_ass_status", array(
1729 "ass_id" => array(
"integer", $a_ass_id),
1730 "usr_id" => array(
"integer", $mem)
1732 "status" => array(
"text",
"notgraded")
1743 include_once(
"./Modules/Exercise/classes/class.ilFSStorageExercise.php");
1746 $storage->uploadAssignmentFiles($a_files);
1766 $sql =
"SELECT id FROM il_exc_team".
1767 " WHERE ass_id = ".$ilDB->quote($this->
getId(),
"integer").
1768 " AND user_id = ".$ilDB->quote($a_user_id,
"integer");
1769 $set = $ilDB->query($sql);
1770 $row = $ilDB->fetchAssoc($set);
1773 if(!$id && $a_create_on_demand)
1775 $id = $ilDB->nextId(
"il_exc_team");
1777 $fields = array(
"id" => array(
"integer", $id),
1778 "ass_id" => array(
"integer", $this->
getId()),
1779 "user_id" => array(
"integer", $a_user_id));
1780 $ilDB->insert(
"il_exc_team", $fields);
1802 $sql =
"SELECT user_id".
1803 " FROM il_exc_team".
1804 " WHERE ass_id = ".$ilDB->quote($this->
getId(),
"integer").
1805 " AND id = ".$ilDB->quote($a_team_id,
"integer");
1806 $set = $ilDB->query($sql);
1807 while(
$row = $ilDB->fetchAssoc($set))
1809 $ids[] =
$row[
"user_id"];
1826 $sql =
"SELECT user_id".
1827 " FROM il_exc_team".
1828 " WHERE ass_id = ".$ilDB->quote($this->
getId(),
"integer");
1829 $set = $ilDB->query($sql);
1830 while(
$row = $ilDB->fetchAssoc($set))
1832 $ids[] =
$row[
"user_id"];
1850 if(!in_array($a_user_id, $members))
1852 $fields = array(
"id" => array(
"integer", $a_team_id),
1853 "ass_id" => array(
"integer", $this->
getId()),
1854 "user_id" => array(
"integer", $a_user_id));
1855 $ilDB->insert(
"il_exc_team", $fields);
1875 $sql =
"DELETE FROM il_exc_team".
1876 " WHERE ass_id = ".$ilDB->quote($this->
getId(),
"integer").
1877 " AND id = ".$ilDB->quote($a_team_id,
"integer").
1878 " AND user_id = ".$ilDB->quote($a_user_id,
"integer");
1879 $ilDB->manipulate($sql);
1903 $set = $ilDB->query(
"SELECT user_id".
1904 " FROM il_exc_team".
1905 " WHERE ass_id = ".$ilDB->quote($a_ass_id,
"integer").
1906 " AND id = ". $ilDB->quote($team_id,
"integer"));
1907 while(
$row = $ilDB->fetchAssoc($set))
1909 $ids[] =
$row[
"user_id"];
1927 $result = $ilDB->query(
"SELECT type".
1928 " FROM exc_assignment".
1929 " WHERE id = ".$ilDB->quote($a_ass_id,
"integer"));
1930 $type = $ilDB->fetchAssoc(
$result);
1932 if($type[
"type"] == self::TYPE_UPLOAD_TEAM)
1934 $set = $ilDB->query(
"SELECT id".
1935 " FROM il_exc_team".
1936 " WHERE ass_id = ".$ilDB->quote($a_ass_id,
"integer").
1937 " AND user_id = ".$ilDB->quote($a_user_id,
"integer"));
1938 $team_id = $ilDB->fetchAssoc($set);
1939 return $team_id[
"id"];
1955 $sql =
"SELECT * FROM il_exc_team".
1956 " WHERE ass_id = ".$ilDB->quote($a_ass_id,
"integer");
1957 $set = $ilDB->query($sql);
1958 while(
$row = $ilDB->fetchAssoc($set))
1960 $map[
$row[
"user_id"]] = $row[
"id"];
1973 public static function writeTeamLog($a_team_id, $a_action, $a_details = null)
1978 "team_id" => array(
"integer", $a_team_id),
1979 "user_id" => array(
"integer", $ilUser->getId()),
1980 "action" => array(
"integer", $a_action),
1981 "details" => array(
"text", $a_details),
1982 "tstamp" => array(
"integer", time())
1985 $ilDB->insert(
"il_exc_team_log", $fields);
2000 $sql =
"SELECT * FROM il_exc_team_log".
2001 " WHERE team_id = ".$ilDB->quote($a_team_id,
"integer").
2002 " ORDER BY tstamp DESC";
2003 $set = $ilDB->query($sql);
2004 while(
$row = $ilDB->fetchAssoc($set))
2023 if($ilUser->getId() == $a_user_id)
2028 include_once
"./Services/Mail/classes/class.ilMail.php";
2029 include_once
"./Services/User/classes/class.ilObjUser.php";
2030 include_once
"./Services/Language/classes/class.ilLanguageFactory.php";
2031 include_once(
"./Services/User/classes/class.ilUserUtil.php");
2032 include_once(
"./Services/Link/classes/class.ilLink.php");
2038 $ulng->loadLanguageModule(
'exc');
2040 $subject = sprintf($ulng->txt(
'exc_team_notification_subject_'.$a_action), $this->
getTitle());
2043 $message .= $ulng->txt(
'exc_team_notification_body_'.$a_action).
"\n\n";
2045 $message .= $ulng->txt(
'exc_assignment').
": ".$this->
getTitle().
"\n";
2047 $message .= $ulng->txt(
'exc_team_notification_link').
": ".$link;
2049 $mail_obj =
new ilMail(ANONYMOUS_USER_ID);
2050 $mail_obj->appendInstallationSignature(
true);
2052 "",
"", $subject, $message, array(), array(
"system"));