19declare(strict_types=1);
34 self::NAME_AUTH_PROP_1 =>
'',
35 self::NAME_AUTH_PROP_2 =>
''
38 protected \ILIAS\HTTP\Services
$http;
62 $response->{self::NAME_AUTH_PROP_2} = $this->uuidV4();
65 $this->
http->saveResponse(
66 $this->
http->response()
67 ->withBody($responseStream)
68 ->withHeader(ResponseHeader::CONTENT_TYPE,
'application/json')
70 $this->
http->sendResponse();
77 '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
79 random_int(0, 0xffff),
80 random_int(0, 0xffff),
82 random_int(0, 0xffff),
85 random_int(0, 0x0fff) | 0x4000,
89 random_int(0, 0x3fff) | 0x8000,
91 random_int(0, 0xffff),
92 random_int(0, 0xffff),
102 $this->ctrl_path = $ctrl_path;
108 self::NAME_AUTH_PROP_1 => $a_values[$this->getPostVar()][self::NAME_AUTH_PROP_1] ??
'',
109 self::NAME_AUTH_PROP_2 => $a_values[$this->getPostVar()][self::NAME_AUTH_PROP_2]??
''
112 foreach ($this->getSubItems() as $item) {
113 $item->setValueByArray($a_values);
119 $post = $this->
http->request()->getParsedBody()[$this->getPostVar()] ?? [];
121 if ($this->getRequired() && 2 > count(array_filter(array_map(
'trim',
$post)))) {
122 $this->setAlert($this->
lng->txt(
'msg_input_is_required'));
126 return $this->checkSubItemsInput();
134 $input = self::DEFAULT_SHAPE;
136 $as_sanizited_string = $this->
refinery->custom()->transformation(
function (
string $value):
string {
137 return $this->stripSlashesAddSpaceFallback($value);
140 $null_to_empty_string = $this->
refinery->custom()->transformation(
static function ($value):
string {
141 if ($value ===
null) {
145 throw new ilException(
'Expected null in transformation');
148 $sanizite_as_string = $this->
refinery->in()->series([
150 $this->refinery->kindlyTo()->string(),
151 $null_to_empty_string
156 if ($this->
http->wrapper()->post()->has($this->getPostVar())) {
157 $input = $this->
http->wrapper()->post()->retrieve(
159 $this->
refinery->kindlyTo()->recordOf([
160 self::NAME_AUTH_PROP_1 => $sanizite_as_string,
161 self::NAME_AUTH_PROP_2 => $sanizite_as_string
172 $a_tpl->
setVariable(
'PROP_GENERIC', $this->render());
180 $tpl =
new ilTemplate(
'tpl.chatroom_auth_input.html',
true,
true,
'Modules/Chatroom');
182 for (
$i = 1, $iMax = count($this->values);
$i <= $iMax;
$i++) {
183 $const =
'NAME_AUTH_PROP_' .
$i;
184 $const_val = constant(
'self::' . $const);
186 $tpl->setVariable(
'TXT_AUTH_PROP_' .
$i,
$DIC->language()->txt(
'chatroom_auth_' . $const_val));
187 $tpl->setVariable(
'ID_AUTH_PROP_' .
$i, $const_val);
188 $tpl->setVariable(
'NAME_AUTH_PROP_' .
$i, $const_val);
189 $tpl->setVariable(
'VALUE_AUTH_PROP_' .
$i, $this->values[$const_val]);
192 if (!$this->isReadOnly && !$this->getDisabled()) {
193 for (
$i = 1, $iMax = count($this->values);
$i <= $iMax;
$i++) {
194 $const =
'NAME_AUTH_PROP_' .
$i;
195 $const_val = constant(
'self::' . $const);
197 $tpl->setVariable(
'ID_AUTH_PROP_' .
$i .
'_BTN', $const_val);
200 $DIC->ctrl()->setParameterByClass(
'ilformpropertydispatchgui',
'postvar', $this->getPostVar());
203 $DIC->ctrl()->getLinkTargetByClass($this->ctrl_path,
'getRandomValues',
'',
true)
205 $tpl->setVariable(
'ID_BTN', $this->getFieldId() .
'_btn');
206 $tpl->setVariable(
'TXT_BTN',
$DIC->language()->txt(
'chatroom_auth_btn_txt'));
209 $tpl->setVariable(
'POST_VAR', $this->getPostVar());
210 $tpl->setVariable(
'SIZE', $this->getSize());
212 if ($this->getDisabled()) {
213 $tpl->setVariable(
'DISABLED',
' disabled="disabled"');
setVariable($variable, $value='')
Sets a variable value.
static ofString(string $string)
Creates a new stream with an initial value.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
special template class to simplify handling of ITX/PEAR
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
Class ChatMainBarProvider \MainMenu\Provider.