/** * Fill table row */ protected function fillRow($member) { global $lng, $ilCtrl; include_once "./Services/Object/classes/class.ilObjectFactory.php"; $member_id = $member["usr_id"]; if (!($mem_obj = ilObjectFactory::getInstanceByObjId($member_id, false))) { return; } // mail sent if ($this->sent_col) { if (ilExAssignment::lookupStatusSentOfUser($this->ass_id, $member_id)) { $this->tpl->setCurrentBlock("mail_sent"); if (($st = ilExAssignment::lookupSentTimeOfUser($this->ass_id, $member_id)) > 0) { $this->tpl->setVariable("TXT_MAIL_SENT", sprintf($lng->txt("exc_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", " "); $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 if (!isset($member["team"])) { $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")); } else { $this->tpl->setCurrentBlock("team_member"); asort($member["team"]); foreach ($member["team"] as $member_name) { $this->tpl->setVariable("TXT_MEMBER_NAME", $member_name); $this->tpl->parseCurrentBlock(); } $ilCtrl->setParameter($this->parent_obj, "lmem", $member_id); $this->tpl->setVariable("HREF_LOG", $ilCtrl->getLinkTarget($this->parent_obj, "showTeamLog")); $this->tpl->setVariable("TXT_LOG", $lng->txt("exc_team_log")); $ilCtrl->setParameter($this->parent_obj, "lmem", ""); } // submission: // see if files have been resubmmited after solved $last_sub = ilExAssignment::getLastSubmission($this->ass_id, $member_id); if ($last_sub) { $last_sub = ilDatePresentation::formatDate(new ilDateTime($last_sub, IL_CAL_DATETIME)); } else { $last_sub = "---"; } if (ilExAssignment::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("exc_last_submission")); switch ($this->type) { case ilExAssignment::TYPE_UPLOAD_TEAM: // data is merged by team - see above // fallthrough // data is merged by team - see above // fallthrough case ilExAssignment::TYPE_UPLOAD: // nr of submitted files $this->tpl->setVariable("TXT_SUBMITTED_FILES", $lng->txt("exc_files_returned")); //$sub_cnt = count($this->exc->getDeliveredFiles($member_id, $this->ass_id)); $sub_cnt = count(ilExAssignment::getDeliveredFiles($this->exc_id, $this->ass_id, $member_id)); $new = ilExAssignment::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("exc_download_files")); } else { $this->tpl->setVariable("TXT_DOWNLOAD", $lng->txt("exc_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("exc_download_new")); $this->tpl->parseCurrentBlock(); } } break; case ilExAssignment::TYPE_BLOG: $has_submitted = false; $this->tpl->setVariable("TXT_SUBMITTED_FILES", $lng->txt("exc_blog_returned")); $blogs = ilExAssignment::getDeliveredFiles($this->exc_id, $this->ass_id, $member_id); if ($blogs) { $blogs = array_pop($blogs); if ($blogs && substr($blogs["filename"], -1) != "/") { $has_submitted = true; $this->tpl->setVariable("VAL_SUBMITTED_FILES", 1); $ilCtrl->setParameter($this->parent_obj, "member_id", $member_id); $this->tpl->setCurrentBlock("download_link"); $this->tpl->setVariable("LINK_DOWNLOAD", $ilCtrl->getLinkTarget($this->parent_obj, "downloadReturned")); $this->tpl->setVariable("TXT_DOWNLOAD", $lng->txt("exc_download_files")); $this->tpl->parseCurrentBlock(); } } if (!$has_submitted) { $this->tpl->setVariable("VAL_SUBMITTED_FILES", "---"); } break; case ilExAssignment::TYPE_PORTFOLIO: $has_submitted = false; $this->tpl->setVariable("TXT_SUBMITTED_FILES", $lng->txt("exc_portfolio_returned")); $portfolios = ilExAssignment::getDeliveredFiles($this->exc_id, $this->ass_id, $member_id); if ($portfolios) { $portfolios = array_pop($portfolios); if ($portfolios && substr($portfolios["filename"], -1) != "/") { $has_submitted = true; $this->tpl->setVariable("VAL_SUBMITTED_FILES", 1); $ilCtrl->setParameter($this->parent_obj, "member_id", $member_id); $this->tpl->setCurrentBlock("download_link"); $this->tpl->setVariable("LINK_DOWNLOAD", $ilCtrl->getLinkTarget($this->parent_obj, "downloadReturned")); $this->tpl->setVariable("TXT_DOWNLOAD", $lng->txt("exc_download_files")); $this->tpl->parseCurrentBlock(); } } if (!$has_submitted) { $this->tpl->setVariable("VAL_SUBMITTED_FILES", "---"); } break; } // note $this->tpl->setVariable("TXT_NOTE", $lng->txt("note")); $this->tpl->setVariable("NAME_NOTE", "notice[{$member_id}]"); $this->tpl->setVariable("VAL_NOTE", ilUtil::prepareFormOutput(ilExAssignment::lookupNoticeOfUser($this->ass_id, $member_id))); // comment for learner $this->tpl->setVariable("TXT_LCOMMENT", $lng->txt("exc_comment_for_learner")); $this->tpl->setVariable("NAME_LCOMMENT", "lcomment[{$member_id}]"); $lpcomment = ilExAssignment::lookupCommentForUser($this->ass_id, $member_id); $this->tpl->setVariable("VAL_LCOMMENT", ilUtil::prepareFormOutput($lpcomment)); // solved //$this->tpl->setVariable("CHKBOX_SOLVED", // ilUtil::formCheckbox($this->exc->members_obj->getStatusByMember($member_id),"solved[$member_id]",1)); $status = ilExAssignment::lookupStatusOfUser($this->ass_id, $member_id); $this->tpl->setVariable("SEL_" . strtoupper($status), ' selected="selected" '); $this->tpl->setVariable("TXT_NOTGRADED", $lng->txt("exc_notgraded")); $this->tpl->setVariable("TXT_PASSED", $lng->txt("exc_passed")); $this->tpl->setVariable("TXT_FAILED", $lng->txt("exc_failed")); if (($sd = ilExAssignment::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("exc_" . $status)); // mark $this->tpl->setVariable("TXT_MARK", $lng->txt("exc_mark")); $this->tpl->setVariable("NAME_MARK", "mark[{$member_id}]"); $mark = ilExAssignment::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 = ilExAssignment::lookupFeedbackTimeOfUser($this->ass_id, $member_id)) > 0) { $this->tpl->setCurrentBlock("feedback_date"); $this->tpl->setVariable("TXT_FEEDBACK_MAIL_SENT", sprintf($lng->txt("exc_sent_at"), ilDatePresentation::formatDate(new ilDateTime($ft, IL_CAL_DATETIME)))); $this->tpl->parseCurrentBlock(); } // feedback mail $this->tpl->setVariable("LINK_FEEDBACK", $ilCtrl->getLinkTarget($this->parent_obj, "redirectFeedbackMail")); $this->tpl->setVariable("TXT_FEEDBACK", $lng->txt("exc_send_mail")); if ($this->type == ilExAssignment::TYPE_UPLOAD_TEAM) { $feedback_id = "t" . $member["team_id"]; } else { $feedback_id = $member_id; } // file feedback $cnt_files = $this->storage->countFeedbackFiles($feedback_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("exc_add_feedback_file")); } else { $this->tpl->setVariable("TXT_FILE_FEEDBACK", $lng->txt("exc_fb_files") . " (" . $cnt_files . ")"); } $this->tpl->parseCurrentBlock(); }
public static function getDownloadedFilesInfoForTableGUIS($a_parent_obj, $a_exercise_id, $a_ass_type, $a_ass_id, $a_user_id, $a_parent_cmd = null) { global $lng, $ilCtrl; $result = array(); $result["files"]["count"] = "---"; $ilCtrl->setParameter($a_parent_obj, "ass_id", $a_ass_id); // submission: // see if files have been resubmmited after solved $last_sub = self::getLastSubmission($a_ass_id, $a_user_id); if ($last_sub) { $last_sub = ilDatePresentation::formatDate(new ilDateTime($last_sub, IL_CAL_DATETIME)); } else { $last_sub = "---"; } if (ilExAssignment::lookupUpdatedSubmission($a_ass_id, $a_user_id) == 1) { $last_sub = "<b>" . $last_sub . "</b>"; } $result["last_submission"]["txt"] = $lng->txt("exc_last_submission"); $result["last_submission"]["value"] = $last_sub; // assignment type specific switch ($a_ass_type) { case ilExAssignment::TYPE_UPLOAD_TEAM: // data is merged by team - see above // fallthrough // data is merged by team - see above // fallthrough case ilExAssignment::TYPE_UPLOAD: // nr of submitted files $result["files"]["txt"] = $lng->txt("exc_files_returned"); $sub_cnt = count(ilExAssignment::getDeliveredFiles($a_exercise_id, $a_ass_id, $a_user_id)); $new = ilExAssignment::lookupNewFiles($a_ass_id, $a_user_id); if (count($new) > 0) { $sub_cnt .= " " . sprintf($lng->txt("cnt_new"), count($new)); } $result["files"]["count"] = $sub_cnt; // download command $ilCtrl->setParameter($a_parent_obj, "member_id", $a_user_id); if ($sub_cnt > 0) { $result["files"]["download_url"] = $ilCtrl->getLinkTarget($a_parent_obj, "downloadReturned"); if (count($new) <= 0) { $result["files"]["download_txt"] = $lng->txt("exc_download_files"); } else { $result["files"]["download_txt"] = $lng->txt("exc_download_all"); } // download new files only if (count($new) > 0) { $result["files"]["download_new_url"] = $ilCtrl->getLinkTarget($a_parent_obj, "downloadNewReturned"); $result["files"]["download_new_txt"] = $lng->txt("exc_download_new"); } } break; case ilExAssignment::TYPE_BLOG: $result["files"]["txt"] = $lng->txt("exc_blog_returned"); $blogs = ilExAssignment::getDeliveredFiles($a_exercise_id, $a_ass_id, $a_user_id); if ($blogs) { $blogs = array_pop($blogs); if ($blogs && substr($blogs["filename"], -1) != "/") { $result["files"]["count"] = 1; $ilCtrl->setParameter($a_parent_obj, "member_id", $a_user_id); $result["files"]["download_url"] = $ilCtrl->getLinkTarget($a_parent_obj, "downloadReturned"); $ilCtrl->setParameter($a_parent_obj, "member_id", ""); $result["files"]["download_txt"] = $lng->txt("exc_download_files"); } } break; case ilExAssignment::TYPE_PORTFOLIO: $result["files"]["txt"] = $lng->txt("exc_portfolio_returned"); $portfolios = ilExAssignment::getDeliveredFiles($a_exercise_id, $a_ass_id, $a_user_id); if ($portfolios) { $portfolios = array_pop($portfolios); if ($portfolios && substr($portfolios["filename"], -1) != "/") { $result["files"]["count"] = 1; $ilCtrl->setParameter($a_parent_obj, "member_id", $a_user_id); $result["files"]["download_url"] = $ilCtrl->getLinkTarget($a_parent_obj, "downloadReturned"); $ilCtrl->setParameter($a_parent_obj, "member_id", ""); $result["files"]["download_txt"] = $lng->txt("exc_download_files"); } } break; case ilExAssignment::TYPE_TEXT: $result["files"]["txt"] = $lng->txt("exc_files_returned_text"); $files = ilExAssignment::getDeliveredFiles($a_exercise_id, $a_ass_id, $a_user_id); if ($files) { $result["files"]["count"] = 1; $files = array_shift($files); if (trim($files["atext"])) { // #11397 if ($a_parent_cmd) { $ilCtrl->setParameter($a_parent_obj, "grd", $a_parent_cmd == "members" ? 1 : 2); } $ilCtrl->setParameter($a_parent_obj, "member_id", $a_user_id); $result["files"]["download_url"] = $ilCtrl->getLinkTarget($a_parent_obj, "showAssignmentText"); $ilCtrl->setParameter($a_parent_obj, "member_id", ""); $ilCtrl->setParameter($a_parent_obj, "grd", ""); $result["files"]["download_txt"] = $lng->txt("exc_text_assignment_show"); } } break; } return $result; }
/** * Fill table row */ protected function fillRow($d) { global $lng, $ilCtrl; $this->tpl->setVariable("TXT_ASS_TITLE", $d["title"]); if ($d["type"] == ilExAssignment::TYPE_UPLOAD_TEAM) { $members = ilExAssignment::getTeamMembersByAssignmentId($d["id"], $this->part_id); $this->tpl->setCurrentBlock("ass_members"); foreach ($members as $member_id) { $this->tpl->setVariable("TXT_MEMBER_NAME", ilObjUser::_lookupFullname($member_id)); $this->tpl->parseCurrentBlock(); } $ilCtrl->setParameter($this->parent_obj, "lpart", $this->part_id); $this->tpl->setVariable("HREF_LOG", $ilCtrl->getLinkTarget($this->parent_obj, "showTeamLog")); $this->tpl->setVariable("TXT_LOG", $lng->txt("exc_team_log")); $ilCtrl->setParameter($this->parent_obj, "lpart", ""); } $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 = ilExAssignment::getLastSubmission($d["id"], $this->part_id); if ($last_sub) { $last_sub = ilDatePresentation::formatDate(new ilDateTime($last_sub, IL_CAL_DATETIME)); } else { $last_sub = "---"; } if (ilExAssignment::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("exc_last_submission")); // nr of submitted files $this->tpl->setVariable("TXT_SUBMITTED_FILES", $lng->txt("exc_files_returned")); $sub_cnt = count(ilExAssignment::getDeliveredFiles($this->exc_id, $d["id"], $this->part_id)); $new = ilExAssignment::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("exc_download_files")); } else { $this->tpl->setVariable("TXT_DOWNLOAD", $lng->txt("exc_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("exc_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(ilExAssignment::lookupNoticeOfUser($d["id"], $this->part_id))); // comment for learner $this->tpl->setVariable("TXT_LCOMMENT", $lng->txt("exc_comment_for_learner")); $this->tpl->setVariable("NAME_LCOMMENT", "lcomment[" . $d["id"] . "]"); $lpcomment = ilExAssignment::lookupCommentForUser($d["id"], $this->part_id); $this->tpl->setVariable("VAL_LCOMMENT", ilUtil::prepareFormOutput($lpcomment)); // solved //$this->tpl->setVariable("CHKBOX_SOLVED", // ilUtil::formCheckbox($this->exc->members_obj->getStatusByMember($member_id),"solved[$member_id]",1)); $status = ilExAssignment::lookupStatusOfUser($d["id"], $this->part_id); $this->tpl->setVariable("SEL_" . strtoupper($status), ' selected="selected" '); $this->tpl->setVariable("TXT_NOTGRADED", $lng->txt("exc_notgraded")); $this->tpl->setVariable("TXT_PASSED", $lng->txt("exc_passed")); $this->tpl->setVariable("TXT_FAILED", $lng->txt("exc_failed")); if (($sd = ilExAssignment::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("exc_" . $status)); // mark $this->tpl->setVariable("TXT_MARK", $lng->txt("exc_mark")); $this->tpl->setVariable("NAME_MARK", "mark[" . $d["id"] . "]"); $mark = ilExAssignment::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 = ilExAssignment::lookupFeedbackTimeOfUser($d["id"], $this->part_id)) > 0) { $this->tpl->setCurrentBlock("feedback_date"); $this->tpl->setVariable("TXT_FEEDBACK_MAIL_SENT", sprintf($lng->txt("exc_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")); //"ilias.php?baseClass=ilMailGUI&type=new&rcp_to=".$mem_obj->getLogin()); $this->tpl->setVariable("TXT_FEEDBACK", $lng->txt("exc_send_mail")); $ilCtrl->setParameter($this->parent_obj, "rcp_to", ""); if ($d["type"] == ilExAssignment::TYPE_UPLOAD_TEAM) { $feedback_id = "t" . ilExAssignment::getTeamIdByAssignment($d["id"], $this->part_id); } else { $feedback_id = $this->part_id; } $storage = new ilFSStorageExercise($this->exc_id, $d["id"]); $cnt_files = $storage->countFeedbackFiles($feedback_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("exc_add_feedback_file")); } else { $this->tpl->setVariable("TXT_FILE_FEEDBACK", $lng->txt("exc_fb_files") . " (" . $cnt_files . ")"); } $ilCtrl->setParameter($this->parent_obj, "ass_id", $_GET["ass_id"]); }