ILIAS  release_8 Revision v8.24
ilTermsOfServiceCriterionFormGUI Class Reference

Class ilTermsOfServiceCriterionFormGUI. More...

+ Inheritance diagram for ilTermsOfServiceCriterionFormGUI:
+ Collaboration diagram for ilTermsOfServiceCriterionFormGUI:

Public Member Functions

 __construct (ilTermsOfServiceDocument $document, ilTermsOfServiceDocumentCriterionAssignment $assignment, ilTermsOfServiceCriterionTypeFactoryInterface $criterionTypeFactory, ilObjUser $actor, string $formAction='', string $saveCommand='saveDocument', string $cancelCommand='showDocuments')
 
 setCheckInputCalled (bool $status)
 
 hasTranslatedError ()
 
 getTranslatedError ()
 
 saveObject ()
 
- Public Member Functions inherited from ilPropertyFormGUI
 __construct ()
 
 executeCommand ()
 
 setTableWidth (string $a_width)
 
 getTableWidth ()
 
 setMode (string $a_mode)
 
 getMode ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setTitleIcon (string $a_titleicon)
 
 getTitleIcon ()
 
 setDescription (string $a_val)
 
 getDescription ()
 
 setTopAnchor (string $a_val)
 
 getTopAnchor ()
 
 setShowTopButtons (bool $a_val)
 
 getShowTopButtons ()
 
 setForceTopButtons (bool $a_val)
 
 getForceTopButtons ()
 
 addItem ($a_item)
 
 removeItemByPostVar (string $a_post_var, bool $a_remove_unused_headers=false)
 
 getItemByPostVar (string $a_post_var)
 
 setItems (array $a_items)
 
 getItems ()
 
 getInputItemsRecursive ()
 returns a flat array of all input items including the possibly existing subitems recursively More...
 
 setDisableStandardMessage (bool $a_val)
 
 getDisableStandardMessage ()
 
 getHideLabels ()
 
 setHideLabels (bool $a_value=true)
 
 setValuesByArray (array $a_values, bool $a_restrict_to_value_keys=false)
 
 setValuesByPost ()
 
 checkInput ()
 
 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-POST variable, identified by the passed postvar. More...
 
 addCommandButton (string $a_cmd, string $a_text, string $a_id="")
 
 getCommandButtons ()
 
 clearCommandButtons ()
 
 getContent ()
 
 insertItem ( $item, bool $a_sub_item=false)
 
 addAsyncOnloadCode (string $code)
 
 getHTML ()
 
 getHTMLAsync ()
 
 getFileUpload (string $a_field, ?string $a_index=null, ?string $a_sub_index=null)
 Get file upload data. More...
 
 hasFileUpload (string $a_field, ?string $a_index=null, ?string $a_sub_index=null)
 
 moveFileUpload (string $a_target_directory, string $a_field, ?string $a_target_name=null, ?string $a_index=null, ?string $a_sub_index=null)
 Move upload to target directory. More...
 
- Public Member Functions inherited from ilFormGUI
 setFormAction (string $a_formaction)
 
 getFormAction ()
 
 setTarget (string $a_target)
 
 getTarget ()
 
 setMultipart (bool $a_multipart)
 
 getMultipart ()
 
 setId (string $a_id)
 
 getId ()
 
 setName (string $a_name)
 
 getName ()
 
 setKeepOpen (bool $a_keepopen)
 
 getKeepOpen ()
 
 setOpenTag (bool $a_open)
 
 getOpenTag ()
 
 setCloseTag (bool $a_val)
 
 getCloseTag ()
 
 setPreventDoubleSubmission (bool $a_val)
 
 getPreventDoubleSubmission ()
 
 getHTML ()
 
 getContent ()
 

Protected Member Functions

 fillObject ()
 
- Protected Member Functions inherited from ilPropertyFormGUI
 getRequestedPostVar ()
 
 getFileHash ()
 
 hideRequired (string $a_type)
 
 appendOnloadCode (string $html)
 
 rebuildUploadedFiles ()
 

