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();
43 else if ($a_data[
"start_time"] > 0 && time() - $a_data[
"start_time"] <= 0)
45 $tpl->setCurrentBlock(
"prop");
46 $tpl->setVariable(
"PROP", $lng->txt(
"exc_starting_on"));
47 $tpl->setVariable(
"PROP_VAL",
49 $tpl->parseCurrentBlock();
54 $tpl->setCurrentBlock(
"prop");
55 $tpl->setVariable(
"PROP", $lng->txt(
"exc_time_to_send"));
56 $tpl->setVariable(
"PROP_VAL", $time_str);
57 $tpl->parseCurrentBlock();
59 if ($a_data[
"deadline"] > 0)
61 $tpl->setCurrentBlock(
"prop");
62 $tpl->setVariable(
"PROP", $lng->txt(
"exc_edit_until"));
63 $tpl->setVariable(
"PROP_VAL",
65 $tpl->parseCurrentBlock();
71 if ($a_data[
"mandatory"])
73 $mand =
" (".$lng->txt(
"exc_mandatory").
")";
75 $tpl->setVariable(
"TITLE", $a_data[
"title"].$mand);
82 case "passed": $pic =
"scorm/passed.png";
break;
83 case "failed": $pic =
"scorm/failed.png";
break;
84 default: $pic =
"scorm/not_attempted.png";
break;
87 $tpl->setVariable(
"ALT_STATUS", $lng->txt(
"exc_".$stat));
99 $tpl =
new ilTemplate(
"tpl.assignment_body.html",
true,
true,
"Modules/Exercise");
101 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
102 if(IS_PAYMENT_ENABLED)
104 include_once
'./Services/Payment/classes/class.ilPaymentObject.php';
108 $info->setTableClass(
"");
110 $not_started_yet =
false;
111 if ($a_data[
"start_time"] > 0 && time() - $a_data[
"start_time"] <= 0)
113 $not_started_yet =
true;
116 if (!$not_started_yet)
119 $info->addSection($lng->txt(
"exc_instruction"));
121 $is_html = (strlen($a_data[
"instruction"]) != strlen(strip_tags($a_data[
"instruction"])));
126 $info->addProperty(
"", $a_data[
"instruction"]);
130 $info->addSection($lng->txt(
"exc_schedule"));
131 if ($a_data[
"start_time"] > 0)
133 $info->addProperty($lng->txt(
"exc_start_time"),
136 if ($a_data[
"deadline"] > 0)
138 $info->addProperty($lng->txt(
"exc_edit_until"),
142 if (!$not_started_yet)
144 $info->addProperty($lng->txt(
"exc_time_to_send"),
145 "<b>".$time_str.
"</b>");
149 if ($this->exc->getShowSubmissions())
151 $ilCtrl->setParameterByClass(
"ilobjexercisegui",
"ass_id", $a_data[
"id"]);
152 if ($a_data[
"deadline"] - time() <= 0)
154 $link =
'<a class="submit" href="'.
155 $ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"listPublicSubmissions").
'">'.
156 $lng->txt(
"exc_list_submission").
'</a>';
157 $info->addProperty($lng->txt(
"exc_public_submission"), $link);
161 $info->addProperty($lng->txt(
"exc_public_submission"),
162 $lng->txt(
"exc_msg_public_submission"));
164 $ilCtrl->setParameterByClass(
"ilobjexercisegui",
"ass_id",
$_GET[
"ass_id"]);
167 $ilCtrl->setParameterByClass(
"ilobjexercisegui",
"ass_id", $a_data[
"id"]);
169 if (!$not_started_yet)
173 if (count($files) > 0)
175 $info->addSection($lng->txt(
"exc_files"));
176 foreach($files as
$file)
182 $info->addProperty($file[
"name"],
184 $ilCtrl->getLinkTargetByClass(
"ilShopPurchaseGUI",
"showDetails"));
188 $ilCtrl->setParameterByClass(
"ilobjexercisegui",
"file", urlencode($file[
"name"]));
189 $info->addProperty($file[
"name"],
190 $lng->txt(
"download"),
191 $ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"downloadFile"));
192 $ilCtrl->setParameterByClass(
"ilobjexercisegui",
"file",
"");
200 if(IS_PAYMENT_ENABLED
204 $info->addSection($lng->txt(
"exc_your_submission"));
206 $ilCtrl->clearParameters($this);
208 $ilCtrl->setParameter($this,
"ref_id",
$_GET[
'ref_id']);
209 $ilCtrl->setParameter($this,
'subtype',
'upload');
210 $info->addProperty($lng->txt(
'exc_hand_in'),
212 $ilCtrl->getLinkTargetByClass(
"ilShopPurchaseGUI",
"showDetails"));
216 $info->addSection($lng->txt(
"exc_your_submission"));
221 if(($a_data[
"deadline"] > 0) && $a_data[
"deadline"] - time() < 0)
226 $team_members = null;
227 switch($a_data[
"type"])
230 $no_team_yet =
false;
232 if(
sizeof($team_members))
235 foreach($team_members as $member_id)
239 $info->addProperty($lng->txt(
"exc_team_members"), implode(
", ", $team));
244 if(!
sizeof($delivered_files))
246 $info->addProperty($lng->txt(
"exc_team_members"), $lng->txt(
"exc_no_team_yet"));
250 $info->addProperty($lng->txt(
"exc_team_members"),
251 '<span class="warning">'.$lng->txt(
"exc_no_team_yet").
'</span>');
258 foreach($delivered_files as
$file)
260 $titles[] = $file[
"filetitle"];
262 $files_str = implode($titles,
", ");
263 if ($files_str ==
"")
265 $files_str = $lng->txt(
"message_no_delivered_files");
268 $ilCtrl->setParameterByClass(
"ilobjexercisegui",
"ass_id", $a_data[
"id"]);
273 if($no_team_yet && count($titles))
275 $title = $lng->txt(
"exc_create_team");
279 $title = (count($titles) == 0
280 ? $lng->txt(
"exc_hand_in")
281 : $lng->txt(
"exc_edit_submission"));
283 $files_str.=
' <a class="submit emphsubmit" href="'.
284 $ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"submissionScreen").
'">'.
291 $files_str .=
'<div class="warning">'.
292 $lng->txt(
"exc_create_team_times_up_warning").
'</div>';
294 else if (count($titles) > 0)
296 $files_str.=
' <a class="submit" href="'.
297 $ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"submissionScreen").
'">'.
298 $lng->txt(
"already_delivered_files").
'</a>';
302 $info->addProperty($lng->txt(
"exc_files_returned"),
307 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
311 if(!$wsp_tree->getRootId())
318 if(
sizeof($delivered_files))
320 $delivered_files = array_pop($delivered_files);
321 $blog_id = (int)$delivered_files[
"filetitle"];
322 $node = $wsp_tree->getNodeData($blog_id);
326 $ilCtrl->setParameterByClass(
"ilobjbloggui",
"wsp_id", $blog_id);
327 $blog_link = $ilCtrl->getLinkTargetByClass(array(
"ilpersonaldesktopgui",
"ilpersonalworkspacegui",
"ilobjbloggui"),
"");
328 $ilCtrl->setParameterByClass(
"ilobjbloggui",
"wsp_id",
"");
329 $files_str =
'<a href="'.$blog_link.
'">'.
330 $node[
"title"].
'</a>';
334 else if(substr($delivered_files[
"filename"], -1) ==
"/")
336 $this->exc->deleteResourceObject($delivered_files[
"ass_id"],
337 $ilUser->getId(), $delivered_files[
"returned_id"]);
344 $files_str .=
'<a class="submit" href="'.
345 $ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"createBlog").
'">'.
346 $lng->txt(
"exc_create_blog").
'</a>';
349 $blogs =
sizeof($wsp_tree->getObjectsFromType(
"blog"));
350 if((!$valid_blog && $blogs)
351 || ($valid_blog && $blogs > 1))
353 $files_str .=
' <a class="submit" href="'.
354 $ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"selectBlog").
'">'.
355 $lng->txt(
"exc_select_blog".($valid_blog ?
"_change" :
"")).
'</a>';
360 $info->addProperty($lng->txt(
"exc_blog_returned"), $files_str);
362 if($delivered_files && substr($delivered_files[
"filename"], -1) !=
"/")
364 $ilCtrl->setParameterByClass(
"ilobjexercisegui",
"delivered", $delivered_files[
"returned_id"]);
365 $dl_link = $ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"download");
366 $ilCtrl->setParameterByClass(
"ilobjexercisegui",
"delivered",
"");
368 $info->addProperty($lng->txt(
"exc_files_returned"),
369 "<a href=\"".$dl_link.
"\" class=\"submit\">".$lng->txt(
"download").
"</a>");
374 include_once
"Modules/Portfolio/classes/class.ilObjPortfolio.php";
378 if(
sizeof($delivered_files))
380 $delivered_files = array_pop($delivered_files);
381 $portfolio_id = (int)$delivered_files[
"filetitle"];
387 if($portfolio->getTitle())
390 $ilCtrl->setParameterByClass(
"ilobjportfoliogui",
"prt_id", $portfolio_id);
391 $prtf_link = $ilCtrl->getLinkTargetByClass(array(
"ilpersonaldesktopgui",
"ilportfoliorepositorygui",
"ilobjportfoliogui"),
"view");
392 $ilCtrl->setParameterByClass(
"ilobjportfoliogui",
"prt_id",
"");
394 $files_str =
'<a href="'.$prtf_link.
395 '">'.$portfolio->getTitle().
'</a>';
400 else if(substr($delivered_files[
"filename"], -1) ==
"/")
402 $this->exc->deleteResourceObject($delivered_files[
"ass_id"],
403 $ilUser->getId(), $delivered_files[
"returned_id"]);
411 include_once
"Modules/Portfolio/classes/class.ilObjPortfolioTemplate.php";
416 $files_str .=
'<a class="submit" href="'.
417 $ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"createPortfolio".$has_prtt).
'">'.
418 $lng->txt(
"exc_create_portfolio").
'</a>';
422 if((!$valid_prtf && $prtfs)
423 || ($valid_prtf && $prtfs > 1))
425 $files_str .=
' <a class="submit" href="'.
426 $ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"selectPortfolio").
'">'.
427 $lng->txt(
"exc_select_portfolio".($valid_prtf ?
"_change" :
"")).
'</a>';
432 $info->addProperty($lng->txt(
"exc_portfolio_returned"), $files_str);
434 if($delivered_files && substr($delivered_files[
"filename"], -1) !=
"/")
436 $ilCtrl->setParameterByClass(
"ilobjexercisegui",
"delivered", $delivered_files[
"returned_id"]);
437 $dl_link = $ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"download");
438 $ilCtrl->setParameterByClass(
"ilobjexercisegui",
"delivered",
"");
440 $info->addProperty($lng->txt(
"exc_files_returned"),
441 "<a href=\"".$dl_link.
"\" class=\"submit\">".$lng->txt(
"download").
"</a>");
446 $ilCtrl->setParameterByClass(
"ilobjexercisegui",
"ass_id", $a_data[
"id"]);
450 $files_str = $ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"editAssignmentText");
451 $files_str =
"<a href=\"".$files_str.
"\" class=\"submit emphsubmit\">".
452 $lng->txt(
"exc_text_assignment_edit").
"</a>";
456 $files_str = $ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"showAssignmentText");
457 $files_str =
"<a href=\"".$files_str.
"\" class=\"submit\">".
458 $lng->txt(
"exc_text_assignment_show").
"</a>";
461 $info->addProperty($lng->txt(
"exc_files_returned_text"),
477 if ($last_sub !=
"---")
479 $info->addProperty($lng->txt(
"exc_last_submission"),
485 if($times_up && $a_data[
"peer"])
489 if(!$a_data[
"peer_dl"] || $a_data[
"peer_dl"] > time())
492 if($a_data[
"peer_dl"])
494 $dl_info =
" (".sprintf($lng->txt(
"exc_peer_review_deadline_info_button"),
498 $emph = $nr_missing_fb ?
" emphsubmit" :
"";
499 $peer_url = $ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"editPeerReview");
500 $edit_pc =
"<a href=\"".$peer_url.
"\" class=\"submit".$emph.
"\">".
501 $lng->txt(
"exc_peer_review_give").$dl_info.
"</a>";
503 else if($a_data[
"peer_dl"])
505 $edit_pc = $lng->txt(
"exc_peer_review_deadline_reached");
507 if((!$a_data[
"peer_dl"] || $a_data[
"peer_dl"] < time()) &&
510 $view_url = $ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"showPersonalPeerReview");
511 $view_pc =
"<a href=\"".$view_url.
"\" class=\"submit\">".
512 $lng->txt(
"exc_peer_review_show").
"</a>";
521 $info->addProperty($lng->txt(
"exc_peer_review"),
522 $edit_pc.
" ".$view_pc);
529 $feedback_id =
"t".ilExAssignment::getTeamIdByAssignment($a_data[
"id"], $ilUser->getId());
533 $feedback_id = $ilUser->getId();
536 $cnt_files = $storage->countFeedbackFiles($feedback_id);
540 if ($lpcomment !=
"" || $mark !=
"" || $status !=
"notgraded" ||
541 $cnt_files > 0 || ($times_up && $a_data[
"fb_file"]))
543 $info->addSection($lng->txt(
"exc_feedback_from_tutor"));
544 if ($lpcomment !=
"")
546 $info->addProperty($lng->txt(
"exc_comment"),
551 $info->addProperty($lng->txt(
"exc_mark"),
560 else if ($status !=
"notgraded")
562 $img =
'<img src="'.ilUtil::getImagePath(
"scorm/".$status.
".png").
'" '.
563 ' alt="'.$lng->txt(
"exc_".$status).
'" title="'.$lng->txt(
"exc_".$status).
565 $info->addProperty($lng->txt(
"status"),
566 $img.
" ".$lng->txt(
"exc_".$status));
569 if ($cnt_files > 0 || ($times_up && $a_data[
"fb_file"]))
571 $info->addSection($lng->txt(
"exc_fb_files").
572 '<a name="fb'.$a_data[
"id"].
'"></a>');
576 $files = $storage->getFeedbackFiles($feedback_id);
577 foreach($files as
$file)
579 $ilCtrl->setParameterByClass(
"ilobjexercisegui",
"file", urlencode($file));
580 $info->addProperty($file,
581 $lng->txt(
"download"),
582 $ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"downloadFeedbackFile"));
583 $ilCtrl->setParameterByClass(
"ilobjexercisegui",
"file",
"");
588 if($times_up && $a_data[
"fb_file"])
590 $info->addProperty($a_data[
"fb_file"],
591 $lng->txt(
"download"),
592 $ilCtrl->getLinkTargetByClass(
"ilobjexercisegui",
"downloadGlobalFeedbackFile"));
599 $tpl->setVariable(
"CONTENT", $info->getHTML());
611 if ($a_deadline == 0)
613 return $lng->txt(
"exc_no_deadline_specified");
616 if ($a_deadline - time() <= 0)
618 $time_str = $lng->txt(
"exc_time_over_short");
624 if (isset($time_diff[
'minutes']))
626 unset($time_diff[
'seconds']);
628 if (isset($time_diff[
'days']))
630 unset($time_diff[
'minutes']);
632 if (isset($time_diff[
'months']))
634 unset($time_diff[
'hours']);