Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
columnfields.php
1<?php
2
4
6
11{
17 protected string $firstOrder = 'asc';
23 protected bool $showname = true;
29 protected ?string $align = null;
35 protected ?string $title = null;
41 protected ?int $width = null;
47 protected bool $resizeable = true;
53 protected bool $preventDefault = true;
59 protected bool $sticked = false;
65 protected bool $shift = false;
71 protected ?string $sectionId = null;
77 protected int $sortIndex = 0;
83 protected ?string $sortUrl = null;
89 protected ?string $sortState = null;
95 protected bool $shown;
101 protected ?Icon $icon = null;
107 protected ?Hint $hint = null;
113 protected Layout $layout;
114
115 // css
116 protected ?string $cssClassName = null;
117 protected ?string $cssColorValue = null;
118 protected ?string $cssColorClassName = null;
119
120 public function getFirstOrder(): string
121 {
122 return $this->firstOrder;
123 }
124
130 public function setFirstOrder(string $firstOrder): self
131 {
132 $this->firstOrder = $firstOrder === 'asc' ? 'asc' : 'desc';
133
134 return $this;
135 }
136
137 public function isShowname(): bool
138 {
139 return $this->showname;
140 }
141
142 public function setShowname(bool $showname): self
143 {
144 $this->showname = $showname;
145
146 return $this;
147 }
148
149 public function getCssClassName(): ?string
150 {
151 return $this->cssClassName;
152 }
153
154 public function setCssClassName(?string $cssClassName): self
155 {
156 $this->cssClassName = $cssClassName;
157
158 return $this;
159 }
160
161 public function getAlign(): string
162 {
163 return $this->align ?? 'left';
164 }
165
166 public function setAlign(?string $align): self
167 {
168 $this->align = $align;
169
170 return $this;
171 }
172
173 public function getTitle(): ?string
174 {
175 return $this->title;
176 }
177
178 public function setTitle(?string $title): self
179 {
180 $this->title = $title;
181
182 return $this;
183 }
184
185 public function getWidth(): ?int
186 {
187 return $this->width;
188 }
189
197 public function setWidth(?int $width): self
198 {
199 $this->width = $width;
200
201 return $this;
202 }
203
204 public function getCssColorClassName(): ?string
205 {
207 }
208
220 public function setCssColorClassName(string $color): self
221 {
222 $this->cssColorClassName = $color;
223
224 return $this;
225 }
226
227 public static function isValidCssColorValue(string $value): bool
228 {
229 return
230 strpos($value, '#') === 0
231 || strpos($value, 'rgb') === 0
232 || strpos($value, 'hsl') === 0
233 ;
234 }
235
243 public function setCssColorValue(string $value): self
244 {
245 if (!self::isValidCssColorValue($value))
246 {
247 throw new ArgumentException('Invalid css color value');
248 }
249
250 $this->cssColorValue = $value;
251
252 return $this;
253 }
254
255 public function getCssColorValue(): ?string
256 {
258 }
259
260 public function isResizeable(): bool
261 {
262 return $this->resizeable !== false;
263 }
264
265 public function setResizeable(bool $resizeable): self
266 {
267 $this->resizeable = $resizeable;
268
269 return $this;
270 }
271
272 public function isPreventDefault(): bool
273 {
274 return $this->preventDefault ?? true;
275 }
276
277 public function setPreventDefault(bool $preventDefault): self
278 {
279 $this->preventDefault = $preventDefault;
280
281 return $this;
282 }
283
284 public function isShift(): bool
285 {
286 return $this->shift;
287 }
288
289 public function setShift(bool $shift): self
290 {
291 $this->shift = $shift;
292
293 return $this;
294 }
295
296 public function isSticked(): bool
297 {
298 return $this->sticked;
299 }
300
301 public function setSticked(bool $sticked): self
302 {
303 $this->sticked = $sticked;
304
305 return $this;
306 }
307
308 public function setSection(?string $value): self
309 {
310 $this->sectionId = $value;
311
312 return $this;
313 }
314
315 public function getSection(): ?string
316 {
317 return $this->sectionId;
318 }
319
320 public function setSortIndex(int $value): self
321 {
322 $this->sortIndex = $value;
323
324 return $this;
325 }
326
327 public function getSortIndex(): int
328 {
329 return $this->sortIndex;
330 }
331
337 public function setSortState(string $value): self
338 {
339 $this->sortState = $value === 'asc' ? 'asc' : 'desc';
340
341 return $this;
342 }
343
344 public function getSortState(): ?string
345 {
346 return $this->sortState;
347 }
348
349 public function setSortUrl(string $value): self
350 {
351 $this->sortUrl = $value;
352
353 return $this;
354 }
355
356 public function getSortUrl(): ?string
357 {
358 return $this->sortUrl;
359 }
360
361 public function getSortOrder(): string
362 {
363 return $this->getSortState() === 'desc' ? 'desc' : 'asc';
364 }
365
366 public function getNextSortOrder(): string
367 {
368 $sortState = $this->getSortState();
369 if (isset($sortState))
370 {
371 return $sortState === 'asc' ? 'desc' : 'asc';
372 }
373
374 return $this->getFirstOrder();
375 }
376
377 public function setShown(bool $value): self
378 {
379 $this->shown = $value;
380
381 return $this;
382 }
383
384 abstract public function isDefault(): bool;
385
386 public function isShown(): bool
387 {
388 return $this->shown ?? $this->isDefault();
389 }
390
391 public function getLayout(): Layout
392 {
393 $this->layout ??= new Layout($this);
394
395 return $this->layout;
396 }
397
398 public function setIcon(?Icon $value): self
399 {
400 $this->icon = $value;
401
402 return $this;
403 }
404
405 public function getIcon(): ?Icon
406 {
407 return $this->icon;
408 }
409
410 public function setHint(?Hint $value): self
411 {
412 $this->hint = $value;
413
414 return $this;
415 }
416
417 public function getHint(): ?Hint
418 {
419 return $this->hint;
420 }
421}
setResizeable(bool $resizeable)
setCssClassName(?string $cssClassName)
setPreventDefault(bool $preventDefault)
setCssColorClassName(string $color)
setFirstOrder(string $firstOrder)
setCssColorValue(string $value)