ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
 ilPropertyFormGUI ()
 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)
 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)
 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
 ilFormGUI ()
 Constructor. More...
 
 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)
 
 keepFileUpload ($a_hash, $a_field, $a_tmp_name, $a_name, $a_type, $a_index=null, $a_sub_index=null)
 Import upload into temp directory. More...
 
 rebuildUploadedFiles ()
 try to rebuild files
More...
 

Protected Attributes

 $ar
 
 $parent_gui
 
 $ctrl
 
 $form_name = ""
 
 $form_prefix = ""
 
 $fields
 
- Protected Attributes inherited from ilPropertyFormGUI
 $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
 
 $reloaded_files
 
 $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 45 of file class.arEditGUI.php.

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

References $ar, $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 167 of file class.arEditGUI.php.

167 {
168 return new ilCheckboxInputGUI($this->txt($field->getTxt()), $field->getName());
169 }
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 211 of file class.arEditGUI.php.

211 {
212 return new ilTextAreaInputGUI($this->txt($field->getTxt()), $field->getName());
213 }
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 197 of file class.arEditGUI.php.

197 {
198 $date_input = new ilDateTimeInputGUI($this->txt($field->getTxt()), $field->getName());
199 $date_input->setDate(new ilDate(date('Y-m-d H:i:s'), IL_CAL_DATE));
200 $date_input->setShowTime(true);
201
202 return $date_input;
203 }
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 533 of file class.arEditGUI.php.

533 {
534 $this->getFields()->addField($field);
535 }

References getFields().

+ Here is the call graph for this function:

◆ addFormField()

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

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

127 {
128 $field_element = NULL;
129 if (!$field->getFormElement()) {
130 switch ($field->getFieldType()) {
131 case 'integer':
132 case 'float':
133 $field->setFormElement($this->addNumbericInputField($field));
134 break;
135 break;
136 case 'date':
137 case 'time':
138 case 'timestamp':
139 $field->setFormElement($this->addDateTimeInputField($field));
140 break;
141 case 'clob':
142 $field->setFormElement($this->addClobInputField($field));
143 break;
144 default:
145 $field->setFormElement($this->addTextInputField($field));
146 }
147 if ($field->getNotNull()) {
148 $field->getFormElement()->setRequired(true);
149 }
150 }
151
152 if ($field->getFormElement()) {
153 if ($field->getSubelementOf()) {
154 $field->getSubelementOf()->addSubItem($field->getFormElement());
155 } else {
156 $this->addItem($field->getFormElement());
157 }
158 }
159 }
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 187 of file class.arEditGUI.php.

187 {
188 return new ilNumberInputGUI($this->txt($field->getTxt()), $field->getName());
189 }
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 177 of file class.arEditGUI.php.

177 {
178 return new ilTextInputGUI($this->txt($field->getTxt()), $field->getName());
179 }
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 255 of file class.arEditGUI.php.

255 {
256 }

◆ afterInitForm()

arEditGUI::afterInitForm ( )
protected

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

226 {
227 }

Referenced by initForm().

+ Here is the caller graph for this function:

◆ afterSave()

arEditGUI::afterSave ( )
protected
Returns
bool

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

358 {
359 return true;
360 }

◆ afterValidation()

arEditGUI::afterValidation ( )
protected

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

384 {
385 return true;
386 }

Referenced by setArFieldsAfterSubmit().

+ Here is the caller graph for this function:

◆ beforeFillForm()

arEditGUI::beforeFillForm ( )
protected

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

251 {
252 }

◆ beforeInitForm()

arEditGUI::beforeInitForm ( )
protected

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

92 {
93 }

◆ beforeSave()

arEditGUI::beforeSave ( )
protected

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

350 {
351 return true;
352 }

◆ customizeFields()

arEditGUI::customizeFields ( )
protected

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

78 {
79 }

Referenced by initFields().

+ Here is the caller graph for this function:

◆ fillCustomFormField()

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

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

294 {
295 }

◆ getField()

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

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

525 {
526 return $this->getFields()->getField($field_name);
527 }

References getFields().

+ Here is the call graph for this function:

◆ getFields()

arEditGUI::getFields ( )
Returns
arEditFields

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

507 {
508 return $this->fields;
509 }

References $fields.

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

+ Here is the caller graph for this function:

◆ getFieldsAsArray()

arEditGUI::getFieldsAsArray ( )
Returns
arEditField []

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

515 {
516 return $this->getFields()->getFields();
517 }

References getFields().

+ Here is the call graph for this function:

◆ getFormName()

arEditGUI::getFormName ( )
Returns
string

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

