22 public const CACHE_ID =
'socialnetwork-toolbar-composition-';
42 catch (Exception $exception)
44 $result->addError(Error::createFromThrowable($exception));
57 if (is_null($composition))
64 ->setSettings($collection->toArray())
68 catch (Exception $exception)
70 $result->addError(Error::createFromThrowable($exception));
75 $this->cache->store(
$result->getData()[
'SETTINGS']);
81 public function getDefaultSettings(
bool $withHidden =
true):
array
84 foreach ($this->collection as $item)
87 if ($item->isHidden() && !$withHidden)
92 $items[] = $item->getModuleId();
100 if (
$data = $this->cache->get())
103 !$withHidden && $collection->hideItems();
105 return $collection->toArray();
112 $cacheCollection = clone $collection;
114 !$withHidden && $collection->hideItems();
123 return $collection->toArray();
127 return $this->getDefaultSettings();
133 $deselectedSettings = array_diff($this->getDefaultSettings($withHidden), $this->
getSettings());
137 : $deselectedSettings;
144 (
new Crm())->getModuleId(),
148 private function init(): void
150 $this->cache =
new Cache($this->userId, $this->spaceId);
153 ->addItem(
new Task())
160 private function getCacheId(): string
162 return static::CACHE_ID . $this->userId .
'-' . $this->spaceId;
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
static getByIds(int $userId, int $spaceId=0)
static fill(int $userId, int $spaceId, array $settings)
static isDataFilled(int $userId, int $spaceId)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)