ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilExSubmissionObjectGUI Class Reference

Object-based submissions (ends up as static file) More...

+ Inheritance diagram for ilExSubmissionObjectGUI:
+ Collaboration diagram for ilExSubmissionObjectGUI:

Public Member Functions

 __construct (ilObjExercise $a_exercise, ilExSubmission $a_submission)
 
 executeCommand ()
 
 submitBlog (int $a_blog_id)
 Submit blog for assignment. More...
 
 submitPortfolio (int $a_portfolio_id)
 Submit portfolio for assignment. More...
 
- Public Member Functions inherited from ilExSubmissionBaseGUI
 __construct (ilObjExercise $a_exercise, ilExSubmission $a_submission)
 
 returnToParentObject ()
 

Static Public Member Functions

static getOverviewContent (ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
 
static initGUIForSubmit (int $a_ass_id, ?int $a_user_id=null)
 
static getOverviewContent (ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
 

Protected Member Functions

 renderResourceSelection (string $a_title, string $a_info, string $a_cmd, string $a_explorer_cmd, ?array $a_items=null)
 
 createBlogObject ()
 
 selectBlogObject ()
 
 saveBlogObject ()
 
 setSelectedBlogObject ()
 
 renderWorkspaceExplorer (string $a_cmd)
 
 selectPortfolioObject ()
 
 initPortfolioTemplateForm (array $a_templates)
 
 createPortfolioFromAssignmentObject ()
 
 createPortfolioTemplateObject (?ilPropertyFormGUI $a_form=null)
 
 setSelectedPortfolioTemplateObject ()
 
 createPortfolioObject ()
 
 setSelectedPortfolioObject ()
 
 askUnlinkPortfolioObject ()
 
 unlinkPortfolioObject ()
 
 askUnlinkBlogObject ()
 
 unlinkBlogObject ()
 
 askDirectSubmissionObject ()
 
 directSubmitObject ()
 
- Protected Member Functions inherited from ilExSubmissionBaseGUI
 handleTabs ()
 
 handleNewUpload (bool $a_no_notifications=false)
 
 handleRemovedUpload ()
 
 triggerAssignmentTool ()
 

Static Protected Member Functions

static getOverviewContentBlog (ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
 
static getOverviewContentPortfolio (ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
 

Protected Attributes

int $user_id
 
 $selected_wsp_obj_id
 
- Protected Attributes inherited from ilExSubmissionBaseGUI
ILIAS Exercise Notification NotificationManager $notification
 
ILIAS Exercise InternalDomainService $domain
 
ILIAS Exercise InternalGUIService $gui
 
ilObjUser $user
 
ilCtrl $ctrl
 
ilTabsGUI $tabs_gui
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
ilObjExercise $exercise
 
ilExSubmission $submission
 
ilExAssignment $assignment
 
MandatoryAssignmentsManager $mandatory_manager
 
ContextServices $tool_context
 
ilExAssignmentTypesGUI $type_guis
 
int $requested_ref_id
 
GUIRequest $request
 

Detailed Description

Object-based submissions (ends up as static file)

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

@ilCtrl_Calls ilExSubmissionObjectGUI:

Definition at line 29 of file class.ilExSubmissionObjectGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilExSubmissionObjectGUI::__construct ( ilObjExercise  $a_exercise,
ilExSubmission  $a_submission 
)
Exceptions
ilExcUnknownAssignmentTypeException

Reimplemented from ilExSubmissionBaseGUI.

Definition at line 37 of file class.ilExSubmissionObjectGUI.php.

40 {
41 global $DIC;
42
43 $this->user_id = $DIC->user()->getId();
44
45 parent::__construct($a_exercise, $a_submission);
46 $this->selected_wsp_obj_id = $this->request->getSelectedWspObjId();
47 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References $DIC, and ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ askDirectSubmissionObject()

ilExSubmissionObjectGUI::askDirectSubmissionObject ( )
protected

Definition at line 690 of file class.ilExSubmissionObjectGUI.php.

690 : void
691 {
693
694 if (!$this->submission->canSubmit()) {
695 $this->tpl->setOnScreenMessage('info', $this->lng->txt("exercise_time_over"), true);
696 $this->returnToParentObject();
697 }
698
699 $conf = new ilConfirmationGUI();
700
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");
704 } else {
705 $this->ctrl->setParameter($this, "prtf_id", $this->request->getPortfolioId());
706 $txt = $this->lng->txt("exc_direct_submit_portfolio");
707 }
708 $conf->setFormAction($this->ctrl->getFormAction($this, "directSubmit"));
709
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");
713
714 $tpl->setContent($conf->getHTML());
715 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilGlobalTemplateInterface $tpl
$txt
Definition: error.php:31
setOnScreenMessage(string $type, string $a_txt, bool $a_keep=false)
Set a message to be displayed to the user.
setContent(string $a_html)
Sets content for standard template.

References $txt, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ askUnlinkBlogObject()

ilExSubmissionObjectGUI::askUnlinkBlogObject ( )
protected

Definition at line 657 of file class.ilExSubmissionObjectGUI.php.

657 : void
658 {
660
661 $conf = new ilConfirmationGUI();
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");
666
667 $submission = $this->submission->getSelectedObject();
668 $wstree = new ilWorkspaceTree($this->submission->getUserId());
669 $object_id = $wstree->lookupObjectId((int) $submission?->getTitle());
670 $port = new ilObjBlog($object_id, false);
671
672 $conf->addItem("id[]", "", $port->getTitle(), ilUtil::getImagePath("standard/icon_blog.svg"));
673
674 $tpl->setContent($conf->getHTML());
675 }
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...

References ILIAS\Repository\ctrl(), ilUtil\getImagePath(), ILIAS\GlobalScreen\Scope\Footer\Factory\getTitle(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ askUnlinkPortfolioObject()

ilExSubmissionObjectGUI::askUnlinkPortfolioObject ( )
protected

Definition at line 622 of file class.ilExSubmissionObjectGUI.php.

622 : void
623 {
625
626 $conf = new ilConfirmationGUI();
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");
631
632 $submission = $this->submission->getSelectedObject();
633 $port = new ilObjPortfolio((int) $submission?->getTitle(), false);
634
635 $conf->addItem("id[]", "", $port->getTitle(), ilUtil::getImagePath("standard/icon_prtf.svg"));
636
637 $tpl->setContent($conf->getHTML());
638 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Repository\ctrl(), ilUtil\getImagePath(), ILIAS\GlobalScreen\Scope\Footer\Factory\getTitle(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ createBlogObject()

ilExSubmissionObjectGUI::createBlogObject ( )
protected

Definition at line 316 of file class.ilExSubmissionObjectGUI.php.

316 : void
317 {
318 $this->handleTabs();
319
321 "exc_create_blog",
322 "exc_create_blog_select_info",
323 "saveBlog",
324 "createBlog"
325 );
326 }
renderResourceSelection(string $a_title, string $a_info, string $a_cmd, string $a_explorer_cmd, ?array $a_items=null)

◆ createPortfolioFromAssignmentObject()

ilExSubmissionObjectGUI::createPortfolioFromAssignmentObject ( )
protected

Definition at line 481 of file class.ilExSubmissionObjectGUI.php.

481 : void
482 {
483 global $DIC;
484
485 $ctrl = $DIC->ctrl();
486
488
489 //template id is stored in the DB with the ref_id.
490 $template_id = $this->assignment->getPortfolioTemplateId();
491 //get the object id to compare with a list of template objects.
492 $template_object_id = ilObject::_lookupObjectId($template_id);
493
494 // select a template, if available
495 if ($templates !== [] && $template_object_id == 0) {
497 return;
498 }
499
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);
504
505 if ($template_object_id > 0) {
506 $ctrl->setParameterByClass("ilObjPortfolioGUI", "prtt", $template_object_id);
507 }
508 $ctrl->setParameterByClass("ilobjportfoliogui", "exc_back_ref_id", $this->requested_ref_id);
509 $ctrl->redirectByClass(array("ildashboardgui", "ilPortfolioRepositoryGUI", "ilObjPortfolioGUI"), "createPortfolioFromAssignment");
510 }
redirectByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
@inheritDoc
setParameterByClass(string $a_class, string $a_parameter, $a_value)
@inheritDoc
createPortfolioTemplateObject(?ilPropertyFormGUI $a_form=null)
static getAvailablePortfolioTemplates(string $a_permission="read")
static _lookupObjectId(int $ref_id)

References $DIC, ilObject\_lookupObjectId(), and ilObjPortfolioTemplate\getAvailablePortfolioTemplates().

+ Here is the call graph for this function:

◆ createPortfolioObject()

ilExSubmissionObjectGUI::createPortfolioObject ( )
protected
Exceptions
ilExcUnknownAssignmentTypeException
ilExerciseException

Definition at line 574 of file class.ilExSubmissionObjectGUI.php.

574 : void
575 {
576 if (!$this->submission->canSubmit()) {
577 $this->tpl->setOnScreenMessage('info', $this->lng->txt("exercise_time_over"), true);
578 $this->returnToParentObject();
579 }
580
581 $portfolio = new ilObjPortfolio();
582 $portfolio->setTitle($this->exercise->getTitle() . " - " . $this->assignment->getTitle());
583 $portfolio->create();
584
585 $this->submission->deleteAllFiles();
586 $this->handleRemovedUpload();
587
588 $this->submission->addResourceObject($portfolio->getId());
589
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");
593 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ createPortfolioTemplateObject()

ilExSubmissionObjectGUI::createPortfolioTemplateObject ( ?ilPropertyFormGUI  $a_form = null)
protected

Definition at line 512 of file class.ilExSubmissionObjectGUI.php.

514 : void {
515 if (!$this->submission->canSubmit()) {
516 $this->tpl->setOnScreenMessage('info', $this->lng->txt("exercise_time_over"), true);
517 $this->returnToParentObject();
518 }
519
521 if ($templates === []) {
522 $this->returnToParentObject();
523 }
524
525 if ($a_form === null) {
526 $a_form = $this->initPortfolioTemplateForm($templates);
527 }
528
529 $this->tpl->setContent($a_form->getHTML());
530 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ directSubmitObject()

ilExSubmissionObjectGUI::directSubmitObject ( )
protected
Exceptions
ilException
ilFileUtilsException

Definition at line 721 of file class.ilExSubmissionObjectGUI.php.

721 : void
722 {
723 if (!$this->submission->canSubmit()) {
724 $this->tpl->setOnScreenMessage('info', $this->lng->txt("exercise_time_over"), true);
725 $this->returnToParentObject();
726 }
727
728 $success = false;
729
730 // submit current version of blog
731 if ($this->request->getBlogId() > 0) {
732 $success = $this->submitBlog($this->request->getBlogId());
733 $this->ctrl->setParameter($this, "blog_id", "");
734 }
735 // submit current version of portfolio
736 elseif ($this->request->getPortfolioId() > 0) {
737 $success = $this->submitPortfolio($this->request->getPortfolioId());
738 $this->ctrl->setParameter($this, "prtf_id", "");
739 }
740
741 if ($success) {
742 $this->tpl->setOnScreenMessage('success', $this->lng->txt("settings_saved"), true);
743 } else {
744 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("msg_failed"), true);
745 }
746 $this->ctrl->redirectByClass([ilExerciseHandlerGUI::class, ilObjExerciseGUI::class, ilAssignmentPresentationGUI::class, ilExSubmissionGUI::class, ilExSubmissionObjectGUI::class], "returnToParent");
747 }
submitPortfolio(int $a_portfolio_id)
Submit portfolio for assignment.
submitBlog(int $a_blog_id)
Submit blog for assignment.

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ executeCommand()

ilExSubmissionObjectGUI::executeCommand ( )

Definition at line 49 of file class.ilExSubmissionObjectGUI.php.

49 : void
50 {
51 $ilCtrl = $this->ctrl;
52
53 if (!$this->submission->canView()) {
54 $this->returnToParentObject();
55 }
56
57 $class = $ilCtrl->getNextClass($this);
58 $cmd = $ilCtrl->getCmd();
59
60 switch ($class) {
61 default:
62 $this->{$cmd . "Object"}();
63 break;
64 }
65 }

References ilExSubmissionBaseGUI\$ctrl, and ilExSubmissionBaseGUI\returnToParentObject().

+ Here is the call graph for this function:

◆ getOverviewContent()

static ilExSubmissionObjectGUI::getOverviewContent ( ilInfoScreenGUI  $a_info,
ilExSubmission  $a_submission 
)
static

Reimplemented from ilExSubmissionBaseGUI.

Definition at line 67 of file class.ilExSubmissionObjectGUI.php.

70 : void {
71 switch ($a_submission->getAssignment()->getType()) {
73 self::getOverviewContentBlog($a_info, $a_submission);
74 break;
75
77 self::getOverviewContentPortfolio($a_info, $a_submission);
78 break;
79 }
80 }
static getOverviewContentBlog(ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
static getOverviewContentPortfolio(ilInfoScreenGUI $a_info, ilExSubmission $a_submission)

References getOverviewContentBlog(), getOverviewContentPortfolio(), ilExAssignment\TYPE_BLOG, and ilExAssignment\TYPE_PORTFOLIO.

+ Here is the call graph for this function:

◆ getOverviewContentBlog()

static ilExSubmissionObjectGUI::getOverviewContentBlog ( ilInfoScreenGUI  $a_info,
ilExSubmission  $a_submission 
)
staticprotected

Definition at line 82 of file class.ilExSubmissionObjectGUI.php.

85 : void {
86 global $DIC;
87
88 $lng = $DIC->language();
89 $ilCtrl = $DIC->ctrl();
90 $gui = $DIC->exercise()->internal()->gui();
91
92 $wsp_tree = new ilWorkspaceTree($a_submission->getUserId());
93
94 // #12939
95 if (!$wsp_tree->getRootId()) {
96 $wsp_tree->createTreeForUser($a_submission->getUserId());
97 }
98
99 $files_str = "";
100 $buttons_str = "";
101 $valid_blog = false;
102 $selected_blog = $a_submission->getSelectedObject();
103 if ($selected_blog) {
104 $blog_id = (int) $selected_blog?->getTitle();
105 $node = $wsp_tree->getNodeData($blog_id);
106 if ($node["title"]) {
107 // #10116
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>';
113 $valid_blog = true;
114 }
115 // remove invalid resource if no upload yet (see download below)
116 elseif (substr($selected_blog["filename"], -1) == "/") {
117 // #16887
118 $a_submission->deleteResourceObject();
119 }
120 }
121 if ($a_submission->canSubmit()) {
122 if (!$valid_blog) {
123 $button = $gui->button(
124 $lng->txt("exc_create_blog"),
125 $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class, "ilExSubmissionGUI", "ilExSubmissionObjectGUI"), "createBlog")
126 );
127 $buttons_str .= $button->render();
128 }
129 // #10462
130 $blogs = count($wsp_tree->getObjectsFromType("blog"));
131 if ((!$valid_blog && $blogs)
132 || ($valid_blog && $blogs > 1)) {
133 $link = $gui->link(
134 $lng->txt("exc_select_blog" . ($valid_blog ? "_change" : "")),
135 $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class, "ilExSubmissionGUI", "ilExSubmissionObjectGUI"), "selectBlog")
136 )->emphasised();
137 $buttons_str .= " " . $link->render();
138 }
139 }
140
141 // todo: move this to ks somehow
142 if ($buttons_str != "") {
143 $files_str .= "<p>" . $buttons_str . "</p>";
144 }
145
146
147 if ($files_str) {
148 $a_info->addProperty($lng->txt("exc_blog_returned"), $files_str);
149 }
150 if ($a_submission->hasSubmitted()) {
151 $ilCtrl->setParameterByClass("ilExSubmissionFileGUI", "delivered", $selected_blog["returned_id"]);
152 $dl_link = $ilCtrl->getLinkTargetByClass(array("ilExSubmissionGUI", "ilExSubmissionFileGUI"), "download");
153 $ilCtrl->setParameterByClass("ilExSubmissionFileGUI", "delivered", "");
154
155 $button = $gui->button(
156 $lng->txt("download"),
157 $dl_link
158 );
159
160 $a_info->addProperty($lng->txt("exc_files_returned"), $button->render());
161 }
162 }
ILIAS Exercise InternalGUIService $gui
addProperty(string $a_name, string $a_value, string $a_link="")
add a property to current section
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...

Referenced by getOverviewContent().

+ Here is the caller graph for this function:

◆ getOverviewContentPortfolio()

static ilExSubmissionObjectGUI::getOverviewContentPortfolio ( ilInfoScreenGUI  $a_info,
ilExSubmission  $a_submission 
)
staticprotected

Definition at line 164 of file class.ilExSubmissionObjectGUI.php.

164 : void
165 {
166 global $DIC;
167
168 $back_ref_id = $DIC->http()->wrapper()->query()->retrieve(
169 "ref_id",
170 $DIC->refinery()->kindlyTo()->int()
171 ) ?? 0;
172
173 $request = $DIC->exercise()->internal()->gui()->request();
174 $gui = $DIC->exercise()->internal()->gui();
175
176
177 $lng = $DIC->language();
178 $ilCtrl = $DIC->ctrl();
179
180 $files_str = "";
181 $buttons_str = "";
182 $valid_prtf = false;
183 $selected_prtf = $a_submission->getSelectedObject();
184 if ($selected_prtf) {
185 $portfolio_id = (int) $selected_prtf?->getTitle();
186
187 // #11746
188 if (ilObject::_exists($portfolio_id, false, "prtf")) {
189 $portfolio = new ilObjPortfolio($portfolio_id, false);
190 if ($portfolio->getTitle()) {
191 // #10116 / #12791
192 $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", $portfolio_id);
193
194 $ref_id = $request->getRefId();
195 $ilCtrl->setParameterByClass("ilobjportfoliogui", "ref_id", $ref_id);
196 $ilCtrl->setParameterByClass("ilobjportfoliogui", "exc_back_ref_id", $back_ref_id);
197
198 $prtf_link = $ilCtrl->getLinkTargetByClass(array("ildashboardgui", "ilportfoliorepositorygui", "ilobjportfoliogui"), "view");
199 $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", "");
200 $ilCtrl->setParameterByClass("ilobjportfoliogui", "ref_id", "");
201
202
203 $files_str = '<a href="' . $prtf_link .
204 '">' . $portfolio->getTitle() . '</a>';
205 $valid_prtf = true;
206 }
207 }
208 // remove invalid resource if no upload yet (see download below)
209 elseif (substr($selected_prtf["filename"], -1) == "/") {
210 // #16887
211 $a_submission->deleteResourceObject();
212 }
213 }
214 if ($a_submission->canSubmit()) {
215 if (!$valid_prtf) {
216 $button = $gui->button(
217 $lng->txt("exc_create_portfolio"),
218 $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class, "ilExSubmissionGUI", "ilExSubmissionObjectGUI"), "createPortfolioFromAssignment")
219 );
220
221 $buttons_str .= $button->render();
222 }
223 // #10462
224 //selectPortfolio ( remove it? )
225 $prtfs = count(ilObjPortfolio::getPortfoliosOfUser($a_submission->getUserId()));
226 if ((!$valid_prtf && $prtfs)
227 || ($valid_prtf && $prtfs > 1)) {
228 $link = $gui->link(
229 $lng->txt("exc_select_portfolio" . ($valid_prtf ? "_change" : "")),
230 $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class, "ilExSubmissionGUI", "ilExSubmissionObjectGUI"), "selectPortfolio")
231 )->emphasised();
232
233 $buttons_str .= " " . $link->render();
234 }
235 if ($valid_prtf) {
236 $link = $gui->link(
237 $lng->txt("exc_select_portfolio_unlink"),
238 $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class, "ilExSubmissionGUI", "ilExSubmissionObjectGUI"), "askUnlinkPortfolio")
239 )->emphasised();
240 $buttons_str .= " " . $link->render();
241 }
242 }
243 // todo: move this to ks somehow
244 if ($buttons_str != "") {
245 $files_str .= "<p>" . $buttons_str . "</p>";
246 }
247 if ($files_str) {
248 $a_info->addProperty($lng->txt("exc_portfolio_returned"), $files_str);
249 }
250 if ($a_submission->hasSubmitted()) {
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", "");
254
255 $button = $gui->button(
256 $lng->txt("download"),
257 $dl_link
258 );
259
260 $a_info->addProperty($lng->txt("exc_files_returned"), $button->render());
261 }
262 }
static getPortfoliosOfUser(int $a_user_id)
Get portfolios of user.
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
$ref_id
Definition: ltiauth.php:66