560 {
561 return $this->form_name;
562 }

References $form_name.

Referenced by initFormTitle().

+ Here is the caller graph for this function:

◆ getFormPrefix()

arEditGUI::getFormPrefix ( )
Returns
string

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

576 {
577 return $this->form_prefix;
578 }

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 487 of file class.arEditGUI.php.

487 {
488 return true;
489 }

◆ init()

arEditGUI::init ( )
protected

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

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

62 {
63 $this->initFields();
64 $this->initForm();
65 if ($this->ar->getPrimaryFieldValue() != 0) {
66 $this->fillForm();
67 }
68 }

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 216 of file class.arEditGUI.php.

216 {
217 if ($this->ar->getPrimaryFieldValue() == 0) {
218 $this->addCommandButton('create', $this->txt('create', false));
219 } else {
220 $this->addCommandButton('update', $this->txt('save', false));
221 }
222 $this->addCommandButton('index', $this->txt('cancel', false));
223 }
addCommandButton($a_cmd, $a_text)
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 71 of file class.arEditGUI.php.

71 {
72 $this->fields = new arEditFields($this->ar);
73 $this->customizeFields();
74 $this->fields->sortFields();
75 }
GUI-Class arEditFields.
$errors fields
Definition: imgupload.php:48

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 82 of file class.arEditGUI.php.

82 {
83 $this->BeforeInitForm();
84 $this->initFormAction();
85 $this->initFormTitle();
86 $this->generateFormFields();
87 $this->initCommandButtons();
88 $this->afterInitForm();
89 }

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 96 of file class.arEditGUI.php.

96 {
97 $this->setFormAction($this->ctrl->getFormAction($this->parent_gui, "index"));
98 }
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 101 of file class.arEditGUI.php.

101 {
102 $this->setFormPrefix("");
103 if ($this->ar->getPrimaryFieldValue() == 0) {
104 $this->setTitle($this->txt($this->getFormPrefix() . 'create_' . $this->getFormName()));
105 } else {
106 $this->setTitle($this->txt($this->getFormPrefix() . 'edit_' . $this->getFormName()));
107 }
108 }
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 366 of file class.arEditGUI.php.

366 {
367 if (!$this->checkInput()) {
368 return false;
369 }
370 if (!$this->afterValidation()) {
371 return false;
372 }
373
374 foreach ($this->fields->getFields() as $field) {
375 if (!$this->setArFieldAfterSubmit($field)) {
376 return false;
377 }
378 }
379
380 return true;
381 }
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 477 of file class.arEditGUI.php.

477 {
478 return true;
479 }

◆ setDateTimeRecordField()

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

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

458 {
459 $set_function = $field->getSetFunctionName();
460 $value = $this->getInput($field->getName());
461 if ($value['time']) {
462 $datetime = new ilDateTime($value['date'] . " " . $value['time'], IL_CAL_DATETIME);
463 } else {
464 $datetime = new ilDateTime($value['date'], IL_CAL_DATETIME);
465 }
466 $this->ar->$set_function($datetime);
467
468 return true;
469 }
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 499 of file class.arEditGUI.php.

499 {
500 $this->fields = $fields;
501 }

References $fields, and fields.

◆ setFormName()

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

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

552 {
553 $this->form_name = $form_name;
554 }

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 568 of file class.arEditGUI.php.

568 {
569 $this->form_prefix = $form_prefix;
570 }

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 432 of file class.arEditGUI.php.

432 {
433 $set_function = $field->getSetFunctionName();
434 $this->ar->$set_function($this->getInput($field->getName()));
435
436 return true;
437 }

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 445 of file class.arEditGUI.php.

445 {
446 $set_function = $field->getSetFunctionName();
447 $this->ar->$set_function($this->getInput($field->getName()));
448
449 return true;
450 }

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 544 of file class.arEditGUI.php.

544 {
545 return $this->parent_gui->txt($txt, $plugin_txt);
546 }
$txt
Definition: error.php:12

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 18 of file class.arEditGUI.php.

Referenced by __construct().

◆ $ctrl

arEditGUI::$ctrl
protected

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

◆ $fields

arEditGUI::$fields
protected

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

Referenced by getFields(), and setFields().

◆ $form_name

arEditGUI::$form_name = ""
protected

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

Referenced by getFormName(), and setFormName().

◆ $form_prefix

arEditGUI::$form_prefix = ""
protected

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

Referenced by getFormPrefix(), and setFormPrefix().

◆ $parent_gui

arEditGUI::$parent_gui
protected

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

Referenced by __construct().


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