/**
  * Constructor
  */
 function ilEphAssignmentTableGUI($a_parent_obj, $a_parent_cmd, $a_eph)
 {
     global $ilCtrl, $lng, $ilAccess;
     $this->eph = $a_eph;
     $this->setId("ephass" . $this->eph->getId());
     parent::__construct($a_parent_obj, $a_parent_cmd);
     $this->setTitle($lng->txt("rep_robj_xeph_assignments"));
     $this->setTopCommands(true);
     // if you add pagination and disable the unlimited setting:
     // fix saving of ordering of single pages!
     $this->setLimit(9999);
     $this->addColumn("", "", "1", true);
     $this->addColumn($lng->txt("title"), "title");
     $this->addColumn($lng->txt("rep_robj_xeph_presentation_order"), "order_val");
     $this->addColumn($lng->txt("rep_robj_xeph_start_time"), "start_time");
     $this->addColumn($lng->txt("rep_robj_xeph_deadline"), "deadline");
     $this->addColumn($lng->txt("rep_robj_xeph_mandatory"), "mandatory");
     $this->addColumn($lng->txt("rep_robj_xeph_instruction"), "", "40%");
     $this->addColumn($lng->txt("actions"));
     $this->setDefaultOrderField("val_order");
     $this->setDefaultOrderDirection("asc");
     $this->setEnableHeader(true);
     $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
     $this->setRowTemplate("tpl.eph_assignments_row.html", "Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus");
     $this->setEnableTitle(true);
     $this->setSelectAllCheckbox("id");
     $this->addMultiCommand("confirmDeleteAssignment", $lng->txt("delete"));
     $this->addCommandButton("orderAssignmentsByDeadline", $lng->txt("rep_robj_xeph_order_by_deadline"));
     $this->addCommandButton("saveAssignmentsOrder", $lng->txt("rep_robj_xeph_save_order"));
     include_once "./Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus/classes/class.ilEphAssignment.php";
     $data = ilEphAssignment::getAssignmentDataOfEphorus($this->eph->getId());
     $this->setData($data);
 }
 /**
  * Assign a user to the ephorus
  *
  * @param	int		$a_user_id		user id
  */
 function assignMember($a_user_id)
 {
     global $ilDB;
     $tmp_user = ilObjectFactory::getInstanceByObjId($a_user_id);
     $tmp_user->addDesktopItem($this->getRefId(), "eph");
     $ilDB->manipulate("DELETE FROM rep_robj_xeph_members " . "WHERE obj_id = " . $ilDB->quote($this->getObjId(), "integer") . " " . "AND user_id = " . $ilDB->quote($a_user_id, "integer") . " ");
     // @todo: some of this fields may not be needed anymore
     $ilDB->manipulateF("INSERT INTO rep_robj_xeph_members (obj_id, user_id, status, sent, feedback) " . " VALUES (%s,%s,%s,%s,%s)", array("integer", "integer", "text", "integer", "integer"), array($this->getObjId(), $a_user_id, 'notgraded', 0, 0));
     include_once "./Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus/classes/class.ilEphAssignment.php";
     ilEphAssignment::createNewUserRecords($a_user_id, $this->getObjId());
     $this->read();
     //include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
     //ilLPStatusWrapper::_updateStatus($this->getObjId(), $a_user_id);
     return true;
 }
 /**
  * Fill table row
  */
 protected function fillRow($member)
 {
     global $lng, $ilCtrl;
     include_once "./Services/Object/classes/class.ilObjectFactory.php";
     $member_id = $member["user_id"];
     if (!($mem_obj = ilObjectFactory::getInstanceByObjId($member_id, false))) {
         //continue;
     }
     // name and login
     $this->tpl->setVariable("TXT_NAME", $member["name"]);
     $this->tpl->setVariable("TXT_LOGIN", "[" . $member["login"] . "]");
     // image
     $this->tpl->setVariable("USR_IMAGE", $mem_obj->getPersonalPicturePath("xxsmall"));
     $this->tpl->setVariable("USR_ALT", $lng->txt("personal_picture"));
     // submission:
     // see if files have been resubmmited after solved
     $last_sub = ilEphAssignment::getLastSubmission($this->ass_id, $member_id);
     if ($last_sub) {
         $last_sub = ilDatePresentation::formatDate(new ilDateTime($last_sub, IL_CAL_DATETIME));
     } else {
         $last_sub = "---";
     }
     // 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, $this->ass_id, $member_id));
     $this->tpl->setVariable("VAL_SUBMITTED_FILES", $sub_cnt);
     // download command
     $ilCtrl->setParameter($this->parent_obj, "member_id", $member_id);
     if ($sub_cnt > 0) {
         $this->tpl->setCurrentBlock("download_link");
         $this->tpl->setVariable("LINK_DOWNLOAD", $ilCtrl->getLinkTarget($this->parent_obj, "downloadReturned"));
         $this->tpl->setVariable("TXT_DOWNLOAD", $lng->txt("rep_robj_xeph_download_files"));
         $this->tpl->parseCurrentBlock();
     }
     $this->tpl->parseCurrentBlock();
 }
 /**
  * Create member status record for a new participant for all assignments
  */
 static function createNewUserRecords($a_user_id, $a_eph_id)
 {
     global $ilDB;
     $ass_data = ilEphAssignment::getAssignmentDataOfEphorus($a_eph_id);
     foreach ($ass_data as $ass) {
         $ilDB->replace("rep_robj_xeph_ass_stat", array("ass_id" => array("integer", $ass["id"]), "user_id" => array("integer", $a_user_id)), array("status" => array("text", "notgraded")));
     }
 }
 function viewReport()
 {
     global $ilCtrl, $ilTabs, $lng, $tpl;
     include_once "./Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus/classes/class.ilEphorusReportTableGUI.php";
     include_once "./Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus/classes/class.ilEphorusReportGUI.php";
     include_once "./Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus/include/class.DLEApi.php";
     include_once "./Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus/include/class.EphorusApi.php";
     $document = DLEApi::getDocument($_GET['doc_id']);
     $mode = isset($_GET["mode"]) ? $_GET["mode"] : "summary";
     $ephorus_report = new EphorusReport($_GET['doc_id'], $mode);
     $tpl->setTitle(sprintf($lng->txt("rep_robj_xeph_report_for assignment"), ilEphAssignment::lookupTitle($_GET["ass_id"])));
     $tpl->setDescription("");
     $tpl->addCss($this->object->plugin->getStyleSheetLocation("report.css"));
     $ilTabs->clearTargets();
     $ilTabs->setBackTarget($lng->txt("back"), $ilCtrl->getLinkTarget($this, "showSubmissions"));
     $eph_tab = new ilEphorusReportHeaderTableGUI($this, "viewReport", $document);
     $header = $eph_tab->getHTML() . "<br />";
     $matches = "";
     $eph_content = new ilEphorusReportGUI($this);
     if ($document->status == 1) {
         $pre_header = "<div class=\"small xephModeSelection\">";
         $ilCtrl->setParameter($this, "mode", "summary");
         $pre_header .= ($mode == "summary" ? "<span style=>Summary</span>" : "<a href=\"" . $ilCtrl->getLinkTarget($this, "viewReport") . "\">Summary</a>") . " / ";
         $ilCtrl->setParameter($this, "mode", "detailed");
         $pre_header .= $mode == "detailed" ? "<span>Detailed</span>" : "<a href=\"" . $ilCtrl->getLinkTarget($this, "viewReport") . "\">Detailed</a>";
         $header = $pre_header . "</div>" . $header;
         $ilCtrl->setParameter($this, "mode", $mode);
         $results = DLEApi::getResults($document->guid);
         if ($mode == "detailed") {
             $js = "\$('input[name=\"diff\"]').change(function() {\n                    \$(this).parents('form').append('<input type=\"hidden\" name=\"cmd[viewReport]\">');\n                    \$(this).parents('form').submit();\n                 });";
             $tpl->addOnLoadCode($js);
             $result = isset($_POST['diff']) ? $_POST["diff"] : reset($results)->guid;
             $eph_matches = new ilEphorusReportMatchesDetailedTableGUI($this, "viewReport", $document, $ephorus_report->getHeader($result));
             $matches = $eph_matches->getHTML() . "<br />";
             $content = $eph_content->getReport($ephorus_report->getReport(array(), $results[$result]->comparison));
         } else {
             $guids = isset($_POST['guids_use']) ? $_POST["guids_use"] : array_keys($results);
             $eph_matches = new ilEphorusReportMatchesTableGUI($this, "viewReport", $document, $ephorus_report->getHeader($guids));
             $matches = $eph_matches->getHTML() . "<br />";
             $content = $eph_content->getReport($ephorus_report->getReport($guids));
         }
     } else {
         $content = $eph_content->getReport($ephorus_report->getReport());
     }
     $tpl->setContent($header . $matches . $content);
 }
 /**
  * Get delivered files
  *
  * @param
  * @return
  */
 function getDeliveredFiles()
 {
     global $ilUser;
     $files = ilEphAssignment::getDeliveredFiles($this->eph_id, $this->ass_id, $ilUser->getId());
     return $files;
 }
 /**
  * Fill table row
  */
 protected function fillRow($member)
 {
     global $lng, $ilCtrl;
     include_once "./Services/Object/classes/class.ilObjectFactory.php";
     $member_id = $member["user_id"];
     if (!($mem_obj = ilObjectFactory::getInstanceByObjId($member_id, false))) {
         return;
     }
     // mail sent
     if ($this->sent_col) {
         if (ilEphAssignment::lookupStatusSentOfUser($this->ass_id, $member_id)) {
             $this->tpl->setCurrentBlock("mail_sent");
             if (($st = ilEphAssignment::lookupSentTimeOfUser($this->ass_id, $member_id)) > 0) {
                 $this->tpl->setVariable("TXT_MAIL_SENT", sprintf($lng->txt("rep_robj_xeph_sent_at"), ilDatePresentation::formatDate(new ilDateTime($st, IL_CAL_DATE))));
             } else {
                 $this->tpl->setVariable("TXT_MAIL_SENT", $lng->txt("sent"));
             }
             $this->tpl->parseCurrentBlock();
         } else {
             $this->tpl->setCurrentBlock("mail_sent");
             $this->tpl->setVariable("TXT_MAIL_SENT", "&nbsp;");
             $this->tpl->parseCurrentBlock();
         }
     }
     // checkbox
     $this->tpl->setVariable("VAL_CHKBOX", ilUtil::formCheckbox(0, "member[{$member_id}]", 1));
     $this->tpl->setVariable("VAL_ID", $member_id);
     // name and login
     $this->tpl->setVariable("TXT_NAME", $member["name"]);
     $this->tpl->setVariable("TXT_LOGIN", "[" . $member["login"] . "]");
     // image
     $this->tpl->setVariable("USR_IMAGE", $mem_obj->getPersonalPicturePath("xxsmall"));
     $this->tpl->setVariable("USR_ALT", $lng->txt("personal_picture"));
     // submission:
     // see if files have been resubmmited after solved
     $last_sub = ilEphAssignment::getLastSubmission($this->ass_id, $member_id);
     if ($last_sub) {
         $last_sub = ilDatePresentation::formatDate(new ilDateTime($last_sub, IL_CAL_DATETIME));
     } else {
         $last_sub = "---";
     }
     if (ilEphAssignment::lookupUpdatedSubmission($this->ass_id, $member_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, $this->ass_id, $member_id));
     $new = ilEphAssignment::lookupNewFiles($this->ass_id, $member_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, "member_id", $member_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[{$member_id}]");
     $this->tpl->setVariable("VAL_NOTE", ilUtil::prepareFormOutput(ilEphAssignment::lookupNoticeOfUser($this->ass_id, $member_id)));
     // comment for learner
     $this->tpl->setVariable("TXT_LCOMMENT", $lng->txt("rep_robj_xeph_comment_for_learner"));
     $this->tpl->setVariable("NAME_LCOMMENT", "lcomment[{$member_id}]");
     $lpcomment = ilEphAssignment::lookupCommentForUser($this->ass_id, $member_id);
     $this->tpl->setVariable("VAL_LCOMMENT", ilUtil::prepareFormOutput($lpcomment));
     // Reports
     $documents = ilEphAssignment::getDeliveredFiles($this->eph_id, $this->ass_id, $member_id);
     foreach ($documents as $document) {
         $ilCtrl->setParameter($this->parent_obj, "filename", $document["filename"]);
         $ilCtrl->setParameter($this->parent_obj, "filetitle", $document["filetitle"]);
         $ilCtrl->setParameter($this->parent_obj, "part_id", $member_id);
         $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, "part_id", "");
         $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
     //$this->tpl->setVariable("CHKBOX_SOLVED",
     //ilUtil::formCheckbox($this->eph->members_obj->getStatusByMember($member_id),"solved[$member_id]",1));
     $status = ilEphAssignment::lookupStatusOfUser($this->ass_id, $member_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($this->ass_id, $member_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[{$member_id}]");
     $mark = ilEphAssignment::lookupMarkOfUser($this->ass_id, $member_id);
     $this->tpl->setVariable("VAL_MARK", ilUtil::prepareFormOutput($mark));
     // feedback
     $ilCtrl->setParameter($this->parent_obj, "member_id", $member_id);
     if (($ft = ilEphAssignment::lookupFeedbackTimeOfUser($this->ass_id, $member_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();
     }
     // feedback mail
     $ilCtrl->setParameter($this, "rcp_to", $mem_obj->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", "");
     // file feedback
     $cnt_files = $this->storage->countFeedbackFiles($member_id);
     $ilCtrl->setParameter($this->parent_obj, "fsmode", "feedback");
     $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 . ")");
     }
     $this->tpl->parseCurrentBlock();
 }
 /**
  * Fill table row
  */
 protected function fillRow($d)
 {
     global $lng, $ilCtrl;
     $user_id = $d["user_id"];
     foreach ($this->ass_data as $ass) {
         // grade
         $this->tpl->setCurrentBlock("grade");
         $status = ilEphAssignment::lookupStatusOfUser($ass["id"], $user_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"));
         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
         $mark = ilEphAssignment::lookupMarkOfUser($ass["id"], $user_id);
         $this->tpl->setVariable("VAL_ONLY_MARK", $mark);
         $this->tpl->parseCurrentBlock();
     }
     // exercise total
     // mark input
     $this->tpl->setCurrentBlock("mark_input");
     $this->tpl->setVariable("TXT_MARK", $lng->txt("rep_robj_xeph_mark"));
     $this->tpl->setVariable("NAME_MARK", "mark[" . $user_id . "]");
     include_once 'Services/Tracking/classes/class.ilLPMarks.php';
     $mark = ilLPMarks::_lookupMark($user_id, $this->eph_id);
     $this->tpl->setVariable("VAL_MARK", ilUtil::prepareFormOutput($mark));
     $this->tpl->parseCurrentBlock();
     $this->tpl->setCurrentBlock("grade");
     $status = ilEphorusMembers::_lookupStatus($this->eph_id, $user_id);
     $this->tpl->setVariable("SEL_" . strtoupper($status), ' selected="selected" ');
     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("eph_mark"));
       $this->tpl->setVariable("NAME_MARK",
           "mark[".$d["id"]."]");
       $mark = ilEphAssignment::lookupMarkOfUser($ass["id"], $user_id);
       $this->tpl->setVariable("VAL_MARK",
           ilUtil::prepareFormOutput($mark));*/
     $this->tpl->parseCurrentBlock();
     // name
     $this->tpl->setVariable("TXT_NAME", $d["lastname"] . ", " . $d["firstname"] . " [" . $d["login"] . "]");
     $this->tpl->setVariable("VAL_ID", $user_id);
     $ilCtrl->setParameter($this->parent_obj, "part_id", $user_id);
     $this->tpl->setVariable("LINK_NAME", $ilCtrl->getLinkTarget($this->parent_obj, "showParticipant"));
     // comment
     $this->tpl->setVariable("ID_COMMENT", $user_id);
     $c = ilLPMarks::_lookupComment($user_id, $this->eph_id);
     $this->tpl->setVariable("VAL_COMMENT", ilUtil::prepareFormOutput($c));
 }
 /**
  * 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();
 }
 /**
  * Exports grades as ephel
  */
 function exportGradesExcel()
 {
     include_once "./Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus/classes/class.ilEphAssignment.php";
     $ass_data = ilEphAssignment::getAssignmentDataOfEphorus($this->getId());
     include_once "./Services/Excel/classes/class.ilExcelWriterAdapter.php";
     $ephelfile = ilUtil::ilTempnam();
     $adapter = new ilExcelWriterAdapter($ephelfile, FALSE);
     $workbook = $adapter->getWorkbook();
     $workbook->setVersion(8);
     // Use Excel97/2000 Format
     include_once "./Services/Excel/classes/class.ilExcelUtils.php";
     //
     // status
     //
     $mainworksheet = $workbook->addWorksheet();
     // header row
     $mainworksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("name")));
     $cnt = 1;
     foreach ($ass_data as $ass) {
         $mainworksheet->writeString(0, $cnt, $cnt);
         $cnt++;
     }
     $mainworksheet->writeString(0, $cnt, ilExcelUtils::_convert_text($this->lng->txt("rep_robj_xeph_total_exc")));
     // data rows
     $this->mem_obj = new ilEphorusMembers($this);
     $getmems = $this->mem_obj->getMembers();
     $mems = array();
     foreach ($getmems as $user_id) {
         $mems[$user_id] = ilObjUser::_lookupName($user_id);
     }
     $mems = ilUtil::sortArray($mems, "lastname", "asc", false, true);
     $data = array();
     $row_cnt = 1;
     foreach ($mems as $user_id => $d) {
         $col_cnt = 1;
         // name
         $mainworksheet->writeString($row_cnt, 0, ilExcelUtils::_convert_text($d["lastname"] . ", " . $d["firstname"] . " [" . $d["login"] . "]"));
         reset($ass_data);
         foreach ($ass_data as $ass) {
             $status = ilEphAssignment::lookupStatusOfUser($ass["id"], $user_id);
             $mainworksheet->writeString($row_cnt, $col_cnt, ilExcelUtils::_convert_text($this->lng->txt("rep_robj_xeph_" . $status)));
             $col_cnt++;
         }
         // total status
         $status = ilEphorusMembers::_lookupStatus($this->getId(), $user_id);
         $mainworksheet->writeString($row_cnt, $col_cnt, ilExcelUtils::_convert_text($this->lng->txt("rep_robj_xeph_" . $status)));
         $row_cnt++;
     }
     //
     // mark
     //
     $worksheet2 = $workbook->addWorksheet();
     // header row
     $worksheet2->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("name")));
     $cnt = 1;
     foreach ($ass_data as $ass) {
         $worksheet2->writeString(0, $cnt, $cnt);
         $cnt++;
     }
     $worksheet2->writeString(0, $cnt, ilExcelUtils::_convert_text($this->lng->txt("rep_robj_xeph_total_exc")));
     // data rows
     $data = array();
     $row_cnt = 1;
     reset($mems);
     foreach ($mems as $user_id => $d) {
         $col_cnt = 1;
         $d = ilObjUser::_lookupName($user_id);
         // name
         $worksheet2->writeString($row_cnt, 0, ilExcelUtils::_convert_text($d["lastname"] . ", " . $d["firstname"] . " [" . $d["login"] . "]"));
         reset($ass_data);
         foreach ($ass_data as $ass) {
             $worksheet2->writeString($row_cnt, $col_cnt, ilExcelUtils::_convert_text(ilEphAssignment::lookupMarkOfUser($ass["id"], $user_id)));
             $col_cnt++;
         }
         // total mark
         include_once 'Services/Tracking/classes/class.ilLPMarks.php';
         $worksheet2->writeString($row_cnt, $col_cnt, ilExcelUtils::_convert_text(ilLPMarks::_lookupMark($user_id, $this->getId())));
         $row_cnt++;
     }
     $workbook->close();
     $eph_name = ilUtil::getASCIIFilename(preg_replace("/\\s/", "_", $this->getTitle()));
     ilUtil::deliverFile($ephelfile, $eph_name . ".xls", "application/vnd.ms-ephel");
 }