1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
tab.php
См. документацию.
1<?php
2
3namespace Bitrix\UI\EntitySelector;
4
5class Tab implements \JsonSerializable
6{
7 protected $id;
8
10 protected $title = '';
11 protected $visible = true;
12 protected $itemOrder = [];
13 protected $itemMaxDepth;
14 protected $icon = [];
15 protected $textColor = [];
16 protected $bgColor = [];
17 protected $stub;
18 protected $stubOptions;
19
21 protected $header;
22
24 protected $headerOptions;
25
27 protected $showDefaultHeader = true;
28
30 protected $footer;
31
33 protected $footerOptions;
34
36 protected $showDefaultFooter = true;
37
39 protected $showAvatars;
40
62 public function __construct(array $options)
63 {
64 $id = $options['id'] ?? null;
65 if (is_string($id) && $id !== '')
66 {
67 $this->id = $id;
68 }
69
70 $title = $options['title'] ?? null;
71 if (is_string($title) || is_array($title))
72 {
73 $this->setTitle($options['title']);
74 }
75
76 if (isset($options['icon']))
77 {
78 if (is_string($options['icon']))
79 {
80 $this->setIcon(['default' => $options['icon']]);
81 }
82 elseif (is_array($options['icon']))
83 {
84 $this->setIcon($options['icon']);
85 }
86 }
87
88 if (isset($options['textColor']))
89 {
90 if (is_string($options['textColor']))
91 {
92 $this->setTextColor(['default' => $options['textColor']]);
93 }
94 elseif (is_array($options['textColor']))
95 {
96 $this->setTextColor($options['textColor']);
97 }
98 }
99
100 if (isset($options['bgColor']))
101 {
102 if (is_string($options['bgColor']))
103 {
104 $this->setBgColor(['default' => $options['bgColor']]);
105 }
106 elseif (is_array($options['bgColor']))
107 {
108 $this->setBgColor($options['bgColor']);
109 }
110 }
111
112 if (isset($options['visible']) && is_bool($options['visible']))
113 {
114 $this->setVisible($options['visible']);
115 }
116
117 if (!empty($options['itemOrder']) && is_array($options['itemOrder']))
118 {
119 $this->setItemOrder($options['itemOrder']);
120 }
121
122 if (isset($options['itemMaxDepth']) && is_int($options['itemMaxDepth']))
123 {
124 $this->setItemMaxDepth($options['itemMaxDepth']);
125 }
126
127 if (isset($options['stub']) && (is_bool($options['stub']) || is_string($options['stub'])))
128 {
129 $this->setStub($options['stub']);
130 }
131
132 if (!empty($options['stubOptions']) && is_array($options['stubOptions']))
133 {
134 $this->setStubOptions($options['stubOptions']);
135 }
136
137 if (isset($options['header']) && is_string($options['header']))
138 {
140 isset($options['headerOptions']) && is_array($options['headerOptions'])
141 ? $options['headerOptions']
142 : []
143 ;
144
145 $this->setHeader($options['header'], $headerOptions);
146 }
147
148 if (isset($options['showDefaultHeader']) && is_bool($options['showDefaultHeader']))
149 {
150 $this->showDefaultHeader = $options['showDefaultHeader'];
151 }
152
153 if (isset($options['footer']) && is_string($options['footer']))
154 {
156 isset($options['footerOptions']) && is_array($options['footerOptions'])
157 ? $options['footerOptions']
158 : []
159 ;
160
161 $this->setFooter($options['footer'], $footerOptions);
162 }
163
164 if (isset($options['showDefaultFooter']) && is_bool($options['showDefaultFooter']))
165 {
166 $this->showDefaultFooter = $options['showDefaultFooter'];
167 }
168
169 if (isset($options['showAvatars']) && is_bool($options['showAvatars']))
170 {
171 $this->setShowAvatars($options['showAvatars']);
172 }
173 }
174
175 public function getId(): ?string
176 {
177 return $this->id;
178 }
179
180 public function getTitle(): string
181 {
182 return $this->getTitleNode() && !$this->getTitleNode()->isNullable() ? $this->getTitleNode()->getText() : '';
183 }
184
185 public function getTitleNode(): ?TextNode
186 {
187 return $this->title;
188 }
189
190 public function setTitle($title): self
191 {
192 if (TextNode::isValidText($title) || $title === null)
193 {
194 $this->title = $title === null ? null : new TextNode($title);
195 }
196
197 return $this;
198 }
199
200 public function getIcon(): array
201 {
202 return $this->icon;
203 }
204
205 public function setIcon(array $icon): self
206 {
207 $this->icon = $icon;
208
209 return $this;
210 }
211
212 public function getTextColor(): array
213 {
214 return $this->textColor;
215 }
216
217 public function setTextColor(array $textColor): self
218 {
219 $this->textColor = $textColor;
220
221 return $this;
222 }
223
224 public function getBgColor(): array
225 {
226 return $this->bgColor;
227 }
228
229 public function setBgColor(array $bgColor): self
230 {
231 $this->bgColor = $bgColor;
232
233 return $this;
234 }
235
236 public function setVisible(bool $flag): self
237 {
238 $this->visible = $flag;
239
240 return $this;
241 }
242
243 public function isVisible(): bool
244 {
245 return $this->visible;
246 }
247
248 public function setItemOrder(array $order): self
249 {
250 $this->itemOrder = $order;
251
252 return $this;
253 }
254
255 public function getItemOrder(): array
256 {
257 return $this->itemOrder;
258 }
259
260 public function setItemMaxDepth(int $depth): self
261 {
262 $this->itemMaxDepth = $depth;
263
264 return $this;
265 }
266
267 public function getItemMaxDepth(): ?int
268 {
269 return $this->itemMaxDepth;
270 }
271
272 public function setStub($stub): self
273 {
274 if (is_bool($stub) || is_string($stub))
275 {
276 $this->stub = $stub;
277 }
278
279 return $this;
280 }
281
282 public function getStub()
283 {
284 return $this->stub;
285 }
286
287 public function setStubOptions(array $options): self
288 {
289 $this->stubOptions = $options;
290
291 return $this;
292 }
293
294 public function getStubOptions(): ?array
295 {
296 return $this->stubOptions;
297 }
298
299 public function setHeader(string $header, array $options = []): self
300 {
301 if (strlen($header) > 0)
302 {
303 $this->header = $header;
304 $this->headerOptions = $options;
305 }
306
307 return $this;
308 }
309
310 public function getHeader(): ?string
311 {
312 return $this->header;
313 }
314
315 public function getHeaderOptions(): ?array
316 {
318 }
319
320 public function canShowDefaultHeader(): bool
321 {
323 }
324
325 public function enableDefaultHeader(): self
326 {
327 $this->showDefaultHeader = true;
328
329 return $this;
330 }
331
332 public function disableDefaultHeader(): self
333 {
334 $this->showDefaultHeader = false;
335
336 return $this;
337 }
338
339 public function setFooter(string $footer, array $options = []): self
340 {
341 if (strlen($footer) > 0)
342 {
343 $this->footer = $footer;
344 $this->footerOptions = $options;
345 }
346
347 return $this;
348 }
349
350 public function getFooter(): ?string
351 {
352 return $this->footer;
353 }
354
355 public function getFooterOptions(): ?array
356 {
358 }
359
360 public function canShowDefaultFooter(): bool
361 {
363 }
364
365 public function enableDefaultFooter(): self
366 {
367 $this->showDefaultFooter = true;
368
369 return $this;
370 }
371
372 public function disableDefaultFooter(): self
373 {
374 $this->showDefaultFooter = false;
375
376 return $this;
377 }
378
379 public function setShowAvatars(bool $flag): self
380 {
381 $this->showAvatars = $flag;
382
383 return $this;
384 }
385
386 public function getShowAvatars(): ?bool
387 {
388 return $this->showAvatars;
389 }
390
391 public function jsonSerialize()
392 {
393 $json = [
394 'id' => $this->getId(),
395 'title' => $this->getTitleNode() !== null ? $this->getTitleNode()->jsonSerialize() : '',
396 'visible' => $this->isVisible(),
397 'itemOrder' => $this->getItemOrder(),
398 'itemMaxDepth' => $this->getItemMaxDepth(),
399 'icon' => $this->getIcon(),
400 'textColor' => $this->getTextColor(),
401 'bgColor' => $this->getBgColor(),
402 ];
403
404 if ($this->getStub() !== null)
405 {
406 $json['stub'] = $this->getStub();
407 }
408
409 if ($this->getStubOptions() !== null)
410 {
411 $json['stubOptions'] = $this->getStubOptions();
412 }
413
414 if ($this->getHeader())
415 {
416 $json['header'] = $this->getHeader();
417 $json['headerOptions'] = $this->getHeaderOptions();
418 }
419
420 if (!$this->canShowDefaultHeader())
421 {
422 $json['showDefaultHeader'] = false;
423 }
424
425 if ($this->getFooter())
426 {
427 $json['footer'] = $this->getFooter();
428 $json['footerOptions'] = $this->getFooterOptions();
429 }
430
431 if (!$this->canShowDefaultFooter())
432 {
433 $json['showDefaultFooter'] = false;
434 }
435
436 if ($this->getShowAvatars() !== null)
437 {
438 $json['showAvatars'] = $this->getShowAvatars();
439 }
440
441 return $json;
442 }
443}
$showDefaultFooter
Определения tab.php:36
$itemMaxDepth
Определения tab.php:13
$footerOptions
Определения tab.php:33
setStubOptions(array $options)
Определения tab.php:287
enableDefaultHeader()
Определения tab.php:325
getId()
Определения tab.php:175
__construct(array $options)
Определения tab.php:62
getHeaderOptions()
Определения tab.php:315
disableDefaultFooter()
Определения tab.php:372
getTextColor()
Определения tab.php:212
getStubOptions()
Определения tab.php:294
getIcon()
Определения tab.php:200
isVisible()
Определения tab.php:243
setBgColor(array $bgColor)
Определения tab.php:229
getItemOrder()
Определения tab.php:255
setShowAvatars(bool $flag)
Определения tab.php:379
setFooter(string $footer, array $options=[])
Определения tab.php:339
canShowDefaultFooter()
Определения tab.php:360
getItemMaxDepth()
Определения tab.php:267
getHeader()
Определения tab.php:310
setStub($stub)
Определения tab.php:272
$itemOrder
Определения tab.php:12
getBgColor()
Определения tab.php:224
$stubOptions
Определения tab.php:18
setTitle($title)
Определения tab.php:190
setItemOrder(array $order)
Определения tab.php:248
getShowAvatars()
Определения tab.php:386
getTitle()
Определения tab.php:180
setHeader(string $header, array $options=[])
Определения tab.php:299
$headerOptions
Определения tab.php:24
$showDefaultHeader
Определения tab.php:27
setItemMaxDepth(int $depth)
Определения tab.php:260
disableDefaultHeader()
Определения tab.php:332
setTextColor(array $textColor)
Определения tab.php:217
setIcon(array $icon)
Определения tab.php:205
$textColor
Определения tab.php:15
$showAvatars
Определения tab.php:39
jsonSerialize()
Определения tab.php:391
getFooterOptions()
Определения tab.php:355
enableDefaultFooter()
Определения tab.php:365
canShowDefaultHeader()
Определения tab.php:320
getStub()
Определения tab.php:282
setVisible(bool $flag)
Определения tab.php:236
getTitleNode()
Определения tab.php:185
getFooter()
Определения tab.php:350
static isValidText($text)
Определения textnode.php:29
$options
Определения commerceml2.php:49
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$order
Определения payment.php:8
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
<? endif;?> window document title
Определения prolog_main_admin.php:76