62 protected \ILIAS\Exercise\InternalDomainService
$domain;
71 protected int $id = 0;
118 $this->domain = $DIC->exercise()->internal()->domain();
119 $this->db = $DIC->database();
120 $this->
lng = $DIC->language();
121 $this->
user = $DIC->user();
122 $this->app_event_handler = $DIC[
"ilAppEventHandler"];
124 $this->
access = $DIC->access();
125 $this->domain = $DIC->exercise()->internal()->domain();
127 $this->
setType(self::TYPE_UPLOAD);
136 $this->string_transform = $DIC->refinery()
149 $ilDB = $DIC->database();
151 $set =
$ilDB->query(
"SELECT * FROM exc_assignment " .
152 " WHERE exc_id = " .
$ilDB->quote($a_exc_id,
"integer") .
153 " ORDER BY order_nr");
157 while ($rec =
$ilDB->fetchAssoc($set)) {
159 $rec[
"order_val"] = $order_val;
162 $ass->initFromDB($rec);
182 $db = $DIC->database();
185 $result_order_val = $db->
query(
" 187 FROM exc_ass_file_order 188 WHERE assignment_id = {$db->quote($a_ass_id, 'integer')} 189 AND filename = {$db->quote($a_file_data['entry'], 'text')} 194 while ($row = $db->
fetchAssoc($result_order_val)) {
195 $order_val = (
int) $row[
'order_nr'];
196 $order_id = (
int) $row[
'id'];
198 return array($order_val, $order_id);
203 return $this->ass_type->usesTeams();
206 public function setId(
int $a_val): void
218 $this->exc_id = $a_val;
228 $this->start_time = $a_val;
238 $this->deadline = $a_val;
252 $this->deadline_mode = $a_val;
262 $this->relative_deadline = $a_val;
272 $this->rel_deadline_last_subm = $a_val;
287 if ($this->ass_type->usesTeams()) {
293 $a_user_id = $team_id;
297 $set =
$ilDB->query(
"SELECT tstamp FROM exc_idl" .
298 " WHERE ass_id = " .
$ilDB->quote($this->getId(),
"integer") .
299 " AND member_id = " .
$ilDB->quote($a_user_id,
"integer") .
300 " AND is_team = " .
$ilDB->quote($is_team,
"integer"));
301 $row =
$ilDB->fetchAssoc($set);
304 return max(($row[
"tstamp"] ?? 0), $this->
getDeadline());
312 $set =
$ilDB->query(
"SELECT MAX(tstamp) FROM exc_idl" .
313 " WHERE ass_id = " .
$ilDB->quote($this->getId(),
"integer"));
314 $row =
$ilDB->fetchAssoc($set);
315 return $row[
"tstamp"] ?? 0;
321 $this->deadline2 = $a_val;
331 $this->instruction = $a_val;
343 $is_html = (strlen($inst) != strlen(strip_tags($inst)));
346 $this->string_transform->makeClickable()->transform($inst)
355 $this->title = $a_val;
365 $this->mandatory = $a_val;
375 $this->order_nr = $a_val;
391 $this->type = $a_value;
393 $this->ass_type = $this->types->getById($a_value);
395 if ($this->ass_type->usesTeams()) {
418 return $this->types->isValidId($a_value);
423 $this->peer = $a_value;
433 $this->peer_min = $a_value;
443 $this->peer_unlock = $a_value;
456 $this->peer_dl = $a_val;
471 $this->peer_valid = $a_value;
481 $this->peer_rating = $a_val;
491 $this->peer_text = $a_val;
501 $this->peer_file = $a_val;
511 $this->peer_personal = $a_val;
521 $a_value = (is_numeric($a_value) && (
int) $a_value > 0)
524 $this->peer_char = $a_value;
534 $this->crit_cat = $a_value;
542 public function getPeerReviewCriteriaCatalogueItems(): array
544 if ($this->crit_cat) {
549 if ($this->peer_rating) {
553 if ($this->peer_text) {
556 if ($this->peer_char) {
557 $crit->setMinChars($this->peer_char);
562 if ($this->peer_file) {
572 $this->feedback_file = $a_value;
585 $this->feedback_cron = $a_value;
596 $this->feedback_date = $a_value;
610 $this->feedback_date_custom = $a_value;
621 $this->team_tutor = $a_value;
632 $this->max_file = $a_value;
643 $this->portfolio_template = $a_val;
659 "SELECT * FROM exc_assignment " .
660 " WHERE id = " .
$ilDB->quote($this->getId(),
"integer")
662 $rec =
$ilDB->fetchAssoc($set);
665 if (is_array($rec)) {
677 $this->
setId((
int) $a_set[
"id"]);
682 $this->
setTitle((
string) $a_set[
"title"]);
686 $this->
setType((
int) $a_set[
"type"]);
726 $next_id =
$ilDB->nextId(
"exc_assignment");
727 $ilDB->insert(
"exc_assignment", array(
728 "id" => array(
"integer", $next_id),
730 "time_stamp" => array(
"integer", $this->
getDeadline()),
733 "title" => array(
"text", $this->
getTitle()),
734 "start_time" => array(
"integer", $this->
getStartTime()),
735 "order_nr" => array(
"integer", $this->
getOrderNr()),
737 "type" => array(
"integer", $this->
getType()),
753 "team_tutor" => array(
"integer", $this->
getTeamTutor()),
754 "max_file" => array(
"integer", $this->
getMaxFile()),
762 $this->
setId($next_id);
764 $exc->updateAllUsersStatus();
766 $this->domain->assignment()->instructionFiles($next_id)->createCollection();
768 self::createNewAssignmentRecords($next_id, $exc);
784 "time_stamp" => array(
"integer", $this->
getDeadline()),
787 "title" => array(
"text", $this->
getTitle()),
788 "start_time" => array(
"integer", $this->
getStartTime()),
789 "order_nr" => array(
"integer", $this->
getOrderNr()),
791 "type" => array(
"integer", $this->
getType()),
807 "team_tutor" => array(
"integer", $this->
getTeamTutor()),
808 "max_file" => array(
"integer", $this->
getMaxFile()),
817 "id" => array(
"integer", $this->
getId()),
821 $exc->updateAllUsersStatus();
829 public function delete(
831 bool $update_user_status = true
837 foreach ($exc_members->getMembers() as $mem) {
839 $submission->deleteAllFiles();
843 "DELETE FROM exc_usr_tutor " .
846 array($this->
getId())
854 $peer_review->resetPeerReviews();
858 "DELETE FROM exc_ass_file_order" .
859 " WHERE assignment_id = " .
$ilDB->quote($this->getId(),
'integer')
863 "DELETE FROM exc_mem_ass_status" .
864 " WHERE ass_id = " .
$ilDB->quote($this->getId(),
'integer')
868 "DELETE FROM exc_assignment WHERE " .
869 " id = " .
$ilDB->quote($this->getId(),
"integer")
872 if ($update_user_status) {
881 $reminder->deleteReminders($this->
getId());
884 $this->domain->team()->deleteTeamsOfAssignment($this->
getId());
887 $this->domain->assignment()->instructionFiles($this->
getId())
888 ->deleteCollection();
897 $ilDB = $DIC->database();
901 $set =
$ilDB->query(
"SELECT * FROM exc_assignment " .
902 " WHERE exc_id = " .
$ilDB->quote($a_exc_id,
"integer") .
903 " ORDER BY order_nr");
907 while ($rec =
$ilDB->fetchAssoc($set)) {
909 "id" => (
int) $rec[
"id"],
910 "exc_id" => (
int) $rec[
"exc_id"],
911 "deadline" => (
int) $rec[
"time_stamp"],
912 "deadline2" => (
int) $rec[
"deadline2"],
913 "instruction" => (
string) $rec[
"instruction"],
914 "title" => (
string) $rec[
"title"],
915 "start_time" => (
int) $rec[
"start_time"],
916 "order_val" => $order_val,
917 "mandatory" => (
bool) $rec[
"mandatory"],
918 "type" => (
int) $rec[
"type"],
919 "peer" => (
bool) $rec[
"peer"],
920 "peer_min" => (
int) $rec[
"peer_min"],
921 "peer_dl" => (
int) $rec[
"peer_dl"],
922 "peer_file" => (
bool) $rec[
"peer_file"],
923 "peer_prsl" => (
bool) $rec[
"peer_prsl"],
924 "fb_file" => (
string) $rec[
"fb_file"],
925 "fb_date" => (
int) $rec[
"fb_date"],
926 "fb_cron" => (
bool) $rec[
"fb_cron"],
927 "deadline_mode" => (
int) $rec[
"deadline_mode"],
928 "relative_deadline" => (
int) $rec[
"relative_deadline"],
929 "rel_deadline_last_subm" => (
int) $rec[
"rel_deadline_last_subm"]
946 array $a_crit_cat_map
950 $ass_domain = $DIC->exercise()->internal()->domain()->assignment();
951 $ass_data = self::getInstancesByExercise($a_old_exc_id);
952 foreach ($ass_data as
$d) {
955 $new_ass->setExerciseId($a_new_exc_id);
956 $new_ass->setTitle($d->getTitle());
957 $new_ass->setDeadline($d->getDeadline());
958 $new_ass->setExtendedDeadline($d->getExtendedDeadline());
959 $new_ass->setInstruction($d->getInstruction());
960 $new_ass->setMandatory($d->getMandatory());
961 $new_ass->setOrderNr($d->getOrderNr());
962 $new_ass->setStartTime($d->getStartTime());
963 $new_ass->setType($d->getType());
964 $new_ass->setPeerReview($d->getPeerReview());
965 $new_ass->setPeerReviewMin($d->getPeerReviewMin());
966 $new_ass->setPeerReviewDeadline($d->getPeerReviewDeadline());
967 $new_ass->setPeerReviewFileUpload($d->hasPeerReviewFileUpload());
968 $new_ass->setPeerReviewPersonalized($d->hasPeerReviewPersonalized());
969 $new_ass->setPeerReviewValid($d->getPeerReviewValid());
970 $new_ass->setPeerReviewChars($d->getPeerReviewChars());
971 $new_ass->setPeerReviewText($d->hasPeerReviewText());
972 $new_ass->setPeerReviewRating($d->hasPeerReviewRating());
973 $new_ass->setPeerReviewCriteriaCatalogue($d->getPeerReviewCriteriaCatalogue());
974 $new_ass->setPeerReviewSimpleUnlock($d->getPeerReviewSimpleUnlock());
975 $new_ass->setFeedbackFile($d->getFeedbackFile());
976 $new_ass->setFeedbackDate($d->getFeedbackDate());
977 $new_ass->setFeedbackDateCustom($d->getFeedbackDateCustom());
978 $new_ass->setFeedbackCron($d->hasFeedbackCron());
979 $new_ass->setTeamTutor($d->getTeamTutor());
980 $new_ass->setMaxFile($d->getMaxFile());
981 $new_ass->setMinCharLimit($d->getMinCharLimit());
982 $new_ass->setMaxCharLimit($d->getMaxCharLimit());
983 $new_ass->setPortfolioTemplateId($d->getPortfolioTemplateId());
984 $new_ass->setDeadlineMode($d->getDeadlineMode());
985 $new_ass->setRelativeDeadline($d->getRelativeDeadline());
986 $new_ass->setRelDeadlineLastSubmission($d->getRelDeadlineLastSubmission());
989 if ($d->getPeerReviewCriteriaCatalogue() &&
990 array_key_exists($d->getPeerReviewCriteriaCatalogue(), $a_crit_cat_map)) {
991 $new_ass->setPeerReviewCriteriaCatalogue($a_crit_cat_map[$d->getPeerReviewCriteriaCatalogue()]);
997 $ass_domain->instructionFiles($d->getId())->cloneTo($new_ass->getId());
1000 $ass_domain->sampleSolution($d->getId())->cloneTo($new_ass->getId());
1007 if ($rmd_sub->getReminderStatus()) {
1010 $new_rmd_sub->setReminderStart($rmd_sub->getReminderStart());
1011 $new_rmd_sub->setReminderEnd($rmd_sub->getReminderEnd());
1012 $new_rmd_sub->setReminderFrequency($rmd_sub->getReminderFrequency());
1013 $new_rmd_sub->setReminderMailTemplate($rmd_sub->getReminderMailTemplate());
1014 $new_rmd_sub->save();
1020 $ass_type = $d->getAssignmentType();
1027 return $this->domain->assignment()->instructionFiles($this->
getId())->getFiles();
1036 $set =
$ilDB->query(
1037 "SELECT filename, order_nr, id FROM exc_ass_file_order " .
1038 " WHERE assignment_id = " .
$ilDB->quote($this->getId(),
"integer")
1042 while ($rec =
$ilDB->fetchAssoc($set)) {
1043 $data[$rec[
'filename']] = $rec;
1056 $ilDB = $DIC->database();
1058 $set =
$ilDB->query(
1059 "SELECT MAX(order_nr) mnr FROM exc_assignment " .
1060 " WHERE exc_id = " .
$ilDB->quote($a_exc_id,
"integer")
1062 if ($rec =
$ilDB->fetchAssoc($set)) {
1063 return (
int) $rec[
"mnr"];
1072 $ilDB = $DIC->database();
1074 $query =
"SELECT id FROM exc_assignment " .
1075 "WHERE start_time <= " .
$ilDB->quote(time(),
'integer') .
' ' .
1076 "AND time_stamp >= " .
$ilDB->quote(time(),
'integer') .
' ' .
1077 "AND id = " .
$ilDB->quote($a_ass_id,
'integer');
1080 return (
bool)
$res->numRows();
1087 $ilDB = $DIC->database();
1088 $query =
"SELECT exc_id FROM exc_assignment " .
1089 "WHERE id = " .
$ilDB->quote($a_ass_id,
'integer');
1092 return (
int) (
$res[
"exc_id"] ?? 0);
1095 private static function lookup(
int $a_id,
string $a_field): string
1099 $ilDB = $DIC->database();
1101 $set =
$ilDB->query(
1102 "SELECT " . $a_field .
" FROM exc_assignment " .
1103 " WHERE id = " .
$ilDB->quote($a_id,
"integer")
1106 $rec =
$ilDB->fetchAssoc($set);
1108 return $rec[$a_field] ??
"";
1113 return self::lookup($a_id,
"title");
1118 return (
int) self::lookup($a_id,
"type");
1126 $ilDB = $DIC->database();
1130 foreach ($a_order as $k => $v) {
1133 "UPDATE exc_assignment SET " .
1134 " order_nr = " .
$ilDB->quote($nr,
"integer") .
1135 " WHERE id = " .
$ilDB->quote((
int) $k,
"integer") .
1136 " AND exc_id = " .
$ilDB->quote($a_ex_id,
"integer")
1146 $ilDB = $DIC->database();
1148 $set =
$ilDB->query(
1149 "SELECT id FROM exc_assignment " .
1150 " WHERE exc_id = " .
$ilDB->quote($a_ex_id,
"integer") .
1151 " ORDER BY time_stamp" 1154 while ($rec =
$ilDB->fetchAssoc($set)) {
1156 "UPDATE exc_assignment SET " .
1157 " order_nr = " .
$ilDB->quote($nr,
"integer") .
1158 " WHERE id = " .
$ilDB->quote($rec[
"id"],
"integer")
1169 $ilDB = $DIC->database();
1171 $set =
$ilDB->query(
1172 "SELECT count(*) cntm FROM exc_assignment " .
1173 " WHERE exc_id = " .
$ilDB->quote($a_ex_id,
"integer") .
1174 " AND mandatory = " .
$ilDB->quote(1,
"integer")
1176 $rec =
$ilDB->fetchAssoc($set);
1177 return (
int) $rec[
"cntm"];
1185 $ilDB = $DIC->database();
1187 $set =
$ilDB->query(
1188 "SELECT count(*) cntm FROM exc_assignment " .
1189 " WHERE exc_id = " .
$ilDB->quote($a_ex_id,
"integer")
1191 $rec =
$ilDB->fetchAssoc($set);
1192 return $rec[
"cntm"];
1200 $ilDB = $DIC->database();
1202 $set =
$ilDB->query(
1203 "SELECT * FROM exc_assignment " .
1204 " WHERE exc_id = " .
$ilDB->quote($a_ex_id,
"integer") .
1205 " AND id = " .
$ilDB->quote($a_ass_id,
"integer")
1207 if (
$ilDB->fetchAssoc($set)) {
1220 $set =
$ilDB->query(
"SELECT ud.usr_id, ud.lastname, ud.firstname, ud.login" .
1221 " FROM exc_members excm" .
1222 " JOIN usr_data ud ON (ud.usr_id = excm.usr_id)" .
1223 " WHERE excm.obj_id = " .
$ilDB->quote($this->getExerciseId(),
"integer"));
1224 while ($rec =
$ilDB->fetchAssoc($set)) {
1225 $mem[$rec[
"usr_id"]] =
1227 "name" => $rec[
"lastname"] .
", " . $rec[
"firstname"],
1228 "login" => $rec[
"login"],
1229 "usr_id" => $rec[
"usr_id"],
1230 "lastname" => $rec[
"lastname"],
1231 "firstname" => $rec[
"firstname"]
1238 if (!$this->ass_type->usesTeams()) {
1239 foreach ($idl as $user_id => $v) {
1240 if (!isset($mem[$user_id])) {
1245 "name" => $name[
"lastname"] .
", " . $name[
"firstname"],
1246 "login" => $name[
"login"],
1247 "usr_id" => $user_id,
1248 "lastname" => $name[
"lastname"],
1249 "firstname" => $name[
"firstname"]
1256 $q =
"SELECT * FROM exc_mem_ass_status " .
1257 "WHERE ass_id = " .
$ilDB->quote($this->
getId(),
"integer");
1259 while ($rec =
$ilDB->fetchAssoc($set)) {
1260 if (isset($mem[$rec[
"usr_id"]])) {
1263 $mem[$rec[
"usr_id"]][
"sent_time"] = $rec[
"sent_time"];
1264 $mem[$rec[
"usr_id"]][
"submission"] = $sub->getLastSubmission();
1265 $mem[$rec[
"usr_id"]][
"status_time"] = $rec[
"status_time"];
1266 $mem[$rec[
"usr_id"]][
"feedback_time"] = $rec[
"feedback_time"];
1267 $mem[$rec[
"usr_id"]][
"notice"] = $rec[
"notice"];
1268 $mem[$rec[
"usr_id"]][
"status"] = $rec[
"status"];
1269 $mem[$rec[
"usr_id"]][
"mark"] = $rec[
"mark"];
1270 $mem[$rec[
"usr_id"]][
"comment"] = $rec[
"u_comment"];
1282 string $a_grade =
"" 1285 $ilDB = $DIC->database();
1288 if (in_array($a_grade, array(
"notgraded",
"passed",
"failed"))) {
1289 $and_grade =
" AND status = " .
$ilDB->quote($a_grade,
"text");
1292 $q =
"SELECT * FROM exc_mem_ass_status " .
1293 "WHERE ass_id = " .
$ilDB->quote($this->
getId(),
"integer") .
1294 " AND usr_id = " .
$ilDB->quote($a_user_id,
"integer") .
1300 while ($rec =
$ilDB->fetchAssoc($set)) {
1303 $data[
"sent_time"] = $rec[
"sent_time"];
1304 $data[
"submission"] = $sub->getLastSubmission();
1305 $data[
"status_time"] = $rec[
"status_time"];
1306 $data[
"feedback_time"] = $rec[
"feedback_time"];
1307 $data[
"notice"] = $rec[
"notice"];
1308 $data[
"status"] = $rec[
"status"];
1309 $data[
"mark"] = $rec[
"mark"];
1310 $data[
"comment"] = $rec[
"u_comment"];
1323 $ilDB = $DIC->database();
1324 $ass_domain = $DIC->exercise()->internal()->domain()->assignment();
1326 $ass_data = self::getAssignmentDataOfExercise($a_exc_id);
1327 foreach ($ass_data as $ass) {
1329 $ilDB->replace(
"exc_mem_ass_status", array(
1330 "ass_id" => array(
"integer", $ass[
"id"]),
1331 "usr_id" => array(
"integer", $a_user_id)
1333 "status" => array(
"text",
"notgraded")
1335 if (!$ass_domain->tutorFeedbackFile((
int) $ass[
"id"])->hasCollection($a_user_id)) {
1336 $ass_domain->tutorFeedbackFile((
int) $ass[
"id"])->createCollection($a_user_id);
1348 $ilDB = $DIC->database();
1349 $ass_domain = $DIC->exercise()->internal()->domain()->assignment();
1352 $mems = $exmem->getMembers();
1354 foreach ($mems as $mem) {
1355 $ilDB->replace(
"exc_mem_ass_status", array(
1356 "ass_id" => array(
"integer", $a_ass_id),
1357 "usr_id" => array(
"integer", $mem)
1359 "status" => array(
"text",
"notgraded")
1361 if (!$ass_domain->tutorFeedbackFile($a_ass_id)->hasCollection($mem)) {
1362 $ass_domain->tutorFeedbackFile($a_ass_id)->createCollection($mem);
1378 $dl_id = $this->
getId() .
"0";
1379 $fbdl_id = $this->
getId() .
"1";
1381 $context_ids = array($dl_id, $fbdl_id);
1384 if ($a_event !=
"delete") {
1389 $app->setSubtitle(
"cal_exc_deadline");
1391 $app->setFullday(
false);
1403 $app->setSubtitle(
"cal_exc_peer_review_deadline");
1405 $app->setFullday(
false);
1412 $ilAppEventHandler->raise(
1414 $a_event .
'Assignment',
1417 'obj_id' => $exc->
getId(),
1418 'context_ids' => $context_ids,
1419 'appointments' => $apps)
1428 $log->
debug(
"Get feedback notifications.");
1430 $ilDB = $DIC->database();
1434 $set =
$ilDB->query(
"SELECT id,fb_file,time_stamp,deadline2,fb_date FROM exc_assignment" .
1435 " WHERE fb_cron = " .
$ilDB->quote(1,
"integer") .
1436 " AND (fb_date = " .
$ilDB->quote(self::FEEDBACK_DATE_DEADLINE,
"integer") .
1437 " AND time_stamp IS NOT NULL" .
1438 " AND time_stamp > " .
$ilDB->quote(0,
"integer") .
1439 " AND time_stamp < " .
$ilDB->quote(time(),
"integer") .
1440 " AND fb_cron_done = " .
$ilDB->quote(0,
"integer") .
1441 ") OR (fb_date = " .
$ilDB->quote(self::FEEDBACK_DATE_CUSTOM,
"integer") .
1442 " AND fb_date_custom IS NOT NULL" .
1443 " AND fb_date_custom > " .
$ilDB->quote(0,
"integer") .
1444 " AND fb_date_custom < " .
$ilDB->quote(time(),
"integer") .
1445 " AND fb_cron_done = " .
$ilDB->quote(0,
"integer") .
")");
1449 while ($row =
$ilDB->fetchAssoc($set)) {
1450 $log->
debug(
"check assignment " . $row[
'id'] .
", fb_file " . $row[
"fb_file"]);
1451 if ($row[
'fb_date'] == self::FEEDBACK_DATE_DEADLINE) {
1452 $max = max($row[
'time_stamp'], $row[
'deadline2']);
1453 if (trim($row[
"fb_file"]) && $max <= time()) {
1454 $log->
debug(
"...adding(1)");
1455 $res[] = $row[
"id"];
1457 } elseif ($row[
'fb_date'] == self::FEEDBACK_DATE_CUSTOM) {
1458 if (trim($row[
"fb_file"] ??
"") && ($row[
'fb_date_custom'] ?? 0) <= time()) {
1459 $log->
debug(
"...adding(2)");
1460 $res[] = $row[
"id"];
1473 int $a_user_id = null
1477 $ilDB = $DIC->database();
1480 $ass =
new self($a_ass_id);
1483 if (!$ass->hasFeedbackCron() || !$ass->getFeedbackFile()) {
1484 $log->
debug(
"return(1)");
1490 $set =
$ilDB->query(
"SELECT fb_cron_done" .
1491 " FROM exc_assignment" .
1492 " WHERE id = " .
$ilDB->quote($a_ass_id,
"integer"));
1493 $row =
$ilDB->fetchAssoc($set);
1494 if ($row[
"fb_cron_done"]) {
1495 $log->
debug(
"return(2)");
1501 $ntf->setLangModules(array(
"exc"));
1502 $ntf->setObjId($ass->getExerciseId());
1503 $ntf->setSubjectLangId(
"exc_feedback_notification_subject");
1504 $ntf->setIntroductionLangId(
"exc_feedback_notification_body");
1505 $ntf->addAdditionalInfo(
"exc_assignment", $ass->getTitle());
1506 $ntf->setGotoLangId(
"exc_feedback_notification_link");
1507 $ntf->setReasonLangId(
"exc_feedback_notification_reason");
1513 $ilDB->manipulate(
"UPDATE exc_assignment" .
1514 " SET fb_cron_done = " .
$ilDB->quote(1,
"integer") .
1515 " WHERE id = " .
$ilDB->quote($a_ass_id,
"integer"));
1517 $log->
debug(
"send to user: " . $a_user_id);
1518 $ntf->sendMailAndReturnRecipients(array($a_user_id));
1536 $deadline = max($this->deadline, $this->deadline2, $idl);
1537 return ($deadline - time() <= 0);
1545 $idl = $a_include_personal
1550 $deadline = max($this->deadline, $this->deadline2, $idl);
1554 if ($idl && $deadline == $idl) {
1555 return ($deadline - time() <= 0);
1559 return ($deadline > 0 &&
1573 return ($date_custom - time() <= 0);
1585 return (time() - $this->start_time <= 0);
1596 return $storage->getGlobalFeedbackPath();
1609 $rcid = $this->domain->assignment()->sampleSolution($ass_id)->importFromLegacyUpload($a_file);
1611 return ($rcid !==
"");
1627 return $path .
"/" . $file;
1637 $a_user_id = $ilUser->
getId();
1639 if (!array_key_exists($a_user_id, $this->member_status)) {
1642 return $this->member_status[$a_user_id];
1657 $id = $file[
"returned_id"];
1667 if ($file[
"late"] &&
1670 $uploaded < $deadline)) {
1674 elseif (!$file[
"late"] &&
1677 $uploaded > $deadline) {
1681 if ($late !== null) {
1682 $ilDB->manipulate(
"UPDATE exc_returned" .
1683 " SET late = " .
$ilDB->quote($late,
"integer") .
1684 " WHERE returned_id = " .
$ilDB->quote($id,
"integer"));
1699 if (!is_numeric($id)) {
1700 $id = substr($id, 1);
1715 $set =
$ilDB->query(
"SELECT * FROM exc_idl" .
1716 " WHERE ass_id = " .
$ilDB->quote($this->getId(),
"integer"));
1717 while ($row =
$ilDB->fetchAssoc($set)) {
1718 if ($row[
"is_team"]) {
1719 $row[
"member_id"] =
"t" . $row[
"member_id"];
1722 $res[$row[
"member_id"]] = $row[
"tstamp"];
1734 $set =
$ilDB->query(
"SELECT * FROM exc_idl" .
1735 " WHERE ass_id = " .
$ilDB->quote($this->getId(),
"integer") .
1736 " AND requested = " .
$ilDB->quote(1,
"integer"));
1737 while ($row =
$ilDB->fetchAssoc($set)) {
1738 if ($row[
"is_team"]) {
1739 $row[
"member_id"] =
"t" . $row[
"member_id"];
1742 $res[$row[
"member_id"]] = $row[
"requested"];
1755 if (!$this->ass_type->usesTeams() &&
1759 if ($peer_review->hasPeerReviewGroups()) {
1773 $db = $DIC->database();
1775 asort($a_order, SORT_NUMERIC);
1778 foreach (array_keys($a_order) as $k) {
1781 "UPDATE exc_ass_file_order SET " .
1782 " order_nr = " . $db->
quote($nr,
"integer") .
1783 " WHERE id = " . $db->
quote((
int) $k,
"integer") .
1784 " AND assignment_id = " . $db->
quote($a_ass_id,
"integer")
1796 $db = $DIC->database();
1797 $id = $db->
nextId(
"exc_ass_file_order");
1799 "exc_ass_file_order",
1801 "id" => [
"integer", $id],
1802 "order_nr" => [
"integer", $a_order_nr],
1803 "assignment_id" => [
"integer", $a_ass_id],
1804 "filename" => [
"text", $a_filename]
1817 $db = $DIC->database();
1823 if (self::instructionFileExistsInDb(
$filename, $a_ass_id) == 0) {
1824 if ($a_order_nr == 0) {
1825 $order_val = self::instructionFileOrderGetMax($a_ass_id);
1826 $order = $order_val + 10;
1828 $order = $a_order_nr;
1831 $id = $db->nextID(
'exc_ass_file_order');
1832 $db->
manipulate(
"INSERT INTO exc_ass_file_order " .
1833 "(id, assignment_id, filename, order_nr) VALUES (" .
1834 $db->
quote($id,
"integer") .
"," .
1835 $db->
quote($a_ass_id,
"integer") .
"," .
1837 $db->
quote($order,
"integer") .
1852 $db = $DIC->database();
1855 foreach ($a_file as $v) {
1857 "DELETE FROM exc_ass_file_order " .
1858 "WHERE filename = " . $db->
quote($v,
'text') .
1859 " AND assignment_id = " . $db->
quote($a_ass_id,
'integer')
1871 $db = $DIC->database();
1875 "DELETE FROM exc_ass_file_order" .
1876 " WHERE assignment_id = " . $db->
quote($a_ass_id,
'integer') .
1877 " AND filename = " . $db->
quote($a_new_name,
'text')
1881 "UPDATE exc_ass_file_order SET" .
1882 " filename = " . $db->
quote($a_new_name,
'text') .
1883 " WHERE assignment_id = " . $db->
quote($a_ass_id,
'integer') .
1884 " AND filename = " . $db->
quote($a_old_name,
'text')
1895 $db = $DIC->database();
1898 $result = $db->
query(
1899 "SELECT id FROM exc_ass_file_order" .
1900 " WHERE assignment_id = " . $db->
quote($a_ass_id,
'integer') .
1901 " AND filename = " . $db->
quote($a_filename,
'text')
1914 $files = array_map(
function ($v) {
1918 $set = $db->
query(
"SELECT * FROM exc_ass_file_order " .
1919 " WHERE assignment_id = " . $db->
quote($this->getId(),
"integer") .
1920 " ORDER BY order_nr");
1922 $numbered_files = array();
1925 if (in_array($rec[
"filename"], $files)) {
1927 "UPDATE exc_ass_file_order SET " .
1928 " order_nr = " . $db->
quote($order_nr,
"integer") .
1929 " WHERE assignment_id = " . $db->
quote($this->
getId(),
"integer") .
1930 " AND id = " . $db->
quote($rec[
"id"],
"integer")
1933 $numbered_files[] = $rec[
"filename"];
1936 "DELETE FROM exc_ass_file_order " .
1937 " WHERE assignment_id = " . $db->
quote($this->getId(),
"integer") .
1938 " AND id = " . $db->
quote($rec[
"id"],
"integer")
1942 foreach ($files as
$f) {
1943 if (!in_array($f, $numbered_files)) {
1944 self::instructionFileInsertOrder($f, $this->
getId());
1950 array $a_entries = array()
1955 foreach ($a_entries as $k =>
$e) {
1956 $a_entries[$k][
"order_val"] = $order[
$e[
"file"]][
"order_nr"] ?? 0;
1957 $a_entries[$k][
"order_id"] = $order[$e[
"file"]][
"id"] ??
"";
1967 $db = $DIC->database();
1971 "SELECT max(order_nr) as max_order FROM exc_ass_file_order WHERE assignment_id = %s",
1973 array($db->
quote($a_ass_id,
'integer'))
1978 $order_val = (
int) $row[
'max_order'];
1987 $this->min_char_limit = $a_val;
1998 $this->max_char_limit = $a_val;
2016 $calculated_deadlines = array(
2023 $type = $ts[
"is_team"]
2027 $calculated_deadlines[
$type][$ts[
"member_id"]] = array(
2028 "calculated_deadline" => $ts[
"starting_ts"] + ($this->
getRelativeDeadline() * 24 * 60 * 60)
2032 return $calculated_deadlines;
setStartTime(?int $a_val)
getLastPersonalDeadline()
static cloneAssignmentsOfExercise(int $a_old_exc_id, int $a_new_exc_id, array $a_crit_cat_map)
Clone assignments of exercise.
setRelativeDeadline(int $a_val)
get(int $a_format, string $a_format_str='', string $a_tz='')
get formatted date
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS Refinery String Group $string_transform
const TEAMS_FORMED_BY_RANDOM
getInstructionFilesOrder()
ilAppEventHandler $app_event_handler
static instructionFileOrderGetMax(int $a_ass_id)
const FEEDBACK_DATE_SUBMISSION
getType()
Get type this will most probably become an non public function in the future (or become obsolete) ...
static deleteForAssignment(int $ass_id)
numRows(ilDBStatement $statement)
getInstructionPresentation()
insert(string $table_name, array $values)
static getLogger(string $a_component_id)
Get component logger.
static createNewUserRecords(int $a_user_id, int $a_exc_id)
canParticipantReceiveFeedback(int $part_id)
setMinCharLimit(int $a_val)
setFeedbackFile(?string $a_value)
isValidType(int $a_value)
setPeerReviewValid(int $a_value)
Set peer review validation.
fetchAssoc(ilDBStatement $statement)
setType(int $a_value)
Set type this will most probably become an non public function in the future (or become obsolete) ...
setFeedbackDateCustom(int $a_value)
Set (global) feedback file availability using a custom date.
static getPendingFeedbackNotifications()
static getInstancesByParentId(int $a_parent_id)
handleGlobalFeedbackFileUpload(int $ass_id, array $a_file)
static count(int $a_ex_id)
ilExAssignmentTypes $types
getExerciseMemberAssignmentData(int $a_user_id, string $a_grade="")
Get submission data for an specific user,exercise and assignment.
static createNewAssignmentRecords(int $a_ass_id, ilObjExercise $a_exc)
initFromDB(array $a_set)
Import DB record.
setPeerReviewMin(int $a_value)
getGlobalFeedbackFilePath()
getMemberStatus(?int $a_user_id=null)
static countMandatory(int $a_ex_id)
setPeerReviewFileUpload(bool $a_val)
afterDeadlineStrict(bool $a_include_personal=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static lookupTitle(int $a_id)
static saveAssOrderOfExercise(int $a_ex_id, array $a_order)
static lookupType(int $a_id)
static _lookupName(int $a_user_id)
lookup user name
setDeadlineMode(int $a_val)
Set deadline mode.
setMaxCharLimit(int $a_val)
int $feedback_date_custom
Apointment templates are used for automatic generated apointments.
quote($value, string $type)
setFeedbackCron(bool $a_value)
Toggle (global) feedback file cron.
static orderAssByDeadline(int $a_ex_id)
static getInstanceByType(string $a_type)
recalculateLateSubmissions()
const TYPE_UPLOAD
direct checks against const should be avoided, use type objects instead
const PEER_REVIEW_VALID_ALL
setLimit(int $limit, int $offset=0)
const TEAMS_FORMED_BY_TUTOR
setInstruction(string $a_val)
setExerciseId(int $a_val)
const PEER_REVIEW_VALID_ONE
static getSafeFilename(string $a_initial_filename)
static lookupMaxOrderNrForEx(int $a_exc_id)
setTeamTutor(bool $a_value)
updateAllUsersStatus()
Update status of all users.
static getAssignmentDataOfExercise(int $a_exc_id)
cloneSpecificProperties(ilExAssignment $source, ilExAssignment $target)
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
setPeerReviewRating(bool $a_val)
setExtendedDeadline(?int $a_val)
const DEADLINE_ABSOLUTE_INDIVIDUAL
static instructionFileGetFileOrderData(array $a_file_data, int $a_ass_id)
hasPeerReviewPersonalized()
static renameInstructionFile(string $a_old_name, string $a_new_name, int $a_ass_id)
int $rel_deadline_last_subm
getCalculatedDeadlines()
Get calculated deadlines for user/team members.
nextId(string $table_name)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static raiseContentChanged(int $obj_id)
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static instructionFileExistsInDb(string $a_filename, int $a_ass_id)
getPersonalDeadline(int $a_user_id)
setMandatory(bool $a_val)
setFeedbackDate(int $a_value)
query(string $query)
Run a (read-only) Query on the database.
static getTeamId(int $a_assignment_id, int $a_user_id, bool $a_create_on_demand=false)
setPortfolioTemplateId(int $a_val)
setPeerReviewDeadline(int $a_val)
setRelDeadlineLastSubmission(int $a_val)
static instructionFileDeleteOrder(int $a_ass_id, array $a_file)
static instructionFileInsertOrder(string $a_filename, int $a_ass_id, int $a_order_nr=0)
queryF(string $query, array $types, array $values)
setIndividualDeadline(string $id, ilDateTime $date)
setPeerReviewPersonalized(bool $a_val)
deleteGlobalFeedbackFile()
static insertFileOrderNr(int $a_ass_id, string $a_filename, int $a_order_nr)
static getInstancesByExercise(int $a_exc_id)
static saveInstructionFilesOrderOfAssignment(int $a_ass_id, array $a_order)
const FEEDBACK_DATE_DEADLINE
getRelDeadlineLastSubmission()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const TEAMS_FORMED_BY_PARTICIPANTS
getPeerReviewSimpleUnlock()
setPeerReviewSimpleUnlock(int $a_value)
handleCalendarEntries(string $a_event, ilObjExercise $exc)
Handle calendar entries for deadline(s)
setPeerReviewChars(?int $a_value)
setPeerReviewText(bool $a_val)
const PEER_REVIEW_VALID_NONE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
hasPeerReviewFileUpload()
const FEEDBACK_DATE_CUSTOM
static _getMembers(int $a_obj_id)
static getStartingTimestamps(int $a_ass_id)
Get starting timestamp data for an assignment.
const TEAMS_FORMED_BY_ASSIGNMENT
setMaxFile(?int $a_value)
debug(string $message, array $context=[])
fileAddOrder(array $a_entries=array())
manipulate(string $query)
Run a (write) Query on the database.
static isInExercise(int $a_ass_id, int $a_ex_id)
ilExAssignmentTypeInterface $ass_type
setPeerReview(bool $a_value)
getPeerReviewCriteriaCatalogue()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static lookupAssignmentOnline(int $a_ass_id)
getGlobalFeedbackFileStoragePath()
setReminderStatus(?bool $a_status)
Set reminder for users without submission.
static lookup(int $a_id, string $a_field)
setPeerReviewCriteriaCatalogue(?int $a_value)
static lookupExerciseId(int $a_ass_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getAllAssignmentFiles(int $a_exc_id, int $a_ass_id)
__construct($a_id=0)
Constructor.
ILIAS Exercise InternalDomainService $domain
static sendFeedbackNotifications(int $a_ass_id, int $a_user_id=null)
static getInstance(int $a_ass_id, int $a_participant_id, bool $a_is_team=false)
fixInstructionFileOrdering()