References $DIC, $lng, $ref_id, ilObject\_exists(), ilInfoScreenGUI\addProperty(), ilExSubmission\canSubmit(), ilExSubmission\deleteResourceObject(), ilObjPortfolio\getPortfoliosOfUser(), ilExSubmission\getSelectedObject(), ILIAS\GlobalScreen\Scope\Footer\Factory\getTitle(), ilExSubmission\getUserId(), ilExSubmission\hasSubmitted(), and ILIAS\Repository\int().

Referenced by getOverviewContent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initGUIForSubmit()

static ilExSubmissionObjectGUI::initGUIForSubmit ( int  $a_ass_id,
?int  $a_user_id = null 
)
static
Exceptions
ilExcUnknownAssignmentTypeException

Definition at line 859 of file class.ilExSubmissionObjectGUI.php.

863 global $DIC;
864
865 $ilUser = $DIC->user();
866
867 if (!$a_user_id) {
868 $a_user_id = $ilUser->getId();
869 }
870
871 $ass = new ilExAssignment($a_ass_id);
872 $sub = new ilExSubmission($ass, $a_user_id);
873 $exc_id = $ass->getExerciseId();
874
875 // #11173 - ref_id is needed for notifications
876 $ref_ids = ilObject::_getAllReferences($exc_id);
877 $exc_ref_id = current($ref_ids);
878 $exc = new ilObjExercise($exc_ref_id, true);
879
880 return new self($exc, $sub);
881 }
Exercise assignment.
Object-based submissions (ends up as static file)
Exercise submission //TODO: This class has many static methods related to delivered "files".
Class ilObjExercise.
static _getAllReferences(int $id)
get all reference ids for object ID

