41 $this->selected_wsp_obj_id = $this->request->getSelectedWspObjId();
48 if (!$this->submission->canView()) {
52 $class = $ilCtrl->getNextClass($this);
53 $cmd = $ilCtrl->getCmd();
57 $this->{$cmd .
"Object"}();
68 self::getOverviewContentBlog($a_info, $a_submission);
72 self::getOverviewContentPortfolio($a_info, $a_submission);
83 $lng = $DIC->language();
84 $ilCtrl = $DIC->ctrl();
85 $gui = $DIC->exercise()->internal()->gui();
90 if (!$wsp_tree->getRootId()) {
99 $blog_id = (
int) $selected_blog[
"filetitle"];
100 $node = $wsp_tree->getNodeData($blog_id);
101 if ($node[
"title"]) {
103 $ilCtrl->setParameterByClass(
"ilobjbloggui",
"wsp_id", $blog_id);
104 $blog_link = $ilCtrl->getLinkTargetByClass(array(
"ildashboardgui",
"ilpersonalworkspacegui",
"ilobjbloggui"),
"");
105 $ilCtrl->setParameterByClass(
"ilobjbloggui",
"wsp_id",
"");
106 $files_str =
'<a href="' . $blog_link .
'">' .
107 $node[
"title"] .
'</a>';
111 elseif (substr($selected_blog[
"filename"], -1) ==
"/") {
118 $button =
$gui->button(
120 $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class,
"ilExSubmissionGUI",
"ilExSubmissionObjectGUI"),
"createBlog")
122 $buttons_str .= $button->render();
125 $blogs = count($wsp_tree->getObjectsFromType(
"blog"));
126 if ((!$valid_blog && $blogs)
127 || ($valid_blog && $blogs > 1)) {
129 $lng->
txt(
"exc_select_blog" . ($valid_blog ?
"_change" :
"")),
130 $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class,
"ilExSubmissionGUI",
"ilExSubmissionObjectGUI"),
"selectBlog")
132 $buttons_str .=
" " . $link->render();
137 if ($buttons_str !=
"") {
138 $files_str .=
"<p>" . $buttons_str .
"</p>";
146 $ilCtrl->setParameterByClass(
"ilExSubmissionFileGUI",
"delivered", $selected_blog[
"returned_id"]);
147 $dl_link = $ilCtrl->getLinkTargetByClass(array(
"ilExSubmissionGUI",
"ilExSubmissionFileGUI"),
"download");
148 $ilCtrl->setParameterByClass(
"ilExSubmissionFileGUI",
"delivered",
"");
150 $button =
$gui->button(
163 $back_ref_id = $DIC->http()->wrapper()->query()->retrieve(
165 $DIC->refinery()->kindlyTo()->int()
168 $request = $DIC->exercise()->internal()->gui()->request();
169 $gui = $DIC->exercise()->internal()->gui();
172 $lng = $DIC->language();
173 $ilCtrl = $DIC->ctrl();
179 if ($selected_prtf) {
180 $portfolio_id = (
int) $selected_prtf[
"filetitle"];
185 if ($portfolio->getTitle()) {
187 $ilCtrl->setParameterByClass(
"ilobjportfoliogui",
"prt_id", $portfolio_id);
190 $ilCtrl->setParameterByClass(
"ilobjportfoliogui",
"ref_id",
$ref_id);
191 $ilCtrl->setParameterByClass(
"ilobjportfoliogui",
"exc_back_ref_id", $back_ref_id);
193 $prtf_link = $ilCtrl->getLinkTargetByClass(array(
"ildashboardgui",
"ilportfoliorepositorygui",
"ilobjportfoliogui"),
"view");
194 $ilCtrl->setParameterByClass(
"ilobjportfoliogui",
"prt_id",
"");
195 $ilCtrl->setParameterByClass(
"ilobjportfoliogui",
"ref_id",
"");
198 $files_str =
'<a href="' . $prtf_link .
199 '">' . $portfolio->getTitle() .
'</a>';
204 elseif (substr($selected_prtf[
"filename"], -1) ==
"/") {
211 $button =
$gui->button(
212 $lng->
txt(
"exc_create_portfolio"),
213 $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class,
"ilExSubmissionGUI",
"ilExSubmissionObjectGUI"),
"createPortfolioFromAssignment")
216 $buttons_str .= $button->render();
221 if ((!$valid_prtf && $prtfs)
222 || ($valid_prtf && $prtfs > 1)) {
224 $lng->
txt(
"exc_select_portfolio" . ($valid_prtf ?
"_change" :
"")),
225 $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class,
"ilExSubmissionGUI",
"ilExSubmissionObjectGUI"),
"selectPortfolio")
228 $buttons_str .=
" " . $link->render();
232 $lng->
txt(
"exc_select_portfolio_unlink"),
233 $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class,
"ilExSubmissionGUI",
"ilExSubmissionObjectGUI"),
"askUnlinkPortfolio")
235 $buttons_str .=
" " . $link->render();
239 if ($buttons_str !=
"") {
240 $files_str .=
"<p>" . $buttons_str .
"</p>";
246 $ilCtrl->setParameterByClass(
"ilExSubmissionFileGUI",
"delivered", $selected_prtf[
"returned_id"]);
247 $dl_link = $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class,
"ilExSubmissionGUI",
"ilExSubmissionFileGUI"),
"download");
248 $ilCtrl->setParameterByClass(
"ilExSubmissionFileGUI",
"delivered",
"");
250 $button =
$gui->button(
263 string $a_explorer_cmd,
264 array $a_items = null
266 if (!$this->submission->canSubmit()) {
267 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"exercise_time_over"),
true);
272 $tpl =
new ilTemplate(
"tpl.exc_select_resource.html",
true,
true,
"Modules/Exercise");
274 if (is_array($a_items)) {
276 foreach ($a_items as $item_id => $item_title) {
287 } elseif ($a_explorer_cmd) {
292 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt($a_info));
294 $title = $this->
lng->txt($a_title) .
": " . $this->assignment->getTitle();
296 $f = $this->gui->ui()->factory();
297 $r = $this->gui->ui()->renderer();
298 $p =
$f->panel()->standard(
303 $this->tpl->setContent(
$r->render($p));
317 "exc_create_blog_select_info",
329 "exc_select_blog_info",
341 if (!$this->submission->canSubmit()) {
342 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"exercise_time_over"),
true);
346 if ($this->selected_wsp_obj_id == 0) {
347 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"select_one"));
355 $blog->setTitle($this->exercise->getTitle() .
" - " . $this->assignment->getTitle());
360 $node_id = $tree->
insertObject($parent_node, $blog->getId());
363 $access_handler->setPermissions($parent_node, $node_id);
365 $this->submission->deleteAllFiles();
368 $this->submission->addResourceObject($node_id);
370 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"exc_blog_created"),
true);
371 $this->
ctrl->setParameterByClass(ilObjBlogGUI::class,
"wsp_id", $node_id);
372 $this->
ctrl->redirectByClass(
373 [ilDashboardGUI::class, ilPersonalWorkspaceGUI::class, ilObjBlogGUI::class],
384 if (!$this->submission->canSubmit()) {
385 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"exercise_time_over"),
true);
389 if ($this->selected_wsp_obj_id > 0) {
391 $node = $tree->
getNodeData($this->selected_wsp_obj_id);
392 if ($node && $node[
"type"] ==
"blog") {
393 $this->submission->deleteAllFiles();
396 $this->submission->addResourceObject($node[
"wsp_id"]);
398 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"exc_blog_selected"),
true);
399 $this->
ctrl->setParameter($this,
"blog_id", $node[
"wsp_id"]);
400 $this->
ctrl->redirect($this,
"askDirectSubmission");
413 $exp2 =
new ilWorkspaceExplorerGUI($this->submission->getUserId(), $this, $a_cmd, $this,
"setSelectedBlog");
415 $exp2->setSelectableTypes(array(
"blog"));
421 $exp2->setSelectableTypes(array(
"wsrt",
"wfld"));
424 if (!$exp2->handleCommand()) {
425 return $exp2->getHTML();
441 foreach ($portfolios as $portfolio) {
442 $items[$portfolio[
"id"]] = $portfolio[
"title"];
446 "exc_select_portfolio",
447 "exc_select_portfolio_info",
448 "setSelectedPortfolio",
458 $form->setTitle($this->
lng->txt(
"exc_create_portfolio") .
": " . $this->assignment->getTitle());
459 $form->setFormAction($this->
ctrl->getFormAction($this,
"setSelectedPortfolioTemplate"));
463 $prtt->addOption(
new ilRadioOption($this->
lng->txt(
"exc_create_portfolio_no_template"), -1));
464 foreach ($a_templates as
$id => $title) {
468 $form->addItem($prtt);
470 $form->addCommandButton(
"setSelectedPortfolioTemplate", $this->
lng->txt(
"save"));
471 $form->addCommandButton(
"returnToParent", $this->
lng->txt(
"cancel"));
480 $ctrl = $DIC->ctrl();
485 $template_id = $this->assignment->getPortfolioTemplateId();
490 if ($templates !== [] && $template_object_id == 0) {
495 $title = $this->exercise->getTitle() .
" - " . $this->assignment->getTitle();
500 if ($template_object_id > 0) {
504 $ctrl->
redirectByClass(array(
"ildashboardgui",
"ilPortfolioRepositoryGUI",
"ilObjPortfolioGUI"),
"createPortfolioFromAssignment");
510 if (!$this->submission->canSubmit()) {
511 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"exercise_time_over"),
true);
516 if ($templates === []) {
520 if ($a_form === null) {
524 $this->tpl->setContent($a_form->getHTML());
533 if (!$this->submission->canSubmit()) {
534 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"exercise_time_over"),
true);
539 if ($templates === []) {
540 $this->
ctrl->redirect($this,
"returnToParent");
544 if ($form->checkInput()) {
545 $prtt = $form->getInput(
"prtt");
546 if ($prtt > 0 && array_key_exists($prtt, $templates)) {
547 $title = $this->exercise->getTitle() .
" - " . $this->assignment->getTitle();
548 $this->
ctrl->setParameterByClass(
"ilObjPortfolioGUI",
"exc_id", $this->exercise->getRefId());
549 $this->
ctrl->setParameterByClass(
"ilObjPortfolioGUI",
"ass_id", $this->assignment->getId());
550 $this->
ctrl->setParameterByClass(
"ilObjPortfolioGUI",
"pt", $title);
551 $this->
ctrl->setParameterByClass(
"ilObjPortfolioGUI",
"prtt", $prtt);
552 $this->
ctrl->setParameterByClass(
"ilobjportfoliogui",
"exc_back_ref_id", $this->requested_ref_id);
553 $this->
ctrl->redirectByClass(array(
"ildashboardgui",
"ilPortfolioRepositoryGUI",
"ilObjPortfolioGUI"),
"createPortfolioFromTemplate");
561 $form->setValuesByPost();
571 if (!$this->submission->canSubmit()) {
572 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"exercise_time_over"),
true);
577 $portfolio->setTitle($this->exercise->getTitle() .
" - " . $this->assignment->getTitle());
578 $portfolio->create();
580 $this->submission->deleteAllFiles();
583 $this->submission->addResourceObject($portfolio->getId());
585 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"exc_portfolio_created"),
true);
586 $this->
ctrl->setParameterByClass(ilObjPortfolioGUI::class,
"prt_id", $portfolio->getId());
587 $this->
ctrl->redirectByClass(array(
"ildashboardgui",
"ilPortfolioRepositoryGUI",
"ilObjPortfolioGUI"),
"view");
596 if (!$this->submission->canSubmit()) {
597 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"exercise_time_over"),
true);
601 $prtf_id = $this->request->getResourceObjectId();
603 $this->submission->deleteAllFiles();
606 $this->submission->addResourceObject($prtf_id);
608 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"exc_portfolio_selected"),
true);
609 $this->
ctrl->setParameter($this,
"prtf_id", $prtf_id);
610 $this->
ctrl->redirect($this,
"askDirectSubmission");
613 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"select_one"));
622 $conf->setFormAction($this->
ctrl->getFormAction($this,
"unlinkPortfolio"));
623 $conf->setHeaderText($this->
lng->txt(
"exc_sure_unlink_portfolio",
"sure_unlink_portfolio"));
624 $conf->setConfirm($this->
lng->txt(
"confirm"),
"unlinkPortfolio");
625 $conf->setCancel($this->
lng->txt(
"cancel"),
"returnToParent");
639 $user = $DIC->user();
645 $this->submission->deleteResourceObject();
647 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"exc_portfolio_unlinked_from_assignment"),
true);
649 $this->
ctrl->redirect($this,
"returnToParent");
657 $conf->setFormAction($this->
ctrl->getFormAction($this,
"unlinkBlog"));
658 $conf->setHeaderText($this->
lng->txt(
"exc_sure_unlink_blog"));
659 $conf->setConfirm($this->
lng->txt(
"confirm"),
"unlinkBlog");
660 $conf->setCancel($this->
lng->txt(
"cancel"),
"returnToParent");
665 $port =
new ilObjBlog($object_id,
false);
674 $this->submission->deleteResourceObject();
676 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"exc_blog_unlinked_from_assignment"),
true);
678 $this->
ctrl->redirect($this,
"returnToParent");
689 if (!$this->submission->canSubmit()) {
696 if ($this->request->getBlogId() > 0) {
697 $this->
ctrl->setParameter($this,
"blog_id", $this->request->getBlogId());
698 $txt = $this->
lng->txt(
"exc_direct_submit_blog");
700 $this->
ctrl->setParameter($this,
"prtf_id", $this->request->getPortfolioId());
701 $txt = $this->
lng->txt(
"exc_direct_submit_portfolio");
703 $conf->setFormAction($this->
ctrl->getFormAction($this,
"directSubmit"));
705 $conf->setHeaderText(
$txt);
706 $conf->setConfirm($this->
lng->txt(
"exc_direct_submit"),
"directSubmit");
707 $conf->setCancel($this->
lng->txt(
"exc_direct_no_submit"),
"returnToParent");
718 if (!$this->submission->canSubmit()) {
719 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"exercise_time_over"),
true);
726 if ($this->request->getBlogId() > 0) {
727 $success = $this->
submitBlog($this->request->getBlogId());
728 $this->
ctrl->setParameter($this,
"blog_id",
"");
731 elseif ($this->request->getPortfolioId() > 0) {
733 $this->
ctrl->setParameter($this,
"prtf_id",
"");
737 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"settings_saved"),
true);
739 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"msg_failed"),
true);
741 $this->
ctrl->redirectByClass([ilExerciseHandlerGUI::class, ilObjExerciseGUI::class, ilAssignmentPresentationGUI::class, ilExSubmissionGUI::class, ilExSubmissionObjectGUI::class],
"returnToParent");
752 if (!$this->submission->canSubmit()) {
756 $blog_id = $a_blog_id;
759 if ($blog_gui->getObject()) {
760 $file = $blog_gui->buildExportFile();
761 $size = filesize($file);
763 $this->submission->deleteAllFiles();
766 "name" => $blog_id .
".zip",
770 $this->submission->uploadFile($meta,
true);
773 $file = $file = $blog_gui->buildExportFile(
false,
true);
774 $size = filesize($file);
777 "name" => $blog_id .
"print.zip",
781 $this->submission->uploadFile($meta,
true);
798 if (!$this->submission->canSubmit()) {
802 $prtf_id = $a_portfolio_id;
805 if ($prtf->getTitle()) {
808 $file = $port_export->exportHtml();
810 $size = filesize($file);
812 $this->submission->deleteAllFiles();
815 "name" => $prtf_id .
".zip",
819 $this->submission->uploadFile($meta,
true);
822 $port_export->setPrintVersion(
true);
823 $file = $port_export->exportHtml();
824 $size = filesize($file);
827 "name" => $prtf_id .
"print.zip",
831 $this->submission->uploadFile($meta,
true);
846 int $a_user_id = null
850 $ilUser = $DIC->user();
853 $a_user_id = $ilUser->getId();
858 $exc_id = $ass->getExerciseId();
862 $exc_ref_id = current($ref_ids);
865 return new self($exc, $sub);
handleNewUpload(bool $a_no_notifications=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS Exercise InternalGUIService $gui
static getOverviewContent(ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
askDirectSubmissionObject()
getNodeData(int $a_node_id, ?int $a_tree_pk=null)
get all information of a node.
redirectByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
__construct(ilObjExercise $a_exercise, ilExSubmission $a_submission)
setOnScreenMessage(string $type, string $a_txt, bool $a_keep=false)
Set a message to be displayed to the user.
setTypeWhiteList(array $a_val)
Set type white list.
static _getAllReferences(int $id)
get all reference ids for object ID
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
Exercise submission base gui.
addProperty(string $a_name, string $a_value, string $a_link="")
add a property to current section
setSelectedPortfolioObject()
askUnlinkPortfolioObject()
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setParameterByClass(string $a_class, string $a_parameter, $a_value)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
createPortfolioTemplateObject(ilPropertyFormGUI $a_form=null)
renderWorkspaceExplorer(string $a_cmd)
setVariable(string $variable, $value='')
Sets the given variable to the given value.
static getOverviewContentPortfolio(ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
static getAvailablePortfolioTemplates(string $a_permission="read")
ilGlobalTemplateInterface $tpl
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
submitBlog(int $a_blog_id)
Submit blog for assignment.
static getOverviewContentBlog(ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
Portfolio view gui class.
setContent(string $a_html)
Sets content for standard template.
static getPortfoliosOfUser(int $a_user_id)
Get portfolios of user.
Explorer for selecting a personal workspace item.
static _lookupObjectId(int $ref_id)
renderResourceSelection(string $a_title, string $a_info, string $a_cmd, string $a_explorer_cmd, array $a_items=null)
setSelectedPortfolioTemplateObject()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
static initGUIForSubmit(int $a_ass_id, int $a_user_id=null)
lookupObjectId(int $a_node_id)
Get object id for node id.
createPortfolioFromAssignmentObject()
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilExSubmission $submission
submitPortfolio(int $a_portfolio_id)
Submit portfolio for assignment.
createTreeForUser(int $a_user_id)
Create personal workspace tree for user.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
initPortfolioTemplateForm(array $a_templates)
insertObject(int $a_parent_node_id, int $a_object_id)
Add object to tree.
Object-based submissions (ends up as static file)