ILIAS  release_7 Revision v7.30-3-g800a261c036
ilChatroomAuthInputGUI Class Reference

Class ilChatroomAuthInputGUI. More...

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

Public Member Functions

 setIsReadOnly (bool $isReadOnly)
 
 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
 
 $isReadOnly = false
 
- 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 110 of file class.ilChatroomAuthInputGUI.php.

111 {
112 global $DIC;
113
114 $_POST[$this->getPostVar()][self::NAME_AUTH_PROP_1] = ilUtil::stripSlashes($_POST[$this->getPostVar()][self::NAME_AUTH_PROP_1]);
115 $_POST[$this->getPostVar()][self::NAME_AUTH_PROP_2] = ilUtil::stripSlashes($_POST[$this->getPostVar()][self::NAME_AUTH_PROP_2]);
116
117 $post = $_POST[$this->getPostVar()];
118
119 if ($this->getRequired() && 2 > count(array_filter(array_map('trim', $post)))) {
120 $this->setAlert($DIC->language()->txt('msg_input_is_required'));
121 return false;
122 }
123
124 return $this->checkSubItemsInput();
125 }
$_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
global $DIC
Definition: goto.php:24

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

+ Here is the call graph for this function:

◆ getRandomValues()

ilChatroomAuthInputGUI::getRandomValues ( )
protected

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

47 {
48 $response = new stdClass();
49
50 $response->{self::NAME_AUTH_PROP_1} = $this->uuidV4();
51 $response->{self::NAME_AUTH_PROP_2} = $this->uuidV4();
52
53 echo json_encode($response);
54 exit();
55 }
uuidV4()
Generates a pseudo random string following the RFC 4122.
exit
Definition: login.php:29
$response

References $response.

◆ getSize()

ilChatroomAuthInputGUI::getSize ( )
Returns
int

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

References $size.

◆ insert()

ilChatroomAuthInputGUI::insert ( ilTemplate  $a_tpl)

{}

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

131 {
132 $a_tpl->setCurrentBlock('prop_generic');
133 $a_tpl->setVariable('PROP_GENERIC', $this->render());
134 $a_tpl->parseCurrentBlock();
135 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:615
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 140 of file class.ilChatroomAuthInputGUI.php.

141 {
142 global $DIC;
143
144 $tpl = new ilTemplate('tpl.chatroom_auth_input.html', true, true, 'Modules/Chatroom');
145
146 for ($i = 1; $i <= count($this->values); $i++) {
147 $const = 'NAME_AUTH_PROP_' . $i;
148 $const_val = constant('self::' . $const);
149
150 $tpl->setVariable('TXT_AUTH_PROP_' . $i, $DIC->language()->txt('chatroom_auth_' . $const_val));
151 $tpl->setVariable('ID_AUTH_PROP_' . $i, $const_val);
152 $tpl->setVariable('NAME_AUTH_PROP_' . $i, $const_val);
153 $tpl->setVariable('VALUE_AUTH_PROP_' . $i, $this->values[$const_val]);
154 }
155
156 if (!$this->isReadOnly && !$this->getDisabled()) {
157 for ($i = 1; $i <= count($this->values); $i++) {
158 $const = 'NAME_AUTH_PROP_' . $i;
159 $const_val = constant('self::' . $const);
160
161 $tpl->setVariable('ID_AUTH_PROP_' . $i . '_BTN', $const_val);
162 }
163
164 $DIC->ctrl()->setParameterByClass('ilformpropertydispatchgui', 'postvar', $this->getPostVar());
165 $tpl->setVariable(
166 'URL',
167 $DIC->ctrl()->getLinkTargetByClass($this->ctrl_path, 'getRandomValues', '', true, false)
168 );
169 $tpl->setVariable('ID_BTN', $this->getFieldId() . '_btn');
170 $tpl->setVariable('TXT_BTN', $DIC->language()->txt('chatroom_auth_btn_txt'));
171 }
172
173 $tpl->setVariable('POST_VAR', $this->getPostVar());
174 $tpl->setVariable('SIZE', $this->getSize());
175
176 if ($this->getDisabled()) {
177 $tpl->setVariable('DISABLED', ' disabled="disabled"');
178 }
179
180 return $tpl->get();
181 }
getFieldId()
Get Post Variable.
special template class to simplify handling of ITX/PEAR
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
$i
Definition: metadata.php:24

References $DIC, $i, and $tpl.

◆ setCtrlPath()

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

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

88 {
89 $this->ctrl_path = $ctrl_path;
90 }

◆ setIsReadOnly()

ilChatroomAuthInputGUI::setIsReadOnly ( bool  $isReadOnly)
Parameters
bool$isReadOnly

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

38 : void
39 {
40 $this->isReadOnly = $isReadOnly;
41 }

References $isReadOnly.

◆ setSize()

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

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

195 {
196 $this->size = $size;
197 }

References $size.

◆ setValueByArray()

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

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

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

◆ uuidV4()

ilChatroomAuthInputGUI::uuidV4 ( )
private

Generates a pseudo random string following the RFC 4122.

Returns
string

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

62 {
63 return sprintf(
64 '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
65 // 32 bits for "time_low"
66 mt_rand(0, 0xffff),
67 mt_rand(0, 0xffff),
68 // 16 bits for "time_mid"
69 mt_rand(0, 0xffff),
70 // 16 bits for "time_high_and_version",
71 // four most significant bits holds version number 4
72 mt_rand(0, 0x0fff) | 0x4000,
73 // 16 bits, 8 bits for "clk_seq_hi_res",
74 // 8 bits for "clk_seq_low",
75 // two most significant bits holds zero and one for variant DCE1.1
76 mt_rand(0, 0x3fff) | 0x8000,
77 // 48 bits for "node"
78 mt_rand(0, 0xffff),
79 mt_rand(0, 0xffff),
80 mt_rand(0, 0xffff)
81 );
82 }

Field Documentation

◆ $ctrl_path

ilChatroomAuthInputGUI::$ctrl_path = array()
protected

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

◆ $isReadOnly

ilChatroomAuthInputGUI::$isReadOnly = false
protected

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

Referenced by setIsReadOnly().

◆ $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: