ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilAccessibilityCriterionFormGUI Class Reference

Class ilAccessibilityCriterionFormGUI. More...

+ Inheritance diagram for ilAccessibilityCriterionFormGUI:
+ Collaboration diagram for ilAccessibilityCriterionFormGUI:

Public Member Functions

 __construct (ilAccessibilityDocument $document, ilAccessibilityDocumentCriterionAssignment $assignment, ilAccessibilityCriterionTypeFactoryInterface $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

ilAccessibilityDocument $document
 
ilAccessibilityDocumentCriterionAssignment $assignment
 
string $formAction
 
ilObjUser $actor
 
string $saveCommand
 
string $cancelCommand
 
string $translatedError = ''
 
ilAccessibilityCriterionTypeFactoryInterface $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()

ilAccessibilityCriterionFormGUI::__construct ( ilAccessibilityDocument  $document,
ilAccessibilityDocumentCriterionAssignment  $assignment,
ilAccessibilityCriterionTypeFactoryInterface  $criterionTypeFactory,
ilObjUser  $actor,
string  $formAction = '',
string  $saveCommand = 'saveDocument',
string  $cancelCommand = 'showDocuments' 
)

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

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

43  {
44  $this->document = $document;
45  $this->assignment = $assignment;
46  $this->criterionTypeFactory = $criterionTypeFactory;
47  $this->actor = $actor;
48  $this->formAction = $formAction;
49  $this->saveCommand = $saveCommand;
50  $this->cancelCommand = $cancelCommand;
51 
53 
54  $this->initForm();
55  }
ilAccessibilityCriterionTypeFactoryInterface $criterionTypeFactory
ilAccessibilityDocumentCriterionAssignment $assignment
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ fillObject()

ilAccessibilityCriterionFormGUI::fillObject ( )
protected

Definition at line 172 of file class.ilAccessibilityCriterionFormGUI.php.

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

Referenced by saveObject().

172  : bool
173  {
174  if (!$this->checkInput()) {
175  return false;
176  }
177 
178  try {
179  $criterionType = $this->criterionTypeFactory->findByTypeIdent($this->getInput('criterion'));
180  $criterionGui = $criterionType->ui($this->lng);
181 
182  $this->assignment->setCriterionId($criterionType->getTypeIdent());
183  $this->assignment->setCriterionValue($criterionGui->getConfigByForm($this));
184 
185  if ($this->assignment->getId() > 0) {
186  $this->assignment->setLastModifiedUsrId($this->actor->getId());
187  } else {
188  $this->assignment->setOwnerUsrId($this->actor->getId());
189  }
190  } catch (Exception $e) {
191  $this->getItemByPostVar('criterion')->setAlert($e->getMessage());
192  $this->translatedError = $this->lng->txt('form_input_not_valid');
193  return false;
194  }
195 
196  return true;
197  }
getItemByPostVar(string $a_post_var)
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:
+ Here is the caller graph for this function:

◆ getTranslatedError()

ilAccessibilityCriterionFormGUI::getTranslatedError ( )

Definition at line 131 of file class.ilAccessibilityCriterionFormGUI.php.

References $translatedError.

131  : string
132  {
133  return $this->translatedError;
134  }

◆ hasTranslatedError()

ilAccessibilityCriterionFormGUI::hasTranslatedError ( )

Definition at line 126 of file class.ilAccessibilityCriterionFormGUI.php.

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

◆ saveObject()

ilAccessibilityCriterionFormGUI::saveObject ( )
Exceptions
ilAccessibilityDuplicateCriterionAssignmentException

Definition at line 139 of file class.ilAccessibilityCriterionFormGUI.php.

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

139  : bool
140  {
141  if (!$this->fillObject()) {
142  $this->setValuesByPost();
143  return false;
144  }
145 
146  $uniqueAssignmentConstraint = new ilAccessibilityDocumentCriterionAssignmentConstraint(
147  $this->criterionTypeFactory,
148  $this->document,
149  new Factory(),
150  $this->lng
151  );
152 
153  if (!$uniqueAssignmentConstraint->accepts($this->assignment)) {
154  $this->getItemByPostVar('criterion')->setAlert($this->lng->txt('acc_criterion_assignment_must_be_unique_insert'));
155  if ($this->assignment->getId() > 0) {
156  $this->getItemByPostVar('criterion')->setAlert($this->lng->txt('acc_criterion_assignment_must_be_unique_update'));
157  }
158 
159  $this->translatedError = $this->lng->txt('form_input_not_valid');
160  $this->setValuesByPost();
161  return false;
162  }
163 
164  if (!$this->assignment->getId()) {
165  $this->document->attachCriterion($this->assignment);
166  }
167  $this->document->save();
168 
169  return true;
170  }
getItemByPostVar(string $a_post_var)
+ Here is the call graph for this function:

◆ setCheckInputCalled()

ilAccessibilityCriterionFormGUI::setCheckInputCalled ( bool  $status)

Definition at line 57 of file class.ilAccessibilityCriterionFormGUI.php.

References ilPropertyFormGUI\addCommandButton(), ilPropertyFormGUI\addItem(), ILIAS\Repository\lng(), ilFormGUI\setFormAction(), ilFormPropertyGUI\setRequired(), and ilPropertyFormGUI\setTitle().

57  : void
58  {
59  $this->check_input_called = $status;
60  }
+ Here is the call graph for this function:

Field Documentation

◆ $actor

ilObjUser ilAccessibilityCriterionFormGUI::$actor
protected

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

Referenced by __construct().

◆ $assignment

ilAccessibilityDocumentCriterionAssignment ilAccessibilityCriterionFormGUI::$assignment
protected

Definition at line 27 of file class.ilAccessibilityCriterionFormGUI.php.

Referenced by __construct().

◆ $cancelCommand

string ilAccessibilityCriterionFormGUI::$cancelCommand
protected

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

Referenced by __construct().

◆ $criterionTypeFactory

ilAccessibilityCriterionTypeFactoryInterface ilAccessibilityCriterionFormGUI::$criterionTypeFactory
protected

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

Referenced by __construct().

◆ $document

ilAccessibilityDocument ilAccessibilityCriterionFormGUI::$document
protected

Definition at line 26 of file class.ilAccessibilityCriterionFormGUI.php.

Referenced by __construct().

◆ $formAction

string ilAccessibilityCriterionFormGUI::$formAction
protected

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

Referenced by __construct().

◆ $saveCommand

string ilAccessibilityCriterionFormGUI::$saveCommand
protected

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

Referenced by __construct().

◆ $translatedError

string ilAccessibilityCriterionFormGUI::$translatedError = ''
protected

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

Referenced by getTranslatedError().


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