Protected Attributes

ilTermsOfServiceDocument $document
 
ilTermsOfServiceDocumentCriterionAssignment $assignment
 
string $formAction
 
ilObjUser $actor
 
string $saveCommand
 
string $cancelCommand
 
string $translatedError = ''
 
ilTermsOfServiceCriterionTypeFactoryInterface $criterionTypeFactory
 
- Protected Attributes inherited from ilPropertyFormGUI
bool $required_text = false
 
ilLanguage $lng
 
ilCtrl $ctrl
 
ilTemplate $tpl
 
ilObjUser $user = null
 
ilSetting $settings = null
 
string $mode = "std"
 
bool $check_input_called = false
 
bool $disable_standard_message = false
 
string $top_anchor = "il_form_top"
 
string $title = ''
 
string $titleicon = ""
 
string $description = ""
 
string $tbl_width = ""
 
bool $show_top_buttons = true
 
bool $hide_labels = false
 
bool $force_top_buttons = false
 
HTTP Services $http
 
Refinery Factory $refinery = null
 
ilGlobalTemplateInterface $global_tpl = null
 
 $onload_code = []
 
- Protected Attributes inherited from ilFormGUI
string $formaction = ""
 
bool $multipart = false
 
bool $keepopen = false
 
bool $opentag = true
 
string $id = ''
 
string $name = ''
 
string $target = ''
 
bool $prevent_double_submission = false
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilTermsOfServiceCriterionFormGUI::__construct ( ilTermsOfServiceDocument  $document,
ilTermsOfServiceDocumentCriterionAssignment  $assignment,
ilTermsOfServiceCriterionTypeFactoryInterface  $criterionTypeFactory,
ilObjUser  $actor,
string  $formAction = '',
string  $saveCommand = 'saveDocument',
string  $cancelCommand = 'showDocuments' 
)

Definition at line 38 of file class.ilTermsOfServiceCriterionFormGUI.php.

46 {
47 $this->document = $document;
48 $this->assignment = $assignment;
49 $this->criterionTypeFactory = $criterionTypeFactory;
50 $this->actor = $actor;
51 $this->formAction = $formAction;
52 $this->saveCommand = $saveCommand;
53 $this->cancelCommand = $cancelCommand;
54
56
57 $this->initForm();
58 }
ilTermsOfServiceDocumentCriterionAssignment $assignment
ilTermsOfServiceCriterionTypeFactoryInterface $criterionTypeFactory
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $actor, $assignment, $cancelCommand, $criterionTypeFactory, $document, $formAction, $saveCommand, and ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ fillObject()

ilTermsOfServiceCriterionFormGUI::fillObject ( )
protected

Definition at line 150 of file class.ilTermsOfServiceCriterionFormGUI.php.

150 : bool
151 {
152 if (!$this->checkInput()) {
153 return false;
154 }
155
156 try {
157 $criterionType = $this->criterionTypeFactory->findByTypeIdent($this->getInput('criterion'));
158 $criterionGui = $criterionType->ui($this->lng);
159
160 $this->assignment->setCriterionId($criterionType->getTypeIdent());
161 $this->assignment->setCriterionValue($criterionGui->getConfigByForm($this));
162
163 if ($this->assignment->getId() > 0) {
164 $this->assignment->setLastModifiedUsrId($this->actor->getId());
165 } else {
166 $this->assignment->setOwnerUsrId($this->actor->getId());
167 }
168 } catch (Exception $e) {
169 $this->getItemByPostVar('criterion')->setAlert($e->getMessage());
170 $this->translatedError = $this->lng->txt('form_input_not_valid');
171 return false;
172 }
173
174 return true;
175 }
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-...
getItemByPostVar(string $a_post_var)

