ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 ()
 Constructor. More...
 
 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.
Returns
array
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
 setSubmission (ilExSubmission $a_submission)
 Set submission. More...
 
 setExercise (ilObjExercise $a_exercise)
 Set exercise. More...
 

Protected Attributes

 $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 ( )

Constructor.

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

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

37  {
38  global $DIC;
39 
40  $this->lng = $DIC->language();
41  }
global $DIC
Definition: feed.php:28
+ 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 46 of file class.ilExAssTypePortfolioGUI.php.

References $lng, ilPropertyFormGUI\addItem(), ilRadioOption\addSubItem(), and ilFormPropertyGUI\setRequired().

46  : void
47  {
48  $lng = $this->lng;
49 
50  $rd_template = new ilRadioGroupInputGUI($lng->txt("exc_template"), "template");
51  $rd_template->setRequired(true);
52  $radio_no_template = new ilRadioOption($lng->txt("exc_without_template"), "0", $lng->txt("exc_without_template_info", "without_template_info"));
53  $radio_with_template = new ilRadioOption($lng->txt("exc_with_template"), "1", $lng->txt("exc_with_template_info", "with_template_info"));
54 
55  $repo = new ilRepositorySelector2InputGUI($lng->txt("exc_portfolio_template"), "template_id");
56  $repo->setRequired(true);
57  $repo->getExplorerGUI()->setSelectableTypes(array("prtt"));
58  $repo->getExplorerGUI()->setTypeWhiteList(array("root", "prtt", "cat", "crs", "grp", "fold"));
59  $radio_with_template->addSubItem($repo);
60 
61  $rd_template->addOption($radio_no_template);
62  $rd_template->addOption($radio_with_template);
63  $form->addItem($rd_template);
64  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setRequired(bool $a_required)
+ Here is the call graph for this function:

◆ buildSubmissionPropertiesAndActions()

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

Implements ilExAssignmentTypeGUIInterface.

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

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

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

References ilExAssignment\getPortfolioTemplateId().

81  {
82  $values = [];
83 
84  $values["template"] = "0";
85  if ($ass->getPortfolioTemplateId() > 0) {
86  $values["template_id"] = $ass->getPortfolioTemplateId();
87  $values["template"] = "1";
88  }
89 
90  return $values;
91  }
+ 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 93 of file class.ilExAssTypePortfolioGUI.php.

93  : void
94  {
95  }

◆ importFormToAssignment()

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

Get values from form and put them into assignment.

Implements ilExAssignmentTypeGUIInterface.

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

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

69  : void
70  {
71  $ass->setPortfolioTemplateId(0);
72  if ($form->getInput("template_id") && $form->getInput("template")) {
73  $ass->setPortfolioTemplateId($form->getInput("template_id"));
74  }
75  }
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-...
setPortfolioTemplateId(int $a_val)
+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilExAssTypePortfolioGUI::$lng
protected

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