ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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.
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

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.

References ILIAS\Repository\lng().

33  {
34  $this->lng = $this->domain->lng();
35  }
+ 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.

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

40  : void
41  {
42  $lng = $this->lng;
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  }
This class represents an option in a radio group.
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.
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 91 of file class.ilExAssTypePortfolioGUI.php.

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

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

References ilExAssignment\getPortfolioTemplateId().

75  {
76  $values = [];
77 
78  $values["template"] = "0";
79  if ($ass->getPortfolioTemplateId() > 0) {
80  $values["template_id"] = $ass->getPortfolioTemplateId();
81  $values["template"] = "1";
82  }
83 
84  return $values;
85  }
+ 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 87 of file class.ilExAssTypePortfolioGUI.php.

87  : void
88  {
89  }

◆ 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.

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

63  : void
64  {
65  $ass->setPortfolioTemplateId(0);
66  if ($form->getInput("template_id") && $form->getInput("template")) {
67  $ass->setPortfolioTemplateId($form->getInput("template_id"));
68  }
69  }
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

ilLanguage ilExAssTypePortfolioGUI::$lng
protected

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

Referenced by addEditFormCustomProperties().


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