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

Class ilChatroomAuthInputGUI. More...

+ Inheritance diagram for ilChatroomAuthInputGUI:
+ Collaboration diagram for ilChatroomAuthInputGUI:

Public Member Functions

 getCtrlPath ()
 
 setCtrlPath ($ctrl_path)
 
 setValueByArray (array $a_values)
 
 checkInput ()
 {Check input, strip slashes etc.set alert, if input is not ok.
Returns
boolean Input ok, true/false
} More...
 
 insert (ilTemplate $a_tpl)
 {} More...
 
 render ()
 
 getSize ()
 
 setSize ($size)
 
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem ($a_item)
 Add Subitem. More...
 
 getSubItems ()
 Get Subitems. More...
 
 getSubInputItemsRecursive ()
 returns a flat array of possibly existing subitems recursively More...
 
 checkSubItemsInput ()
 Check SubItems. More...
 
 getSubForm ()
 Get sub form html. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 getType ()
 Get Type. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setPostVar ($a_postvar)
 Set Post Variable. More...
 
 getPostVar ()
 Get Post Variable. More...
 
 getFieldId ()
 Get Post Variable. More...
 
 setInfo ($a_info)
 Set Information Text. More...
 
 getInfo ()
 Get Information Text. More...
 
 setAlert ($a_alert)
 Set Alert Text. More...
 
 getAlert ()
 Get Alert Text. More...
 
 setRequired ($a_required)
 Set Required. More...
 
 getRequired ()
 Get Required. More...
 
 setDisabled ($a_disabled)
 Set Disabled. More...
 
 getDisabled ()
 Get Disabled. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm ($a_parentform)
 Set Parent Form. More...
 
 getParentForm ()
 Get Parent Form. More...
 
 setParent ($a_val)
 Set Parent GUI object. More...
 
 getParent ()
 Get Parent GUI object. More...
 
 getSubForm ()
 Get sub form html. More...
 
 hideSubForm ()
 Sub form hidden on init? More...
 
 setHiddenTitle ($a_val)
 Set hidden title (for screenreaders) More...
 
 getHiddenTitle ()
 Get hidden title. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
 serializeData ()
 serialize data More...
 
 unserializeData ($a_data)
 unserialize data More...
 
 writeToSession ()
 Write to session. More...
 
 clearFromSession ()
 Clear session value. More...
 
 readFromSession ()
 Read from session. More...
 
 getHiddenTag ($a_post_var, $a_value)
 Get hidden tag (used for disabled properties) More...
 
 setMulti ($a_multi, $a_sortable=false, $a_addremove=true)
 Set Multi. More...
 
 getMulti ()
 Get Multi. More...
 
 setMultiValues (array $a_values)
 Set multi values. More...
 
 getMultiValues ()
 Get multi values. More...
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 stripSlashesAddSpaceFallback ($a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. More...
 
 getTableFilterLabelFor ()
 Get label "for" attribute value for filter. More...
 
 getFormLabelFor ()
 Get label "for" attribute value for form. More...
 

Data Fields

const NAME_AUTH_PROP_1 = 'key'
 
const NAME_AUTH_PROP_2 = 'secret'
 

Protected Member Functions

 getRandomValues ()
 
- Protected Member Functions inherited from ilFormPropertyGUI
 setType ($a_type)
 Set Type. More...
 
 getMultiIconsHTML ()
 Get HTML for multiple value icons. More...
 

Protected Attributes

 $ctrl_path = array()
 
 $size = 10
 
 $values
 
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
 $sub_items = array()
 
- Protected Attributes inherited from ilFormPropertyGUI
 $ctrl
 
 $lng
 
 $type
 
 $title
 
 $postvar
 
 $info
 
 $alert
 
 $required = false
 
 $parentgui
 
 $parentform
 
 $hidden_title = ""
 
 $multi = false
 
 $multi_sortable = false
 
 $multi_addremove = true
 
 $multi_values
 

Private Member Functions

 uuidV4 ()
 Generates a pseudo random string following the RFC 4122. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. More...
 

Detailed Description

Member Function Documentation

◆ checkInput()

ilChatroomAuthInputGUI::checkInput ( )

{Check input, strip slashes etc.set alert, if input is not ok.

Returns
boolean Input ok, true/false
}

Reimplemented from ilFormPropertyGUI.

Definition at line 107 of file class.ilChatroomAuthInputGUI.php.

108 {
109 global $DIC;
110
111 $_POST[$this->getPostVar()][self::NAME_AUTH_PROP_1] = ilUtil::stripSlashes($_POST[$this->getPostVar()][self::NAME_AUTH_PROP_1]);
112 $_POST[$this->getPostVar()][self::NAME_AUTH_PROP_2] = ilUtil::stripSlashes($_POST[$this->getPostVar()][self::NAME_AUTH_PROP_2]);
113
114 $post = $_POST[$this->getPostVar()];
115
116 if ($this->getRequired() && 2 > count(array_filter(array_map('trim', $post)))) {
117 $this->setAlert($DIC->language()->txt('msg_input_is_required'));
118 return false;
119 }
120
121 return $this->checkSubItemsInput();
122 }
$_POST["username"]
getPostVar()
Get Post Variable.
setAlert($a_alert)
Set Alert Text.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$post
Definition: post.php:34
global $DIC
Definition: saml.php:7

References $_POST, $DIC, $post, and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ getCtrlPath()

ilChatroomAuthInputGUI::getCtrlPath ( )
Returns
array

Definition at line 76 of file class.ilChatroomAuthInputGUI.php.

◆ getRandomValues()

ilChatroomAuthInputGUI::getRandomValues ( )
protected

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

36 {
37 $response = new stdClass();
38
39 $response->{self::NAME_AUTH_PROP_1} = $this->uuidV4();
40 $response->{self::NAME_AUTH_PROP_2} = $this->uuidV4();
41
42 echo json_encode($response);
43 exit();
44 }
exit
Definition: backend.php:16
uuidV4()
Generates a pseudo random string following the RFC 4122.
$response

References $response.

◆ getSize()

ilChatroomAuthInputGUI::getSize ( )
Returns
int

Definition at line 169 of file class.ilChatroomAuthInputGUI.php.

References $size.

◆ insert()

ilChatroomAuthInputGUI::insert ( ilTemplate  $a_tpl)

{}

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

128 {
129 $a_tpl->setCurrentBlock('prop_generic');
130 $a_tpl->setVariable('PROP_GENERIC', $this->render());
131 $a_tpl->parseCurrentBlock();
132 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:613
parseCurrentBlock($part="DEFAULT")
Überladene Funktion, die auf den aktuelle Block vorher noch ein replace ausführt @access public.
setCurrentBlock($part="DEFAULT")
Überladene Funktion, die sich hier lokal noch den aktuellen Block merkt.

References ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), and HTML_Template_IT\setVariable().

+ Here is the call graph for this function:

◆ render()

ilChatroomAuthInputGUI::render ( )
Returns
string

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

138 {
139 global $DIC;
140
141 $tpl = new ilTemplate('tpl.chatroom_auth_input.html', true, true, 'Modules/Chatroom');
142
143 for ($i = 1; $i <= count($this->values); $i++) {
144 $const = 'NAME_AUTH_PROP_' . $i;
145 $const_val = constant('self::' . $const);
146
147 $tpl->setVariable('TXT_AUTH_PROP_' . $i, $DIC->language()->txt('chatroom_auth_' . $const_val));
148 $tpl->setVariable('ID_AUTH_PROP_' . $i, $const_val);
149 $tpl->setVariable('NAME_AUTH_PROP_' . $i, $const_val);
150 $tpl->setVariable('VALUE_AUTH_PROP_' . $i, $this->values[$const_val]);
151 }
152
153 $DIC->ctrl()->setParameterByClass('ilformpropertydispatchgui', 'postvar', $this->getPostVar());
154 $tpl->setVariable('URL', $DIC->ctrl()->getLinkTargetByClass($this->ctrl_path, 'getRandomValues', '', true, false));
155 $tpl->setVariable('ID_BTN', $this->getFieldId() . '_btn');
156 $tpl->setVariable('TXT_BTN', $DIC->language()->txt('chatroom_auth_btn_txt'));
157 $tpl->setVariable('POST_VAR', $this->getPostVar());
158 $tpl->setVariable('SIZE', $this->getSize());
159 if ($this->getDisabled()) {
160 $tpl->setVariable('DISABLED', ' disabled="disabled"');
161 }
162
163 return $tpl->get();
164 }
$tpl
Definition: ilias.php:10
getFieldId()
Get Post Variable.
special template class to simplify handling of ITX/PEAR
$i
Definition: disco.tpl.php:19

References $DIC, $i, and $tpl.

◆ setCtrlPath()

ilChatroomAuthInputGUI::setCtrlPath (   $ctrl_path)
Parameters
array$ctrl_path

Definition at line 84 of file class.ilChatroomAuthInputGUI.php.

85 {
86 $this->ctrl_path = $ctrl_path;
87 }

◆ setSize()

ilChatroomAuthInputGUI::setSize (   $size)
Parameters
int$size

Definition at line 177 of file class.ilChatroomAuthInputGUI.php.

178 {
179 $this->size = $size;
180 }
font size
Definition: langcheck.php:162

References $size, and size.

◆ setValueByArray()

ilChatroomAuthInputGUI::setValueByArray ( array  $a_values)
Parameters
array$a_values

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

93 {
94 $this->values = array(
95 self::NAME_AUTH_PROP_1 => $a_values[$this->getPostVar()][self::NAME_AUTH_PROP_1],
96 self::NAME_AUTH_PROP_2 => $a_values[$this->getPostVar()][self::NAME_AUTH_PROP_2]
97 );
98
99 foreach ($this->getSubItems() as $item) {
100 $item->setValueByArray($a_values);
101 }
102 }

◆ uuidV4()

ilChatroomAuthInputGUI::uuidV4 ( )
private

Generates a pseudo random string following the RFC 4122.

Returns
string

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

51 {
52 return sprintf(
53 '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
54 // 32 bits for "time_low"
55 mt_rand(0, 0xffff),
56 mt_rand(0, 0xffff),
57 // 16 bits for "time_mid"
58 mt_rand(0, 0xffff),
59 // 16 bits for "time_high_and_version",
60 // four most significant bits holds version number 4
61 mt_rand(0, 0x0fff) | 0x4000,
62 // 16 bits, 8 bits for "clk_seq_hi_res",
63 // 8 bits for "clk_seq_low",
64 // two most significant bits holds zero and one for variant DCE1.1
65 mt_rand(0, 0x3fff) | 0x8000,
66 // 48 bits for "node"
67 mt_rand(0, 0xffff),
68 mt_rand(0, 0xffff),
69 mt_rand(0, 0xffff)
70 );
71 }

Field Documentation

◆ $ctrl_path

ilChatroomAuthInputGUI::$ctrl_path = array()
protected

Definition at line 18 of file class.ilChatroomAuthInputGUI.php.

◆ $size

ilChatroomAuthInputGUI::$size = 10
protected

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

◆ $values

ilChatroomAuthInputGUI::$values
protected
Initial value:
= array(
self::NAME_AUTH_PROP_1 => '',
self::NAME_AUTH_PROP_2 => ''
)

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

◆ NAME_AUTH_PROP_1

const ilChatroomAuthInputGUI::NAME_AUTH_PROP_1 = 'key'

Definition at line 12 of file class.ilChatroomAuthInputGUI.php.

◆ NAME_AUTH_PROP_2

const ilChatroomAuthInputGUI::NAME_AUTH_PROP_2 = 'secret'

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


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