ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
arEditGUI Class Reference

GUI-Class arEditGUI. More...

+ Inheritance diagram for arEditGUI:
+ Collaboration diagram for arEditGUI:

Public Member Functions

 __construct (arGUI $parent_gui, ActiveRecord $ar)
 
 setArFieldsAfterSubmit ()
 
 setFields (arEditFields $fields)
 Setters and Getters *********************. More...
 
 getFields ()
 
 getFieldsAsArray ()
 
 getField ($field_name)
 
 addEditField (arEditField $field)
 
 setFormName ($form_name)
 
 getFormName ()
 
 setFormPrefix ($form_prefix)
 
 getFormPrefix ()
 
- 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...
 
 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

 init ()
 Form Initialization **********************. More...
 
 initFields ()
 
 customizeFields ()
 
 initForm ()
 
 beforeInitForm ()
 
 initFormAction ()
 
 initFormTitle ()
 
 addFormField (arEditField $field)
 
 addBooleanInputField (arEditField $field)
 
 addTextInputField (arEditField $field)
 
 addNumbericInputField (arEditField $field)
 
 addDateTimeInputField (arEditField $field)
 
 addClobInputField (arEditField $field)
 
 initCommandButtons ()
 
 afterInitForm ()
 
 beforeFillForm ()
 
 afterFillForm ()
 
 fillCustomFormField (arEditField $field)
 
 beforeSave ()
 
 afterSave ()
 
 afterValidation ()
 
 setNumericRecordField (arEditField $field)
 
 setTextRecordField (arEditField $field)
 
 setDateTimeRecordField (arEditField $field)
 
 setCustomRecordField (arEditField $field)
 
 handleEmptyPostValue (arEditField $field)
 
 txt ($txt, $plugin_txt=true)
 
- Protected Member Functions inherited from ilPropertyFormGUI
 hideRequired ($a_type)
 
 rebuildUploadedFiles ()
 try to rebuild files More...
 

Protected Attributes

 $ar
 
 $parent_gui
 
 $ctrl
 
 $form_name = ""
 
 $form_prefix = ""
 
 $fields
 
- 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
 
- Protected Attributes inherited from ilFormGUI
 $formaction
 
 $multipart = false
 
 $keepopen = false
 
 $opentag = true
 
 $id
 
 $name
 
 $prevent_double_submission = false
 

Detailed Description

GUI-Class arEditGUI.

Author
Timon Amstutz timon.nosp@m..ams.nosp@m.tutz@.nosp@m.ilub.nosp@m..unib.nosp@m.e.ch
Version
2.0.7

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

Constructor & Destructor Documentation

◆ __construct()

arEditGUI::__construct ( arGUI  $parent_gui,
ActiveRecord  $ar 
)
Parameters
arGUI$parent_gui
ActiveRecord$ar

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

47 {
48 global $DIC;
49 $ilCtrl = $DIC['ilCtrl'];
50
51 $this->ar = $ar;
52 $this->parent_gui = $parent_gui;
53 $this->ctrl = $ilCtrl;
54 $this->ctrl->saveParameter($parent_gui, 'ar_id');
55 $this->setFormName(get_class($ar));
56 $this->init();
57 }
setFormName($form_name)
init()
Form Initialization **********************.
global $ilCtrl
Definition: ilias.php:18
global $DIC
Definition: saml.php:7

References $ar, $DIC, $ilCtrl, $parent_gui, init(), and setFormName().

+ Here is the call graph for this function:

Member Function Documentation

◆ addBooleanInputField()

arEditGUI::addBooleanInputField ( arEditField  $field)
protected
Parameters
arEditField$field
Returns
ilTextInputGUI

Definition at line 178 of file class.arEditGUI.php.

179 {
180 return new ilCheckboxInputGUI($this->txt($field->getTxt()), $field->getName());
181 }
txt($txt, $plugin_txt=true)
This class represents a checkbox property in a property form.