Referenced by ilBlogExerciseGUI\finalize(), and ilPortfolioExerciseGUI\finalize().

+ Here is the caller graph for this function:

◆ initPortfolioTemplateForm()

ilExSubmissionObjectGUI::initPortfolioTemplateForm ( array  $a_templates)
protected

Definition at line 459 of file class.ilExSubmissionObjectGUI.php.

462 $form = new ilPropertyFormGUI();
463 $form->setTitle($this->lng->txt("exc_create_portfolio") . ": " . $this->assignment->getTitle());
464 $form->setFormAction($this->ctrl->getFormAction($this, "setSelectedPortfolioTemplate"));
465
466 $prtt = new ilRadioGroupInputGUI($this->lng->txt("obj_prtt"), "prtt");
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) {
470 $prtt->addOption(new ilRadioOption('"' . $title . '"', $id));
471 }
472 $prtt->setValue(-1);
473 $form->addItem($prtt);
474
475 $form->addCommandButton("setSelectedPortfolioTemplate", $this->lng->txt("save"));
476 $form->addCommandButton("returnToParent", $this->lng->txt("cancel"));
477
478 return $form;
479 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.

◆ renderResourceSelection()

ilExSubmissionObjectGUI::renderResourceSelection ( string  $a_title,
string  $a_info,
string  $a_cmd,
string  $a_explorer_cmd,
?array  $a_items = null 
)
protected

