ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilExAssTypeTextGUI 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 ilExAssTypeTextGUI:
+ Collaboration diagram for ilExAssTypeTextGUI:

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
 
int $requested_min_char_limit = 0
 

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 Text type gui implementations

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

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

Constructor & Destructor Documentation

◆ __construct()

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

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

References ILIAS\Repository\lng().

34  {
35  $this->lng = $domain->lng();
36  $request = $gui->request();
37  $this->requested_min_char_limit = $request->getMinCharLimit();
38  }
+ Here is the call graph for this function:

Member Function Documentation

◆ addEditFormCustomProperties()

ilExAssTypeTextGUI::addEditFormCustomProperties ( ilPropertyFormGUI  $form)

Add custom form properties to edit form.

Implements ilExAssignmentTypeGUIInterface.

Definition at line 43 of file class.ilExAssTypeTextGUI.php.

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

43  : void
44  {
45  $lng = $this->lng;
46 
47  $rb_limit_chars = new ilCheckboxInputGUI($lng->txt("exc_limit_characters"), "limit_characters");
48 
49  $min_char_limit = new ilNumberInputGUI($lng->txt("exc_min_char_limit"), "min_char_limit");
50  $min_char_limit->allowDecimals(false);
51  $min_char_limit->setMinValue(0);
52  $min_char_limit->setSize(3);
53 
54  $max_char_limit = new ilNumberInputGUI($lng->txt("exc_max_char_limit"), "max_char_limit");
55  $max_char_limit->allowDecimals(false);
56  $max_char_limit->setMinValue($this->requested_min_char_limit + 1);
57 
58  $max_char_limit->setSize(3);
59 
60  $rb_limit_chars->addSubItem($min_char_limit);
61  $rb_limit_chars->addSubItem($max_char_limit);
62 
63  $form->addItem($rb_limit_chars);
64  }
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...
allowDecimals(bool $a_value)
This class represents a number property in a property form.
+ Here is the call graph for this function:

◆ buildSubmissionPropertiesAndActions()

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

Implements ilExAssignmentTypeGUIInterface.

Definition at line 100 of file class.ilExAssTypeTextGUI.php.

References $DIC, Vendor\Package\$f, $service, $url, getSubmission(), ILIAS\Repository\lng(), and ilLanguage\txt().

100  : void
101  {
102  global $DIC;
103 
104  $service = $DIC->exercise()->internal();
105  $gui = $service->gui();
106  $f = $gui->ui()->factory();
107  $lng = $DIC->language();
108  $ilCtrl = $DIC->ctrl();
109  $submission = $this->getSubmission();
110 
111  if ($submission->canSubmit()) {
112  $url = $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class, "ilExSubmissionGUI", "ilExSubmissionTextGUI"), "editAssignmentText");
113  $button = $f->button()->primary(
114  $this->lng->txt("exc_text_assignment_edit"),
115  $url
116  );
117  $builder->setMainAction(
118  $builder::SEC_SUBMISSION,
119  $button
120  );
121  $builder->addView(
122  "submission",
123  $lng->txt("exc_submission"),
124  $url
125  );
126  } else {
127  if ($submission->hasSubmitted()) {
128  $url = $ilCtrl->getLinkTargetByClass(array(ilAssignmentPresentationGUI::class,
129  "ilExSubmissionGUI",
130  "ilExSubmissionTextGUI"
131  ), "showAssignmentText");
132  $link = $f->link()->standard(
133  $this->lng->txt("exc_text_assignment_show"),
134  $url
135  );
136  $builder->addAction(
137  $builder::SEC_SUBMISSION,
138  $link
139  );
140  $builder->addView(
141  "submission",
142  $lng->txt("exc_submission"),
143  $url
144  );
145  }
146  }
147 
148  //$a_info->addProperty($lng->txt("exc_files_returned_text"), $files_str);
149 
150  }
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...
$url
Definition: shib_logout.php:66
global $DIC
Definition: shib_login.php:22
$service
Definition: ltiservices.php:40
+ Here is the call graph for this function:

◆ getFormValuesArray()

ilExAssTypeTextGUI::getFormValuesArray ( ilExAssignment  $ass)

Get form values array from assignment.

Returns
array

Implements ilExAssignmentTypeGUIInterface.

Definition at line 81 of file class.ilExAssTypeTextGUI.php.

References ilExAssignment\getMaxCharLimit(), and ilExAssignment\getMinCharLimit().

81  : array
82  {
83  $values = [];
84  if ($ass->getMinCharLimit() !== 0) {
85  $values['limit_characters'] = 1;
86  $values['min_char_limit'] = $ass->getMinCharLimit();
87  }
88  if ($ass->getMaxCharLimit() !== 0) {
89  $values['limit_characters'] = 1;
90  $values['max_char_limit'] = $ass->getMaxCharLimit();
91  }
92 
93  return $values;
94  }
+ Here is the call graph for this function:

◆ getOverviewContent()

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

Add overview content of submission to info screen object.

Implements ilExAssignmentTypeGUIInterface.

Definition at line 96 of file class.ilExAssTypeTextGUI.php.

96  : void
97  {
98  }

◆ importFormToAssignment()

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

Get values from form and put them into assignment.

Implements ilExAssignmentTypeGUIInterface.

Definition at line 66 of file class.ilExAssTypeTextGUI.php.

References ilPropertyFormGUI\getInput(), ilExAssignment\setMaxCharLimit(), and ilExAssignment\setMinCharLimit().

66  : void
67  {
68  $ass->setMaxCharLimit(0);
69  $ass->setMinCharLimit(0);
70  if ($form->getInput("limit_characters") && $form->getInput("max_char_limit")) {
71  $ass->setMaxCharLimit($form->getInput("max_char_limit"));
72  }
73  if ($form->getInput("limit_characters") && $form->getInput("min_char_limit")) {
74  $ass->setMinCharLimit($form->getInput("min_char_limit"));
75  }
76  }
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-...
+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilLanguage ilExAssTypeTextGUI::$lng
protected

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

Referenced by addEditFormCustomProperties().

◆ $requested_min_char_limit

int ilExAssTypeTextGUI::$requested_min_char_limit = 0
protected

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


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