References Vendor\Package\$e, ilPropertyFormGUI\checkInput(), ilPropertyFormGUI\getInput(), ilPropertyFormGUI\getItemByPostVar(), and ILIAS\Repository\lng().

Referenced by saveObject().

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

◆ getTranslatedError()

ilTermsOfServiceCriterionFormGUI::getTranslatedError ( )

Definition at line 112 of file class.ilTermsOfServiceCriterionFormGUI.php.

References $translatedError.

◆ hasTranslatedError()

ilTermsOfServiceCriterionFormGUI::hasTranslatedError ( )

Definition at line 107 of file class.ilTermsOfServiceCriterionFormGUI.php.

107 : bool
108 {
109 return $this->translatedError !== '';
110 }

◆ saveObject()

ilTermsOfServiceCriterionFormGUI::saveObject ( )

Definition at line 117 of file class.ilTermsOfServiceCriterionFormGUI.php.

117 : bool
118 {
119 if (!$this->fillObject()) {
120 $this->setValuesByPost();
121 return false;
122 }
123
124 $uniqueAssignmentConstraint = new ilTermsOfServiceDocumentCriterionAssignmentConstraint(
125 $this->criterionTypeFactory,
126 $this->document,
127 new Factory(),
128 $this->lng
129 );
130
131 if (!$uniqueAssignmentConstraint->accepts($this->assignment)) {
132 $this->getItemByPostVar('criterion')->setAlert($this->lng->txt('tos_criterion_assignment_must_be_unique_insert'));
133 if ($this->assignment->getId() > 0) {
134 $this->getItemByPostVar('criterion')->setAlert($this->lng->txt('tos_criterion_assignment_must_be_unique_update'));
135 }
136
137 $this->translatedError = $this->lng->txt('form_input_not_valid');
138 $this->setValuesByPost();
139 return false;
140 }
141
142 if (!$this->assignment->getId()) {
143 $this->document->attachCriterion($this->assignment);
144 }
145 $this->document->save();
146
147 return true;
148 }
Builds data types.
Definition: Factory.php:21

References fillObject(), ilPropertyFormGUI\getItemByPostVar(), ILIAS\Repository\lng(), and ilPropertyFormGUI\setValuesByPost().

+ Here is the call graph for this function:

◆ setCheckInputCalled()

ilTermsOfServiceCriterionFormGUI::setCheckInputCalled ( bool  $status)

Definition at line 60 of file class.ilTermsOfServiceCriterionFormGUI.php.

60 : void
61 {
62 $this->check_input_called = $status;
63 }

Field Documentation

◆ $actor

ilObjUser ilTermsOfServiceCriterionFormGUI::$actor
protected

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

Referenced by __construct().

◆ $assignment

ilTermsOfServiceDocumentCriterionAssignment ilTermsOfServiceCriterionFormGUI::$assignment
protected

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

Referenced by __construct().

◆ $cancelCommand

string ilTermsOfServiceCriterionFormGUI::$cancelCommand
protected

Definition at line 34 of file class.ilTermsOfServiceCriterionFormGUI.php.

Referenced by __construct().

◆ $criterionTypeFactory

ilTermsOfServiceCriterionTypeFactoryInterface ilTermsOfServiceCriterionFormGUI::$criterionTypeFactory
protected

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

Referenced by __construct().

◆ $document

ilTermsOfServiceDocument ilTermsOfServiceCriterionFormGUI::$document
protected

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

Referenced by __construct().

◆ $formAction

string ilTermsOfServiceCriterionFormGUI::$formAction
protected

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

Referenced by __construct().

◆ $saveCommand

string ilTermsOfServiceCriterionFormGUI::$saveCommand
protected

Definition at line 33 of file class.ilTermsOfServiceCriterionFormGUI.php.

Referenced by __construct().

◆ $translatedError

string ilTermsOfServiceCriterionFormGUI::$translatedError = ''
protected

Definition at line 35 of file class.ilTermsOfServiceCriterionFormGUI.php.

Referenced by getTranslatedError().


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