Definition at line 264 of file class.ilExSubmissionObjectGUI.php.

270 : void {
271 if (!$this->submission->canSubmit()) {
272 $this->tpl->setOnScreenMessage('info', $this->lng->txt("exercise_time_over"), true);
273 $this->returnToParentObject();
274 }
275
276 $html = "";
277 $tpl = new ilTemplate("tpl.exc_select_resource.html", true, true, "components/ILIAS/Exercise");
278
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);
285 }
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");
291 $html = $tpl->get();
292 } elseif ($a_explorer_cmd) {
293 $html = $this->renderWorkspaceExplorer($a_explorer_cmd);
294 }
295
296
297 $this->tpl->setOnScreenMessage('info', $this->lng->txt($a_info));
298
299 $title = $this->lng->txt($a_title) . ": " . $this->assignment->getTitle();
300
301 $f = $this->gui->ui()->factory();
302 $r = $this->gui->ui()->renderer();
303 $p = $f->panel()->standard(
304 $title,
305 $f->legacy()->content($html)
306 );
307
308 $this->tpl->setContent($r->render($p));
309 }
special template class to simplify handling of ITX/PEAR
setVariable(string $variable, $value='')
Sets the given variable to the given value.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ renderWorkspaceExplorer()

ilExSubmissionObjectGUI::renderWorkspaceExplorer ( string  $a_cmd)
protected

