ILIAS  release_7 Revision v7.30-3-g800a261c036
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')
 ilTermsOfServiceCriterionFormGUI constructor. More...
 
 setCheckInputCalled (bool $status)
 
 hasTranslatedError ()
 
 getTranslatedError ()
 
 saveObject ()
 
- Public Member Functions inherited from ilPropertyFormGUI
 __construct ()
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 setTableWidth ($a_width)
 Set table width. More...
 
 getTableWidth ()
 get table width More...
 
 setMode ($a_mode)
 Set Mode ('std', 'subform'). More...
 
 getMode ()
 Get Mode ('std', 'subform'). More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setTitleIcon ($a_titleicon)
 Set TitleIcon. More...
 
 getTitleIcon ()
 Get TitleIcon. More...
 
 setDescription ($a_val)
 Set description. More...
 
 getDescription ()
 Get description. More...
 
 setTopAnchor ($a_val)
 Set top anchor. More...
 
 getTopAnchor ()
 Get top anchor. More...
 
 setShowTopButtons ($a_val)
 Get show top buttons. More...
 
 getShowTopButtons ()
 Set show top buttons. More...
 
 setForceTopButtons ($a_val)
 Set force top buttons. More...
 
 getForceTopButtons ()
 Get force top buttons. More...
 
 addItem ($a_item)
 Add Item (Property, SectionHeader). More...
 
 removeItemByPostVar ($a_post_var, $a_remove_unused_headers=false)
 Remove Item. More...
 
 getItemByPostVar ($a_post_var)
 Get Item by POST variable. More...
 
 setItems ($a_items)
 Set Items. More...
 
 getItems ()
 Get Items. More...
 
 getInputItemsRecursive ()
 returns a flat array of all input items including the possibly existing subitems recursively More...
 
 setDisableStandardMessage ($a_val)
 Set disable standard message. More...
 
 getDisableStandardMessage ()
 Get disable standard message. More...
 
 getHideLabels ()
 Get a value indicating whether the labels should be hidden or not. More...
 
 setHideLabels ($a_value=true)
 Set a value indicating whether the labels should be hidden or not. More...
 
 setValuesByArray ($a_values, $a_restrict_to_value_keys=false)
 Set form values from an array. More...
 
 setValuesByPost ()
 Set form values from POST values. More...
 
 checkInput ()
 Check Post Input. More...
 
 getInput ($a_post_var, $ensureValidation=true)
 Returns the value of a HTTP-POST variable, identified by the passed id. More...
 
 addCustomProperty ( $a_title, $a_html, $a_info="", $a_alert="", $a_required=false)
 Add a custom property. More...
 
 addCommandButton ($a_cmd, $a_text, $a_id="")
 Add Command button. More...
 
 getCommandButtons ()
 Return all Command buttons. More...
 
 clearCommandButtons ()
 Remove all command buttons. More...
 
 getContent ()
 Get Content. More...
 
 insertItem ($item, $a_sub_item=false)
 
 getHTML ()
 Get HTML. More...
 
 getFileUpload ($a_field, $a_index=null, $a_sub_index=null)
 Get file upload data. More...
 
 hasFileUpload ($a_field, $a_index=null, $a_sub_index=null)
 Was any file uploaded? More...
 
 moveFileUpload ($a_target_directory, $a_field, $a_target_name=null, $a_index=null, $a_sub_index=null)
 Move upload to target directory. More...
 
- Public Member Functions inherited from ilFormGUI
 setFormAction ($a_formaction)
 Set FormAction. More...
 
 getFormAction ()
 Get FormAction. More...
 
 setTarget ($a_target)
 Set Target. More...
 
 getTarget ()
 Get Target. More...
 
 setMultipart ($a_multipart)
 Set Enctype Multipart/Formdata true/false. More...
 
 getMultipart ()
 Get Enctype Multipart/Formdata true/false. More...
 
 setId ($a_id)
 Set Id. More...
 
 getId ()
 Get Id. More...
 
 setName ($a_name)
 Set Name. More...
 
 getName ()
 Get Name. More...
 
 setKeepOpen ($a_keepopen)
 Set Keep Form Tag Open. More...
 
 getKeepOpen ()
 Get Keep Form Tag Open. More...
 
 setOpenTag ($a_open)
 Enable/Disable Open Form Tag. More...
 
 getOpenTag ()
 Get Open Form Tag Enabled. More...
 
 setCloseTag ($a_val)
 Set close tag. More...
 
 getCloseTag ()
 Get close tag. More...
 
 setPreventDoubleSubmission ($a_val)
 Set prevent double submission. More...
 
 getPreventDoubleSubmission ()
 Get prevent double submission. More...
 
 getHTML ()
 Get HTML. More...
 
 getContent ()
 Get Content. More...
 

Protected Member Functions

 fillObject ()
 
- Protected Member Functions inherited from ilPropertyFormGUI
 hideRequired ($a_type)
 
 rebuildUploadedFiles ()
 try to rebuild files More...
 

Protected Attributes

 $document
 
 $assignment
 
 $formAction
 
 $actor
 
 $saveCommand
 
 $cancelCommand
 
 $translatedError = ''
 
 $criterionTypeFactory
 
