43 $this->user_id =
$DIC->user()->getId();
46 $this->selected_wsp_obj_id = $this->request->getSelectedWspObjId();
53 if (!$this->submission->canView()) {
57 $class = $ilCtrl->getNextClass($this);
58 $cmd = $ilCtrl->getCmd();
62 $this->{$cmd .
"Object"}();
71 switch ($a_submission->getAssignment()->getType()) {
89 $ilCtrl =
$DIC->ctrl();
90 $gui =
$DIC->exercise()->internal()->gui();
95 if (!$wsp_tree->getRootId()) {
96 $wsp_tree->createTreeForUser($a_submission->
getUserId());
103 if ($selected_blog) {
105 $node = $wsp_tree->getNodeData($blog_id);
106 if ($node[
"title"]) {
108 $ilCtrl->setParameterByClass(
"ilobjbloggui",
"wsp_id", $blog_id);
109 $blog_link = $ilCtrl->getLinkTargetByClass(array(
"ildashboardgui",
"ilpersonalworkspacegui",
"ilobjbloggui"),
"");
110 $ilCtrl->setParameterByClass(
"ilobjbloggui",
"wsp_id",
"");
111 $files_str =
'<a href="' . $blog_link .
'">' .
112 $node[
"title"] .
'</a>';
116 elseif (substr($selected_blog[
"filename"], -1) ==
"/") {
123 $button = $gui->button(
124 $lng->txt(
"exc_create_blog"),
125 $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class,
"ilExSubmissionGUI",
"ilExSubmissionObjectGUI"),
"createBlog")
127 $buttons_str .= $button->render();
130 $blogs = count($wsp_tree->getObjectsFromType(
"blog"));
131 if ((!$valid_blog && $blogs)
132 || ($valid_blog && $blogs > 1)) {
134 $lng->txt(
"exc_select_blog" . ($valid_blog ?
"_change" :
"")),
135 $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class,
"ilExSubmissionGUI",
"ilExSubmissionObjectGUI"),
"selectBlog")
137 $buttons_str .=
" " . $link->render();
142 if ($buttons_str !=
"") {
143 $files_str .=
"<p>" . $buttons_str .
"</p>";
151 $ilCtrl->setParameterByClass(
"ilExSubmissionFileGUI",
"delivered", $selected_blog[
"returned_id"]);
152 $dl_link = $ilCtrl->getLinkTargetByClass(array(
"ilExSubmissionGUI",
"ilExSubmissionFileGUI"),
"download");
153 $ilCtrl->setParameterByClass(
"ilExSubmissionFileGUI",
"delivered",
"");
155 $button = $gui->button(
156 $lng->txt(
"download"),
160 $a_info->
addProperty(
$lng->txt(
"exc_files_returned"), $button->render());
168 $back_ref_id =
$DIC->http()->wrapper()->query()->retrieve(
170 $DIC->refinery()->kindlyTo()->int()
173 $request =
$DIC->exercise()->internal()->gui()->request();
174 $gui =
$DIC->exercise()->internal()->gui();
178 $ilCtrl =
$DIC->ctrl();
184 if ($selected_prtf) {
190 if ($portfolio->getTitle()) {
192 $ilCtrl->setParameterByClass(
"ilobjportfoliogui",
"prt_id", $portfolio_id);
194 $ref_id = $request->getRefId();
195 $ilCtrl->setParameterByClass(
"ilobjportfoliogui",
"ref_id",
$ref_id);
196 $ilCtrl->setParameterByClass(
"ilobjportfoliogui",
"exc_back_ref_id", $back_ref_id);
198 $prtf_link = $ilCtrl->getLinkTargetByClass(array(
"ildashboardgui",
"ilportfoliorepositorygui",
"ilobjportfoliogui"),
"view");
199 $ilCtrl->setParameterByClass(
"ilobjportfoliogui",
"prt_id",
"");
200 $ilCtrl->setParameterByClass(
"ilobjportfoliogui",
"ref_id",
"");
203 $files_str =
'<a href="' . $prtf_link .
204 '">' . $portfolio->getTitle() .
'</a>';
209 elseif (substr($selected_prtf[
"filename"], -1) ==
"/") {
216 $button = $gui->button(
217 $lng->txt(
"exc_create_portfolio"),
218 $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class,
"ilExSubmissionGUI",
"ilExSubmissionObjectGUI"),
"createPortfolioFromAssignment")
221 $buttons_str .= $button->render();
226 if ((!$valid_prtf && $prtfs)
227 || ($valid_prtf && $prtfs > 1)) {
229 $lng->txt(
"exc_select_portfolio" . ($valid_prtf ?
"_change" :
"")),
230 $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class,
"ilExSubmissionGUI",
"ilExSubmissionObjectGUI"),
"selectPortfolio")
233 $buttons_str .=
" " . $link->render();
237 $lng->txt(
"exc_select_portfolio_unlink"),
238 $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class,
"ilExSubmissionGUI",
"ilExSubmissionObjectGUI"),
"askUnlinkPortfolio")
240 $buttons_str .=
" " . $link->render();
244 if ($buttons_str !=
"") {
245 $files_str .=
"<p>" . $buttons_str .
"</p>";
251 $ilCtrl->setParameterByClass(
"ilExSubmissionFileGUI",
"delivered", $selected_prtf[
"returned_id"]);
252 $dl_link = $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class,
"ilExSubmissionGUI",
"ilExSubmissionFileGUI"),
"download");
253 $ilCtrl->setParameterByClass(
"ilExSubmissionFileGUI",
"delivered",
"");
255 $button = $gui->button(
256 $lng->txt(
"download"),
260 $a_info->
addProperty(
$lng->txt(
"exc_files_returned"), $button->render());
268 string $a_explorer_cmd,
269 ?array $a_items =
null
271 if (!$this->submission->canSubmit()) {
272 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"exercise_time_over"),
true);
273 $this->returnToParentObject();
277 $tpl =
new ilTemplate(
"tpl.exc_select_resource.html",
true,
true,
"components/ILIAS/Exercise");
279 if (is_array($a_items)) {
280 $tpl->setCurrentBlock(
"item");
281 foreach ($a_items as $item_id => $item_title) {
282 $tpl->setVariable(
"ITEM_ID", $item_id);
283 $tpl->setVariable(
"ITEM_TITLE", $item_title);
284 $tpl->parseCurrentBlock();
286 $tpl->setVariable(
"FORM_ACTION", $this->
ctrl->getFormAction($this));
287 $tpl->setVariable(
"TXT_SUBMIT", $this->
lng->txt(
"save"));
288 $tpl->setVariable(
"TXT_CANCEL", $this->
lng->txt(
"cancel"));
289 $tpl->setVariable(
"CMD_SUBMIT", $a_cmd);
290 $tpl->setVariable(
"CMD_CANCEL",
"returnToParent");
292 } elseif ($a_explorer_cmd) {
293 $html = $this->renderWorkspaceExplorer($a_explorer_cmd);
297 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt($a_info));
299 $title = $this->
lng->txt($a_title) .
": " . $this->assignment->getTitle();
301 $f = $this->gui->ui()->factory();
302 $r = $this->gui->ui()->renderer();
303 $p =
$f->panel()->standard(
305 $f->legacy()->content($html)
308 $this->tpl->setContent($r->render($p));
320 $this->renderResourceSelection(
322 "exc_create_blog_select_info",
332 $this->renderResourceSelection(
334 "exc_select_blog_info",
346 if (!$this->submission->canSubmit()) {
347 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"exercise_time_over"),
true);
348 $this->returnToParentObject();
351 if ($this->selected_wsp_obj_id == 0) {
352 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"select_one"));
353 $this->createBlogObject();
357 $parent_node = $this->selected_wsp_obj_id;
360 $blog->setTitle($this->exercise->getTitle() .
" - " . $this->assignment->getTitle());
365 $node_id = $tree->insertObject($parent_node, $blog->getId());
368 $access_handler->setPermissions($parent_node, $node_id);
370 $this->submission->deleteAllFiles();
371 $this->handleRemovedUpload();
373 $this->submission->addResourceObject($node_id);
375 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"exc_blog_created"),
true);
376 $this->
ctrl->setParameterByClass(ilObjBlogGUI::class,
"wsp_id", $node_id);
377 $this->
ctrl->redirectByClass(
378 [ilDashboardGUI::class, ilPersonalWorkspaceGUI::class, ilObjBlogGUI::class],
389 if (!$this->submission->canSubmit()) {
390 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"exercise_time_over"),
true);
391 $this->returnToParentObject();
394 if ($this->selected_wsp_obj_id > 0) {
396 $node = $tree->getNodeData($this->selected_wsp_obj_id);
397 if ($node && $node[
"type"] ==
"blog") {
398 $this->submission->deleteAllFiles();
399 $this->handleRemovedUpload();
401 $this->submission->addResourceObject($node[
"wsp_id"]);
403 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"exc_blog_selected"),
true);
404 $this->
ctrl->setParameter($this,
"blog_id", $node[
"wsp_id"]);
405 $this->
ctrl->redirect($this,
"askDirectSubmission");
409 $this->selectBlogObject();
418 $exp2 =
new ilWorkspaceExplorerGUI($this->submission->getUserId(), $this, $a_cmd, $this,
"setSelectedBlog");
419 $exp2->setTypeWhiteList(array(
"blog",
"wsrt",
"wfld"));
420 $exp2->setSelectableTypes(array(
"blog"));
425 $exp2->setTypeWhiteList(array(
"wsrt",
"wfld"));
426 $exp2->setSelectableTypes(array(
"wsrt",
"wfld"));
429 if (!$exp2->handleCommand()) {
430 return $exp2->getHTML();
446 foreach ($portfolios as $portfolio) {
447 $items[$portfolio[
"id"]] = $portfolio[
"title"];
450 $this->renderResourceSelection(
451 "exc_select_portfolio",
452 "exc_select_portfolio_info",
453 "setSelectedPortfolio",
463 $form->
setTitle($this->
lng->txt(
"exc_create_portfolio") .
": " . $this->assignment->getTitle());
464 $form->setFormAction($this->
ctrl->getFormAction($this,
"setSelectedPortfolioTemplate"));
467 $prtt->setRequired(
true);
468 $prtt->addOption(
new ilRadioOption($this->
lng->txt(
"exc_create_portfolio_no_template"), -1));
469 foreach ($a_templates as
$id => $title) {
473 $form->addItem($prtt);
475 $form->addCommandButton(
"setSelectedPortfolioTemplate", $this->
lng->txt(
"save"));
476 $form->addCommandButton(
"returnToParent", $this->
lng->txt(
"cancel"));
485 $ctrl =
$DIC->ctrl();
490 $template_id = $this->assignment->getPortfolioTemplateId();
495 if ($templates !== [] && $template_object_id == 0) {
496 $this->createPortfolioTemplateObject();
500 $title = $this->exercise->getTitle() .
" - " . $this->assignment->getTitle();
501 $ctrl->setParameterByClass(
"ilObjPortfolioGUI",
"exc_id", $this->exercise->getRefId());
502 $ctrl->setParameterByClass(
"ilObjPortfolioGUI",
"ass_id", $this->assignment->getId());
503 $ctrl->setParameterByClass(
"ilObjPortfolioGUI",
"pt", $title);
505 if ($template_object_id > 0) {
506 $ctrl->setParameterByClass(
"ilObjPortfolioGUI",
"prtt", $template_object_id);
508 $ctrl->setParameterByClass(
"ilobjportfoliogui",
"exc_back_ref_id", $this->requested_ref_id);
509 $ctrl->redirectByClass(array(
"ildashboardgui",
"ilPortfolioRepositoryGUI",
"ilObjPortfolioGUI"),
"createPortfolioFromAssignment");
515 if (!$this->submission->canSubmit()) {
516 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"exercise_time_over"),
true);
517 $this->returnToParentObject();
521 if ($templates === []) {
522 $this->returnToParentObject();
525 if ($a_form ===
null) {
526 $a_form = $this->initPortfolioTemplateForm($templates);
529 $this->tpl->setContent($a_form->getHTML());
538 if (!$this->submission->canSubmit()) {
539 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"exercise_time_over"),
true);
540 $this->returnToParentObject();
544 if ($templates === []) {
545 $this->
ctrl->redirect($this,
"returnToParent");
548 $form = $this->initPortfolioTemplateForm($templates);
549 if ($form->checkInput()) {
550 $prtt = $form->getInput(
"prtt");
551 if ($prtt > 0 && array_key_exists($prtt, $templates)) {
552 $title = $this->exercise->getTitle() .
" - " . $this->assignment->getTitle();
553 $this->
ctrl->setParameterByClass(
"ilObjPortfolioGUI",
"exc_id", $this->exercise->getRefId());
554 $this->
ctrl->setParameterByClass(
"ilObjPortfolioGUI",
"ass_id", $this->assignment->getId());
555 $this->
ctrl->setParameterByClass(
"ilObjPortfolioGUI",
"pt", $title);
556 $this->
ctrl->setParameterByClass(
"ilObjPortfolioGUI",
"prtt", $prtt);
557 $this->
ctrl->setParameterByClass(
"ilobjportfoliogui",
"exc_back_ref_id", $this->requested_ref_id);
558 $this->
ctrl->redirectByClass(array(
"ildashboardgui",
"ilPortfolioRepositoryGUI",
"ilObjPortfolioGUI"),
"createPortfolioFromTemplate");
561 $this->createPortfolioObject();
566 $form->setValuesByPost();
567 $this->createPortfolioTemplateObject($form);
576 if (!$this->submission->canSubmit()) {
577 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"exercise_time_over"),
true);
578 $this->returnToParentObject();
582 $portfolio->setTitle($this->exercise->getTitle() .
" - " . $this->assignment->getTitle());
583 $portfolio->create();
585 $this->submission->deleteAllFiles();
586 $this->handleRemovedUpload();
588 $this->submission->addResourceObject($portfolio->getId());
590 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"exc_portfolio_created"),
true);
591 $this->
ctrl->setParameterByClass(ilObjPortfolioGUI::class,
"prt_id", $portfolio->getId());
592 $this->
ctrl->redirectByClass(array(
"ildashboardgui",
"ilPortfolioRepositoryGUI",
"ilObjPortfolioGUI"),
"view");
601 if (!$this->submission->canSubmit()) {
602 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"exercise_time_over"),
true);
603 $this->returnToParentObject();
606 $prtf_id = $this->request->getResourceObjectId();
608 $this->submission->deleteAllFiles();
609 $this->handleRemovedUpload();
611 $this->submission->addResourceObject($prtf_id);
613 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"exc_portfolio_selected"),
true);
614 $this->
ctrl->setParameter($this,
"prtf_id", $prtf_id);
615 $this->
ctrl->redirect($this,
"askDirectSubmission");
618 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"select_one"));
619 $this->selectPortfolioObject();
627 $conf->setFormAction($this->
ctrl->getFormAction($this,
"unlinkPortfolio"));
628 $conf->setHeaderText($this->
lng->txt(
"exc_sure_unlink_portfolio",
"sure_unlink_portfolio"));
629 $conf->setConfirm($this->
lng->txt(
"confirm"),
"unlinkPortfolio");
630 $conf->setCancel($this->
lng->txt(
"cancel"),
"returnToParent");
632 $submission = $this->submission->getSelectedObject();
637 $tpl->setContent($conf->getHTML());
644 $user =
$DIC->user();
650 $this->submission->deleteResourceObject();
652 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"exc_portfolio_unlinked_from_assignment"),
true);
654 $this->
ctrl->redirect($this,
"returnToParent");
662 $conf->setFormAction($this->
ctrl->getFormAction($this,
"unlinkBlog"));
663 $conf->setHeaderText($this->
lng->txt(
"exc_sure_unlink_blog"));
664 $conf->setConfirm($this->
lng->txt(
"confirm"),
"unlinkBlog");
665 $conf->setCancel($this->
lng->txt(
"cancel"),
"returnToParent");
667 $submission = $this->submission->getSelectedObject();
669 $object_id = $wstree->lookupObjectId((
int) $submission?->
getTitle());
670 $port =
new ilObjBlog($object_id,
false);
674 $tpl->setContent($conf->getHTML());
679 $this->submission->deleteResourceObject();
681 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"exc_blog_unlinked_from_assignment"),
true);
683 $this->
ctrl->redirect($this,
"returnToParent");
694 if (!$this->submission->canSubmit()) {
695 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"exercise_time_over"),
true);
696 $this->returnToParentObject();
701 if ($this->request->getBlogId() > 0) {
702 $this->
ctrl->setParameter($this,
"blog_id", $this->request->getBlogId());
703 $txt = $this->
lng->txt(
"exc_direct_submit_blog");
705 $this->
ctrl->setParameter($this,
"prtf_id", $this->request->getPortfolioId());
706 $txt = $this->
lng->txt(
"exc_direct_submit_portfolio");
708 $conf->setFormAction($this->
ctrl->getFormAction($this,
"directSubmit"));
710 $conf->setHeaderText(
$txt);
711 $conf->setConfirm($this->
lng->txt(
"exc_direct_submit"),
"directSubmit");
712 $conf->setCancel($this->
lng->txt(
"exc_direct_no_submit"),
"returnToParent");
714 $tpl->setContent($conf->getHTML());
723 if (!$this->submission->canSubmit()) {
724 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"exercise_time_over"),
true);
725 $this->returnToParentObject();
731 if ($this->request->getBlogId() > 0) {
732 $success = $this->submitBlog($this->request->getBlogId());
733 $this->
ctrl->setParameter($this,
"blog_id",
"");
736 elseif ($this->request->getPortfolioId() > 0) {
737 $success = $this->submitPortfolio($this->request->getPortfolioId());
738 $this->
ctrl->setParameter($this,
"prtf_id",
"");
742 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"settings_saved"),
true);
744 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"msg_failed"),
true);
746 $this->
ctrl->redirectByClass([ilExerciseHandlerGUI::class, ilObjExerciseGUI::class, ilAssignmentPresentationGUI::class, ilExSubmissionGUI::class, ilExSubmissionObjectGUI::class],
"returnToParent");
757 if (!$this->submission->canSubmit()) {
761 $subm = $this->domain->submission($this->submission->getAssignment()->getId());
763 $blog_id = $a_blog_id;
766 if ($blog_gui->getObject()) {
767 $export = $blog_gui->buildExportFile();
768 $file = $export->getFilePath();
769 $size = filesize($file);
771 $this->submission->deleteAllFiles();
781 $export = $blog_gui->buildExportFile(
false,
true);
782 $file = $export->getFilePath();
783 $size = filesize($file);
788 $blog_id .
"print.zip"
793 $this->handleNewUpload();
807 if (!$this->submission->canSubmit()) {
811 $prtf_id = $a_portfolio_id;
812 $subm = $this->domain->submission($this->submission->getAssignment()->getId());
815 if ($prtf->getTitle()) {
818 $port_export->exportHtml();
820 $file = $port_export->getFilePath();
822 $size = filesize($file);
824 $this->submission->deleteAllFiles();
831 $port_export->delete();
835 $port_export->setPrintVersion(
true);
836 $port_export->exportHtml();
837 $file = $port_export->getFilePath();
838 $size = filesize($file);
844 $prtf_id .
"print.zip"
846 $file = $port_export->delete();
849 $this->handleNewUpload();
861 ?
int $a_user_id =
null
865 $ilUser =
$DIC->user();
868 $a_user_id = $ilUser->getId();
873 $exc_id = $ass->getExerciseId();
877 $exc_ref_id = current($ref_ids);
880 return new self($exc, $sub);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Exercise submission base gui.
Object-based submissions (ends up as static file)
setSelectedPortfolioObject()
__construct(ilObjExercise $a_exercise, ilExSubmission $a_submission)
static getOverviewContent(ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
renderResourceSelection(string $a_title, string $a_info, string $a_cmd, string $a_explorer_cmd, ?array $a_items=null)
askDirectSubmissionObject()
setSelectedPortfolioTemplateObject()
submitPortfolio(int $a_portfolio_id)
Submit portfolio for assignment.
createPortfolioFromAssignmentObject()
static getOverviewContentBlog(ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
askUnlinkPortfolioObject()
static initGUIForSubmit(int $a_ass_id, ?int $a_user_id=null)
initPortfolioTemplateForm(array $a_templates)
createPortfolioTemplateObject(?ilPropertyFormGUI $a_form=null)
renderWorkspaceExplorer(string $a_cmd)
static getOverviewContentPortfolio(ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
submitBlog(int $a_blog_id)
Submit blog for assignment.
Exercise submission //TODO: This class has many static methods related to delivered "files".
addProperty(string $a_name, string $a_value, string $a_link="")
add a property to current section
@ilCtrl_Calls ilObjBlogGUI: ilBlogPostingGUI, ilWorkspaceAccessGUI @ilCtrl_Calls ilObjBlogGUI: ilInfo...
@ilCtrl_Calls ilObjPortfolioGUI: ilPortfolioPageGUI, ilPageObjectGUI @ilCtrl_Calls ilObjPortfolioGUI:...
static getAvailablePortfolioTemplates(string $a_permission="read")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getPortfoliosOfUser(int $a_user_id)
Get portfolios of user.
static _lookupObjectId(int $ref_id)
static _getAllReferences(int $id)
get all reference ids for object ID
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
This class represents an option in a radio group.
special template class to simplify handling of ITX/PEAR
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Explorer for selecting a personal workspace item.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
if(!file_exists('../ilias.ini.php'))