Definition at line 412 of file class.ilExSubmissionObjectGUI.php.

414 : string {
415 $exp2 = null;
416 switch ($a_cmd) {
417 case "selectBlog":
418 $exp2 = new ilWorkspaceExplorerGUI($this->submission->getUserId(), $this, $a_cmd, $this, "setSelectedBlog");
419 $exp2->setTypeWhiteList(array("blog", "wsrt", "wfld"));
420 $exp2->setSelectableTypes(array("blog"));
421 break;
422
423 case "createBlog":
424 $exp2 = new ilWorkspaceExplorerGUI($this->submission->getUserId(), $this, $a_cmd, $this, "saveBlog");
425 $exp2->setTypeWhiteList(array("wsrt", "wfld"));
426 $exp2->setSelectableTypes(array("wsrt", "wfld"));
427 break;
428 }
429 if (!$exp2->handleCommand()) {
430 return $exp2->getHTML();
431 }
432 exit;
433 }
Explorer for selecting a personal workspace item.
exit

◆ saveBlogObject()

ilExSubmissionObjectGUI::saveBlogObject ( )
protected
Exceptions
ilExcUnknownAssignmentTypeException
ilExerciseException

Definition at line 344 of file class.ilExSubmissionObjectGUI.php.

344 : void
345 {
346 if (!$this->submission->canSubmit()) {
347 $this->tpl->setOnScreenMessage('info', $this->lng->txt("exercise_time_over"), true);
348 $this->returnToParentObject();
349 }
350
351 if ($this->selected_wsp_obj_id == 0) {
352 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("select_one"));
353 $this->createBlogObject();
354 return;
355 }
356
357 $parent_node = $this->selected_wsp_obj_id;
358
359 $blog = new ilObjBlog();
360 $blog->setTitle($this->exercise->getTitle() . " - " . $this->assignment->getTitle());
361 $blog->create();
362
363 $tree = new ilWorkspaceTree($this->submission->getUserId()); // #15993
364
365 $node_id = $tree->insertObject($parent_node, $blog->getId());
366
367 $access_handler = new ilWorkspaceAccessHandler($tree);
368 $access_handler->setPermissions($parent_node, $node_id);
369
370 $this->submission->deleteAllFiles();
371 $this->handleRemovedUpload();
372
373 $this->submission->addResourceObject($node_id);
374
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],
379 ""
380 );
381 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ selectBlogObject()