References arField\getName(), arViewField\getTxt(), and txt().

+ Here is the call graph for this function:

◆ addClobInputField()

arEditGUI::addClobInputField ( arEditField  $field)
protected
Parameters
arEditField$field
Returns
ilTextAreaInputGUI

Definition at line 226 of file class.arEditGUI.php.

227 {
228 return new ilTextAreaInputGUI($this->txt($field->getTxt()), $field->getName());
229 }
This class represents a text area property in a property form.

References arField\getName(), arViewField\getTxt(), and txt().

Referenced by addFormField().

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

◆ addDateTimeInputField()

arEditGUI::addDateTimeInputField ( arEditField  $field)
protected
Parameters
arEditField$field
Returns
ilDateTimeInputGUI

Definition at line 211 of file class.arEditGUI.php.

212 {
213 $date_input = new ilDateTimeInputGUI($this->txt($field->getTxt()), $field->getName());
214 $date_input->setDate(new ilDate(date('Y-m-d H:i:s'), IL_CAL_DATE));
215 $date_input->setShowTime(true);
216
217 return $date_input;
218 }
const IL_CAL_DATE
This class represents a date/time property in a property form.
Class for single dates.

References arField\getName(), arViewField\getTxt(), IL_CAL_DATE, and txt().

Referenced by addFormField().

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

◆ addEditField()

arEditGUI::addEditField ( arEditField  $field)
Parameters
arEditField

Definition at line 573 of file class.arEditGUI.php.

574 {
575 $this->getFields()->addField($field);
576 }

References getFields().

+ Here is the call graph for this function:

◆ addFormField()

arEditGUI::addFormField ( arEditField  $field)
protected
Parameters
arEditField$field

Definition at line 137 of file class.arEditGUI.php.

138 {
139 $field_element = null;
140 if (!$field->getFormElement()) {
141 switch ($field->getFieldType()) {
142 case 'integer':
143 case 'float':
144 $field->setFormElement($this->addNumbericInputField($field));
145 break;
146 break;
147 case 'date':
148 case 'time':
149 case 'timestamp':
150 $field->setFormElement($this->addDateTimeInputField($field));
151 break;
152 case 'clob':
153 $field->setFormElement($this->addClobInputField($field));
154 break;
155 default:
156 $field->setFormElement($this->addTextInputField($field));
157 }
158 if ($field->getNotNull()) {
159 $field->getFormElement()->setRequired(true);
160 }
161 }
162
163 if ($field->getFormElement()) {
164 if ($field->getSubelementOf()) {
165 $field->getSubelementOf()->addSubItem($field->getFormElement());
166 } else {
167 $this->addItem($field->getFormElement());
168 }
169 }
170 }
setFormElement($form_element)
addTextInputField(arEditField $field)
addDateTimeInputField(arEditField $field)
addClobInputField(arEditField $field)
addNumbericInputField(arEditField $field)
addItem($a_item)
Add Item (Property, SectionHeader).

References addClobInputField(), addDateTimeInputField(), ilPropertyFormGUI\addItem(), addNumbericInputField(), addTextInputField(), arField\getFieldType(), arEditField\getFormElement(), arField\getNotNull(), arEditField\getSubelementOf(), and arEditField\setFormElement().

+ Here is the call graph for this function:

◆ addNumbericInputField()

arEditGUI::addNumbericInputField ( arEditField  $field)
protected
Parameters
arEditField$field
Returns
ilNumberInputGUI

Definition at line 200 of file class.arEditGUI.php.

201 {
202 return new ilNumberInputGUI($this->txt($field->getTxt()), $field->getName());
203 }
This class represents a number property in a property form.

References arField\getName(), arViewField\getTxt(), and txt().

Referenced by addFormField().

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

◆ addTextInputField()

arEditGUI::addTextInputField ( arEditField  $field)
protected
Parameters
arEditField$field
Returns
ilTextInputGUI

