ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilTermsOfServiceSettingsFormGUI Class Reference

Class ilTermsOfServiceSettingsFormGUI. More...

+ Inheritance diagram for ilTermsOfServiceSettingsFormGUI:
+ Collaboration diagram for ilTermsOfServiceSettingsFormGUI:

Public Member Functions

 __construct (ilObjTermsOfService $tos, string $formAction='', string $saveCommand='saveSettings', bool $isEditable=false)
 ilTermsOfServiceSettingsForm 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

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

Protected Attributes

 $tos
 
 $formAction = ''
 
 $saveCommand = ''
 
 $isEditable = false
 
 $translatedError = ''
 
- 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()

ilTermsOfServiceSettingsFormGUI::__construct ( ilObjTermsOfService  $tos,
string  $formAction = '',
string  $saveCommand = 'saveSettings',
bool  $isEditable = false 
)

ilTermsOfServiceSettingsForm constructor.

Parameters
ilObjTermsOfService$tos
string$formAction
string$saveCommand
bool$isEditable

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

References $formAction, $isEditable, $saveCommand, $tos, ILIAS\GlobalScreen\Provider\__construct(), and initForm().

+ Here is the call graph for this function:

Member Function Documentation

◆ fillObject()

ilTermsOfServiceSettingsFormGUI::fillObject ( )
protected

Definition at line 125 of file class.ilTermsOfServiceSettingsFormGUI.php.

125 : bool
126 {
127 if (!$this->checkInput()) {
128 return false;
129 }
130
131 return true;
132 }
checkInput()
Check Post Input.

References ilPropertyFormGUI\checkInput().

Referenced by saveObject().

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

◆ getTranslatedError()

ilTermsOfServiceSettingsFormGUI::getTranslatedError ( )
Returns
string

Definition at line 86 of file class.ilTermsOfServiceSettingsFormGUI.php.

References $translatedError.

◆ hasTranslatedError()

ilTermsOfServiceSettingsFormGUI::hasTranslatedError ( )
Returns
bool

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

78 : bool
79 {
80 return strlen($this->translatedError) > 0;
81 }

◆ initForm()

ilTermsOfServiceSettingsFormGUI::initForm ( )
protected

Definition at line 50 of file class.ilTermsOfServiceSettingsFormGUI.php.

50 : void
51 {
52 $this->setTitle($this->lng->txt('tos_tos_settings'));
53 $this->setFormAction($this->formAction);
54
55 $status = new ilCheckboxInputGUI($this->lng->txt('tos_status_enable'), 'tos_status');
56 $status->setValue(1);
57 $status->setChecked((bool) $this->tos->getStatus());
58 $status->setInfo($this->lng->txt('tos_status_desc'));
59 $status->setDisabled(!$this->isEditable);
60 $this->addItem($status);
61
62 if ($this->isEditable) {
63 $this->addCommandButton($this->saveCommand, $this->lng->txt('save'));
64 }
65 }
This class represents a checkbox property in a property form.
setFormAction($a_formaction)
Set FormAction.
addItem($a_item)
Add Item (Property, SectionHeader).
addCommandButton($a_cmd, $a_text, $a_id="")
Add Command button.
setTitle($a_title)
Set Title.

References ilPropertyFormGUI\addCommandButton(), ilPropertyFormGUI\addItem(), ilFormGUI\setFormAction(), and ilPropertyFormGUI\setTitle().

Referenced by __construct().

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

◆ saveObject()

ilTermsOfServiceSettingsFormGUI::saveObject ( )
Returns
bool

Definition at line 94 of file class.ilTermsOfServiceSettingsFormGUI.php.

94 : bool
95 {
96 if (!$this->fillObject()) {
97 $this->setValuesByPost();
98 return false;
99 }
100
101 if (!(int) $this->getInput('tos_status')) {
102 $this->tos->saveStatus((bool) $this->getInput('tos_status'));
103 return true;
104 }
105
106 $hasDocuments = ilTermsOfServiceDocument::where([])->count() > 0;
107 if ($hasDocuments) {
108 $this->tos->saveStatus((bool) $this->getInput('tos_status'));
109 return true;
110 }
111
112 if (!$this->tos->getStatus()) {
113 $this->translatedError = $this->lng->txt('tos_no_documents_exist_cant_save');
114 $this->getItemByPostVar('tos_status')->setChecked(false);
115 return false;
116 }
117
118 $this->tos->saveStatus((bool) $this->getInput('tos_status'));
119 return true;
120 }
static where($where, $operator=null)
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
setValuesByPost()
Set form values from POST values.
getItemByPostVar($a_post_var)
Get Item by POST variable.

References fillObject(), ilPropertyFormGUI\getInput(), ilPropertyFormGUI\getItemByPostVar(), ilPropertyFormGUI\setValuesByPost(), and ActiveRecord\where().

+ Here is the call graph for this function:

◆ setCheckInputCalled()

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

Definition at line 70 of file class.ilTermsOfServiceSettingsFormGUI.php.

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

Field Documentation

◆ $formAction

ilTermsOfServiceSettingsFormGUI::$formAction = ''
protected

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

Referenced by __construct().

◆ $isEditable

ilTermsOfServiceSettingsFormGUI::$isEditable = false
protected

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

Referenced by __construct().

◆ $saveCommand

ilTermsOfServiceSettingsFormGUI::$saveCommand = ''
protected

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

Referenced by __construct().

◆ $tos

ilTermsOfServiceSettingsFormGUI::$tos
protected

Definition at line 10 of file class.ilTermsOfServiceSettingsFormGUI.php.

Referenced by __construct().

◆ $translatedError

ilTermsOfServiceSettingsFormGUI::$translatedError = ''
protected

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

Referenced by getTranslatedError().


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