/**
  * Fill table row
  */
 protected function fillRow($d)
 {
     global $lng, $ilCtrl;
     $this->tpl->setVariable("TXT_ASS_TITLE", $d["title"]);
     $this->tpl->setVariable("VAL_CHKBOX", ilUtil::formCheckbox(0, "assid[" . $d["id"] . "]", 1));
     $this->tpl->setVariable("VAL_ID", $d["id"]);
     // submission:
     // see if files have been resubmmited after solved
     $last_sub = ilEphAssignment::getLastSubmission($d["id"], $this->part_id);
     if ($last_sub) {
         $last_sub = ilDatePresentation::formatDate(new ilDateTime($last_sub, IL_CAL_DATETIME));
     } else {
         $last_sub = "---";
     }
     if (ilEphAssignment::lookupUpdatedSubmission($d["id"], $this->part_id) == 1) {
         $last_sub = "<b>" . $last_sub . "</b>";
     }
     $this->tpl->setVariable("VAL_LAST_SUBMISSION", $last_sub);
     $this->tpl->setVariable("TXT_LAST_SUBMISSION", $lng->txt("rep_robj_xeph_last_submission"));
     // nr of submitted files
     $this->tpl->setVariable("TXT_SUBMITTED_FILES", $lng->txt("rep_robj_xeph_files_returned"));
     $sub_cnt = count(ilEphAssignment::getDeliveredFiles($this->eph_id, $d["id"], $this->part_id));
     $new = ilEphAssignment::lookupNewFiles($d["id"], $this->part_id);
     if (count($new) > 0) {
         $sub_cnt .= " " . sprintf($lng->txt("cnt_new"), count($new));
     }
     $this->tpl->setVariable("VAL_SUBMITTED_FILES", $sub_cnt);
     // download command
     $ilCtrl->setParameter($this->parent_obj, "ass_id", $d["id"]);
     $ilCtrl->setParameter($this->parent_obj, "member_id", $this->part_id);
     if ($sub_cnt > 0) {
         $this->tpl->setCurrentBlock("download_link");
         $this->tpl->setVariable("LINK_DOWNLOAD", $ilCtrl->getLinkTarget($this->parent_obj, "downloadReturned"));
         if (count($new) <= 0) {
             $this->tpl->setVariable("TXT_DOWNLOAD", $lng->txt("rep_robj_xeph_download_files"));
         } else {
             $this->tpl->setVariable("TXT_DOWNLOAD", $lng->txt("rep_robj_xeph_download_all"));
         }
         $this->tpl->parseCurrentBlock();
         // download new files only
         if (count($new) > 0) {
             $this->tpl->setCurrentBlock("download_link");
             $this->tpl->setVariable("LINK_NEW_DOWNLOAD", $ilCtrl->getLinkTarget($this->parent_obj, "downloadNewReturned"));
             $this->tpl->setVariable("TXT_NEW_DOWNLOAD", $lng->txt("rep_robj_xeph_download_new"));
             $this->tpl->parseCurrentBlock();
         }
     }
     // note
     $this->tpl->setVariable("TXT_NOTE", $lng->txt("note"));
     $this->tpl->setVariable("NAME_NOTE", "notice[" . $d["id"] . "]");
     $this->tpl->setVariable("VAL_NOTE", ilUtil::prepareFormOutput(ilEphAssignment::lookupNoticeOfUser($d["id"], $this->part_id)));
     // comment for learner
     $this->tpl->setVariable("TXT_LCOMMENT", $lng->txt("rep_robj_xeph_comment_for_learner"));
     $this->tpl->setVariable("NAME_LCOMMENT", "lcomment[" . $d["id"] . "]");
     $lpcomment = ilEphAssignment::lookupCommentForUser($d["id"], $this->part_id);
     $this->tpl->setVariable("VAL_LCOMMENT", ilUtil::prepareFormOutput($lpcomment));
     // Reports
     $documents = ilEphAssignment::getDeliveredFiles($this->eph_id, $d["id"], $this->part_id);
     foreach ($documents as $document) {
         $ilCtrl->setParameter($this->parent_obj, "filename", $document["filename"]);
         $ilCtrl->setParameter($this->parent_obj, "filetitle", $document["filetitle"]);
         $this->tpl->setCurrentBlock("report");
         $this->tpl->setVariable("DOCUMENT_LINK", $ilCtrl->getLinkTarget($this->parent_obj, "downloadSubmittedFile"));
         $this->tpl->setVariable("DOCUMENT_TITLE", $document["filetitle"]);
         $ilCtrl->setParameter($this->parent_obj, "filename", "");
         $ilCtrl->setParameter($this->parent_obj, "filetitle", "");
         $ilCtrl->setParameter($this->parent_obj, "doc_id", $document["guid"]);
         $report_link = "";
         $visibility_link = "";
         switch ($document["status"]) {
             case 0:
                 if (!$document["guid"]) {
                     $report_link = "<span title=\"" . $lng->txt("rep_robj_xeph_wait_for_sending_msg") . "\">" . $lng->txt("rep_robj_xeph_wait_for_sending") . "</span>";
                 } else {
                     $report_link = "<span title=\"" . $lng->txt("rep_robj_xeph_processing_msg") . "\">" . $lng->txt("rep_robj_xeph_processing") . "</span>";
                     $visibility_link = "<img src=\"./templates/default/images/loader.gif" . "\">";
                 }
                 break;
             case 1:
                 $report_link = "<a href=\"" . $ilCtrl->getLinkTarget($this->parent_obj, "viewReport") . "\">" . $document["percentage"] . "%</a>";
                 $visibility_link = "<a href=\"" . $ilCtrl->getLinkTarget($this->parent_obj, "changeVisibility") . "\">" . "<img src=\"./Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus/templates/images/" . "eye_" . ($document["visibility_index"] == 1 ? "open" : "closed") . ".png" . "\"></a>";
                 break;
             case 2:
                 $report_link = "<a href=\"" . $ilCtrl->getLinkTarget($this->parent_obj, "viewReport") . "\"" . "title=\"" . $lng->txt("rep_robj_xeph_duplicate_document_msg") . "\">" . $lng->txt("rep_robj_xeph_duplicate_document") . "</a>";
                 break;
             case 3:
                 $report_link = "<span title=\"" . $lng->txt("rep_robj_xeph_document_protected_msg") . "\">" . $lng->txt("rep_robj_xeph_document_protected") . "</span>";
                 break;
             case 4:
                 $report_link = "<span title=\"" . $lng->txt("rep_robj_xeph_not_enough_text_msg") . "\">" . $lng->txt("rep_robj_xeph_not_enough_text") . "</span>";
                 break;
             case 5:
                 $report_link = "<span title=\"" . $lng->txt("rep_robj_xeph_no_text_msg") . "\">" . $lng->txt("rep_robj_xeph_no_text") . "</span>";
                 break;
             case 6:
                 $report_link = "<span title=\"" . $lng->txt("rep_robj_xeph_unknown_error_msg") . "\">" . $lng->txt("rep_robj_xeph_unknown_error") . "</span>";
                 break;
             case 99:
                 $report_link = "<span title=\"" . $lng->txt("rep_robj_xeph_" . $document["error"] . "_msg") . "\">" . $lng->txt("rep_robj_xeph_" . $document["error"]) . "</span>";
                 break;
         }
         $this->tpl->setVariable("REPORT_LINK", $report_link);
         $this->tpl->setVariable("VISIBILITY_LINK", $visibility_link);
         $this->tpl->parseCurrentBlock();
     }
     // solved
     $status = ilEphAssignment::lookupStatusOfUser($d["id"], $this->part_id);
     $this->tpl->setVariable("SEL_" . strtoupper($status), ' selected="selected" ');
     $this->tpl->setVariable("TXT_NOTGRADED", $lng->txt("rep_robj_xeph_notgraded"));
     $this->tpl->setVariable("TXT_PASSED", $lng->txt("rep_robj_xeph_passed"));
     $this->tpl->setVariable("TXT_FAILED", $lng->txt("rep_robj_xeph_failed"));
     if (($sd = ilEphAssignment::lookupStatusTimeOfUser($d["id"], $this->part_id)) > 0) {
         $this->tpl->setCurrentBlock("status_date");
         $this->tpl->setVariable("TXT_LAST_CHANGE", $lng->txt("last_change"));
         $this->tpl->setVariable('VAL_STATUS_DATE', ilDatePresentation::formatDate(new ilDateTime($sd, IL_CAL_DATETIME)));
         $this->tpl->parseCurrentBlock();
     }
     switch ($status) {
         case "passed":
             $pic = "scorm/passed.png";
             break;
         case "failed":
             $pic = "scorm/failed.png";
             break;
         default:
             $pic = "scorm/not_attempted.png";
             break;
     }
     $this->tpl->setVariable("IMG_STATUS", ilUtil::getImagePath($pic));
     $this->tpl->setVariable("ALT_STATUS", $lng->txt("rep_robj_xeph_" . $status));
     // mark
     $this->tpl->setVariable("TXT_MARK", $lng->txt("rep_robj_xeph_mark"));
     $this->tpl->setVariable("NAME_MARK", "mark[" . $d["id"] . "]");
     $mark = ilEphAssignment::lookupMarkOfUser($d["id"], $this->part_id);
     $this->tpl->setVariable("VAL_MARK", ilUtil::prepareFormOutput($mark));
     // feedback
     $ilCtrl->setParameter($this->parent_obj, "member_id", $this->part_id);
     if (($ft = ilEphAssignment::lookupFeedbackTimeOfUser($d["id"], $this->part_id)) > 0) {
         $this->tpl->setCurrentBlock("feedback_date");
         $this->tpl->setVariable("TXT_FEEDBACK_MAIL_SENT", sprintf($lng->txt("rep_robj_xeph_sent_at"), ilDatePresentation::formatDate(new ilDateTime($ft, IL_CAL_DATETIME))));
         $this->tpl->parseCurrentBlock();
     }
     $ilCtrl->setParameter($this, "rcp_to", $this->user->getLogin());
     $this->tpl->setVariable("LINK_FEEDBACK", $ilCtrl->getLinkTarget($this->parent_obj, "redirectFeedbackMail"));
     $this->tpl->setVariable("TXT_FEEDBACK", $lng->txt("rep_robj_xeph_send_mail"));
     $ilCtrl->setParameter($this->parent_obj, "rcp_to", "");
     $storage = new ilFSStorageEphorus($this->eph_id, $d["id"]);
     $cnt_files = $storage->countFeedbackFiles($this->part_id);
     $ilCtrl->setParameter($this->parent_obj, "fsmode", "feedbackpart");
     $this->tpl->setVariable("LINK_FILE_FEEDBACK", $ilCtrl->getLinkTargetByClass("ilfilesystemgui", "listFiles"));
     if ($cnt_files == 0) {
         $this->tpl->setVariable("TXT_FILE_FEEDBACK", $lng->txt("rep_robj_xeph_add_feedback_file"));
     } else {
         $this->tpl->setVariable("TXT_FILE_FEEDBACK", $lng->txt("rep_robj_xeph_fb_files") . " (" . $cnt_files . ")");
     }
     $ilCtrl->setParameter($this->parent_obj, "ass_id", $_GET["ass_id"]);
 }
 /**
  * Get assignment body for overview
  */
 function getOverviewBody($a_data)
 {
     global $lng, $ilCtrl, $ilUser;
     $tpl = new ilTemplate("tpl.assignment_body.html", true, true, "Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus");
     include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php";
     $info = new ilInfoScreenGUI(null);
     $info->setTableClass("");
     $not_started_yet = false;
     if ($a_data["start_time"] > 0 && time() - $a_data["start_time"] <= 0) {
         $not_started_yet = true;
     }
     if (!$not_started_yet) {
         // instructions
         $info->addSection($lng->txt("rep_robj_xeph_instruction"));
         $info->addProperty("", nl2br(ilUtil::makeClickable($a_data["instruction"], true)));
     }
     // schedule
     $info->addSection($lng->txt("rep_robj_xeph_schedule"));
     if ($a_data["start_time"] > 0) {
         $info->addProperty($lng->txt("rep_robj_xeph_start_time"), ilDatePresentation::formatDate(new ilDateTime($a_data["start_time"], IL_CAL_UNIX)));
     }
     $info->addProperty($lng->txt("rep_robj_xeph_edit_until"), ilDatePresentation::formatDate(new ilDateTime($a_data["deadline"], IL_CAL_UNIX)));
     $time_str = $this->getTimeString($a_data["deadline"]);
     if (!$not_started_yet) {
         $info->addProperty($lng->txt("rep_robj_xeph_time_to_send"), "<b>" . $time_str . "</b>");
     }
     // public submissions
     if ($this->eph->getShowSubmissions()) {
         $ilCtrl->setParameterByClass("ilobjephorusgui", "ass_id", $a_data["id"]);
         if ($a_data["deadline"] - time() <= 0) {
             $link = '<a class="submit" href="' . $ilCtrl->getLinkTargetByClass("ilobjephorusgui", "listPublicSubmissions") . '">' . $lng->txt("rep_robj_xeph_list_submission") . '</a>';
             $info->addProperty($lng->txt("rep_robj_xeph_public_submission"), $link);
         } else {
             $info->addProperty($lng->txt("rep_robj_xeph_public_submission"), $lng->txt("rep_robj_xeph_msg_public_submission"));
         }
         $ilCtrl->setParameterByClass("ilobjephorusgui", "ass_id", $_GET["ass_id"]);
     }
     $ilCtrl->setParameterByClass("ilobjephorusgui", "ass_id", $a_data["id"]);
     if (!$not_started_yet) {
         // download files
         $files = ilEphAssignment::getFiles($a_data["eph_id"], $a_data["id"]);
         if (count($files) > 0) {
             $info->addSection($lng->txt("rep_robj_xeph_files"));
             foreach ($files as $file) {
                 $ilCtrl->setParameterByClass("ilobjephorusgui", "file", urlencode($file["name"]));
                 $info->addProperty($file["name"], $lng->txt("rep_robj_xeph_download"), $ilCtrl->getLinkTargetByClass("ilobjephorusgui", "downloadFile"));
                 $ilCtrl->setParameterByClass("ilobjephorusgui", "file", "");
             }
         }
         // submission
         $info->addSection($lng->txt("rep_robj_xeph_your_submission"));
         $delivered_files = ilEphAssignment::getDeliveredFiles($a_data["eph_id"], $a_data["id"], $ilUser->getId());
         $times_up = false;
         if ($a_data["deadline"] - time() < 0) {
             $times_up = true;
         }
         $titles = array();
         foreach ($delivered_files as $file) {
             $titles[] = $file["filetitle"];
         }
         $files_str = implode($titles, ", ");
         if ($files_str == "") {
             $files_str = $lng->txt("rep_robj_xeph_message_no_delivered_files");
         }
         $ilCtrl->setParameterByClass("ilobjephorusgui", "ass_id", $a_data["id"]);
         if (!$times_up) {
             $files_str .= ' <a class="submit" href="' . $ilCtrl->getLinkTargetByClass("ilobjephorusgui", "submissionScreen") . '">' . (count($titles) == 0 ? $lng->txt("rep_robj_xeph_hand_in") : $lng->txt("rep_robj_xeph_edit_submission")) . '</a>';
         } else {
             if (count($titles) > 0) {
                 $files_str .= ' <a class="submit" href="' . $ilCtrl->getLinkTargetByClass("ilobjephorusgui", "submissionScreen") . '">' . $lng->txt("rep_robj_xeph_already_delivered_files") . '</a>';
             }
         }
         $info->addProperty($lng->txt("rep_robj_xeph_files_returned"), $files_str);
         $last_sub = ilEphAssignment::getLastSubmission($a_data["id"], $ilUser->getId());
         if ($last_sub) {
             $last_sub = ilDatePresentation::formatDate(new ilDateTime($last_sub, IL_CAL_DATETIME));
         } else {
             $last_sub = "---";
         }
         if ($last_sub != "---") {
             $info->addProperty($lng->txt("rep_robj_xeph_last_submission"), $last_sub);
         }
         // feedback from tutor
         $storage = new ilFSStorageEphorus($a_data["eph_id"], $a_data["id"]);
         $cnt_files = $storage->countFeedbackFiles($ilUser->getId());
         $lpcomment = ilEphAssignment::lookupCommentForUser($a_data["id"], $ilUser->getId());
         $mark = ilEphAssignment::lookupMarkOfUser($a_data["id"], $ilUser->getId());
         $status = ilEphAssignment::lookupStatusOfUser($a_data["id"], $ilUser->getId());
         if ($lpcomment != "" || $mark != "" || $status != "notgraded" || $cnt_files > 0) {
             $info->addSection($lng->txt("rep_robj_xeph_feedback_from_tutor"));
             if ($lpcomment != "") {
                 $info->addProperty($lng->txt("rep_robj_xeph_comment"), $lpcomment);
             }
             if ($mark != "") {
                 $info->addProperty($lng->txt("rep_robj_xeph_mark"), $mark);
             }
             if ($status == "") {
                 $info->addProperty($lng->txt("rep_robj_xeph_status"), $lng->txt("rep_robj_xeph_message_no_delivered_files"));
             } else {
                 if ($status != "notgraded") {
                     $img = '<img border="0" src="' . ilUtil::getImagePath("scorm/" . $status . ".png") . '" ' . ' alt="' . $lng->txt("rep_robj_xeph_" . $status) . '" title="' . $lng->txt("rep_robj_xeph_" . $status) . '" style="vertical-align:middle;"/>';
                     $info->addProperty($lng->txt("rep_robj_xeph_status"), $img . " " . $lng->txt("rep_robj_xeph_" . $status));
                 }
             }
             if ($cnt_files > 0) {
                 $info->addSection($lng->txt("fb_files"));
                 $files = $storage->getFeedbackFiles($ilUser->getId());
                 foreach ($files as $file) {
                     $ilCtrl->setParameterByClass("ilobjephorusgui", "file", urlencode($file));
                     $info->addProperty($file, $lng->txt("rep_robj_xeph_download"), $ilCtrl->getLinkTargetByClass("ilobjephorusgui", "downloadFeedbackFile"));
                     $ilCtrl->setParameter($this, "file", "");
                 }
             }
         }
     }
     $tpl->setVariable("CONTENT", $info->getHTML());
     return $tpl->get();
 }