Definition at line 189 of file class.arEditGUI.php.

190 {
191 return new ilTextInputGUI($this->txt($field->getTxt()), $field->getName());
192 }
This class represents a text property in a property form.

References arField\getName(), arViewField\getTxt(), and txt().

Referenced by addFormField().

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

◆ afterFillForm()

arEditGUI::afterFillForm ( )
protected

Definition at line 275 of file class.arEditGUI.php.

276 {
277 }

◆ afterInitForm()

arEditGUI::afterInitForm ( )
protected

Definition at line 243 of file class.arEditGUI.php.

244 {
245 }

Referenced by initForm().

+ Here is the caller graph for this function:

◆ afterSave()

arEditGUI::afterSave ( )
protected
Returns
bool

Definition at line 384 of file class.arEditGUI.php.

385 {
386 return true;
387 }

◆ afterValidation()

arEditGUI::afterValidation ( )
protected

Definition at line 412 of file class.arEditGUI.php.

413 {
414 return true;
415 }

Referenced by setArFieldsAfterSubmit().

+ Here is the caller graph for this function:

◆ beforeFillForm()

arEditGUI::beforeFillForm ( )
protected

Definition at line 270 of file class.arEditGUI.php.

271 {
272 }

◆ beforeInitForm()

arEditGUI::beforeInitForm ( )
protected

Definition at line 99 of file class.arEditGUI.php.

100 {
101 }

◆ beforeSave()

arEditGUI::beforeSave ( )
protected

Definition at line 375 of file class.arEditGUI.php.

376 {
377 return true;
378 }

◆ customizeFields()

arEditGUI::customizeFields ( )
protected

Definition at line 83 of file class.arEditGUI.php.

84 {
85 }

Referenced by initFields().

+ Here is the caller graph for this function:

◆ fillCustomFormField()

arEditGUI::fillCustomFormField ( arEditField  $field)
protected
Parameters
arEditField$field

Definition at line 316 of file class.arEditGUI.php.

317 {
318 }

◆ getField()

arEditGUI::getField (   $field_name)
Parameters
$field_name
Returns
arEditField

Definition at line 564 of file class.arEditGUI.php.

565 {
566 return $this->getFields()->getField($field_name);
567 }

References getFields().

+ Here is the call graph for this function:

◆ getFields()

arEditGUI::getFields ( )
Returns
arEditFields

Definition at line 544 of file class.arEditGUI.php.

545 {
546 return $this->fields;
547 }

References $fields.

Referenced by addEditField(), getField(), and getFieldsAsArray().

+ Here is the caller graph for this function:

◆ getFieldsAsArray()

arEditGUI::getFieldsAsArray ( )
Returns
arEditField []

Definition at line 553 of file class.arEditGUI.php.

554 {
555 return $this->getFields()->getFields();
556 }

References getFields().

+ Here is the call graph for this function:

◆ getFormName()

arEditGUI::getFormName ( )
Returns
string

Definition at line 603 of file class.arEditGUI.php.

604 {
605 return $this->form_name;
606 }

References $form_name.

Referenced by initFormTitle().

+ Here is the caller graph for this function:

◆ getFormPrefix()

arEditGUI::getFormPrefix ( )
Returns
string

Definition at line 621 of file class.arEditGUI.php.

622 {
623 return $this->form_prefix;
624 }

References $form_prefix.

Referenced by initFormTitle().

+ Here is the caller graph for this function:

◆ handleEmptyPostValue()

arEditGUI::handleEmptyPostValue ( arEditField  $field)
protected
Parameters
arEditField$field
Returns
bool

Definition at line 522 of file class.arEditGUI.php.

523 {
524 return true;
525 }

◆ init()

arEditGUI::init ( )
protected

Form Initialization **********************.

Definition at line 65 of file class.arEditGUI.php.

