ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ilExAssTypePortfolioGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilExAssTypePortfolioGUI:
+ Collaboration diagram for ilExAssTypePortfolioGUI:

Public Member Functions

 __construct (protected \ILIAS\Exercise\InternalDomainService $domain, protected \ILIAS\Exercise\InternalGUIService $gui)
 
 addEditFormCustomProperties (ilPropertyFormGUI $form)
 Add custom form properties to edit form. More...
 
 importFormToAssignment (ilExAssignment $ass, ilPropertyFormGUI $form)
 Get values from form and put them into assignment. More...
 
 getFormValuesArray (ilExAssignment $ass)
 Get form values array from assignment. More...
 
 getOverviewContent (ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
 Add overview content of submission to info screen object. More...
 
 buildSubmissionPropertiesAndActions (\ILIAS\Exercise\Assignment\PropertyAndActionBuilderUI $builder)
 
- Public Member Functions inherited from ilExAssignmentTypeGUIInterface
 addEditFormCustomProperties (ilPropertyFormGUI $form)
 Add custom form properties to edit form. More...
 
 importFormToAssignment (ilExAssignment $ass, ilPropertyFormGUI $form)
 Get values from form and put them into assignment. More...
 
 getFormValuesArray (ilExAssignment $ass)
 Get form values array from assignment. More...
 
 getOverviewContent (ilInfoScreenGUI $a_info, ilExSubmission $a_submission)
 Add overview content of submission to info screen object. More...
 
 setSubmission (ilExSubmission $a_submission)
 Set submission. More...
 
 setExercise (ilObjExercise $a_exercise)
 Set exercise. More...
 
 buildSubmissionPropertiesAndActions (\ILIAS\Exercise\Assignment\PropertyAndActionBuilderUI $builder)
 

Protected Attributes

ilLanguage $lng
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Portfolio type gui implementations

Author
Alex Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 24 of file class.ilExAssTypePortfolioGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilExAssTypePortfolioGUI::__construct ( protected \ILIAS\Exercise\InternalDomainService  $domain,
protected \ILIAS\Exercise\InternalGUIService  $gui 
)

Definition at line 30 of file class.ilExAssTypePortfolioGUI.php.

33 {
34 $this->lng = $this->domain->lng();
35 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ addEditFormCustomProperties()

ilExAssTypePortfolioGUI::addEditFormCustomProperties ( ilPropertyFormGUI  $form)

Add custom form properties to edit form.

Implements ilExAssignmentTypeGUIInterface.

Definition at line 40 of file class.ilExAssTypePortfolioGUI.php.

40 : void
41 {
43
44 $rd_template = new ilRadioGroupInputGUI($lng->txt("exc_template"), "template");
45 $rd_template->setRequired(true);
46 $radio_no_template = new ilRadioOption($lng->txt("exc_without_template"), "0", $lng->txt("exc_without_template_info", "without_template_info"));
47 $radio_with_template = new ilRadioOption($lng->txt("exc_with_template"), "1", $lng->txt("exc_with_template_info", "with_template_info"));
48
49 $repo = new ilRepositorySelector2InputGUI($lng->txt("exc_portfolio_template"), "template_id");
50 $repo->setRequired(true);
51 $repo->getExplorerGUI()->setSelectableTypes(array("prtt"));
52 $repo->getExplorerGUI()->setTypeWhiteList(array("root", "prtt", "cat", "crs", "grp", "fold"));
53 $radio_with_template->addSubItem($repo);
54
55 $rd_template->addOption($radio_no_template);
56 $rd_template->addOption($radio_with_template);
57 $form->addItem($rd_template);
58 }
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...
This class represents a property in a property form.
This class represents an option in a radio group.

References $lng, ilPropertyFormGUI\addItem(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ buildSubmissionPropertiesAndActions()

ilExAssTypePortfolioGUI::buildSubmissionPropertiesAndActions ( \ILIAS\Exercise\Assignment\PropertyAndActionBuilderUI  $builder)

Implements ilExAssignmentTypeGUIInterface.

Definition at line 88 of file class.ilExAssTypePortfolioGUI.php.

88 : void
89 {
90 global $DIC;
91
92 $service = $DIC->exercise()->internal();
93 $gui = $service->gui();
94 $domain = $service->domain();
95 $request = $gui->request();
96 $back_ref_id = $request->getRefId();
97 $lng = $domain->lng();
98 $ilCtrl = $gui->ctrl();
99 $f = $gui->ui()->factory();
100
101 $submission = $this->getSubmission();
102
103 $files_str = "";
104 $buttons_str = "";
105 $valid_prtf = false;
106 $selected_prtf = $submission->getSelectedObject();
107 if ($selected_prtf) {
108 $portfolio_id = (int) $selected_prtf->getTitle();
109
110 // #11746
111 if (\ilObject::_exists($portfolio_id, false, "prtf")) {
112 $portfolio = new \ilObjPortfolio($portfolio_id, false);
113 if ($portfolio->getTitle()) {
114 // #10116 / #12791
115 $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", $portfolio_id);
116
117 $ref_id = $request->getRefId();
118 $ilCtrl->setParameterByClass("ilobjportfoliogui", "ref_id", $ref_id);
119 $ilCtrl->setParameterByClass("ilobjportfoliogui", "exc_back_ref_id", $back_ref_id);
120
121 $prtf_view = $ilCtrl->getLinkTargetByClass(array("ildashboardgui", "ilportfoliorepositorygui", "ilobjportfoliogui"), "preview");
122 $prtf_edit = $ilCtrl->getLinkTargetByClass(array("ildashboardgui", "ilportfoliorepositorygui", "ilobjportfoliogui"), "view");
123 $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", "");
124 $ilCtrl->setParameterByClass("ilobjportfoliogui", "ref_id", "");
125
126 $builder->addProperty(
127 $builder::SEC_SUBMISSION,
128 $lng->txt("exc_portfolio_returned"),
129 $portfolio->getTitle()
130 );
131 if ($submission->canSubmit()) {
132 $button = $f->button()->primary(
133 $lng->txt("exc_edit_portfolio"),
134 $prtf_edit
135 );
136 $builder->setMainAction(
137 $builder::SEC_SUBMISSION,
138 $button
139 );
140 } else {
141 $link = $f->link()->standard(
142 $lng->txt("exc_view_portfolio"),
143 $prtf_view
144 );
145 $builder->addAction(
146 $builder::SEC_SUBMISSION,
147 $link
148 );
149 }
150 $valid_prtf = true;
151 }
152 }
153 // remove invalid resource if no upload yet (see download below)
154 /*elseif (substr($selected_prtf["filename"], -1) == "/") {
155 // #16887
156 $submission->deleteResourceObject();
157 }*/
158 }
159 if ($submission->canSubmit()) {
160 if (!$valid_prtf) {
161 $button = $f->button()->primary(
162 $lng->txt("exc_create_portfolio"),
163 $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class, "ilExSubmissionGUI", "ilExSubmissionObjectGUI"), "createPortfolioFromAssignment")
164 );
165 $builder->setMainAction(
166 $builder::SEC_SUBMISSION,
167 $button
168 );
169 }
170 // #10462
171 //selectPortfolio ( remove it? )
172 $prtfs = count(ilObjPortfolio::getPortfoliosOfUser($submission->getUserId()));
173 if ((!$valid_prtf && $prtfs)
174 || ($valid_prtf && $prtfs > 1)) {
175 $button = $f->button()->standard(
176 $lng->txt("exc_select_portfolio" . ($valid_prtf ? "_change" : "")),
177 $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class, "ilExSubmissionGUI", "ilExSubmissionObjectGUI"), "selectPortfolio")
178 );
179 $builder->addAction(
180 $builder::SEC_SUBMISSION,
181 $button
182 );
183 }
184 if ($valid_prtf) {
185 $button = $f->button()->standard(
186 $lng->txt("exc_select_portfolio_unlink"),
187 $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class, "ilExSubmissionGUI", "ilExSubmissionObjectGUI"), "askUnlinkPortfolio")
188 );
189 $builder->addAction(
190 $builder::SEC_SUBMISSION,
191 $button
192 );
193 }
194 }
195
196 if ($submission->hasSubmitted()) {
197 $ilCtrl->setParameterByClass("ilExSubmissionFileGUI", "delivered", $selected_prtf->getId());
198 $dl_link = $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class, "ilExSubmissionGUI", "ilExSubmissionFileGUI"), "download");
199 $ilCtrl->setParameterByClass("ilExSubmissionFileGUI", "delivered", "");
200
201 $link = $f->link()->standard(
202 $lng->txt("download"),
203 $dl_link
204 );
205 $builder->addAction(
206 $builder::SEC_SUBMISSION,
207 $link
208 );
209 }
210 }
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
$service
Definition: ltiresult.php:36
global $DIC
Definition: shib_login.php:26