ilExSubmissionObjectGUI::selectBlogObject ( )
protected

Definition at line 328 of file class.ilExSubmissionObjectGUI.php.

328 : void
329 {
330 $this->handleTabs();
331
333 "exc_select_blog",
334 "exc_select_blog_info",
335 "setSelectedBlog",
336 "selectBlog"
337 );
338 }

◆ selectPortfolioObject()

ilExSubmissionObjectGUI::selectPortfolioObject ( )
protected

Definition at line 440 of file class.ilExSubmissionObjectGUI.php.

440 : void
441 {
442 $this->handleTabs();
443
444 $items = array();
445 $portfolios = ilObjPortfolio::getPortfoliosOfUser($this->submission->getUserId());
446 foreach ($portfolios as $portfolio) {
447 $items[$portfolio["id"]] = $portfolio["title"];
448 }
449
451 "exc_select_portfolio",
452 "exc_select_portfolio_info",
453 "setSelectedPortfolio",
454 "",
455 $items
456 );
457 }

References ilObjPortfolio\getPortfoliosOfUser().

+ Here is the call graph for this function:

◆ setSelectedBlogObject()

ilExSubmissionObjectGUI::setSelectedBlogObject ( )
protected
Exceptions
ilExcUnknownAssignmentTypeException
ilExerciseException