66 {
67 $this->initFields();
68 $this->initForm();
69 if ($this->ar->getPrimaryFieldValue() != 0) {
70 $this->fillForm();
71 }
72 }

References initFields(), and initForm().

Referenced by __construct().

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

◆ initCommandButtons()

arEditGUI::initCommandButtons ( )
protected

Definition at line 232 of file class.arEditGUI.php.

233 {
234 if ($this->ar->getPrimaryFieldValue() == 0) {
235 $this->addCommandButton('create', $this->txt('create', false));
236 } else {
237 $this->addCommandButton('update', $this->txt('save', false));
238 }
239 $this->addCommandButton('index', $this->txt('cancel', false));
240 }
addCommandButton($a_cmd, $a_text, $a_id="")
Add Command button.

References ilPropertyFormGUI\addCommandButton(), and txt().

Referenced by initForm().

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

◆ initFields()

arEditGUI::initFields ( )
protected

Definition at line 75 of file class.arEditGUI.php.

76 {
77 $this->fields = new arEditFields($this->ar);
78 $this->customizeFields();
79 $this->fields->sortFields();
80 }
GUI-Class arEditFields.
$errors fields
Definition: imgupload.php:51

References customizeFields(), and fields.

Referenced by init().

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

◆ initForm()

arEditGUI::initForm ( )
protected

Definition at line 88 of file class.arEditGUI.php.

89 {
90 $this->BeforeInitForm();
91 $this->initFormAction();
92 $this->initFormTitle();
93 $this->generateFormFields();
94 $this->initCommandButtons();
95 $this->afterInitForm();
96 }

References afterInitForm(), initCommandButtons(), initFormAction(), and initFormTitle().

Referenced by init().

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

◆ initFormAction()

arEditGUI::initFormAction ( )
protected

Definition at line 104 of file class.arEditGUI.php.

105 {
106 $this->setFormAction($this->ctrl->getFormAction($this->parent_gui, "index"));
107 }
setFormAction($a_formaction)
Set FormAction.

References ilFormGUI\setFormAction().

Referenced by initForm().

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

◆ initFormTitle()

arEditGUI::initFormTitle ( )
protected

Definition at line 110 of file class.arEditGUI.php.

111 {
112 $this->setFormPrefix("");
113 if ($this->ar->getPrimaryFieldValue() == 0) {
114 $this->setTitle($this->txt($this->getFormPrefix() . 'create_' . $this->getFormName()));
115 } else {
116 $this->setTitle($this->txt($this->getFormPrefix() . 'edit_' . $this->getFormName()));
117 }
118 }
setFormPrefix($form_prefix)
setTitle($a_title)
Set Title.

References getFormName(), getFormPrefix(), setFormPrefix(), ilPropertyFormGUI\setTitle(), and txt().

Referenced by initForm().

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

◆ setArFieldsAfterSubmit()

arEditGUI::setArFieldsAfterSubmit ( )
Returns
bool

Definition at line 393 of file class.arEditGUI.php.

394 {
395 if (!$this->checkInput()) {
396 return false;
397 }
398 if (!$this->afterValidation()) {
399 return false;
400 }
401
402 foreach ($this->fields->getFields() as $field) {
403 if (!$this->setArFieldAfterSubmit($field)) {
404 return false;
405 }
406 }
407
408 return true;
409 }
checkInput()
Check Post Input.

References afterValidation(), ilPropertyFormGUI\checkInput(), and fields.

+ Here is the call graph for this function:

◆ setCustomRecordField()

arEditGUI::setCustomRecordField ( arEditField  $field)
protected
Parameters
arEditField$field
Returns
bool

Definition at line 511 of file class.arEditGUI.php.

512 {
513 return true;
514 }

◆ setDateTimeRecordField()

arEditGUI::setDateTimeRecordField ( arEditField  $field)
protected
Parameters
arEditField$field
Returns
bool

