/** * Get assignment body for overview */ function getOverviewBody($a_data) { global $lng, $ilCtrl, $ilUser; $tpl = new ilTemplate("tpl.assignment_body.html", true, true, "Modules/Exercise"); include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php"; include_once "./Services/UIComponent/Button/classes/class.ilLinkButton.php"; if (IS_PAYMENT_ENABLED) { include_once './Services/Payment/classes/class.ilPaymentObject.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("exc_instruction")); $is_html = strlen($a_data["instruction"]) != strlen(strip_tags($a_data["instruction"])); if (!$is_html) { $a_data["instruction"] = nl2br(ilUtil::makeClickable($a_data["instruction"], true)); } $info->addProperty("", $a_data["instruction"]); } // schedule $info->addSection($lng->txt("exc_schedule")); if ($a_data["start_time"] > 0) { $info->addProperty($lng->txt("exc_start_time"), ilDatePresentation::formatDate(new ilDateTime($a_data["start_time"], IL_CAL_UNIX))); } if ($a_data["deadline"] > 0) { $info->addProperty($lng->txt("exc_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("exc_time_to_send"), "<b>" . $time_str . "</b>"); } // public submissions if ($this->exc->getShowSubmissions()) { $ilCtrl->setParameterByClass("ilobjexercisegui", "ass_id", $a_data["id"]); if ($a_data["deadline"] - time() <= 0) { $button = ilLinkButton::getInstance(); $button->setCaption("exc_list_submission"); $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "listPublicSubmissions")); $info->addProperty($lng->txt("exc_public_submission"), $button->render()); } else { $info->addProperty($lng->txt("exc_public_submission"), $lng->txt("exc_msg_public_submission")); } $ilCtrl->setParameterByClass("ilobjexercisegui", "ass_id", $_GET["ass_id"]); } $ilCtrl->setParameterByClass("ilobjexercisegui", "ass_id", $a_data["id"]); if (!$not_started_yet) { // download files $files = ilExAssignment::getFiles($a_data["exc_id"], $a_data["id"]); if (count($files) > 0) { $info->addSection($lng->txt("exc_files")); foreach ($files as $file) { // if download must be purchased first show a "buy"-button if (IS_PAYMENT_ENABLED && (ilPaymentObject::_isBuyable($_GET['ref_id'], 'download') && !ilPaymentObject::_hasAccess($_GET['ref_id'], '', 'download'))) { $info->addProperty($file["name"], $lng->txt("buy"), $ilCtrl->getLinkTargetByClass("ilShopPurchaseGUI", "showDetails")); } else { $ilCtrl->setParameterByClass("ilobjexercisegui", "file", urlencode($file["name"])); $info->addProperty($file["name"], $lng->txt("download"), $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "downloadFile")); $ilCtrl->setParameterByClass("ilobjexercisegui", "file", ""); } } } // submission // if submission must be purchased first if (IS_PAYMENT_ENABLED && (ilPaymentObject::_isBuyable($_GET['ref_id'], 'upload') && !ilPaymentObject::_hasAccess($_GET['ref_id'], '', 'upload'))) { $info->addSection($lng->txt("exc_your_submission")); $ilCtrl->clearParameters($this); $ilCtrl->setParameter($this, "ref_id", $_GET['ref_id']); $ilCtrl->setParameter($this, 'subtype', 'upload'); $info->addProperty($lng->txt('exc_hand_in'), $lng->txt("buy"), $ilCtrl->getLinkTargetByClass("ilShopPurchaseGUI", "showDetails")); } else { $info->addSection($lng->txt("exc_your_submission")); $delivered_files = ilExAssignment::getDeliveredFiles($a_data["exc_id"], $a_data["id"], $ilUser->getId()); $times_up = false; if ($a_data["deadline"] > 0 && $a_data["deadline"] - time() < 0) { $times_up = true; } $team_members = null; switch ($a_data["type"]) { case ilExAssignment::TYPE_UPLOAD_TEAM: $no_team_yet = false; $team_members = ilExAssignment::getTeamMembersByAssignmentId($a_data["id"], $ilUser->getId()); if (sizeof($team_members)) { $team = array(); foreach ($team_members as $member_id) { $team[] = ilObjUser::_lookupFullname($member_id); } $team = implode(", ", $team); $button = ilLinkButton::getInstance(); $button->setCaption("exc_manage_team"); $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "submissionScreenTeam")); $team .= " " . $button->render(); $info->addProperty($lng->txt("exc_team_members"), $team); } else { $no_team_yet = true; if (!$times_up) { if (!sizeof($delivered_files)) { $team_info = $lng->txt("exc_no_team_yet_notice"); } else { $team_info = '<span class="warning">' . $lng->txt("exc_no_team_yet_notice") . '</span>'; } $button = ilLinkButton::getInstance(); $button->setPrimary(true); $button->setCaption("exc_create_team"); $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "createTeam")); $team_info .= " " . $button->render(); $team_info .= '<div class="ilFormInfo">' . $lng->txt("exc_no_team_yet_info") . '</div>'; } else { $team_info = '<span class="warning">' . $lng->txt("exc_create_team_times_up_warning") . '</span>'; } $info->addProperty($lng->txt("exc_team_members"), $team_info); } // fallthrough // fallthrough case ilExAssignment::TYPE_UPLOAD: $titles = array(); foreach ($delivered_files as $file) { $titles[] = $file["filetitle"]; } $files_str = implode($titles, ", "); if ($files_str == "") { $files_str = $lng->txt("message_no_delivered_files"); } // no team == no submission if (!$no_team_yet) { $ilCtrl->setParameterByClass("ilobjexercisegui", "ass_id", $a_data["id"]); if (!$times_up) { $title = count($titles) == 0 ? $lng->txt("exc_hand_in") : $lng->txt("exc_edit_submission"); $button = ilLinkButton::getInstance(); $button->setPrimary(true); $button->setCaption($title, false); $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "submissionScreen")); $files_str .= " " . $button->render(); } else { if (count($titles) > 0) { $button = ilLinkButton::getInstance(); $button->setCaption("already_delivered_files"); $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "submissionScreen")); $files_str .= " " . $button->render(); } } } $info->addProperty($lng->txt("exc_files_returned"), $files_str); break; case ilExAssignment::TYPE_BLOG: include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php"; $wsp_tree = new ilWorkspaceTree($ilUser->getId()); // #12939 if (!$wsp_tree->getRootId()) { $wsp_tree->createTreeForUser($ilUser->getId()); } $files_str = ""; $valid_blog = false; if (sizeof($delivered_files)) { $delivered_files = array_pop($delivered_files); $blog_id = (int) $delivered_files["filetitle"]; $node = $wsp_tree->getNodeData($blog_id); if ($node["title"]) { // #10116 $ilCtrl->setParameterByClass("ilobjbloggui", "wsp_id", $blog_id); $blog_link = $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilpersonalworkspacegui", "ilobjbloggui"), ""); $ilCtrl->setParameterByClass("ilobjbloggui", "wsp_id", ""); $files_str = '<a href="' . $blog_link . '">' . $node["title"] . '</a>'; $valid_blog = true; } else { if (substr($delivered_files["filename"], -1) == "/") { $this->exc->deleteResourceObject($delivered_files["ass_id"], $ilUser->getId(), $delivered_files["returned_id"]); } } } if (!$times_up) { if (!$valid_blog) { $button = ilLinkButton::getInstance(); $button->setCaption("exc_create_blog"); $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "createBlog")); $files_str .= $button->render(); } // #10462 $blogs = sizeof($wsp_tree->getObjectsFromType("blog")); if (!$valid_blog && $blogs || $valid_blog && $blogs > 1) { $button = ilLinkButton::getInstance(); $button->setCaption("exc_select_blog" . ($valid_blog ? "_change" : "")); $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "selectBlog")); $files_str .= " " . $button->render(); } } if ($files_str) { $info->addProperty($lng->txt("exc_blog_returned"), $files_str); } if ($delivered_files && substr($delivered_files["filename"], -1) != "/") { $ilCtrl->setParameterByClass("ilobjexercisegui", "delivered", $delivered_files["returned_id"]); $dl_link = $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "download"); $ilCtrl->setParameterByClass("ilobjexercisegui", "delivered", ""); $button = ilLinkButton::getInstance(); $button->setCaption("download"); $button->setUrl($dl_link); $info->addProperty($lng->txt("exc_files_returned"), $button->render()); } break; case ilExAssignment::TYPE_PORTFOLIO: include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php"; $files_str = ""; $valid_prtf = false; if (sizeof($delivered_files)) { $delivered_files = array_pop($delivered_files); $portfolio_id = (int) $delivered_files["filetitle"]; // #11746 if (ilObject::_exists($portfolio_id, false, "prtf")) { $portfolio = new ilObjPortfolio($portfolio_id, false); if ($portfolio->getTitle()) { // #10116 / #12791 $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", $portfolio_id); $prtf_link = $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilportfoliorepositorygui", "ilobjportfoliogui"), "view"); $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", ""); $files_str = '<a href="' . $prtf_link . '">' . $portfolio->getTitle() . '</a>'; $valid_prtf = true; } } else { if (substr($delivered_files["filename"], -1) == "/") { $this->exc->deleteResourceObject($delivered_files["ass_id"], $ilUser->getId(), $delivered_files["returned_id"]); } } } if (!$times_up) { if (!$valid_prtf) { // if there are portfolio templates available show form first include_once "Modules/Portfolio/classes/class.ilObjPortfolioTemplate.php"; $has_prtt = sizeof(ilObjPortfolioTemplate::getAvailablePortfolioTemplates()) ? "Template" : ""; $button = ilLinkButton::getInstance(); $button->setCaption("exc_create_portfolio"); $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "createPortfolio" . $has_prtt)); $files_str .= $button->render(); } // #10462 $prtfs = sizeof(ilObjPortfolio::getPortfoliosOfUser($ilUser->getId())); if (!$valid_prtf && $prtfs || $valid_prtf && $prtfs > 1) { $button = ilLinkButton::getInstance(); $button->setCaption("exc_select_portfolio" . ($valid_prtf ? "_change" : "")); $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "selectPortfolio")); $files_str .= " " . $button->render(); } } if ($files_str) { $info->addProperty($lng->txt("exc_portfolio_returned"), $files_str); } if ($delivered_files && substr($delivered_files["filename"], -1) != "/") { $ilCtrl->setParameterByClass("ilobjexercisegui", "delivered", $delivered_files["returned_id"]); $dl_link = $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "download"); $ilCtrl->setParameterByClass("ilobjexercisegui", "delivered", ""); $button = ilLinkButton::getInstance(); $button->setCaption("download"); $button->setUrl($dl_link); $info->addProperty($lng->txt("exc_files_returned"), $button->render()); } break; case ilExAssignment::TYPE_TEXT: $ilCtrl->setParameterByClass("ilobjexercisegui", "ass_id", $a_data["id"]); if (!$times_up) { $button = ilLinkButton::getInstance(); $button->setPrimary(true); $button->setCaption("exc_text_assignment_edit"); $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "editAssignmentText")); $files_str = $button->render(); } else { $button = ilLinkButton::getInstance(); $button->setCaption("exc_text_assignment_show"); $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "showAssignmentText")); $files_str = $button->render(); } $info->addProperty($lng->txt("exc_files_returned_text"), $files_str); break; } $last_sub = ilExAssignment::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("exc_last_submission"), $last_sub); } // peer feedback if ($times_up && $a_data["peer"]) { $nr_missing_fb = ilExAssignment::getNumberOfMissingFeedbacks($a_data["id"], $a_data["peer_min"]); if (!$a_data["peer_dl"] || $a_data["peer_dl"] > time()) { $dl_info = ""; if ($a_data["peer_dl"]) { $dl_info = " (" . sprintf($lng->txt("exc_peer_review_deadline_info_button"), ilDatePresentation::formatDate(new ilDateTime($a_data["peer_dl"], IL_CAL_UNIX))) . ")"; } $button = ilLinkButton::getInstance(); $button->setPrimary($nr_missing_fb); $button->setCaption($lng->txt("exc_peer_review_give") . $dl_info, false); $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "editPeerReview")); $edit_pc = $button->render(); } else { if ($a_data["peer_dl"]) { $edit_pc = $lng->txt("exc_peer_review_deadline_reached"); } } if ((!$a_data["peer_dl"] || $a_data["peer_dl"] < time()) && !$nr_missing_fb) { $button = ilLinkButton::getInstance(); $button->setCaption("exc_peer_review_show"); $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "showPersonalPeerReview")); $view_pc = $button->render(); } /* else { $view_pc = $lng->txt("exc_peer_review_show_not_rated_yet"); } */ $info->addProperty($lng->txt("exc_peer_review"), $edit_pc . " " . $view_pc); } // feedback from tutor if ($a_data["type"] == ilExAssignment::TYPE_UPLOAD_TEAM) { $feedback_id = "t" . ilExAssignment::getTeamIdByAssignment($a_data["id"], $ilUser->getId()); } else { $feedback_id = $ilUser->getId(); } // global feedback / sample solution if ($a_data["fb_date"] == ilExAssignment::FEEDBACK_DATE_DEADLINE) { $show_global_feedback = $times_up && $a_data["fb_file"]; } else { $show_global_feedback = $last_sub != "---" && $a_data["fb_file"]; } $storage = new ilFSStorageExercise($a_data["exc_id"], $a_data["id"]); $cnt_files = $storage->countFeedbackFiles($feedback_id); $lpcomment = ilExAssignment::lookupCommentForUser($a_data["id"], $ilUser->getId()); $mark = ilExAssignment::lookupMarkOfUser($a_data["id"], $ilUser->getId()); $status = ilExAssignment::lookupStatusOfUser($a_data["id"], $ilUser->getId()); if ($lpcomment != "" || $mark != "" || $status != "notgraded" || $cnt_files > 0 || $show_global_feedback) { $info->addSection($lng->txt("exc_feedback_from_tutor")); if ($lpcomment != "") { $info->addProperty($lng->txt("exc_comment"), $lpcomment); } if ($mark != "") { $info->addProperty($lng->txt("exc_mark"), $mark); } if ($status == "") { // $info->addProperty($lng->txt("status"), // $lng->txt("message_no_delivered_files")); } else { if ($status != "notgraded") { $img = '<img src="' . ilUtil::getImagePath("scorm/" . $status . ".svg") . '" ' . ' alt="' . $lng->txt("exc_" . $status) . '" title="' . $lng->txt("exc_" . $status) . '" />'; $info->addProperty($lng->txt("status"), $img . " " . $lng->txt("exc_" . $status)); } } if ($cnt_files > 0) { $info->addSection($lng->txt("exc_fb_files") . '<a name="fb' . $a_data["id"] . '"></a>'); if ($cnt_files > 0) { $files = $storage->getFeedbackFiles($feedback_id); foreach ($files as $file) { $ilCtrl->setParameterByClass("ilobjexercisegui", "file", urlencode($file)); $info->addProperty($file, $lng->txt("download"), $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "downloadFeedbackFile")); $ilCtrl->setParameterByClass("ilobjexercisegui", "file", ""); } } } // #15002 - global feedback if ($show_global_feedback) { $info->addSection($lng->txt("exc_global_feedback_file")); $info->addProperty($a_data["fb_file"], $lng->txt("download"), $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "downloadGlobalFeedbackFile")); } } } } $tpl->setVariable("CONTENT", $info->getHTML()); return $tpl->get(); }
/** * Get assignment body for overview */ function getOverviewBody($a_data) { global $lng, $ilCtrl, $ilUser; $tpl = new ilTemplate("tpl.assignment_body.html", true, true, "Modules/Exercise"); include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php"; if (IS_PAYMENT_ENABLED) { include_once './Services/Payment/classes/class.ilPaymentObject.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("exc_instruction")); $info->addProperty("", nl2br(ilUtil::makeClickable($a_data["instruction"], true))); } // schedule $info->addSection($lng->txt("exc_schedule")); if ($a_data["start_time"] > 0) { $info->addProperty($lng->txt("exc_start_time"), ilDatePresentation::formatDate(new ilDateTime($a_data["start_time"], IL_CAL_UNIX))); } if ($a_data["deadline"] > 0) { $info->addProperty($lng->txt("exc_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("exc_time_to_send"), "<b>" . $time_str . "</b>"); } // public submissions if ($this->exc->getShowSubmissions()) { $ilCtrl->setParameterByClass("ilobjexercisegui", "ass_id", $a_data["id"]); if ($a_data["deadline"] - time() <= 0) { $link = '<a class="submit" href="' . $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "listPublicSubmissions") . '">' . $lng->txt("exc_list_submission") . '</a>'; $info->addProperty($lng->txt("exc_public_submission"), $link); } else { $info->addProperty($lng->txt("exc_public_submission"), $lng->txt("exc_msg_public_submission")); } $ilCtrl->setParameterByClass("ilobjexercisegui", "ass_id", $_GET["ass_id"]); } $ilCtrl->setParameterByClass("ilobjexercisegui", "ass_id", $a_data["id"]); if (!$not_started_yet) { // download files $files = ilExAssignment::getFiles($a_data["exc_id"], $a_data["id"]); if (count($files) > 0) { $info->addSection($lng->txt("exc_files")); foreach ($files as $file) { // if download must be purchased first show a "buy"-button if (IS_PAYMENT_ENABLED && (ilPaymentObject::_isBuyable($_GET['ref_id'], 'download') && !ilPaymentObject::_hasAccess($_GET['ref_id'], '', 'download'))) { $info->addProperty($file["name"], $lng->txt("buy"), $ilCtrl->getLinkTargetByClass("ilShopPurchaseGUI", "showDetails")); } else { $ilCtrl->setParameterByClass("ilobjexercisegui", "file", urlencode($file["name"])); $info->addProperty($file["name"], $lng->txt("download"), $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "downloadFile")); $ilCtrl->setParameterByClass("ilobjexercisegui", "file", ""); } } } // submission // if submission must be purchased first if (IS_PAYMENT_ENABLED && (ilPaymentObject::_isBuyable($_GET['ref_id'], 'upload') && !ilPaymentObject::_hasAccess($_GET['ref_id'], '', 'upload'))) { $info->addSection($lng->txt("exc_your_submission")); $ilCtrl->clearParameters($this); $ilCtrl->setParameter($this, "ref_id", $_GET['ref_id']); $ilCtrl->setParameter($this, 'subtype', 'upload'); $info->addProperty($lng->txt('exc_hand_in'), $lng->txt("buy"), $ilCtrl->getLinkTargetByClass("ilShopPurchaseGUI", "showDetails")); } else { $info->addSection($lng->txt("exc_your_submission")); $delivered_files = ilExAssignment::getDeliveredFiles($a_data["exc_id"], $a_data["id"], $ilUser->getId()); $times_up = false; if ($a_data["deadline"] > 0 && $a_data["deadline"] - time() < 0) { $times_up = true; } $team_members = null; switch ($a_data["type"]) { case ilExAssignment::TYPE_UPLOAD_TEAM: $team_members = ilExAssignment::getTeamMembersByAssignmentId($a_data["id"], $ilUser->getId()); if (sizeof($team_members) > 1) { $team = array(); foreach ($team_members as $member_id) { $team[] = ilObjUser::_lookupFullname($member_id); } $info->addProperty($lng->txt("exc_team_members"), implode(", ", $team)); } // fallthrough // fallthrough case ilExAssignment::TYPE_UPLOAD: $titles = array(); foreach ($delivered_files as $file) { $titles[] = $file["filetitle"]; } $files_str = implode($titles, ", "); if ($files_str == "") { $files_str = $lng->txt("message_no_delivered_files"); } $ilCtrl->setParameterByClass("ilobjexercisegui", "ass_id", $a_data["id"]); if (!$times_up) { $files_str .= ' <a class="submit" href="' . $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "submissionScreen") . '">' . (count($titles) == 0 ? $lng->txt("exc_hand_in") : $lng->txt("exc_edit_submission")) . '</a>'; } else { if (count($titles) > 0) { $files_str .= ' <a class="submit" href="' . $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "submissionScreen") . '">' . $lng->txt("already_delivered_files") . '</a>'; } } $info->addProperty($lng->txt("exc_files_returned"), $files_str); break; case ilExAssignment::TYPE_BLOG: $files_str = ""; $valid_blog = false; if (sizeof($delivered_files)) { $delivered_files = array_pop($delivered_files); $blog_id = (int) $delivered_files["filetitle"]; include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php"; include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php"; $wsp_tree = new ilWorkspaceTree($ilUser->getId()); $node = $wsp_tree->getNodeData($blog_id); if ($node["title"]) { // #10116 // $blog_link = ilWorkspaceAccessHandler::getGotoLink($blog_id, $node["obj_id"]); $ilCtrl->setParameterByClass("ilobjbloggui", "wsp_id", $blog_id); $blog_link = $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilpersonalworkspacegui", "ilobjbloggui"), ""); $ilCtrl->setParameterByClass("ilobjbloggui", "wsp_id", ""); $files_str = '<a href="' . $blog_link . '">' . $node["title"] . '</a>'; $valid_blog = true; } } if (!$times_up) { if (!$valid_blog) { $files_str .= '<a class="submit" href="' . $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "createBlog") . '">' . $lng->txt("exc_create_blog") . '</a>'; } $files_str .= ' <a class="submit" href="' . $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "selectBlog") . '">' . $lng->txt("exc_select_blog" . ($valid_blog ? "_change" : "")) . '</a>'; } if ($files_str) { $info->addProperty($lng->txt("exc_blog_returned"), $files_str); } if ($delivered_files && substr($delivered_files["filename"], -1) != "/") { $ilCtrl->setParameterByClass("ilobjexercisegui", "delivered", $delivered_files["returned_id"]); $dl_link = $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "download"); $ilCtrl->setParameterByClass("ilobjexercisegui", "delivered", ""); $info->addProperty($lng->txt("exc_files_returned"), "<a href=\"" . $dl_link . "\">" . $lng->txt("download") . "</a>"); } break; case ilExAssignment::TYPE_PORTFOLIO: $files_str = ""; $valid_prtf = false; if (sizeof($delivered_files)) { $delivered_files = array_pop($delivered_files); $portfolio_id = (int) $delivered_files["filetitle"]; include_once "Services/Portfolio/classes/class.ilObjPortfolio.php"; include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php"; $portfolio = new ilObjPortfolio($portfolio_id, false); if ($portfolio->getTitle()) { // #10116 // $prtf_link = ilWorkspaceAccessHandler::getGotoLink($portfolio_id, $portfolio_id) $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", $portfolio_id); $prtf_link = $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilobjportfoliogui"), "pages"); $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", ""); $files_str = '<a href="' . $prtf_link . '">' . $portfolio->getTitle() . '</a>'; $valid_prtf = true; } } if (!$times_up) { if (!$valid_prtf) { $files_str .= '<a class="submit" href="' . $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "createPortfolio") . '">' . $lng->txt("exc_create_portfolio") . '</a>'; } $files_str .= ' <a class="submit" href="' . $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "selectPortfolio") . '">' . $lng->txt("exc_select_portfolio" . ($valid_prtf ? "_change" : "")) . '</a>'; } if ($files_str) { $info->addProperty($lng->txt("exc_portfolio_returned"), $files_str); } if ($delivered_files && substr($delivered_files["filename"], -1) != "/") { $ilCtrl->setParameterByClass("ilobjexercisegui", "delivered", $delivered_files["returned_id"]); $dl_link = $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "download"); $ilCtrl->setParameterByClass("ilobjexercisegui", "delivered", ""); $info->addProperty($lng->txt("exc_files_returned"), "<a href=\"" . $dl_link . "\">" . $lng->txt("download") . "</a>"); } break; } $last_sub = ilExAssignment::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("exc_last_submission"), $last_sub); } // feedback from tutor if ($a_data["type"] == ilExAssignment::TYPE_UPLOAD_TEAM) { $feedback_id = "t" . ilExAssignment::getTeamIdByAssignment($a_data["id"], $ilUser->getId()); } else { $feedback_id = $ilUser->getId(); } $storage = new ilFSStorageExercise($a_data["exc_id"], $a_data["id"]); $cnt_files = $storage->countFeedbackFiles($feedback_id); $lpcomment = ilExAssignment::lookupCommentForUser($a_data["id"], $ilUser->getId()); $mark = ilExAssignment::lookupMarkOfUser($a_data["id"], $ilUser->getId()); $status = ilExAssignment::lookupStatusOfUser($a_data["id"], $ilUser->getId()); if ($lpcomment != "" || $mark != "" || $status != "notgraded" || $cnt_files > 0) { $info->addSection($lng->txt("exc_feedback_from_tutor")); if ($lpcomment != "") { $info->addProperty($lng->txt("exc_comment"), $lpcomment); } if ($mark != "") { $info->addProperty($lng->txt("exc_mark"), $mark); } if ($status == "") { // $info->addProperty($lng->txt("status"), // $lng->txt("message_no_delivered_files")); } else { if ($status != "notgraded") { $img = '<img border="0" src="' . ilUtil::getImagePath("scorm/" . $status . ".png") . '" ' . ' alt="' . $lng->txt("exc_" . $status) . '" title="' . $lng->txt("exc_" . $status) . '" style="vertical-align:middle;"/>'; $info->addProperty($lng->txt("status"), $img . " " . $lng->txt("exc_" . $status)); } } if ($cnt_files > 0) { $info->addSection($lng->txt("exc_fb_files")); $files = $storage->getFeedbackFiles($feedback_id); foreach ($files as $file) { $ilCtrl->setParameterByClass("ilobjexercisegui", "file", urlencode($file)); $info->addProperty($file, $lng->txt("download"), $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "downloadFeedbackFile")); $ilCtrl->setParameter($this, "file", ""); } } } } } $tpl->setVariable("CONTENT", $info->getHTML()); return $tpl->get(); }
/** * Fill table row */ protected function fillRow($d) { global $lng, $ilCtrl; $this->tpl->setVariable("TXT_ASS_TITLE", $d["title"]); $file_info = ilExAssignment::getDownloadedFilesInfoForTableGUIS($this->parent_obj, $this->exc_id, $d["type"], $d["id"], $this->part_id, $this->parent_cmd); $has_no_team_yet = false; if ($d["type"] == ilExAssignment::TYPE_UPLOAD_TEAM) { $members = ilExAssignment::getTeamMembersByAssignmentId($d["id"], $this->part_id); // #11957 if (sizeof($members)) { $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", ""); } else { // #11957 $has_no_team_yet = true; $this->tpl->setCurrentBlock("team_info"); $this->tpl->setVariable("TXT_TEAM_INFO", $lng->txt("exc_no_team_yet")); $this->tpl->setVariable("TXT_CREATE_TEAM", $lng->txt("exc_create_team")); $ilCtrl->setParameter($this->parent_obj, "ass_id", $d["id"]); $ilCtrl->setParameter($this->parent_obj, "lpart", $this->part_id); $this->tpl->setVariable("URL_CREATE_TEAM", $ilCtrl->getLinkTarget($this->getParentObject(), "createSingleMemberTeam")); $ilCtrl->setParameter($this->parent_obj, "lpart", ""); $ilCtrl->setParameter($this->parent_obj, "ass_id", ""); if ($file_info["files"]["count"]) { $this->tpl->setVariable("TEAM_FILES_INFO", "<br />" . $file_info["files"]["txt"] . ": " . $file_info["files"]["count"]); } $this->tpl->parseCurrentBlock(); } } if (!$has_no_team_yet) { $this->tpl->setVariable("VAL_CHKBOX", ilUtil::formCheckbox(0, "assid[" . $d["id"] . "]", 1)); $this->tpl->setVariable("VAL_ID", $d["id"]); $this->tpl->setVariable("VAL_LAST_SUBMISSION", $file_info["last_submission"]["value"]); $this->tpl->setVariable("TXT_LAST_SUBMISSION", $file_info["last_submission"]["txt"]); $this->tpl->setVariable("TXT_SUBMITTED_FILES", $file_info["files"]["txt"]); $this->tpl->setVariable("VAL_SUBMITTED_FILES", $file_info["files"]["count"]); if ($file_info["files"]["download_url"]) { $this->tpl->setCurrentBlock("download_link"); $this->tpl->setVariable("LINK_DOWNLOAD", $file_info["files"]["download_url"]); $this->tpl->setVariable("TXT_DOWNLOAD", $file_info["files"]["download_txt"]); $this->tpl->parseCurrentBlock(); } if ($file_info["files"]["download_new_url"]) { $this->tpl->setCurrentBlock("download_link"); $this->tpl->setVariable("LINK_NEW_DOWNLOAD", $file_info["files"]["download_new_url"]); $this->tpl->setVariable("TXT_NEW_DOWNLOAD", $file_info["files"]["download_new_txt"]); $this->tpl->parseCurrentBlock(); } // note $this->tpl->setVariable("TXT_NOTE", $lng->txt("exc_note_for_tutor")); $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 $lcomment_value = ilExAssignment::lookupCommentForUser($d["id"], $this->part_id); $overlay_id = "excasscomm_" . $d["id"] . "_" . $this->part_id; $overlay_trigger_id = $overlay_id . "_tr"; $overlay = new ilOverlayGUI($overlay_id); $overlay->setAnchor($overlay_trigger_id); $overlay->setTrigger($overlay_trigger_id, "click", $overlay_trigger_id); $overlay->add(); $this->tpl->setVariable("LCOMMENT_ID", $overlay_id . "_snip"); $this->tpl->setVariable("LCOMMENT_SNIPPET", ilUtil::shortenText($lcomment_value, 25, true)); $this->tpl->setVariable("COMMENT_OVERLAY_TRIGGER_ID", $overlay_trigger_id); $this->tpl->setVariable("COMMENT_OVERLAY_TRIGGER_TEXT", $lng->txt("exc_comment_for_learner_edit")); $lcomment_form = new ilPropertyFormGUI(); $lcomment_form->setId($overlay_id); $lcomment_form->setPreventDoubleSubmission(false); $lcomment = new ilTextAreaInputGUI($lng->txt("exc_comment_for_learner"), "lcomment_" . $d["id"] . "_" . $this->part_id); $lcomment->setInfo($lng->txt("exc_comment_for_learner_info")); $lcomment->setValue($lcomment_value); $lcomment->setCols(45); $lcomment->setRows(5); $lcomment_form->addItem($lcomment); //$lcomment_form->addCommandButton("save", $lng->txt("save")); // $lcomment_form->addCommandButton("cancel", $lng->txt("cancel")); $this->overlay_tpl->setCurrentBlock("overlay_bl"); $this->overlay_tpl->setVariable("COMMENT_OVERLAY_ID", $overlay_id); $this->overlay_tpl->setVariable("COMMENT_OVERLAY_FORM", $lcomment_form->getHTML()); $this->overlay_tpl->parseCurrentBlock(); /* $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.svg"; break; case "failed": $pic = "scorm/failed.svg"; break; default: $pic = "scorm/not_attempted.svg"; 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 . ")"); } // peer review / rating if ($d["type"] != ilExAssignment::TYPE_UPLOAD_TEAM && $d["peer"]) { $this->tpl->setCurrentBlock("peer_review_bl"); $this->tpl->setVariable("TXT_PEER_REVIEW", $lng->txt("exc_peer_review_show")); $ilCtrl->setParameter($this->parent_obj, "grd", 2); $this->tpl->setVariable("LINK_PEER_REVIEW", $ilCtrl->getLinkTarget($this->parent_obj, "showPersonalPeerReview")); $ilCtrl->setParameter($this->parent_obj, "grd", ""); $rating = new ilRatingGUI(); $rating->setObject($d["id"], "ass", $this->part_id, "peer"); $rating->setUserId(0); $this->tpl->setVariable("VAL_RATING", $rating->getHTML(true, false)); $this->tpl->parseCurrentBlock(); } $ilCtrl->setParameter($this->parent_obj, "ass_id", $_GET["ass_id"]); } else { $this->tpl->touchBlock("member_has_no_team_bl"); } }
/** * 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"]); }