2 include_once
'Services/Payment/classes/class.ilShopPurchaseGUI.php';
31 $lng->loadLanguageModule(
"exc");
33 $tpl =
new ilTemplate(
"tpl.assignment_head.html",
true,
true,
"Modules/Exercise");
35 if (($a_data[
"deadline"] > 0) && $a_data[
"deadline"] - time() <= 0)
37 $tpl->setCurrentBlock(
"prop");
38 $tpl->setVariable(
"PROP", $lng->txt(
"exc_ended_on"));
39 $tpl->setVariable(
"PROP_VAL",
41 $tpl->parseCurrentBlock();
44 if($a_data[
"peer"] && $a_data[
"peer_dl"])
46 $tpl->setCurrentBlock(
"prop");
47 $tpl->setVariable(
"PROP", $lng->txt(
"exc_peer_review_deadline"));
48 $tpl->setVariable(
"PROP_VAL",
50 $tpl->parseCurrentBlock();
53 else if ($a_data[
"start_time"] > 0 && time() - $a_data[
"start_time"] <= 0)
55 $tpl->setCurrentBlock(
"prop");
56 $tpl->setVariable(
"PROP", $lng->txt(
"exc_starting_on"));
57 $tpl->setVariable(
"PROP_VAL",
59 $tpl->parseCurrentBlock();
64 $tpl->setCurrentBlock(
"prop");
65 $tpl->setVariable(
"PROP", $lng->txt(
"exc_time_to_send"));
66 $tpl->setVariable(
"PROP_VAL", $time_str);
67 $tpl->parseCurrentBlock();
69 if ($a_data[
"deadline"] > 0)
71 $tpl->setCurrentBlock(
"prop");
72 $tpl->setVariable(
"PROP", $lng->txt(
"exc_edit_until"));
73 $tpl->setVariable(
"PROP_VAL",
75 $tpl->parseCurrentBlock();
81 if ($a_data[
"mandatory"])
83 $mand =
" (".$lng->txt(
"exc_mandatory").
")";
85 $tpl->setVariable(
"TITLE", $a_data[
"title"].$mand);
91 case "passed": $pic =
"scorm/passed.svg";
break;
92 case "failed": $pic =
"scorm/failed.svg";
break;
93 default: $pic =
"scorm/not_attempted.svg";
break;
96 $tpl->setVariable(
"ALT_STATUS", $lng->txt(
"exc_".$stat));
108 $tpl =
new ilTemplate(
"tpl.assignment_body.html",
true,
true,
"Modules/Exercise");
110 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
111 include_once(
"./Services/UIComponent/Button/classes/class.ilLinkButton.php");
113 if(IS_PAYMENT_ENABLED)
115 include_once
'./Services/Payment/classes/class.ilPaymentObject.php';
119 $info->setTableClass(
"");
121 $not_started_yet =
false;
122 if ($a_data[
"start_time"] > 0 && time() - $a_data[
"start_time"] <= 0)
124 $not_started_yet =
true;
127 if (!$not_started_yet)
130 $info->addSection($lng->txt(
"exc_instruction"));
132 $is_html = (strlen($a_data[
"instruction"]) != strlen(strip_tags($a_data[
"instruction"])));
137 $info->addProperty(
"", $a_data[
"instruction"]);
141 $info->addSection($lng->txt(
"exc_schedule"));
142 if ($a_data[
"start_time"] > 0)
144 $info->addProperty($lng->txt(
"exc_start_time"),
147 if ($a_data[
"deadline"] > 0)
149 $info->addProperty($lng->txt(
"exc_edit_until"),
153 if (!$not_started_yet)
155 $info->addProperty($lng->txt(
"exc_time_to_send"),
156 "<b>".$time_str.
"</b>");
160 if ($this->exc->getShowSubmissions())
162 $ilCtrl->setParameterByClass(
"ilobjexercisegui",
"ass_id", $a_data[
"id"]);
163 if ($a_data[
"deadline"] - time() <= 0)
166 $button->setCaption(
"exc_list_submission");
167 $button->setUrl($ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"listPublicSubmissions"));
169 $info->addProperty($lng->txt(
"exc_public_submission"), $button->render());
173 $info->addProperty($lng->txt(
"exc_public_submission"),
174 $lng->txt(
"exc_msg_public_submission"));
176 $ilCtrl->setParameterByClass(
"ilobjexercisegui",
"ass_id",
$_GET[
"ass_id"]);
179 $ilCtrl->setParameterByClass(
"ilobjexercisegui",
"ass_id", $a_data[
"id"]);
181 if (!$not_started_yet)
185 if (count($files) > 0)
187 $info->addSection($lng->txt(
"exc_files"));
188 foreach($files as
$file)
194 $info->addProperty($file[
"name"],
196 $ilCtrl->getLinkTargetByClass(
"ilShopPurchaseGUI",
"showDetails"));
200 $ilCtrl->setParameterByClass(
"ilobjexercisegui",
"file", urlencode($file[
"name"]));
201 $info->addProperty($file[
"name"],
202 $lng->txt(
"download"),
203 $ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"downloadFile"));
204 $ilCtrl->setParameterByClass(
"ilobjexercisegui",
"file",
"");
212 if(IS_PAYMENT_ENABLED
216 $info->addSection($lng->txt(
"exc_your_submission"));
218 $ilCtrl->clearParameters($this);
220 $ilCtrl->setParameter($this,
"ref_id",
$_GET[
'ref_id']);
221 $ilCtrl->setParameter($this,
'subtype',
'upload');
222 $info->addProperty($lng->txt(
'exc_hand_in'),
224 $ilCtrl->getLinkTargetByClass(
"ilShopPurchaseGUI",
"showDetails"));
228 $info->addSection($lng->txt(
"exc_your_submission"));
233 if(($a_data[
"deadline"] > 0) && $a_data[
"deadline"] - time() < 0)
238 $team_members = null;
239 switch($a_data[
"type"])
242 $no_team_yet =
false;
244 if(
sizeof($team_members))
247 foreach($team_members as $member_id)
251 $team = implode(
", ", $team);
257 $button->setCaption(
"exc_delete_team");
258 $button->setUrl($ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"confirmDeleteTeam"));
259 $team .=
" ".$button->render();
263 $button->setCaption(
"exc_manage_team");
264 $button->setUrl($ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"submissionScreenTeam"));
265 $team .=
" ".$button->render();
267 $info->addProperty($lng->txt(
"exc_team_members"), $team);
275 if(!
sizeof($delivered_files))
277 $team_info = $lng->txt(
"exc_no_team_yet_notice");
281 $team_info =
'<span class="warning">'.$lng->txt(
"exc_no_team_yet_notice").
'</span>';
285 $button->setPrimary(
true);
286 $button->setCaption(
"exc_create_team");
287 $button->setUrl($ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"createTeam"));
288 $team_info .=
" ".$button->render();
290 $team_info .=
'<div class="ilFormInfo">'.$lng->txt(
"exc_no_team_yet_info").
'</div>';
294 $team_info =
'<span class="warning">'.$lng->txt(
"exc_create_team_times_up_warning").
'</span>';
297 $info->addProperty($lng->txt(
"exc_team_members"), $team_info);
303 foreach($delivered_files as
$file)
305 $titles[] = $file[
"filetitle"];
307 $files_str = implode($titles,
", ");
308 if ($files_str ==
"")
310 $files_str = $lng->txt(
"message_no_delivered_files");
316 $ilCtrl->setParameterByClass(
"ilobjexercisegui",
"ass_id", $a_data[
"id"]);
320 $title = (count($titles) == 0
321 ? $lng->txt(
"exc_hand_in")
322 : $lng->txt(
"exc_edit_submission"));
325 $button->setPrimary(
true);
326 $button->setCaption($title,
false);
327 $button->setUrl($ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"submissionScreen"));
328 $files_str.=
" ".$button->render();
332 if (count($titles) > 0)
335 $button->setCaption(
"already_delivered_files");
336 $button->setUrl($ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"submissionScreen"));
337 $files_str.=
" ".$button->render();
342 $info->addProperty($lng->txt(
"exc_files_returned"),
347 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
351 if(!$wsp_tree->getRootId())
358 if(
sizeof($delivered_files))
360 $delivered_files = array_pop($delivered_files);
361 $blog_id = (int)$delivered_files[
"filetitle"];
362 $node = $wsp_tree->getNodeData($blog_id);
366 $ilCtrl->setParameterByClass(
"ilobjbloggui",
"wsp_id", $blog_id);
367 $blog_link = $ilCtrl->getLinkTargetByClass(array(
"ilpersonaldesktopgui",
"ilpersonalworkspacegui",
"ilobjbloggui"),
"");
368 $ilCtrl->setParameterByClass(
"ilobjbloggui",
"wsp_id",
"");
369 $files_str =
'<a href="'.$blog_link.
'">'.
370 $node[
"title"].
'</a>';
374 else if(substr($delivered_files[
"filename"], -1) ==
"/")
376 $this->exc->deleteResourceObject($delivered_files[
"ass_id"],
377 $ilUser->getId(), $delivered_files[
"returned_id"]);
385 $button->setCaption(
"exc_create_blog");
386 $button->setUrl($ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"createBlog"));
387 $files_str.= $button->render();
390 $blogs =
sizeof($wsp_tree->getObjectsFromType(
"blog"));
391 if((!$valid_blog && $blogs)
392 || ($valid_blog && $blogs > 1))
395 $button->setCaption(
"exc_select_blog".($valid_blog ?
"_change" :
""));
396 $button->setUrl($ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"selectBlog"));
397 $files_str.=
" ".$button->render();
402 $info->addProperty($lng->txt(
"exc_blog_returned"), $files_str);
404 if($delivered_files && substr($delivered_files[
"filename"], -1) !=
"/")
406 $ilCtrl->setParameterByClass(
"ilobjexercisegui",
"delivered", $delivered_files[
"returned_id"]);
407 $dl_link = $ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"download");
408 $ilCtrl->setParameterByClass(
"ilobjexercisegui",
"delivered",
"");
411 $button->setCaption(
"download");
412 $button->setUrl($dl_link);
414 $info->addProperty($lng->txt(
"exc_files_returned"),
420 include_once
"Modules/Portfolio/classes/class.ilObjPortfolio.php";
424 if(
sizeof($delivered_files))
426 $delivered_files = array_pop($delivered_files);
427 $portfolio_id = (int)$delivered_files[
"filetitle"];
433 if($portfolio->getTitle())
436 $ilCtrl->setParameterByClass(
"ilobjportfoliogui",
"prt_id", $portfolio_id);
437 $prtf_link = $ilCtrl->getLinkTargetByClass(array(
"ilpersonaldesktopgui",
"ilportfoliorepositorygui",
"ilobjportfoliogui"),
"view");
438 $ilCtrl->setParameterByClass(
"ilobjportfoliogui",
"prt_id",
"");
440 $files_str =
'<a href="'.$prtf_link.
441 '">'.$portfolio->getTitle().
'</a>';
446 else if(substr($delivered_files[
"filename"], -1) ==
"/")
448 $this->exc->deleteResourceObject($delivered_files[
"ass_id"],
449 $ilUser->getId(), $delivered_files[
"returned_id"]);
457 include_once
"Modules/Portfolio/classes/class.ilObjPortfolioTemplate.php";
463 $button->setCaption(
"exc_create_portfolio");
464 $button->setUrl($ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"createPortfolio".$has_prtt));
465 $files_str .= $button->render();
469 if((!$valid_prtf && $prtfs)
470 || ($valid_prtf && $prtfs > 1))
473 $button->setCaption(
"exc_select_portfolio".($valid_prtf ?
"_change" :
""));
474 $button->setUrl($ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"selectPortfolio"));
475 $files_str.=
" ".$button->render();
480 $info->addProperty($lng->txt(
"exc_portfolio_returned"), $files_str);
482 if($delivered_files && substr($delivered_files[
"filename"], -1) !=
"/")
484 $ilCtrl->setParameterByClass(
"ilobjexercisegui",
"delivered", $delivered_files[
"returned_id"]);
485 $dl_link = $ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"download");
486 $ilCtrl->setParameterByClass(
"ilobjexercisegui",
"delivered",
"");
489 $button->setCaption(
"download");
490 $button->setUrl($dl_link);
492 $info->addProperty($lng->txt(
"exc_files_returned"),
498 $ilCtrl->setParameterByClass(
"ilobjexercisegui",
"ass_id", $a_data[
"id"]);
503 $button->setPrimary(
true);
504 $button->setCaption(
"exc_text_assignment_edit");
505 $button->setUrl($ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"editAssignmentText"));
506 $files_str = $button->render();
511 $button->setCaption(
"exc_text_assignment_show");
512 $button->setUrl($ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"showAssignmentText"));
513 $files_str = $button->render();
516 $info->addProperty($lng->txt(
"exc_files_returned_text"),
532 if ($last_sub !=
"---")
534 $info->addProperty($lng->txt(
"exc_last_submission"),
540 if($times_up && $a_data[
"peer"])
544 if(!$a_data[
"peer_dl"] || $a_data[
"peer_dl"] > time())
547 if($a_data[
"peer_dl"])
549 $dl_info =
" (".sprintf($lng->txt(
"exc_peer_review_deadline_info_button"),
554 $button->setPrimary($nr_missing_fb);
555 $button->setCaption($lng->txt(
"exc_peer_review_give").$dl_info,
false);
556 $button->setUrl($ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"editPeerReview"));
557 $edit_pc = $button->render();
559 else if($a_data[
"peer_dl"])
561 $edit_pc = $lng->txt(
"exc_peer_review_deadline_reached");
563 if((!$a_data[
"peer_dl"] || $a_data[
"peer_dl"] < time()) &&
567 $button->setCaption(
"exc_peer_review_show");
568 $button->setUrl($ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"showPersonalPeerReview"));
569 $view_pc = $button->render();
578 $info->addProperty($lng->txt(
"exc_peer_review"),
579 $edit_pc.
" ".$view_pc);
586 $feedback_id =
"t".ilExAssignment::getTeamIdByAssignment($a_data[
"id"], $ilUser->getId());
590 $feedback_id = $ilUser->getId();
596 $show_global_feedback = ($times_up && $a_data[
"fb_file"]);
600 $show_global_feedback = ($last_sub !=
"---" && $a_data[
"fb_file"]);
604 $cnt_files = $storage->countFeedbackFiles($feedback_id);
608 if ($lpcomment !=
"" || $mark !=
"" || $status !=
"notgraded" ||
609 $cnt_files > 0 || $show_global_feedback)
611 $info->addSection($lng->txt(
"exc_feedback_from_tutor"));
612 if ($lpcomment !=
"")
614 $info->addProperty($lng->txt(
"exc_comment"),
619 $info->addProperty($lng->txt(
"exc_mark"),
628 else if ($status !=
"notgraded")
630 $img =
'<img src="'.ilUtil::getImagePath(
"scorm/".$status.
".svg").
'" '.
631 ' alt="'.$lng->txt(
"exc_".$status).
'" title="'.$lng->txt(
"exc_".$status).
633 $info->addProperty($lng->txt(
"status"),
634 $img.
" ".$lng->txt(
"exc_".$status));
639 $info->addSection($lng->txt(
"exc_fb_files").
640 '<a name="fb'.$a_data[
"id"].
'"></a>');
644 $files = $storage->getFeedbackFiles($feedback_id);
645 foreach($files as
$file)
647 $ilCtrl->setParameterByClass(
"ilobjexercisegui",
"file", urlencode($file));
648 $info->addProperty($file,
649 $lng->txt(
"download"),
650 $ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"downloadFeedbackFile"));
651 $ilCtrl->setParameterByClass(
"ilobjexercisegui",
"file",
"");
657 if($show_global_feedback)
659 $info->addSection($lng->txt(
"exc_global_feedback_file"));
661 $info->addProperty($a_data[
"fb_file"],
662 $lng->txt(
"download"),
663 $ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"downloadGlobalFeedbackFile"));
669 $tpl->setVariable(
"CONTENT", $info->getHTML());
681 if ($a_deadline == 0)
683 return $lng->txt(
"exc_no_deadline_specified");
686 if ($a_deadline - time() <= 0)
688 $time_str = $lng->txt(
"exc_time_over_short");
694 if (isset($time_diff[
'minutes']))
696 unset($time_diff[
'seconds']);
698 if (isset($time_diff[
'days']))
700 unset($time_diff[
'minutes']);
702 if (isset($time_diff[
'months']))
704 unset($time_diff[
'hours']);