- Protected Attributes inherited from ilPropertyFormGUI
 $lng
 
 $ctrl
 
 $tpl
 
 $user
 
 $settings
 
 $mode = "std"
 
 $check_input_called = false
 
 $disable_standard_message = false
 
 $top_anchor = "il_form_top"
 
 $titleicon = false
 
 $description = ""
 
 $tbl_width = false
 
 $show_top_buttons = true
 
 $hide_labels = false
 
 $force_top_buttons = false
 
- Protected Attributes inherited from ilFormGUI
 $formaction
 
 $multipart = false
 
 $keepopen = false
 
 $opentag = true
 
 $id
 
 $name
 
 $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' 
)

ilTermsOfServiceCriterionFormGUI constructor.

Parameters
ilTermsOfServiceDocument$document
ilTermsOfServiceDocumentCriterionAssignment$assignment
ilTermsOfServiceCriterionTypeFactoryInterface$criterionTypeFactory
ilObjUser$actor
string$formAction
string$saveCommand
string$cancelCommand

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

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 177 of file class.ilTermsOfServiceCriterionFormGUI.php.

177 : bool
178 {
179 if (!$this->checkInput()) {
180 return false;
181 }
182
183 try {
184 $criterionType = $this->criterionTypeFactory->findByTypeIdent($this->getInput('criterion'));
185 $criterionGui = $criterionType->ui($this->lng);
186
187 $this->assignment->setCriterionId($criterionType->getTypeIdent());
188 $this->assignment->setCriterionValue($criterionGui->getConfigByForm($this));
189
190 if ($this->assignment->getId() > 0) {
191 $this->assignment->setLastModifiedUsrId($this->actor->getId());
192 } else {
193 $this->assignment->setOwnerUsrId($this->actor->getId());
194 }
195 } catch (Exception $e) {
196 $this->getItemByPostVar('criterion')->setAlert($e->getMessage());
197 $this->translatedError = $this->lng->txt('form_input_not_valid');
198 return false;
199 }
200
201 return true;
202 }
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
checkInput()
Check Post Input.
getItemByPostVar($a_post_var)
Get Item by POST variable.

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

Referenced by saveObject().

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

◆ getTranslatedError()

ilTermsOfServiceCriterionFormGUI::getTranslatedError ( )
Returns
string

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

References $translatedError.

◆ hasTranslatedError()

ilTermsOfServiceCriterionFormGUI::hasTranslatedError ( )
Returns
bool

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

124 : bool
125 {
126 return strlen($this->translatedError) > 0;
127 }

◆ saveObject()

ilTermsOfServiceCriterionFormGUI::saveObject ( )
Returns
bool
Exceptions
ilTermsOfServiceDuplicateCriterionAssignmentException

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

141 : bool
142 {
143 if (!$this->fillObject()) {
144 $this->setValuesByPost();
145 return false;
146 }
147
148 $uniqueAssignmentConstraint = new ilTermsOfServiceDocumentCriterionAssignmentConstraint(
149 $this->criterionTypeFactory,
150 $this->document,
151 new Factory(),
152 $this->lng
153 );
154
155 if (!$uniqueAssignmentConstraint->accepts($this->assignment)) {
156 $this->getItemByPostVar('criterion')->setAlert($this->lng->txt('tos_criterion_assignment_must_be_unique_insert'));
157 if ($this->assignment->getId() > 0) {
158 $this->getItemByPostVar('criterion')->setAlert($this->lng->txt('tos_criterion_assignment_must_be_unique_update'));
159 }
160
161 $this->translatedError = $this->lng->txt('form_input_not_valid');
162 $this->setValuesByPost();
163 return false;
164 }
165
166 if (!$this->assignment->getId()) {
167 $this->document->attachCriterion($this->assignment);
168 }
169 $this->document->save();
170
171 return true;
172 }
Builds data types.
Definition: Factory.php:20
setValuesByPost()
Set form values from POST values.

References fillObject(), ilPropertyFormGUI\getItemByPostVar(), and ilPropertyFormGUI\setValuesByPost().

+ Here is the call graph for this function:

◆ setCheckInputCalled()

ilTermsOfServiceCriterionFormGUI::setCheckInputCalled ( bool  $status)
Parameters
bool$status

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

71 : void
72 {
73 $this->check_input_called = $status;
74 }

Field Documentation

◆ $actor

ilTermsOfServiceCriterionFormGUI::$actor
protected

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

Referenced by __construct().

◆ $assignment

ilTermsOfServiceCriterionFormGUI::$assignment
protected

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

Referenced by __construct().

◆ $cancelCommand

ilTermsOfServiceCriterionFormGUI::$cancelCommand
protected

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

Referenced by __construct().

◆ $criterionTypeFactory

ilTermsOfServiceCriterionFormGUI::$criterionTypeFactory
protected

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

Referenced by __construct().

◆ $document

ilTermsOfServiceCriterionFormGUI::$document
protected

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

Referenced by __construct().

◆ $formAction

ilTermsOfServiceCriterionFormGUI::$formAction
protected

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

Referenced by __construct().

◆ $saveCommand

ilTermsOfServiceCriterionFormGUI::$saveCommand
protected

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

Referenced by __construct().

◆ $translatedError

ilTermsOfServiceCriterionFormGUI::$translatedError = ''
protected

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

Referenced by getTranslatedError().


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