130        $this->db = 
$DIC->database();
 
  131        $this->lng = 
$DIC->language();
 
  132        $this->
user = $DIC->user();
 
  133        $this->app_event_handler = 
$DIC[
"ilAppEventHandler"];
 
  134        include_once(
"./Modules/Exercise/AssignmentTypes/classes/class.ilExAssignmentTypes.php");
 
  137        $this->
setType(self::TYPE_UPLOAD);
 
  154        $set = 
$ilDB->query(
"SELECT * FROM exc_assignment " .
 
  155            " WHERE exc_id = " . 
$ilDB->quote($a_exc_id, 
"integer") .
 
  156            " ORDER BY order_nr ASC");
 
  160        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
  162            $rec[
"order_val"] = $order_val;
 
  165            $ass->initFromDB($rec);
 
  186        $result_order_val = 
$db->query(
" 
  188                                FROM exc_ass_file_order 
  189                                WHERE assignment_id = {$db->quote($a_ass_id, 'integer')} 
  190                                AND filename = {$db->quote($a_file_data['entry'], 'string')} 
  195        while (
$row = 
$db->fetchAssoc($result_order_val)) {
 
  196            $order_val = (int) 
$row[
'order_nr'];
 
  197            $order_id = (int) 
$row[
'id'];
 
  199        return array($order_val, $order_id);
 
  204        return $this->ass_type->usesTeams();
 
  234        $this->exc_id = $a_val;
 
  254        $this->start_time = $a_val;
 
  274        $this->deadline = $a_val;
 
  294        $this->deadline_mode = $a_val;
 
  314        $this->relative_deadline = $a_val;
 
  337        if ($this->ass_type->usesTeams()) {
 
  338            include_once(
"./Modules/Exercise/classes/class.ilExAssignmentTeam.php");
 
  344            $a_user_id = $team_id;
 
  348        $set = 
$ilDB->query(
"SELECT tstamp FROM exc_idl" .
 
  349            " WHERE ass_id = " . 
$ilDB->quote($this->getId(), 
"integer") .
 
  350            " AND member_id = " . 
$ilDB->quote($a_user_id, 
"integer") .
 
  351            " AND is_team = " . 
$ilDB->quote($is_team, 
"integer"));
 
  367        $set = 
$ilDB->query(
"SELECT MAX(tstamp) FROM exc_idl" .
 
  368            " WHERE ass_id = " . 
$ilDB->quote($this->getId(), 
"integer"));
 
  370        return $row[
"tstamp"];
 
  380        if ($a_val !== 
null) {
 
  381            $a_val = (int) $a_val;
 
  383        $this->deadline2 = $a_val;
 
  403        $this->instruction = $a_val;
 
  423        $this->title = $a_val;
 
  443        $this->mandatory = $a_val;
 
  463        $this->order_nr = $a_val;
 
  485            $this->type = (int) $a_value;
 
  487            $this->ass_type = $this->types->getById($a_value);
 
  489            if ($this->ass_type->usesTeams()) {
 
  526        return $this->types->isValidId($a_value);
 
  536        $this->peer = (bool) $a_value;
 
  556        $this->peer_min = (int) $a_value;
 
  576        $this->peer_unlock = (bool) $a_value;
 
  596        $this->peer_dl = $a_val;
 
  616        $this->peer_valid = (int) $a_value;
 
  636        $this->peer_rating = (bool) $a_val;
 
  656        $this->peer_text = (bool) $a_val;
 
  676        $this->peer_file = (bool) $a_val;
 
  696        $this->peer_personal = (bool) $a_val;
 
  716        $a_value = (is_numeric($a_value) && (int) $a_value > 0)
 
  719        $this->peer_char = $a_value;
 
  739        $a_value = is_numeric($a_value)
 
  742        $this->crit_cat = $a_value;
 
  752        return $this->crit_cat;
 
  757        include_once 
"Modules/Exercise/classes/class.ilExcCriteria.php";
 
  759        if ($this->crit_cat) {
 
  764            if ($this->peer_rating) {
 
  768            if ($this->peer_text) {
 
  770                if ($this->peer_char) {
 
  771                    $crit->setMinChars($this->peer_char);
 
  776            if ($this->peer_file) {
 
  791        $this->feedback_file = (string) $a_value;
 
  811        $this->feedback_cron = (string) $a_value;
 
  831        $this->feedback_date = (int) $a_value;
 
  850        $this->feedback_date_custom = $a_value;
 
  869        $this->team_tutor = (bool) $a_value;
 
  889        if ($a_value !== 
null) {
 
  890            $a_value = (int) $a_value;
 
  892        $this->max_file = $a_value;
 
  912        $this->portfolio_template = $a_val;
 
  934            "SELECT * FROM exc_assignment " .
 
  935            " WHERE id = " . 
$ilDB->quote($this->getId(), 
"integer")
 
  937        $rec = 
$ilDB->fetchAssoc($set);
 
  940        if (is_array($rec)) {
 
  953        $this->
setId($a_set[
"id"]);
 
  962        $this->
setType($a_set[
"type"]);
 
 1001        $next_id = 
$ilDB->nextId(
"exc_assignment");
 
 1002        $ilDB->insert(
"exc_assignment", array(
 
 1003            "id" => array(
"integer", $next_id),
 
 1005            "time_stamp" => array(
"integer", $this->
getDeadline()),
 
 1008            "title" => array(
"text", $this->
getTitle()),
 
 1009            "start_time" => array(
"integer", $this->
getStartTime()),
 
 1010            "order_nr" => array(
"integer", $this->
getOrderNr()),
 
 1011            "mandatory" => array(
"integer", $this->
getMandatory()),
 
 1012            "type" => array(
"integer", $this->
getType()),
 
 1028            "team_tutor" => array(
"integer", $this->
getTeamTutor()),
 
 1029            "max_file" => array(
"integer", $this->
getMaxFile()),
 
 1030            "portfolio_template" => array(
"integer", $this->getPortFolioTemplateId()),
 
 1036        $this->
setId($next_id);
 
 1038        $exc->updateAllUsersStatus();
 
 1055            "time_stamp" => array(
"integer", $this->
getDeadline()),
 
 1058            "title" => array(
"text", $this->
getTitle()),
 
 1059            "start_time" => array(
"integer", $this->
getStartTime()),
 
 1060            "order_nr" => array(
"integer", $this->
getOrderNr()),
 
 1061            "mandatory" => array(
"integer", $this->
getMandatory()),
 
 1062            "type" => array(
"integer", $this->
getType()),
 
 1078            "team_tutor" => array(
"integer", $this->
getTeamTutor()),
 
 1079            "max_file" => array(
"integer", $this->
getMaxFile()),
 
 1080            "portfolio_template" => array(
"integer", $this->getPortFolioTemplateId()),
 
 1087            "id" => array(
"integer", $this->
getId()),
 
 1091        $exc->updateAllUsersStatus();
 
 1099    public function delete()
 
 1106            "DELETE FROM exc_assignment WHERE " .
 
 1107            " id = " . 
$ilDB->quote($this->getId(), 
"integer")
 
 1110        $exc->updateAllUsersStatus();
 
 1115        $reminder->deleteReminders($this->
getId());
 
 1130        $set = 
$ilDB->query(
"SELECT * FROM exc_assignment " .
 
 1131            " WHERE exc_id = " . 
$ilDB->quote($a_exc_id, 
"integer") .
 
 1132            " ORDER BY order_nr ASC");
 
 1136        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
 1139                "exc_id" => $rec[
"exc_id"],
 
 1140                "deadline" => $rec[
"time_stamp"],
 
 1141                "deadline2" => $rec[
"deadline2"],
 
 1142                "instruction" => $rec[
"instruction"],
 
 1143                "title" => $rec[
"title"],
 
 1144                "start_time" => $rec[
"start_time"],
 
 1145                "order_val" => $order_val,
 
 1146                "mandatory" => $rec[
"mandatory"],
 
 1147                "type" => $rec[
"type"],
 
 1148                "peer" => $rec[
"peer"],
 
 1149                "peer_min" => $rec[
"peer_min"],
 
 1150                "peer_dl" => $rec[
"peer_dl"],
 
 1151                "peer_file" => $rec[
"peer_file"],
 
 1152                "peer_prsl" => $rec[
"peer_prsl"],
 
 1153                "fb_file" => $rec[
"fb_file"],
 
 1154                "fb_date" => $rec[
"fb_date"],
 
 1155                "fb_cron" => $rec[
"fb_cron"],
 
 1156                "deadline_mode" => $rec[
"deadline_mode"],
 
 1157                "relative_deadline" => $rec[
"relative_deadline"]
 
 1172        foreach ($ass_data as 
$d) {
 
 1175            $new_ass->setExerciseId($a_new_exc_id);
 
 1176            $new_ass->setTitle(
$d->getTitle());
 
 1177            $new_ass->setDeadline(
$d->getDeadline());
 
 1178            $new_ass->setExtendedDeadline(
$d->getExtendedDeadline());
 
 1179            $new_ass->setInstruction(
$d->getInstruction());
 
 1180            $new_ass->setMandatory(
$d->getMandatory());
 
 1181            $new_ass->setOrderNr(
$d->getOrderNr());
 
 1182            $new_ass->setStartTime(
$d->getStartTime());
 
 1183            $new_ass->setType(
$d->getType());
 
 1184            $new_ass->setPeerReview(
$d->getPeerReview());
 
 1185            $new_ass->setPeerReviewMin(
$d->getPeerReviewMin());
 
 1186            $new_ass->setPeerReviewDeadline(
$d->getPeerReviewDeadline());
 
 1187            $new_ass->setPeerReviewFileUpload(
$d->hasPeerReviewFileUpload());
 
 1188            $new_ass->setPeerReviewPersonalized(
$d->hasPeerReviewPersonalized());
 
 1189            $new_ass->setPeerReviewValid(
$d->getPeerReviewValid());
 
 1190            $new_ass->setPeerReviewChars(
$d->getPeerReviewChars());
 
 1191            $new_ass->setPeerReviewText(
$d->hasPeerReviewText());
 
 1192            $new_ass->setPeerReviewRating(
$d->hasPeerReviewRating());
 
 1193            $new_ass->setPeerReviewCriteriaCatalogue(
$d->getPeerReviewCriteriaCatalogue());
 
 1194            $new_ass->setPeerReviewSimpleUnlock(
$d->getPeerReviewSimpleUnlock());
 
 1195            $new_ass->setFeedbackFile(
$d->getFeedbackFile());
 
 1196            $new_ass->setFeedbackDate(
$d->getFeedbackDate());
 
 1197            $new_ass->setFeedbackDateCustom(
$d->getFeedbackDateCustom());
 
 1198            $new_ass->setFeedbackCron(
$d->hasFeedbackCron()); 
 
 1199            $new_ass->setTeamTutor(
$d->getTeamTutor());
 
 1200            $new_ass->setMaxFile(
$d->getMaxFile());
 
 1201            $new_ass->setMinCharLimit(
$d->getMinCharLimit());
 
 1202            $new_ass->setMaxCharLimit(
$d->getMaxCharLimit());
 
 1203            $new_ass->setPortfolioTemplateId(
$d->getPortfolioTemplateId());
 
 1204            $new_ass->setDeadlineMode(
$d->getDeadlineMode());
 
 1205            $new_ass->setRelativeDeadline(
$d->getRelativeDeadline());
 
 1208            if (
$d->getPeerReviewCriteriaCatalogue() &&
 
 1209                array_key_exists(
$d->getPeerReviewCriteriaCatalogue(), $a_crit_cat_map)) {
 
 1210                $new_ass->setPeerReviewCriteriaCatalogue($a_crit_cat_map[
$d->getPeerReviewCriteriaCatalogue()]);
 
 1217            include_once(
"./Modules/Exercise/classes/class.ilFSWebStorageExercise.php");
 
 1220            $new_web_storage->create();
 
 1221            if (is_dir($old_web_storage->getPath())) {
 
 1222                ilUtil::rCopy($old_web_storage->getPath(), $new_web_storage->getPath());
 
 1226            include_once(
"./Modules/Exercise/classes/class.ilFSStorageExercise.php");
 
 1229            $new_storage->create();
 
 1230            if (is_dir($old_storage->getGlobalFeedbackPath())) {
 
 1231                ilUtil::rCopy($old_storage->getGlobalFeedbackPath(), $new_storage->getGlobalFeedbackPath());
 
 1239                if ($rmd_sub->getReminderStatus()) {
 
 1241                    $new_rmd_sub->setReminderStatus($rmd_sub->getReminderStatus());
 
 1242                    $new_rmd_sub->setReminderStart($rmd_sub->getReminderStart());
 
 1243                    $new_rmd_sub->setReminderEnd($rmd_sub->getReminderEnd());
 
 1244                    $new_rmd_sub->setReminderFrequency($rmd_sub->getReminderFrequency());
 
 1245                    $new_rmd_sub->setReminderMailTemplate($rmd_sub->getReminderMailTemplate());
 
 1246                    $new_rmd_sub->save();
 
 1262        $this->log->debug(
"getting files from class.ilExAssignment using ilFSWebStorageExercise");
 
 1263        include_once(
"./Modules/Exercise/classes/class.ilFSWebStorageExercise.php");
 
 1265        return $storage->getFiles();
 
 1276        $set = 
$ilDB->query(
 
 1277            "SELECT filename, order_nr, id FROM exc_ass_file_order " .
 
 1278            " WHERE assignment_id  = " . 
$ilDB->quote($this->getId(), 
"integer")
 
 1282        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
 1283            $data[$rec[
'filename']] = $rec;
 
 1298        $set = 
$ilDB->query(
 
 1299            "SELECT MAX(order_nr) mnr FROM exc_assignment " .
 
 1300            " WHERE exc_id = " . 
$ilDB->quote($a_exc_id, 
"integer")
 
 1302        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
 1303            return (
int) $rec[
"mnr"];
 
 1319        $query = 
"SELECT id FROM exc_assignment " .
 
 1320            "WHERE start_time <= " . 
$ilDB->quote(time(), 
'integer') . 
' ' .
 
 1321            "AND time_stamp >= " . 
$ilDB->quote(time(), 
'integer') . 
' ' .
 
 1322            "AND id = " . 
$ilDB->quote($a_ass_id, 
'integer');
 
 1325        return $res->numRows() ? true : 
false;
 
 1340        $query = 
"SELECT exc_id FROM exc_assignment " .
 
 1341            "WHERE id = " . 
$ilDB->quote($a_ass_id, 
'integer');
 
 1344        return (
int) 
$res[
"exc_id"];
 
 1350    private static function lookup($a_id, $a_field)
 
 1356        $set = 
$ilDB->query(
 
 1357            "SELECT " . $a_field . 
" FROM exc_assignment " .
 
 1358            " WHERE id = " . 
$ilDB->quote($a_id, 
"integer")
 
 1361        $rec = 
$ilDB->fetchAssoc($set);
 
 1363        return $rec[$a_field];
 
 1391        $result_order = array();
 
 1394        foreach ($a_order as $k => $v) {
 
 1397                $t = 
"UPDATE exc_assignment SET " .
 
 1398                " order_nr = " . 
$ilDB->quote($nr, 
"integer") .
 
 1399                " WHERE id = " . 
$ilDB->quote((
int) $k, 
"integer") .
 
 1400                " AND exc_id = " . 
$ilDB->quote((
int) $a_ex_id, 
"integer")
 
 1415        $set = 
$ilDB->query(
 
 1416            "SELECT id FROM exc_assignment " .
 
 1417            " WHERE exc_id = " . 
$ilDB->quote($a_ex_id, 
"integer") .
 
 1418            " ORDER BY time_stamp ASC" 
 1421        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
 1423                "UPDATE exc_assignment SET " .
 
 1424                " order_nr = " . 
$ilDB->quote($nr, 
"integer") .
 
 1425                " WHERE id = " . 
$ilDB->quote($rec[
"id"], 
"integer")
 
 1440        $set = 
$ilDB->query(
 
 1441            "SELECT count(*) cntm FROM exc_assignment " .
 
 1442            " WHERE exc_id = " . 
$ilDB->quote($a_ex_id, 
"integer") .
 
 1443            " AND mandatory = " . 
$ilDB->quote(1, 
"integer")
 
 1445        $rec = 
$ilDB->fetchAssoc($set);
 
 1446        return $rec[
"cntm"];
 
 1462        $user_ids = self::getTeamMembersByAssignmentId($ass_id, $member_id);
 
 1464            $user_ids = array($member_id);
 
 1467        $q = 
"SELECT exc_mem_ass_status.status_time, exc_returned.ts " .
 
 1468            "FROM exc_mem_ass_status, exc_returned " .
 
 1469            "WHERE exc_mem_ass_status.status_time < exc_returned.ts " .
 
 1470            "AND NOT exc_mem_ass_status.status_time IS NULL " .
 
 1471            "AND exc_returned.ass_id = exc_mem_ass_status.ass_id " .
 
 1472            "AND exc_returned.user_id = exc_mem_ass_status.usr_id " .
 
 1473            "AND exc_returned.ass_id=" . 
$ilDB->quote($ass_id, 
"integer") .
 
 1474            " AND " . 
$ilDB->in(
"exc_returned.user_id", $user_ids, 
"", 
"integer");
 
 1476        $usr_set = 
$ilDB->query($q);
 
 1478        $array = 
$ilDB->fetchAssoc($usr_set);
 
 1480        if (count($array) == 0) {
 
 1497        $set = 
$ilDB->query(
"SELECT ud.usr_id, ud.lastname, ud.firstname, ud.login" .
 
 1498            " FROM exc_members excm" .
 
 1499            " JOIN usr_data ud ON (ud.usr_id = excm.usr_id)" .
 
 1500            " WHERE excm.obj_id = " . 
$ilDB->quote($this->getExerciseId(), 
"integer"));
 
 1501        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
 1502            $mem[$rec[
"usr_id"]] =
 
 1504                "name" => $rec[
"lastname"] . 
", " . $rec[
"firstname"],
 
 1505                "login" => $rec[
"login"],
 
 1506                "usr_id" => $rec[
"usr_id"],
 
 1507                "lastname" => $rec[
"lastname"],
 
 1508                "firstname" => $rec[
"firstname"]
 
 1512        include_once 
"Modules/Exercise/classes/class.ilExSubmission.php";
 
 1514        $q = 
"SELECT * FROM exc_mem_ass_status " .
 
 1515            "WHERE ass_id = " . 
$ilDB->quote($this->
getId(), 
"integer");
 
 1516        $set = 
$ilDB->query($q);
 
 1517        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
 1518            if (isset($mem[$rec[
"usr_id"]])) {
 
 1521                $mem[$rec[
"usr_id"]][
"sent_time"] = $rec[
"sent_time"];
 
 1522                $mem[$rec[
"usr_id"]][
"submission"] = $sub->getLastSubmission();
 
 1523                $mem[$rec[
"usr_id"]][
"status_time"] = $rec[
"status_time"];
 
 1524                $mem[$rec[
"usr_id"]][
"feedback_time"] = $rec[
"feedback_time"];
 
 1525                $mem[$rec[
"usr_id"]][
"notice"] = $rec[
"notice"];
 
 1526                $mem[$rec[
"usr_id"]][
"status"] = $rec[
"status"];
 
 1527                $mem[$rec[
"usr_id"]][
"mark"] = $rec[
"mark"];
 
 1528                $mem[$rec[
"usr_id"]][
"comment"] = $rec[
"u_comment"];
 
 1546        include_once 
"Modules/Exercise/classes/class.ilExSubmission.php";
 
 1548        if (in_array($a_grade, array(
"notgraded", 
"passed", 
"failed"))) {
 
 1549            $and_grade = 
" AND status = " . 
$ilDB->quote($a_grade, 
"text");
 
 1552        $q = 
"SELECT * FROM exc_mem_ass_status " .
 
 1553            "WHERE ass_id = " . 
$ilDB->quote($this->
getId(), 
"integer") .
 
 1554            " AND usr_id = " . 
$ilDB->quote($a_user_id, 
"integer") .
 
 1557        $set = 
$ilDB->query($q);
 
 1559        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
 1562            $data[
"sent_time"] = $rec[
"sent_time"];
 
 1563            $data[
"submission"] = $sub->getLastSubmission();
 
 1564            $data[
"status_time"] = $rec[
"status_time"];
 
 1565            $data[
"feedback_time"] = $rec[
"feedback_time"];
 
 1566            $data[
"notice"] = $rec[
"notice"];
 
 1567            $data[
"status"] = $rec[
"status"];
 
 1568            $data[
"mark"] = $rec[
"mark"];
 
 1569            $data[
"comment"] = $rec[
"u_comment"];
 
 1585        foreach ($ass_data as $ass) {
 
 1587            $ilDB->replace(
"exc_mem_ass_status", array(
 
 1588                "ass_id" => array(
"integer", $ass[
"id"]),
 
 1589                "usr_id" => array(
"integer", $a_user_id)
 
 1591                "status" => array(
"text", 
"notgraded")
 
 1605        include_once(
"./Modules/Exercise/classes/class.ilExerciseMembers.php");
 
 1607        $mems = $exmem->getMembers();
 
 1609        foreach ($mems as $mem) {
 
 1610            $ilDB->replace(
"exc_mem_ass_status", array(
 
 1611                "ass_id" => array(
"integer", $a_ass_id),
 
 1612                "usr_id" => array(
"integer", $mem)
 
 1614                "status" => array(
"text", 
"notgraded")
 
 1626        include_once(
"./Modules/Exercise/classes/class.ilFSWebStorageExercise.php");
 
 1629        $storage->uploadAssignmentFiles($a_files);
 
 1646        $deliverFilename = trim(str_replace(
" ", 
"_", $this->
getTitle() . 
"_" . $this->
getId()));
 
 1648        $deliverFilename = 
"multi_feedback_" . $deliverFilename;
 
 1657        $mfdir = $tmpdir . 
"/" . $deliverFilename;
 
 1661        include_once(
"./Modules/Exercise/classes/class.ilExerciseMembers.php");
 
 1663        $mems = $exmem->getMembers();
 
 1665        $mems = 
$DIC->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
 
 1666            'edit_submissions_grades',
 
 1667            'edit_submissions_grades',
 
 1671        foreach ($mems as $mem) {
 
 1673            $subdir = 
$name[
"lastname"] . 
"_" . 
$name[
"firstname"] . 
"_" . 
$name[
"login"] . 
"_" . 
$name[
"user_id"];
 
 1680        $tmpzipfile = $tmpdir . 
"/multi_feedback.zip";
 
 1699        include_once(
"./Modules/Exercise/exceptions/class.ilExerciseException.php");
 
 1700        if (!is_file($a_file[
"tmp_name"])) {
 
 1704        include_once(
"./Modules/Exercise/classes/class.ilFSStorageExercise.php");
 
 1706        $mfu = $storage->getMultiFeedbackUploadPath(
$ilUser->getId());
 
 1708        ilUtil::moveUploadedFile($a_file[
"tmp_name"], 
"multi_feedback.zip", $mfu . 
"/" . 
"multi_feedback.zip");
 
 1711        $subdir = 
"notfound";
 
 1712        foreach ($subdirs as 
$s => $j) {
 
 1713            if ($j[
"type"] == 
"dir" && substr(
$s, 0, 14) == 
"multi_feedback") {
 
 1718        if (!is_dir($mfu . 
"/" . $subdir)) {
 
 1735        if ($a_user_id == 0) {
 
 1736            $a_user_id = 
$ilUser->getId();
 
 1739        $mf_files = array();
 
 1743        include_once(
"./Modules/Exercise/classes/class.ilExerciseMembers.php");
 
 1745        $mems = $exmem->getMembers();
 
 1748        include_once(
"./Modules/Exercise/classes/class.ilFSStorageExercise.php");
 
 1750        $mfu = $storage->getMultiFeedbackUploadPath(
$ilUser->getId());
 
 1754        $subdir = 
"notfound";
 
 1755        foreach ($subdirs as 
$s => $j) {
 
 1756            if ($j[
"type"] == 
"dir" && substr(
$s, 0, 14) == 
"multi_feedback") {
 
 1762        foreach ($items as $k => 
$i) {
 
 1764            if (
$i[
"type"] == 
"dir" && !in_array($k, array(
".", 
".."))) {
 
 1766                $parts = explode(
"_", 
$i[
"entry"]);
 
 1767                $user_id = (int) $parts[count($parts) - 1];
 
 1768                if (in_array($user_id, $mems)) {
 
 1774                        if (
$f[
"type"] == 
"file" && substr($k2, 0, 1) != 
".") {
 
 1775                            $mf_files[] = array(
 
 1776                                "lastname" => 
$name[
"lastname"],
 
 1777                                "firstname" => 
$name[
"firstname"],
 
 1778                                "login" => 
$name[
"login"],
 
 1779                                "user_id" => 
$name[
"user_id"],
 
 1780                                "full_path" => $mfu . 
"/" . $subdir . 
"/" . $k . 
"/" . $k2,
 
 1801        include_once(
"./Modules/Exercise/classes/class.ilFSStorageExercise.php");
 
 1803        $mfu = $storage->getMultiFeedbackUploadPath(
$ilUser->getId());
 
 1819        include_once(
"./Modules/Exercise/classes/class.ilFSStorageExercise.php");
 
 1821        $fstorage->create();
 
 1823        $team_map = array();
 
 1826        foreach ($mf_files as 
$f) {
 
 1827            $user_id = 
$f[
"user_id"];
 
 1828            $file_path = 
$f[
"full_path"];
 
 1829            $file_name = 
$f[
"file"];
 
 1832            if ($a_files[$user_id][md5($file_name)] != 
"") {
 
 1834                $feedback_id = $submission->getFeedbackId();
 
 1835                $noti_rec_ids = $submission->getUserIds();
 
 1838                    $fb_path = $fstorage->getFeedbackPath($feedback_id);
 
 1839                    $target = $fb_path . 
"/" . $file_name;
 
 1846                    if ($noti_rec_ids) {
 
 1847                        foreach ($noti_rec_ids as $user_id) {
 
 1856                            (
int) $this->
getId()
 
 1878        $dl_id = $this->
getId() . 
"0";
 
 1879        $fbdl_id = $this->
getId() . 
"1";
 
 1881        $context_ids = array($dl_id, $fbdl_id);
 
 1884        if ($a_event != 
"delete") {
 
 1885            include_once 
"Services/Calendar/classes/class.ilCalendarAppointmentTemplate.php";
 
 1891                $app->setSubtitle(
"cal_exc_deadline");
 
 1893                $app->setFullday(
false);
 
 1905                $app->setSubtitle(
"cal_exc_peer_review_deadline");
 
 1907                $app->setFullday(
false);
 
 1914        include_once 
"Modules/Exercise/classes/class.ilObjExercise.php";
 
 1917        $ilAppEventHandler->raise(
 
 1919            $a_event . 
'Assignment',
 
 1922            'obj_id' => $exc->getId(),
 
 1923            'context_ids' => $context_ids,
 
 1924            'appointments' => $apps)
 
 1937        $set = 
$ilDB->query(
"SELECT id,fb_file,time_stamp,deadline2,fb_date FROM exc_assignment" .
 
 1938            " WHERE fb_cron = " . 
$ilDB->quote(1, 
"integer") .
 
 1939            " AND (fb_date = " . 
$ilDB->quote(self::FEEDBACK_DATE_DEADLINE, 
"integer") .
 
 1940                " AND time_stamp IS NOT NULL" .
 
 1941                " AND time_stamp > " . 
$ilDB->quote(0, 
"integer") .
 
 1942                " AND time_stamp < " . 
$ilDB->quote(time(), 
"integer") .
 
 1943                " AND fb_cron_done = " . 
$ilDB->quote(0, 
"integer") .
 
 1944            ") OR (fb_date = " . 
$ilDB->quote(self::FEEDBACK_DATE_CUSTOM, 
"integer") .
 
 1945                " AND fb_date_custom IS NOT NULL" .
 
 1946                " AND fb_date_custom > " . 
$ilDB->quote(0, 
"integer") .
 
 1947                " AND fb_date_custom < " . 
$ilDB->quote(time(), 
"integer") .
 
 1948                " AND fb_cron_done = " . 
$ilDB->quote(0, 
"integer") . 
")");
 
 1952        while (
$row = 
$ilDB->fetchAssoc($set)) {
 
 1953            if (
$row[
'fb_date'] == self::FEEDBACK_DATE_DEADLINE) {
 
 1954                $max = max(
$row[
'time_stamp'], 
$row[
'deadline2']);
 
 1955                if (trim(
$row[
"fb_file"]) && $max <= time()) {
 
 1958            } elseif (
$row[
'fb_date'] == self::FEEDBACK_DATE_CUSTOM) {
 
 1959                if (trim(
$row[
"fb_file"]) && 
$row[
'fb_date_custom'] <= time()) {
 
 1974        $ass = 
new self($a_ass_id);
 
 1977        if (!$ass->hasFeedbackCron() || !$ass->getFeedbackFile()) {
 
 1983            $set = 
$ilDB->query(
"SELECT fb_cron_done" .
 
 1984                " FROM exc_assignment" .
 
 1985                " WHERE id = " . 
$ilDB->quote($a_ass_id, 
"integer"));
 
 1987            if (
$row[
"fb_cron_done"]) {
 
 1992        include_once 
"./Services/Notification/classes/class.ilSystemNotification.php";
 
 1994        $ntf->setLangModules(array(
"exc"));
 
 1995        $ntf->setObjId($ass->getExerciseId());
 
 1996        $ntf->setSubjectLangId(
"exc_feedback_notification_subject");
 
 1997        $ntf->setIntroductionLangId(
"exc_feedback_notification_body");
 
 1998        $ntf->addAdditionalInfo(
"exc_assignment", $ass->getTitle());
 
 1999        $ntf->setGotoLangId(
"exc_feedback_notification_link");
 
 2000        $ntf->setReasonLangId(
"exc_feedback_notification_reason");
 
 2003            include_once 
"./Modules/Exercise/classes/class.ilExerciseMembers.php";
 
 2006            $ilDB->manipulate(
"UPDATE exc_assignment" .
 
 2007                " SET fb_cron_done = " . 
$ilDB->quote(1, 
"integer") .
 
 2008                " WHERE id = " . 
$ilDB->quote($a_ass_id, 
"integer"));
 
 2010            $ntf->sendMail(array($a_user_id));
 
 2027        $deadline = max($this->deadline, $this->deadline2, $idl);       
 
 2036        $idl = (bool) $a_include_personal
 
 2041        $deadline = max($this->deadline, $this->deadline2, $idl);
 
 2062        return ($date_custom - time() <= 0);
 
 2073        return (time() - $this->start_time <= 0);
 
 2083        include_once(
"./Modules/Exercise/classes/class.ilFSStorageExercise.php");
 
 2085        return $storage->getGlobalFeedbackPath();
 
 2097        if (ilUtil::moveUploadedFile($a_file[
"tmp_name"], $a_file[
"name"], 
$path . 
"/" . $a_file[
"name"])) {
 
 2109            return $path . 
"/" . $file;
 
 2122            $a_user_id = 
$ilUser->getId();
 
 2124        if (!array_key_exists($a_user_id, $this->member_status)) {
 
 2125            include_once 
"Modules/Exercise/classes/class.ilExAssignmentMemberStatus.php";
 
 2128        return $this->member_status[$a_user_id];
 
 2139        include_once 
"Modules/Exercise/classes/class.ilExSubmission.php";
 
 2141            $id = $file[
"returned_id"];
 
 2151            if ($file[
"late"] &&
 
 2158            elseif (!$file[
"late"] &&
 
 2163            } elseif ($last_deadline && $uploaded > $last_deadline) {
 
 2167            if ($late !== 
null) {
 
 2168                $ilDB->manipulate(
"UPDATE exc_returned" .
 
 2169                    " SET late = " . 
$ilDB->quote($late, 
"integer") .
 
 2170                    " WHERE returned_id = " . 
$ilDB->quote(
$id, 
"integer"));
 
 2185        if (!is_numeric(
$id)) {
 
 2190        include_once(
"./Modules/Exercise/classes/class.ilExcIndividualDeadline.php");
 
 2214        $set = 
$ilDB->query(
"SELECT * FROM exc_idl" .
 
 2215            " WHERE ass_id = " . 
$ilDB->quote($this->getId(), 
"integer"));
 
 2216        while (
$row = 
$ilDB->fetchAssoc($set)) {
 
 2217            if (
$row[
"is_team"]) {
 
 2218                $row[
"member_id"] = 
"t" . 
$row[
"member_id"];
 
 2234        if (!$this->ass_type->usesTeams() &&
 
 2235            $this->getPeerReview()) {
 
 2237            include_once 
"Modules/Exercise/classes/class.ilExPeerReview.php";
 
 2239            if ($peer_review->hasPeerReviewGroups()) {
 
 2258        asort($a_order, SORT_NUMERIC);
 
 2261        foreach ($a_order as $k => $v) {
 
 2264                $t = 
"UPDATE exc_ass_file_order SET " .
 
 2265                " order_nr = " . 
$db->quote($nr, 
"integer") .
 
 2266                " WHERE id = " . 
$db->quote((
int) $k, 
"integer") .
 
 2267                " AND assignment_id = " . 
$db->quote((
int) $a_ass_id, 
"integer")
 
 2291            if (!self::instructionFileExistsInDb(
$filename, $a_ass_id)) {
 
 2292                if ($a_order_nr == 0) {
 
 2294                    $order = $order_val + 10;
 
 2296                    $order = $a_order_nr;
 
 2299                $id = 
$db->nextID(
'exc_ass_file_order');
 
 2300                $db->manipulate(
"INSERT INTO exc_ass_file_order " .
 
 2301                    "(id, assignment_id, filename, order_nr) VALUES (" .
 
 2302                    $db->quote(
$id, 
"integer") . 
"," .
 
 2303                    $db->quote($a_ass_id, 
"integer") . 
"," .
 
 2305                    $db->quote($order, 
"integer") .
 
 2318        foreach ($a_file as $k => $v) {
 
 2320                "DELETE FROM exc_ass_file_order " .
 
 2322                "WHERE filename = " . 
$db->quote($v, 
"string") .
 
 2323                " AND assignment_id = " . 
$db->quote($a_ass_id, 
'integer')
 
 2341                "DELETE FROM exc_ass_file_order" .
 
 2342                " WHERE assignment_id = " . 
$db->quote((
int) $a_ass_id, 
'integer') .
 
 2343                " AND filename = " . 
$db->quote($a_new_name, 
'string')
 
 2347                "UPDATE exc_ass_file_order SET" .
 
 2348                " filename = " . 
$db->quote($a_new_name, 
'string') .
 
 2349                " WHERE assignment_id = " . 
$db->quote((
int) $a_ass_id, 
'integer') .
 
 2350                " AND filename = " . 
$db->quote($a_old_name, 
'string')
 
 2368                "SELECT id FROM exc_ass_file_order" .
 
 2369                " WHERE assignment_id = " . 
$db->quote((
int) $a_ass_id, 
'integer') .
 
 2370                " AND filename = " . 
$db->quote($a_filename, 
'string')
 
 2383        $files = array_map(
function ($v) {
 
 2387        $set = 
$db->query(
"SELECT * FROM exc_ass_file_order " .
 
 2388            " WHERE assignment_id = " . 
$db->quote($this->getId(), 
"integer") .
 
 2389            " ORDER BY order_nr");
 
 2391        $numbered_files = array();
 
 2392        while ($rec = 
$db->fetchAssoc($set)) {
 
 2394            if (in_array($rec[
"filename"], 
$files)) {
 
 2396                    "UPDATE exc_ass_file_order SET " .
 
 2398                    " WHERE assignment_id = " . 
$db->quote($this->getId(), 
"integer") .
 
 2399                    " AND id = " . 
$db->quote($rec[
"id"], 
"integer")
 
 2402                $numbered_files[] = $rec[
"filename"];
 
 2405                    "DELETE FROM exc_ass_file_order " .
 
 2406                    " WHERE assignment_id = " . 
$db->quote($this->getId(), 
"integer") .
 
 2407                    " AND id = " . 
$db->quote($rec[
"id"], 
"integer")
 
 2412            if (!in_array(
$f, $numbered_files)) {
 
 2428        foreach ($a_entries as $k => $e) {
 
 2429            $a_entries[$k][
"order_val"] = $order[$e[
"file"]][
"order_nr"];
 
 2430            $a_entries[$k][
"order_id"] = $order[$e[
"file"]][
"id"];
 
 2448            "SELECT max(order_nr) as max_order FROM exc_ass_file_order WHERE assignment_id = %s",
 
 2450            array(
$db->quote($a_ass_id, 
'integer'))
 
 2454            $order_val = (int) 
$row[
'max_order'];
 
 2467        $this->min_char_limit = $a_val;
 
 2486        $this->max_char_limit = $a_val;
 
 2507        $calculated_deadlines = array(
 
 2513            include_once(
"./Modules/Exercise/classes/class.ilExcIndividualDeadline.php");
 
 2515                $type = $ts[
"is_team"]
 
 2519                $calculated_deadlines[
$type][$ts[
"member_id"]] = array(
 
 2520                    "calculated_deadline" => $ts[
"starting_ts"] + ($this->
getRelativeDeadline() * 24 * 60 * 60)
 
 2524        return $calculated_deadlines;
 
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_TRANSLATION_SYSTEM
Apointment templates are used for automatic generated apointments.
@classDescription Date and time handling
get($a_format, $a_format_str='', $a_tz='')
get formatted date
Exercise assignment member status.
TODO: import/export reminder data with the exercise/assignment.
static getTeamId($a_assignment_id, $a_user_id, $a_create_on_demand=false)
Get team id for member id.
static getInstance()
Get instance.
getExerciseMemberAssignmentData($a_user_id, $a_grade="")
Get submission data for an specific user,exercise and assignment.
getRelativeDeadline()
Get relative deadline.
getMinCharLimit()
Get limit minimum characters.
static orderAssByDeadline($a_ex_id)
Order assignments by deadline date.
getPersonalDeadline($a_user_id)
Get individual deadline (max of common or idl (team) deadline = Official Deadline)
deleteGlobalFeedbackFile()
hasPeerReviewText()
Get peer review text status.
afterDeadlineStrict($a_include_personal=true)
getPeerReviewChars()
Get peer review minimum characters.
hasPeerReviewPersonalized()
Get peer review personalized status.
setDeadline($a_val)
Set deadline (timestamp)
static lookupMaxOrderNrForEx($a_exc_id)
Select the maximum order nr for an exercise.
static instructionFileInsertOrder($a_filename, $a_ass_id, $a_order_nr=0)
Store the file order in the database.
setOrderNr($a_val)
Set order nr.
clearMultiFeedbackDirectory()
Clear multi feedback directory.
getLastPersonalDeadline()
Get last/final personal deadline (of assignment)
setPeerReviewRating($a_val)
Set peer review rating.
setPeerReview($a_value)
Toggle peer review.
setPortfolioTemplateId($a_val)
Set portfolio template id.
getFeedbackDate()
Get (global) feedback file availability date.
getPeerReviewValid()
Get peer review validatiob.
fixInstructionFileOrdering()
getMemberListData()
get member list data
getMultiFeedbackFiles($a_user_id=0)
Get multi feedback files (of uploader)
getExerciseId()
Get exercise id.
getFeedbackDateCustom()
Get feedback file availability using custom date.
static saveInstructionFilesOrderOfAssignment($a_ass_id, $a_order)
Save ordering of instruction files for an assignment.
const TEAMS_FORMED_BY_TUTOR
static lookup($a_id, $a_field)
Private lookup.
setTeamTutor($a_value)
Set team management by tutor.
setFeedbackCron($a_value)
Toggle (global) feedback file cron.
setTitle($a_val)
Set title.
fileAddOrder($a_entries=array())
uploadMultiFeedbackFile($a_file)
Upload multi feedback file.
handleCalendarEntries($a_event)
Handle calendar entries for deadline(s)
static renameInstructionFile($a_old_name, $a_new_name, $a_ass_id)
getId()
Get assignment id.
getInstruction()
Get instruction.
setFeedbackDateCustom($a_value)
Set (global) feedback file availability using a custom date.
getInstructionFilesOrder()
static lookupUpdatedSubmission($ass_id, $member_id)
Check whether student has upload new files after tutor has set the exercise to another than notgraded...
static instructionFileGetFileOrderData($a_file_data, $a_ass_id)
static countMandatory($a_ex_id)
Order assignments by deadline date.
const PEER_REVIEW_VALID_NONE
getTeamTutor()
Get team management by tutor.
getPeerReviewMin()
Get peer review minimum.
static getInstancesByExercise($a_exc_id)
setPeerReviewPersonalized($a_val)
Set peer review personalized.
const TEAMS_FORMED_BY_PARTICIPANTS
setRelativeDeadline($a_val)
Set relative deadline.
const PEER_REVIEW_VALID_ALL
isValidType($a_value)
Is given type valid?
setPeerReviewValid($a_value)
Set peer review validation.
getAssignmentType()
Get assignment type.
handleGlobalFeedbackFileUpload(array $a_file)
setPeerReviewText($a_val)
Set peer review text.
setPeerReviewSimpleUnlock($a_value)
Set peer review simple unlock.
getMaxFile()
Get max number of uploads.
static lookupExerciseId($a_ass_id)
Lookup excercise id for assignment id.
saveMultiFeedbackFiles($a_files, ilObjExercise $a_exc)
Save multi feedback files.
getCalculatedDeadlines()
Get calculated deadlines for user/team members.
setExtendedDeadline($a_val)
Set extended deadline (timestamp)
setIndividualDeadline($id, ilDateTime $date)
const TEAMS_FORMED_BY_RANDOM
setPeerReviewMin($a_value)
Set peer review minimum.
setInstruction($a_val)
Set instruction.
static createNewAssignmentRecords($a_ass_id, $a_exc)
Create member status record for a new assignment for all participants.
static getPendingFeedbackNotifications()
initFromDB(array $a_set)
Import DB record.
uploadAssignmentFiles($a_files)
Upload assignment files (from creation form)
__construct($a_id=0)
Constructor.
getPeerReview()
Get peer review status.
hasPeerReviewFileUpload()
Get peer review file upload status.
static sendFeedbackNotifications($a_ass_id, $a_user_id=null)
setDeadlineMode($a_val)
Set deadline mode.
sendMultiFeedbackStructureFile(ilObjExercise $exercise)
Create member status record for a new assignment for all participants.
static cloneAssignmentsOfExercise($a_old_exc_id, $a_new_exc_id, array $a_crit_cat_map)
Clone assignments of exercise.
static getAssignmentDataOfExercise($a_exc_id)
Get assignments data of an exercise in an array.
setId($a_val)
Set assignment id.
setPeerReviewChars($a_value)
Set peer review minimum characters.
setMaxCharLimit($a_val)
Set limit maximum characters.
hasFeedbackCron()
Get (global) feedback file cron status.
recalculateLateSubmissions()
getStartTime()
Get start time (timestamp)
setMaxFile($a_value)
Set max number of uploads.
getMemberStatus($a_user_id=null)
setStartTime($a_val)
Set start time (timestamp)
setMinCharLimit($a_val)
Set limit minimum characters.
setPeerReviewCriteriaCatalogue($a_value)
Set peer review criteria catalogue id.
getPeerReviewSimpleUnlock()
Get peer review simple unlock.
getGlobalFeedbackFileStoragePath()
getDeadlineMode()
Get deadline mode.
static instructionFileExistsInDb($a_filename, $a_ass_id)
const FEEDBACK_DATE_CUSTOM
const TEAMS_FORMED_BY_ASSIGNMENT
const FEEDBACK_DATE_DEADLINE
static instructionFileOrderGetMax($a_ass_id)
getPeerReviewDeadline()
Get peer review deadline (timestamp)
getMaxCharLimit()
get limit maximum characters return int max limit
const PEER_REVIEW_VALID_ONE
getOrderNr()
Get order nr.
getGlobalFeedbackFilePath()
setPeerReviewDeadline($a_val)
Set peer review deadline (timestamp)
setFeedbackDate($a_value)
Set (global) feedback file availability date.
static lookupTitle($a_id)
Lookup title.
getFeedbackFile()
Get (global) feedback file.
getPeerReviewCriteriaCatalogue()
Get peer review criteria catalogue id.
setPeerReviewFileUpload($a_val)
Set peer review file upload.
getPortfolioTemplateId()
Get portfolio template id.
getPeerReviewCriteriaCatalogueItems()
static createNewUserRecords($a_user_id, $a_exc_id)
Create member status record for a new participant for all assignments.
setType($a_value)
Set type.
const FEEDBACK_DATE_SUBMISSION
static lookupAssignmentOnline($a_ass_id)
Check if assignment is online.
getDeadline()
Get deadline (timestamp)
static instructionFileDeleteOrder($a_ass_id, $a_file)
getExtendedDeadline()
Get extended deadline (timestamp)
setExerciseId($a_val)
Set exercise id.
static saveAssOrderOfExercise($a_ex_id, $a_order)
Save ordering of all assignments of an exercise.
static lookupType($a_id)
Lookup type.
setFeedbackFile($a_value)
Set (global) feedback file.
setMandatory($a_val)
Set mandatory.
getMandatory()
Get mandatory.
hasPeerReviewRating()
Get peer review rating status.
Exercise submission //TODO: This class has to much static methods related to delivered "files".
static getAllAssignmentFiles($a_exc_id, $a_ass_id)
static getInstancesByParentId($a_parent_id)
static getInstanceByType($a_type)
static getStartingTimestamps($a_ass_id)
Get starting timestamp data for an assignment.
static getInstance($a_ass_id, $a_participant_id, $a_is_team=false)
Get instance.
Exercise exceptions class.
static _getMembers($a_obj_id)
static getLogger($a_component_id)
Get component logger.
sendFeedbackFileNotification($a_feedback_file, $a_user_id, $a_ass_id, $a_is_text_feedback=false)
Send feedback file notification to user.
static _lookupName($a_user_id)
lookup user name
getId()
get object id @access public
Wrapper classes for system notifications.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
static zip($a_dir, $a_file, $compress_content=false)
zips given directory/file into given zip.file
static getSafeFilename($a_initial_filename)
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
static ilTempnam($a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
foreach($_POST as $key=> $value) $res