Definition at line 491 of file class.arEditGUI.php.

492 {
493 $set_function = $field->getSetFunctionName();
494 $value = $this->getInput($field->getName());
495 if ($value['time']) {
496 $datetime = new ilDateTime($value['date'] . " " . $value['time'], IL_CAL_DATETIME);
497 } else {
498 $datetime = new ilDateTime($value['date'], IL_CAL_DATETIME);
499 }
500 $this->ar->$set_function($datetime);
501
502 return true;
503 }
const IL_CAL_DATETIME
@classDescription Date and time handling
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.

References ilPropertyFormGUI\getInput(), arField\getName(), arViewField\getSetFunctionName(), and IL_CAL_DATETIME.

+ Here is the call graph for this function:

◆ setFields()

arEditGUI::setFields ( arEditFields  $fields)

Setters and Getters *********************.

Parameters
arEditFields$fields

Definition at line 535 of file class.arEditGUI.php.

536 {
537 $this->fields = $fields;
538 }

References $fields, and fields.

◆ setFormName()

arEditGUI::setFormName (   $form_name)
Parameters
string$form_name

Definition at line 594 of file class.arEditGUI.php.

595 {
596 $this->form_name = $form_name;
597 }

References $form_name.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setFormPrefix()

arEditGUI::setFormPrefix (   $form_prefix)
Parameters
string$form_prefix

Definition at line 612 of file class.arEditGUI.php.

613 {
614 $this->form_prefix = $form_prefix;
615 }

References $form_prefix.

Referenced by initFormTitle().

+ Here is the caller graph for this function:

◆ setNumericRecordField()

arEditGUI::setNumericRecordField ( arEditField  $field)
protected
Parameters
arEditField$field
Returns
bool

Definition at line 463 of file class.arEditGUI.php.

464 {
465 $set_function = $field->getSetFunctionName();
466 $this->ar->$set_function($this->getInput($field->getName()));
467
468 return true;
469 }

References ilPropertyFormGUI\getInput(), arField\getName(), and arViewField\getSetFunctionName().

+ Here is the call graph for this function:

◆ setTextRecordField()

arEditGUI::setTextRecordField ( arEditField  $field)
protected
Parameters
arEditField$field
Returns
bool

Definition at line 477 of file class.arEditGUI.php.

478 {
479 $set_function = $field->getSetFunctionName();
480 $this->ar->$set_function($this->getInput($field->getName()));
481
482 return true;
483 }

References ilPropertyFormGUI\getInput(), arField\getName(), and arViewField\getSetFunctionName().

+ Here is the call graph for this function:

◆ txt()

arEditGUI::txt (   $txt,
  $plugin_txt = true 
)
protected
Parameters
$txt
bool$plugin_txt
Returns
string

Definition at line 585 of file class.arEditGUI.php.

586 {
587 return $this->parent_gui->txt($txt, $plugin_txt);
588 }
$txt
Definition: error.php:11

References $txt.

Referenced by addBooleanInputField(), addClobInputField(), addDateTimeInputField(), addNumbericInputField(), addTextInputField(), initCommandButtons(), and initFormTitle().

+ Here is the caller graph for this function:

Field Documentation

◆ $ar

arEditGUI::$ar
protected

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

Referenced by __construct().

◆ $ctrl

arEditGUI::$ctrl
protected

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

◆ $fields

arEditGUI::$fields
protected

Definition at line 39 of file class.arEditGUI.php.

Referenced by getFields(), and setFields().

◆ $form_name

arEditGUI::$form_name = ""
protected

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

Referenced by getFormName(), and setFormName().

◆ $form_prefix

arEditGUI::$form_prefix = ""
protected

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

Referenced by getFormPrefix(), and setFormPrefix().

◆ $parent_gui

arEditGUI::$parent_gui
protected

Definition at line 23 of file class.arEditGUI.php.

Referenced by __construct().


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