References $DIC, Vendor\Package\$f, $lng, $ref_id, $service, ilObject\_exists(), ilObjPortfolio\getPortfoliosOfUser(), getSubmission(), ILIAS\Repository\int(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ getFormValuesArray()

ilExAssTypePortfolioGUI::getFormValuesArray ( ilExAssignment  $ass)

Get form values array from assignment.

Returns
array

Implements ilExAssignmentTypeGUIInterface.

Definition at line 71 of file class.ilExAssTypePortfolioGUI.php.

71 : array
72 {
73 $values = [];
74
75 $values["template"] = "0";
76 if ($ass->getPortfolioTemplateId() > 0) {
77 $values["template_id"] = $ass->getPortfolioTemplateId();
78 $values["template"] = "1";
79 }
80
81 return $values;
82 }

References ilExAssignment\getPortfolioTemplateId().

+ Here is the call graph for this function:

◆ getOverviewContent()

ilExAssTypePortfolioGUI::getOverviewContent ( ilInfoScreenGUI  $a_info,
ilExSubmission  $a_submission 
)

Add overview content of submission to info screen object.

Implements ilExAssignmentTypeGUIInterface.

Definition at line 84 of file class.ilExAssTypePortfolioGUI.php.

84 : void
85 {
86 }

◆ importFormToAssignment()

ilExAssTypePortfolioGUI::importFormToAssignment ( ilExAssignment  $ass,
ilPropertyFormGUI  $form 
)

Get values from form and put them into assignment.

Implements ilExAssignmentTypeGUIInterface.

Definition at line 63 of file class.ilExAssTypePortfolioGUI.php.

63 : void
64 {
66 if ($form->getInput("template_id") && $form->getInput("template")) {
67 $ass->setPortfolioTemplateId($form->getInput("template_id"));
68 }
69 }
setPortfolioTemplateId(int $a_val)
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...

References ilPropertyFormGUI\getInput(), and ilExAssignment\setPortfolioTemplateId().

+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilLanguage ilExAssTypePortfolioGUI::$lng
protected

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