Definition at line 387 of file class.ilExSubmissionObjectGUI.php.

387 : void
388 {
389 if (!$this->submission->canSubmit()) {
390 $this->tpl->setOnScreenMessage('info', $this->lng->txt("exercise_time_over"), true);
391 $this->returnToParentObject();
392 }
393
394 if ($this->selected_wsp_obj_id > 0) {
395 $tree = new ilWorkspaceTree($this->submission->getUserId());
396 $node = $tree->getNodeData($this->selected_wsp_obj_id);
397 if ($node && $node["type"] == "blog") {
398 $this->submission->deleteAllFiles();
399 $this->handleRemovedUpload();
400
401 $this->submission->addResourceObject($node["wsp_id"]);
402
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");
406 }
407 }
408
409 $this->selectBlogObject();
410 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ setSelectedPortfolioObject()

ilExSubmissionObjectGUI::setSelectedPortfolioObject ( )
protected
Exceptions
ilExcUnknownAssignmentTypeException
ilExerciseException

Definition at line 599 of file class.ilExSubmissionObjectGUI.php.

599 : void
600 {
601 if (!$this->submission->canSubmit()) {
602 $this->tpl->setOnScreenMessage('info', $this->lng->txt("exercise_time_over"), true);
603 $this->returnToParentObject();
604 }
605
606 $prtf_id = $this->request->getResourceObjectId();
607 if ($prtf_id > 0) {
608 $this->submission->deleteAllFiles();
609 $this->handleRemovedUpload();
610
611 $this->submission->addResourceObject($prtf_id);
612
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");
616 }
617
618 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("select_one"));
619 $this->selectPortfolioObject();
620 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ setSelectedPortfolioTemplateObject()

ilExSubmissionObjectGUI::setSelectedPortfolioTemplateObject ( )
protected
Exceptions
ilExcUnknownAssignmentTypeException
ilExerciseException

Definition at line 536 of file class.ilExSubmissionObjectGUI.php.

536 : void
537 {
538 if (!$this->submission->canSubmit()) {
539 $this->tpl->setOnScreenMessage('info', $this->lng->txt("exercise_time_over"), true);
540 $this->returnToParentObject();
541 }
542
544 if ($templates === []) {
545 $this->ctrl->redirect($this, "returnToParent");
546 }
547
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");
559 } else {
560 // do not use template
561 $this->createPortfolioObject();
562 return;
563 }
564 }
565
566 $form->setValuesByPost();
567 $this->createPortfolioTemplateObject($form);
568 }

