133        $this->db = 
$DIC->database();
 
  134        $this->lng = 
$DIC->language();
 
  135        $this->
user = $DIC->user();
 
  136        $this->app_event_handler = 
$DIC[
"ilAppEventHandler"];
 
  139        $this->
setType(self::TYPE_UPLOAD);
 
  160        $set = 
$ilDB->query(
"SELECT * FROM exc_assignment " .
 
  161            " WHERE exc_id = " . 
$ilDB->quote($a_exc_id, 
"integer") .
 
  162            " ORDER BY order_nr ASC");
 
  166        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
  168            $rec[
"order_val"] = $order_val;
 
  171            $ass->initFromDB($rec);
 
  192        $result_order_val = 
$db->query(
" 
  194                                FROM exc_ass_file_order 
  195                                WHERE assignment_id = {$db->quote($a_ass_id, 'integer')} 
  196                                AND filename = {$db->quote($a_file_data['entry'], 'string')} 
  201        while ($row = 
$db->fetchAssoc($result_order_val)) {
 
  202            $order_val = (int) $row[
'order_nr'];
 
  203            $order_id = (int) $row[
'id'];
 
  205        return array($order_val, $order_id);
 
  210        return $this->ass_type->usesTeams();
 
  240        $this->exc_id = $a_val;
 
  260        $this->start_time = $a_val;
 
  280        $this->deadline = $a_val;
 
  300        $this->deadline_mode = $a_val;
 
  320        $this->relative_deadline = $a_val;
 
  340        $this->rel_deadline_last_subm = $a_val;
 
  364        if ($this->ass_type->usesTeams()) {
 
  370            $a_user_id = $team_id;
 
  374        $set = 
$ilDB->query(
"SELECT tstamp FROM exc_idl" .
 
  375            " WHERE ass_id = " . 
$ilDB->quote($this->getId(), 
"integer") .
 
  376            " AND member_id = " . 
$ilDB->quote($a_user_id, 
"integer") .
 
  377            " AND is_team = " . 
$ilDB->quote($is_team, 
"integer"));
 
  378        $row = 
$ilDB->fetchAssoc($set);
 
  393        $set = 
$ilDB->query(
"SELECT MAX(tstamp) FROM exc_idl" .
 
  394            " WHERE ass_id = " . 
$ilDB->quote($this->getId(), 
"integer"));
 
  395        $row = 
$ilDB->fetchAssoc($set);
 
  396        return $row[
"tstamp"];
 
  406        if ($a_val !== 
null) {
 
  407            $a_val = (int) $a_val;
 
  409        $this->deadline2 = $a_val;
 
  429        $this->instruction = $a_val;
 
  451            $is_html = (strlen($inst) != strlen(strip_tags($inst)));
 
  467        $this->title = $a_val;
 
  487        $this->mandatory = $a_val;
 
  507        $this->order_nr = $a_val;
 
  529            $this->type = (int) $a_value;
 
  531            $this->ass_type = $this->types->getById($a_value);
 
  533            if ($this->ass_type->usesTeams()) {
 
  570        return $this->types->isValidId($a_value);
 
  580        $this->peer = (bool) $a_value;
 
  600        $this->peer_min = (int) $a_value;
 
  620        $this->peer_unlock = (bool) $a_value;
 
  640        $this->peer_dl = $a_val;
 
  660        $this->peer_valid = (int) $a_value;
 
  680        $this->peer_rating = (bool) $a_val;
 
  700        $this->peer_text = (bool) $a_val;
 
  720        $this->peer_file = (bool) $a_val;
 
  740        $this->peer_personal = (bool) $a_val;
 
  760        $a_value = (is_numeric($a_value) && (int) $a_value > 0)
 
  763        $this->peer_char = $a_value;
 
  783        $a_value = is_numeric($a_value)
 
  786        $this->crit_cat = $a_value;
 
  796        return $this->crit_cat;
 
  801        if ($this->crit_cat) {
 
  806            if ($this->peer_rating) {
 
  810            if ($this->peer_text) {
 
  812                if ($this->peer_char) {
 
  813                    $crit->setMinChars($this->peer_char);
 
  818            if ($this->peer_file) {
 
  833        $this->feedback_file = (string) $a_value;
 
  853        $this->feedback_cron = (string) $a_value;
 
  873        $this->feedback_date = (int) $a_value;
 
  892        $this->feedback_date_custom = $a_value;
 
  911        $this->team_tutor = (bool) $a_value;
 
  931        if ($a_value !== 
null) {
 
  932            $a_value = (int) $a_value;
 
  934        $this->max_file = $a_value;
 
  954        $this->portfolio_template = $a_val;
 
  976            "SELECT * FROM exc_assignment " .
 
  977            " WHERE id = " . 
$ilDB->quote($this->getId(), 
"integer")
 
  979        $rec = 
$ilDB->fetchAssoc($set);
 
  982        if (is_array($rec)) {
 
  995        $this->
setId($a_set[
"id"]);
 
 1004        $this->
setType($a_set[
"type"]);
 
 1044        $next_id = 
$ilDB->nextId(
"exc_assignment");
 
 1045        $ilDB->insert(
"exc_assignment", array(
 
 1046            "id" => array(
"integer", $next_id),
 
 1048            "time_stamp" => array(
"integer", $this->
getDeadline()),
 
 1051            "title" => array(
"text", $this->
getTitle()),
 
 1052            "start_time" => array(
"integer", $this->
getStartTime()),
 
 1053            "order_nr" => array(
"integer", $this->
getOrderNr()),
 
 1054            "mandatory" => array(
"integer", $this->
getMandatory()),
 
 1055            "type" => array(
"integer", $this->
getType()),
 
 1071            "team_tutor" => array(
"integer", $this->
getTeamTutor()),
 
 1072            "max_file" => array(
"integer", $this->
getMaxFile()),
 
 1073            "portfolio_template" => array(
"integer", $this->getPortFolioTemplateId()),
 
 1080        $this->
setId($next_id);
 
 1082        $exc->updateAllUsersStatus();
 
 1099            "time_stamp" => array(
"integer", $this->
getDeadline()),
 
 1102            "title" => array(
"text", $this->
getTitle()),
 
 1103            "start_time" => array(
"integer", $this->
getStartTime()),
 
 1104            "order_nr" => array(
"integer", $this->
getOrderNr()),
 
 1105            "mandatory" => array(
"integer", $this->
getMandatory()),
 
 1106            "type" => array(
"integer", $this->
getType()),
 
 1122            "team_tutor" => array(
"integer", $this->
getTeamTutor()),
 
 1123            "max_file" => array(
"integer", $this->
getMaxFile()),
 
 1124            "portfolio_template" => array(
"integer", $this->getPortFolioTemplateId()),
 
 1132            "id" => array(
"integer", $this->
getId()),
 
 1136        $exc->updateAllUsersStatus();
 
 1144    public function delete()
 
 1151            "DELETE FROM exc_assignment WHERE " .
 
 1152            " id = " . 
$ilDB->quote($this->getId(), 
"integer")
 
 1155        $exc->updateAllUsersStatus();
 
 1160        $reminder->deleteReminders($this->
getId());
 
 1175        $set = 
$ilDB->query(
"SELECT * FROM exc_assignment " .
 
 1176            " WHERE exc_id = " . 
$ilDB->quote($a_exc_id, 
"integer") .
 
 1177            " ORDER BY order_nr ASC");
 
 1181        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
 1184                "exc_id" => $rec[
"exc_id"],
 
 1185                "deadline" => $rec[
"time_stamp"],
 
 1186                "deadline2" => $rec[
"deadline2"],
 
 1187                "instruction" => $rec[
"instruction"],
 
 1188                "title" => $rec[
"title"],
 
 1189                "start_time" => $rec[
"start_time"],
 
 1190                "order_val" => $order_val,
 
 1191                "mandatory" => $rec[
"mandatory"],
 
 1192                "type" => $rec[
"type"],
 
 1193                "peer" => $rec[
"peer"],
 
 1194                "peer_min" => $rec[
"peer_min"],
 
 1195                "peer_dl" => $rec[
"peer_dl"],
 
 1196                "peer_file" => $rec[
"peer_file"],
 
 1197                "peer_prsl" => $rec[
"peer_prsl"],
 
 1198                "fb_file" => $rec[
"fb_file"],
 
 1199                "fb_date" => $rec[
"fb_date"],
 
 1200                "fb_cron" => $rec[
"fb_cron"],
 
 1201                "deadline_mode" => $rec[
"deadline_mode"],
 
 1202                "relative_deadline" => $rec[
"relative_deadline"],
 
 1203                "rel_deadline_last_subm" => $rec[
"rel_deadline_last_subm"]
 
 1218        foreach ($ass_data as 
$d) {
 
 1221            $new_ass->setExerciseId($a_new_exc_id);
 
 1222            $new_ass->setTitle(
$d->getTitle());
 
 1223            $new_ass->setDeadline(
$d->getDeadline());
 
 1224            $new_ass->setExtendedDeadline(
$d->getExtendedDeadline());
 
 1225            $new_ass->setInstruction(
$d->getInstruction());
 
 1226            $new_ass->setMandatory(
$d->getMandatory());
 
 1227            $new_ass->setOrderNr(
$d->getOrderNr());
 
 1228            $new_ass->setStartTime(
$d->getStartTime());
 
 1229            $new_ass->setType(
$d->getType());
 
 1230            $new_ass->setPeerReview(
$d->getPeerReview());
 
 1231            $new_ass->setPeerReviewMin(
$d->getPeerReviewMin());
 
 1232            $new_ass->setPeerReviewDeadline(
$d->getPeerReviewDeadline());
 
 1233            $new_ass->setPeerReviewFileUpload(
$d->hasPeerReviewFileUpload());
 
 1234            $new_ass->setPeerReviewPersonalized(
$d->hasPeerReviewPersonalized());
 
 1235            $new_ass->setPeerReviewValid(
$d->getPeerReviewValid());
 
 1236            $new_ass->setPeerReviewChars(
$d->getPeerReviewChars());
 
 1237            $new_ass->setPeerReviewText(
$d->hasPeerReviewText());
 
 1238            $new_ass->setPeerReviewRating(
$d->hasPeerReviewRating());
 
 1239            $new_ass->setPeerReviewCriteriaCatalogue(
$d->getPeerReviewCriteriaCatalogue());
 
 1240            $new_ass->setPeerReviewSimpleUnlock(
$d->getPeerReviewSimpleUnlock());
 
 1241            $new_ass->setFeedbackFile(
$d->getFeedbackFile());
 
 1242            $new_ass->setFeedbackDate(
$d->getFeedbackDate());
 
 1243            $new_ass->setFeedbackDateCustom(
$d->getFeedbackDateCustom());
 
 1244            $new_ass->setFeedbackCron(
$d->hasFeedbackCron()); 
 
 1245            $new_ass->setTeamTutor(
$d->getTeamTutor());
 
 1246            $new_ass->setMaxFile(
$d->getMaxFile());
 
 1247            $new_ass->setMinCharLimit(
$d->getMinCharLimit());
 
 1248            $new_ass->setMaxCharLimit(
$d->getMaxCharLimit());
 
 1249            $new_ass->setPortfolioTemplateId(
$d->getPortfolioTemplateId());
 
 1250            $new_ass->setDeadlineMode(
$d->getDeadlineMode());
 
 1251            $new_ass->setRelativeDeadline(
$d->getRelativeDeadline());
 
 1252            $new_ass->setRelDeadlineLastSubmission(
$d->getRelDeadlineLastSubmission());
 
 1255            if (
$d->getPeerReviewCriteriaCatalogue() &&
 
 1256                array_key_exists(
$d->getPeerReviewCriteriaCatalogue(), $a_crit_cat_map)) {
 
 1257                $new_ass->setPeerReviewCriteriaCatalogue($a_crit_cat_map[
$d->getPeerReviewCriteriaCatalogue()]);
 
 1266            $new_web_storage->create();
 
 1267            if (is_dir($old_web_storage->getPath())) {
 
 1268                ilUtil::rCopy($old_web_storage->getPath(), $new_web_storage->getPath());
 
 1270            $order = 
$d->getInstructionFilesOrder();
 
 1271            foreach ($order as $file) {
 
 1278            $new_storage->create();
 
 1279            if (is_dir($old_storage->getGlobalFeedbackPath())) {
 
 1280                ilUtil::rCopy($old_storage->getGlobalFeedbackPath(), $new_storage->getGlobalFeedbackPath());
 
 1288                if ($rmd_sub->getReminderStatus()) {
 
 1290                    $new_rmd_sub->setReminderStatus($rmd_sub->getReminderStatus());
 
 1291                    $new_rmd_sub->setReminderStart($rmd_sub->getReminderStart());
 
 1292                    $new_rmd_sub->setReminderEnd($rmd_sub->getReminderEnd());
 
 1293                    $new_rmd_sub->setReminderFrequency($rmd_sub->getReminderFrequency());
 
 1294                    $new_rmd_sub->setReminderMailTemplate($rmd_sub->getReminderMailTemplate());
 
 1295                    $new_rmd_sub->save();
 
 1311        $this->log->debug(
"getting files from class.ilExAssignment using ilFSWebStorageExercise");
 
 1313        return $storage->getFiles();
 
 1324        $set = 
$ilDB->query(
 
 1325            "SELECT filename, order_nr, id FROM exc_ass_file_order " .
 
 1326            " WHERE assignment_id  = " . 
$ilDB->quote($this->getId(), 
"integer")
 
 1330        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
 1331            $data[$rec[
'filename']] = $rec;
 
 1346        $set = 
$ilDB->query(
 
 1347            "SELECT MAX(order_nr) mnr FROM exc_assignment " .
 
 1348            " WHERE exc_id = " . 
$ilDB->quote($a_exc_id, 
"integer")
 
 1350        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
 1351            return (
int) $rec[
"mnr"];
 
 1367        $query = 
"SELECT id FROM exc_assignment " .
 
 1368            "WHERE start_time <= " . 
$ilDB->quote(time(), 
'integer') . 
' ' .
 
 1369            "AND time_stamp >= " . 
$ilDB->quote(time(), 
'integer') . 
' ' .
 
 1370            "AND id = " . 
$ilDB->quote($a_ass_id, 
'integer');
 
 1373        return $res->numRows() ? true : 
false;
 
 1388        $query = 
"SELECT exc_id FROM exc_assignment " .
 
 1389            "WHERE id = " . 
$ilDB->quote($a_ass_id, 
'integer');
 
 1392        return (
int) 
$res[
"exc_id"];
 
 1398    private static function lookup($a_id, $a_field)
 
 1404        $set = 
$ilDB->query(
 
 1405            "SELECT " . $a_field . 
" FROM exc_assignment " .
 
 1406            " WHERE id = " . 
$ilDB->quote($a_id, 
"integer")
 
 1409        $rec = 
$ilDB->fetchAssoc($set);
 
 1411        return $rec[$a_field];
 
 1439        $result_order = array();
 
 1442        foreach ($a_order as $k => $v) {
 
 1445                $t = 
"UPDATE exc_assignment SET " .
 
 1446                " order_nr = " . 
$ilDB->quote($nr, 
"integer") .
 
 1447                " WHERE id = " . 
$ilDB->quote((
int) $k, 
"integer") .
 
 1448                " AND exc_id = " . 
$ilDB->quote((
int) $a_ex_id, 
"integer")
 
 1462        $set = 
$ilDB->query(
 
 1463            "SELECT id FROM exc_assignment " .
 
 1464            " WHERE exc_id = " . 
$ilDB->quote($a_ex_id, 
"integer") .
 
 1465            " ORDER BY time_stamp ASC" 
 1468        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
 1470                "UPDATE exc_assignment SET " .
 
 1471                " order_nr = " . 
$ilDB->quote($nr, 
"integer") .
 
 1472                " WHERE id = " . 
$ilDB->quote($rec[
"id"], 
"integer")
 
 1487        $set = 
$ilDB->query(
 
 1488            "SELECT count(*) cntm FROM exc_assignment " .
 
 1489            " WHERE exc_id = " . 
$ilDB->quote($a_ex_id, 
"integer") .
 
 1490            " AND mandatory = " . 
$ilDB->quote(1, 
"integer")
 
 1492        $rec = 
$ilDB->fetchAssoc($set);
 
 1493        return $rec[
"cntm"];
 
 1505        $set = 
$ilDB->query(
 
 1506            "SELECT count(*) cntm FROM exc_assignment " .
 
 1507            " WHERE exc_id = " . 
$ilDB->quote($a_ex_id, 
"integer")
 
 1509        $rec = 
$ilDB->fetchAssoc($set);
 
 1510        return $rec[
"cntm"];
 
 1522        $set = 
$ilDB->query(
 
 1523            "SELECT * FROM exc_assignment " .
 
 1524            " WHERE exc_id = " . 
$ilDB->quote($a_ex_id, 
"integer") .
 
 1525            " AND id = " . 
$ilDB->quote($a_ass_id, 
"integer")
 
 1527        if ($rec = 
$ilDB->fetchAssoc($set)) {
 
 1546        $user_ids = self::getTeamMembersByAssignmentId($ass_id, $member_id);
 
 1548            $user_ids = array($member_id);
 
 1551        $q = 
"SELECT exc_mem_ass_status.status_time, exc_returned.ts " .
 
 1552            "FROM exc_mem_ass_status, exc_returned " .
 
 1553            "WHERE exc_mem_ass_status.status_time < exc_returned.ts " .
 
 1554            "AND NOT exc_mem_ass_status.status_time IS NULL " .
 
 1555            "AND exc_returned.ass_id = exc_mem_ass_status.ass_id " .
 
 1556            "AND exc_returned.user_id = exc_mem_ass_status.usr_id " .
 
 1557            "AND exc_returned.ass_id=" . 
$ilDB->quote($ass_id, 
"integer") .
 
 1558            " AND " . 
$ilDB->in(
"exc_returned.user_id", $user_ids, 
"", 
"integer");
 
 1560        $usr_set = 
$ilDB->query($q);
 
 1562        $array = 
$ilDB->fetchAssoc($usr_set);
 
 1564        if (
count($array) == 0) {
 
 1581        $set = 
$ilDB->query(
"SELECT ud.usr_id, ud.lastname, ud.firstname, ud.login" .
 
 1582            " FROM exc_members excm" .
 
 1583            " JOIN usr_data ud ON (ud.usr_id = excm.usr_id)" .
 
 1584            " WHERE excm.obj_id = " . 
$ilDB->quote($this->getExerciseId(), 
"integer"));
 
 1585        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
 1586            $mem[$rec[
"usr_id"]] =
 
 1588                "name" => $rec[
"lastname"] . 
", " . $rec[
"firstname"],
 
 1589                "login" => $rec[
"login"],
 
 1590                "usr_id" => $rec[
"usr_id"],
 
 1591                "lastname" => $rec[
"lastname"],
 
 1592                "firstname" => $rec[
"firstname"]
 
 1596        $q = 
"SELECT * FROM exc_mem_ass_status " .
 
 1597            "WHERE ass_id = " . 
$ilDB->quote($this->
getId(), 
"integer");
 
 1598        $set = 
$ilDB->query($q);
 
 1599        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
 1600            if (isset($mem[$rec[
"usr_id"]])) {
 
 1603                $mem[$rec[
"usr_id"]][
"sent_time"] = $rec[
"sent_time"];
 
 1604                $mem[$rec[
"usr_id"]][
"submission"] = $sub->getLastSubmission();
 
 1605                $mem[$rec[
"usr_id"]][
"status_time"] = $rec[
"status_time"];
 
 1606                $mem[$rec[
"usr_id"]][
"feedback_time"] = $rec[
"feedback_time"];
 
 1607                $mem[$rec[
"usr_id"]][
"notice"] = $rec[
"notice"];
 
 1608                $mem[$rec[
"usr_id"]][
"status"] = $rec[
"status"];
 
 1609                $mem[$rec[
"usr_id"]][
"mark"] = $rec[
"mark"];
 
 1610                $mem[$rec[
"usr_id"]][
"comment"] = $rec[
"u_comment"];
 
 1628        if (in_array($a_grade, array(
"notgraded", 
"passed", 
"failed"))) {
 
 1629            $and_grade = 
" AND status = " . 
$ilDB->quote($a_grade, 
"text");
 
 1632        $q = 
"SELECT * FROM exc_mem_ass_status " .
 
 1633            "WHERE ass_id = " . 
$ilDB->quote($this->
getId(), 
"integer") .
 
 1634            " AND usr_id = " . 
$ilDB->quote($a_user_id, 
"integer") .
 
 1637        $set = 
$ilDB->query($q);
 
 1639        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
 1642            $data[
"sent_time"] = $rec[
"sent_time"];
 
 1643            $data[
"submission"] = $sub->getLastSubmission();
 
 1644            $data[
"status_time"] = $rec[
"status_time"];
 
 1645            $data[
"feedback_time"] = $rec[
"feedback_time"];
 
 1646            $data[
"notice"] = $rec[
"notice"];
 
 1647            $data[
"status"] = $rec[
"status"];
 
 1648            $data[
"mark"] = $rec[
"mark"];
 
 1649            $data[
"comment"] = $rec[
"u_comment"];
 
 1665        foreach ($ass_data as $ass) {
 
 1667            $ilDB->replace(
"exc_mem_ass_status", array(
 
 1668                "ass_id" => array(
"integer", $ass[
"id"]),
 
 1669                "usr_id" => array(
"integer", $a_user_id)
 
 1671                "status" => array(
"text", 
"notgraded")
 
 1686        $mems = $exmem->getMembers();
 
 1688        foreach ($mems as $mem) {
 
 1689            $ilDB->replace(
"exc_mem_ass_status", array(
 
 1690                "ass_id" => array(
"integer", $a_ass_id),
 
 1691                "usr_id" => array(
"integer", $mem)
 
 1693                "status" => array(
"text", 
"notgraded")
 
 1707        $storage->uploadAssignmentFiles($a_files);
 
 1724        $deliverFilename = trim(str_replace(
" ", 
"_", $this->
getTitle() . 
"_" . $this->
getId()));
 
 1726        $deliverFilename = 
"multi_feedback_" . $deliverFilename;
 
 1735        $mfdir = $tmpdir . 
"/" . $deliverFilename;
 
 1740        $mems = $exmem->getMembers();
 
 1742        $mems = 
$DIC->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
 
 1743            'edit_submissions_grades',
 
 1744            'edit_submissions_grades',
 
 1748        foreach ($mems as $mem) {
 
 1750            $subdir = 
$name[
"lastname"] . 
"_" . 
$name[
"firstname"] . 
"_" . 
$name[
"login"] . 
"_" . 
$name[
"user_id"];
 
 1757        $tmpzipfile = $tmpdir . 
"/multi_feedback.zip";
 
 1776        if (!is_file($a_file[
"tmp_name"])) {
 
 1781        $mfu = $storage->getMultiFeedbackUploadPath(
$ilUser->getId());
 
 1786        $subdir = 
"notfound";
 
 1787        foreach ($subdirs as $s => $j) {
 
 1788            if ($j[
"type"] == 
"dir" && substr($s, 0, 14) == 
"multi_feedback") {
 
 1793        if (!is_dir($mfu . 
"/" . $subdir)) {
 
 1810        if ($a_user_id == 0) {
 
 1811            $a_user_id = 
$ilUser->getId();
 
 1814        $mf_files = array();
 
 1819        $mems = $exmem->getMembers();
 
 1823        $mfu = $storage->getMultiFeedbackUploadPath(
$ilUser->getId());
 
 1827        $subdir = 
"notfound";
 
 1828        foreach ($subdirs as $s => $j) {
 
 1829            if ($j[
"type"] == 
"dir" && substr($s, 0, 14) == 
"multi_feedback") {
 
 1835        foreach ($items as $k => 
$i) {
 
 1837            if (
$i[
"type"] == 
"dir" && !in_array($k, array(
".", 
".."))) {
 
 1839                $parts = explode(
"_", 
$i[
"entry"]);
 
 1840                $user_id = (int) $parts[
count($parts) - 1];
 
 1841                if (in_array($user_id, $mems)) {
 
 1845                    foreach ($files as $k2 => 
$f) {
 
 1847                        if (
$f[
"type"] == 
"file" && substr($k2, 0, 1) != 
".") {
 
 1848                            $mf_files[] = array(
 
 1849                                "lastname" => 
$name[
"lastname"],
 
 1850                                "firstname" => 
$name[
"firstname"],
 
 1851                                "login" => 
$name[
"login"],
 
 1852                                "user_id" => 
$name[
"user_id"],
 
 1853                                "full_path" => $mfu . 
"/" . $subdir . 
"/" . $k . 
"/" . $k2,
 
 1875        $mfu = $storage->getMultiFeedbackUploadPath(
$ilUser->getId());
 
 1892        $fstorage->create();
 
 1894        $team_map = array();
 
 1897        foreach ($mf_files as 
$f) {
 
 1898            $user_id = 
$f[
"user_id"];
 
 1899            $file_path = 
$f[
"full_path"];
 
 1900            $file_name = 
$f[
"file"];
 
 1903            if ($a_files[$user_id][md5($file_name)] != 
"") {
 
 1905                $feedback_id = $submission->getFeedbackId();
 
 1906                $noti_rec_ids = $submission->getUserIds();
 
 1909                    $fb_path = $fstorage->getFeedbackPath($feedback_id);
 
 1910                    $target = $fb_path . 
"/" . $file_name;
 
 1911                    if (is_file($target)) {
 
 1915                    rename($file_path, $target);
 
 1917                    if ($noti_rec_ids) {
 
 1918                        foreach ($noti_rec_ids as $user_id) {
 
 1927                            (
int) $this->
getId()
 
 1949        $dl_id = $this->
getId() . 
"0";
 
 1950        $fbdl_id = $this->
getId() . 
"1";
 
 1952        $context_ids = array($dl_id, $fbdl_id);
 
 1955        if ($a_event != 
"delete") {
 
 1960                $app->setSubtitle(
"cal_exc_deadline");
 
 1962                $app->setFullday(
false);
 
 1974                $app->setSubtitle(
"cal_exc_peer_review_deadline");
 
 1976                $app->setFullday(
false);
 
 1985        $ilAppEventHandler->raise(
 
 1987            $a_event . 
'Assignment',
 
 1990            'obj_id' => $exc->getId(),
 
 1991            'context_ids' => $context_ids,
 
 1992            'appointments' => $apps)
 
 2005        $set = 
$ilDB->query(
"SELECT id,fb_file,time_stamp,deadline2,fb_date FROM exc_assignment" .
 
 2006            " WHERE fb_cron = " . 
$ilDB->quote(1, 
"integer") .
 
 2007            " AND (fb_date = " . 
$ilDB->quote(self::FEEDBACK_DATE_DEADLINE, 
"integer") .
 
 2008                " AND time_stamp IS NOT NULL" .
 
 2009                " AND time_stamp > " . 
$ilDB->quote(0, 
"integer") .
 
 2010                " AND time_stamp < " . 
$ilDB->quote(time(), 
"integer") .
 
 2011                " AND fb_cron_done = " . 
$ilDB->quote(0, 
"integer") .
 
 2012            ") OR (fb_date = " . 
$ilDB->quote(self::FEEDBACK_DATE_CUSTOM, 
"integer") .
 
 2013                " AND fb_date_custom IS NOT NULL" .
 
 2014                " AND fb_date_custom > " . 
$ilDB->quote(0, 
"integer") .
 
 2015                " AND fb_date_custom < " . 
$ilDB->quote(time(), 
"integer") .
 
 2016                " AND fb_cron_done = " . 
$ilDB->quote(0, 
"integer") . 
")");
 
 2020        while ($row = 
$ilDB->fetchAssoc($set)) {
 
 2021            if ($row[
'fb_date'] == self::FEEDBACK_DATE_DEADLINE) {
 
 2022                $max = max($row[
'time_stamp'], $row[
'deadline2']);
 
 2023                if (trim($row[
"fb_file"]) && $max <= time()) {
 
 2024                    $res[] = $row[
"id"];
 
 2026            } elseif ($row[
'fb_date'] == self::FEEDBACK_DATE_CUSTOM) {
 
 2027                if (trim($row[
"fb_file"]) && $row[
'fb_date_custom'] <= time()) {
 
 2028                    $res[] = $row[
"id"];
 
 2042        $ass = 
new self($a_ass_id);
 
 2045        if (!$ass->hasFeedbackCron() || !$ass->getFeedbackFile()) {
 
 2051            $set = 
$ilDB->query(
"SELECT fb_cron_done" .
 
 2052                " FROM exc_assignment" .
 
 2053                " WHERE id = " . 
$ilDB->quote($a_ass_id, 
"integer"));
 
 2054            $row = 
$ilDB->fetchAssoc($set);
 
 2055            if ($row[
"fb_cron_done"]) {
 
 2061        $ntf->setLangModules(array(
"exc"));
 
 2062        $ntf->setObjId($ass->getExerciseId());
 
 2063        $ntf->setSubjectLangId(
"exc_feedback_notification_subject");
 
 2064        $ntf->setIntroductionLangId(
"exc_feedback_notification_body");
 
 2065        $ntf->addAdditionalInfo(
"exc_assignment", $ass->getTitle());
 
 2066        $ntf->setGotoLangId(
"exc_feedback_notification_link");
 
 2067        $ntf->setReasonLangId(
"exc_feedback_notification_reason");
 
 2072            $ilDB->manipulate(
"UPDATE exc_assignment" .
 
 2073                " SET fb_cron_done = " . 
$ilDB->quote(1, 
"integer") .
 
 2074                " WHERE id = " . 
$ilDB->quote($a_ass_id, 
"integer"));
 
 2076            $ntf->sendMail(array($a_user_id));
 
 2093        $deadline = max($this->deadline, $this->deadline2, $idl);       
 
 2102        $idl = (bool) $a_include_personal
 
 2107        $deadline = max($this->deadline, $this->deadline2, $idl);
 
 2128        return ($date_custom - time() <= 0);
 
 2139        return (time() - $this->start_time <= 0);
 
 2150        return $storage->getGlobalFeedbackPath();
 
 2174            return $path . 
"/" . $file;
 
 2187            $a_user_id = 
$ilUser->getId();
 
 2189        if (!array_key_exists($a_user_id, $this->member_status)) {
 
 2192        return $this->member_status[$a_user_id];
 
 2204            $id = $file[
"returned_id"];
 
 2214            if ($file[
"late"] &&
 
 2221            elseif (!$file[
"late"] &&
 
 2226            } elseif ($last_deadline && $uploaded > $last_deadline) {
 
 2230            if ($late !== 
null) {
 
 2231                $ilDB->manipulate(
"UPDATE exc_returned" .
 
 2232                    " SET late = " . 
$ilDB->quote($late, 
"integer") .
 
 2233                    " WHERE returned_id = " . 
$ilDB->quote(
$id, 
"integer"));
 
 2248        if (!is_numeric(
$id)) {
 
 2276        $set = 
$ilDB->query(
"SELECT * FROM exc_idl" .
 
 2277            " WHERE ass_id = " . 
$ilDB->quote($this->getId(), 
"integer"));
 
 2278        while ($row = 
$ilDB->fetchAssoc($set)) {
 
 2279            if ($row[
"is_team"]) {
 
 2280                $row[
"member_id"] = 
"t" . $row[
"member_id"];
 
 2283            $res[$row[
"member_id"]] = $row[
"tstamp"];
 
 2296        if (!$this->ass_type->usesTeams() &&
 
 2297            $this->getPeerReview()) {
 
 2300            if ($peer_review->hasPeerReviewGroups()) {
 
 2319        asort($a_order, SORT_NUMERIC);
 
 2322        foreach ($a_order as $k => $v) {
 
 2325                $t = 
"UPDATE exc_ass_file_order SET " .
 
 2326                " order_nr = " . 
$db->quote($nr, 
"integer") .
 
 2327                " WHERE id = " . 
$db->quote((
int) $k, 
"integer") .
 
 2328                " AND assignment_id = " . 
$db->quote((
int) $a_ass_id, 
"integer")
 
 2338        $id = 
$db->nextId(
"exc_ass_file_order");
 
 2339        $db->insert(
"exc_ass_file_order", [
 
 2340                "id" => [
"integer", 
$id],
 
 2341                "order_nr" => [
"integer", $a_order_nr],
 
 2342                "assignment_id" => [
"integer", $a_ass_id],
 
 2343                "filename" => [
"text", $a_filename]
 
 2366            if (!self::instructionFileExistsInDb(
$filename, $a_ass_id)) {
 
 2367                if ($a_order_nr == 0) {
 
 2369                    $order = $order_val + 10;
 
 2371                    $order = $a_order_nr;
 
 2374                $id = 
$db->nextID(
'exc_ass_file_order');
 
 2375                $db->manipulate(
"INSERT INTO exc_ass_file_order " .
 
 2376                    "(id, assignment_id, filename, order_nr) VALUES (" .
 
 2377                    $db->quote(
$id, 
"integer") . 
"," .
 
 2378                    $db->quote($a_ass_id, 
"integer") . 
"," .
 
 2380                    $db->quote($order, 
"integer") .
 
 2393        foreach ($a_file as $k => $v) {
 
 2395                "DELETE FROM exc_ass_file_order " .
 
 2397                "WHERE filename = " . 
$db->quote($v, 
"string") .
 
 2398                " AND assignment_id = " . 
$db->quote($a_ass_id, 
'integer')
 
 2416                "DELETE FROM exc_ass_file_order" .
 
 2417                " WHERE assignment_id = " . 
$db->quote((
int) $a_ass_id, 
'integer') .
 
 2418                " AND filename = " . 
$db->quote($a_new_name, 
'string')
 
 2422                "UPDATE exc_ass_file_order SET" .
 
 2423                " filename = " . 
$db->quote($a_new_name, 
'string') .
 
 2424                " WHERE assignment_id = " . 
$db->quote((
int) $a_ass_id, 
'integer') .
 
 2425                " AND filename = " . 
$db->quote($a_old_name, 
'string')
 
 2443                "SELECT id FROM exc_ass_file_order" .
 
 2444                " WHERE assignment_id = " . 
$db->quote((
int) $a_ass_id, 
'integer') .
 
 2445                " AND filename = " . 
$db->quote($a_filename, 
'string')
 
 2458        $files = array_map(
function ($v) {
 
 2462        $set = 
$db->query(
"SELECT * FROM exc_ass_file_order " .
 
 2463            " WHERE assignment_id = " . 
$db->quote($this->getId(), 
"integer") .
 
 2464            " ORDER BY order_nr");
 
 2466        $numbered_files = array();
 
 2467        while ($rec = 
$db->fetchAssoc($set)) {
 
 2469            if (in_array($rec[
"filename"], $files)) {
 
 2471                    "UPDATE exc_ass_file_order SET " .
 
 2473                    " WHERE assignment_id = " . 
$db->quote($this->getId(), 
"integer") .
 
 2474                    " AND id = " . 
$db->quote($rec[
"id"], 
"integer")
 
 2477                $numbered_files[] = $rec[
"filename"];
 
 2480                    "DELETE FROM exc_ass_file_order " .
 
 2481                    " WHERE assignment_id = " . 
$db->quote($this->getId(), 
"integer") .
 
 2482                    " AND id = " . 
$db->quote($rec[
"id"], 
"integer")
 
 2486        foreach ($files as 
$f) {
 
 2487            if (!in_array(
$f, $numbered_files)) {
 
 2503        foreach ($a_entries as $k => 
$e) {
 
 2504            $a_entries[$k][
"order_val"] = $order[
$e[
"file"]][
"order_nr"];
 
 2505            $a_entries[$k][
"order_id"] = $order[
$e[
"file"]][
"id"];
 
 2523            "SELECT max(order_nr) as max_order FROM exc_ass_file_order WHERE assignment_id = %s",
 
 2525            array(
$db->quote($a_ass_id, 
'integer'))
 
 2529            $order_val = (int) $row[
'max_order'];
 
 2542        $this->min_char_limit = $a_val;
 
 2561        $this->max_char_limit = $a_val;
 
 2582        $calculated_deadlines = array(
 
 2589                $type = $ts[
"is_team"]
 
 2593                $calculated_deadlines[
$type][$ts[
"member_id"]] = array(
 
 2594                    "calculated_deadline" => $ts[
"starting_ts"] + ($this->
getRelativeDeadline() * 24 * 60 * 60)
 
 2598        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.
static count($a_ex_id)
Order assignments by deadline date.
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)
Count the number of mandatory assignments.
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.
getInstructionPresentation()
Get instruction presentation.
const PEER_REVIEW_VALID_ALL
isValidType($a_value)
Is given type valid?
setPeerReviewValid($a_value)
Set peer review validation.
static insertFileOrderNr(int $a_ass_id, string $a_filename, int $a_order_nr)
static isInExercise($a_ass_id, $a_ex_id)
Is assignment in exercise?
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)
getRelDeadlineLastSubmission()
Get relative deadline last submission.
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.
setRelDeadlineLastSubmission($a_val)
Set relative deadline last submission.
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 moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
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 makeClickable($a_text, $detectGotoLinks=false)
makeClickable In Texten enthaltene URLs und Mail-Adressen klickbar machen
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