Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/ui/lib/entityselector/ |
Upload File : |
<? namespace Bitrix\UI\EntitySelector; class SearchQuery implements \JsonSerializable { protected $queryWords = []; protected $query = ''; protected $cacheable = true; protected $dynamicSearchEntities = []; protected $rawQuery = ''; public function __construct(array $options) { if (isset($options['queryWords']) && is_array($options['queryWords'])) { $this->setQueryWords($options['queryWords']); } if (isset($options['cacheable']) && is_bool($options['cacheable'])) { $this->setCacheable($options['cacheable']); } if (isset($options['dynamicSearchEntities']) && is_array($options['dynamicSearchEntities'])) { $this->setDynamicSearchEntities($options['dynamicSearchEntities']); } if (isset($options['query']) && is_string($options['query'])) { $this->setRawQuery($options['query']); } } public function getQueryWords(): array { return $this->queryWords; } public function getQuery(): string { return $this->query; } protected function setQueryWords(array $queryWords) { foreach ($queryWords as $queryWord) { if (is_string($queryWord) && mb_strlen(trim($queryWord)) > 0) { $this->queryWords[] = trim($queryWord); $this->query = join(' ', $this->queryWords); } } } public function isCacheable(): bool { return $this->cacheable; } public function setDynamicSearchEntities(array $entities): void { $this->dynamicSearchEntities = $entities; } public function hasDynamicSearchEntity(string $entityId): bool { return in_array($entityId, $this->dynamicSearchEntities); } public function setCacheable(bool $flag = true) { if (is_bool($flag)) { $this->cacheable = $flag; } return $this; } public function jsonSerialize() { return [ 'queryWords' => $this->getQueryWords(), 'cacheable' => $this->isCacheable() ]; } public function getRawQuery(): string { return $this->rawQuery; } protected function setRawQuery(string $rawQuery): void { $this->rawQuery = $rawQuery; } }