References ILIAS\Repository\ctrl(), ilObjPortfolioTemplate\getAvailablePortfolioTemplates(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ submitBlog()

ilExSubmissionObjectGUI::submitBlog ( int  $a_blog_id)

Submit blog for assignment.

Exceptions
ilFileUtilsException
ilException

Definition at line 754 of file class.ilExSubmissionObjectGUI.php.

756 : bool {
757 if (!$this->submission->canSubmit()) {
758 return false;
759 }
760
761 $subm = $this->domain->submission($this->submission->getAssignment()->getId());
762
763 $blog_id = $a_blog_id;
764
765 $blog_gui = new ilObjBlogGUI($blog_id, ilObject2GUI::WORKSPACE_NODE_ID);
766 if ($blog_gui->getObject()) {
767 $export = $blog_gui->buildExportFile();
768 $file = $export->getFilePath();
769 $size = filesize($file);
770 if ($size) {
771 $this->submission->deleteAllFiles();
772
773 $subm->addLocalFile(
774 $this->user_id,
775 $file,
776 $blog_id . ".zip"
777 );
778 $export->delete();
779
780 // print version
781 $export = $blog_gui->buildExportFile(false, true);
782 $file = $export->getFilePath();
783 $size = filesize($file);
784 if ($size) {
785 $subm->addLocalFile(
786 $this->user_id,
787 $file,
788 $blog_id . "print.zip"
789 );
790 $export->delete();
791 }
792
793 $this->handleNewUpload();
794 return true;
795 }
796 }
797 return false;
798 }
handleNewUpload(bool $a_no_notifications=false)
@ilCtrl_Calls ilObjBlogGUI: ilBlogPostingGUI, ilWorkspaceAccessGUI @ilCtrl_Calls ilObjBlogGUI: ilInfo...

◆ submitPortfolio()

ilExSubmissionObjectGUI::submitPortfolio ( int  $a_portfolio_id)

Submit portfolio for assignment.

Exceptions
ilFileUtilsException

Definition at line 804 of file class.ilExSubmissionObjectGUI.php.

806 : bool {
807 if (!$this->submission->canSubmit()) {
808 return false;
809 }
810
811 $prtf_id = $a_portfolio_id;
812 $subm = $this->domain->submission($this->submission->getAssignment()->getId());
813
814 $prtf = new ilObjPortfolio($prtf_id, false);
815 if ($prtf->getTitle()) {
816 $port_gui = new ilObjPortfolioGUI($prtf_id);
817 $port_export = new PortfolioHtmlExport($port_gui);
818 $port_export->exportHtml();
819
820 $file = $port_export->getFilePath();
821
822 $size = filesize($file);
823 if ($size) {
824 $this->submission->deleteAllFiles();
825
826 $subm->addLocalFile(
827 $this->user_id,
828 $file,
829 $prtf_id . ".zip"
830 );
831 $port_export->delete();
832
833 // print version
834 $port_export = new PortfolioHtmlExport($port_gui);
835 $port_export->setPrintVersion(true);
836 $port_export->exportHtml();
837 $file = $port_export->getFilePath();
838 $size = filesize($file);
839
840 if ($size) {
841 $subm->addLocalFile(
842 $this->user_id,
843 $file,
844 $prtf_id . "print.zip"
845 );
846 $file = $port_export->delete();
847 }
848
849 $this->handleNewUpload();
850 return true;
851 }
852 }
853 return false;
854 }
@ilCtrl_Calls ilObjPortfolioGUI: ilPortfolioPageGUI, ilPageObjectGUI @ilCtrl_Calls ilObjPortfolioGUI:...

◆ unlinkBlogObject()

ilExSubmissionObjectGUI::unlinkBlogObject ( )
protected

Definition at line 677 of file class.ilExSubmissionObjectGUI.php.

677 : void
678 {
679 $this->submission->deleteResourceObject();
680
681 $this->tpl->setOnScreenMessage('success', $this->lng->txt("exc_blog_unlinked_from_assignment"), true);
682
683 $this->ctrl->redirect($this, "returnToParent");
684 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ unlinkPortfolioObject()

ilExSubmissionObjectGUI::unlinkPortfolioObject ( )
protected

Definition at line 640 of file class.ilExSubmissionObjectGUI.php.

640 : void
641 {
642 global $DIC;
643
644 $user = $DIC->user();
645
646 //$portfolio = $this->submission->getSelectedObject();
647 //$port_id = $portfolio["returned_id"];
648
649 //$ilsub = new ilExSubmission($this->assignment, $user->getId());
650 $this->submission->deleteResourceObject();
651
652 $this->tpl->setOnScreenMessage('success', $this->lng->txt("exc_portfolio_unlinked_from_assignment"), true);
653
654 $this->ctrl->redirect($this, "returnToParent");
655 }

References $DIC, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Field Documentation

◆ $selected_wsp_obj_id

ilExSubmissionObjectGUI::$selected_wsp_obj_id
protected

Definition at line 32 of file class.ilExSubmissionObjectGUI.php.

◆ $user_id

int ilExSubmissionObjectGUI::$user_id
protected

Definition at line 31 of file class.ilExSubmissionObjectGUI.php.


The documentation for this class was generated from the following file: