3namespace Bitrix\Mail\Internals\Entity;
5use Bitrix\Mail\Helper\Mailbox;
6use Bitrix\Mail\Internals\MailboxDirectoryTable;
7use Bitrix\Mail\MailboxDirectory as MailboxDirectoryManager;
8use Bitrix\Main\Localization\Loc;
9use Bitrix\Main\Web\Json;
10use Bitrix\Main\Text\Emoji;
15 private $children = [];
114 return !empty($this->children);
124 $this->children[] =
$dir;
133 foreach ($this->children as $child)
137 if ($child->hasChildren())
139 $count += $child->getCountChildren();
150 foreach ($this->children as $child)
152 if ($child->isSync())
157 $count += $child->getCountSyncChildren();
165 if ($this->getLevel() === 1)
170 $path = explode($this->getDelimiter(), $this->
getPath());
172 return join(
' / ',
$path);
179 return parent::getPath();
181 return Emoji::encode(parent::getPath());
186 $name = $this->sysGetValue(
'NAME');
187 $level = $this->getLevel();
189 if (mb_strtolower(
$name) ==
'inbox' && $level === 1)
191 return Loc::getMessage(
'MAIL_CLIENT_INBOX_ALIAS');
199 if ($this->getSyncLock() > time() - Mailbox::getTimeout())
209 $this->setSyncLock(time());
221 $this->unsetSyncLock();
222 $this->setSyncLock(
null);
233 'ID' => $this->getId(),
234 'MAILBOX_ID' => $this->getMailboxId(),
238 'FLAGS' => $this->getFlags(),
239 'DELIMITER' => $this->getDelimiter(),
240 'DIR_MD5' => $this->getDirMd5(),
241 'LEVEL' => $this->getLevel(),
243 'CHILDREN' => Json::decode(Json::encode($this->
getChildren()))
getPath($emojiEncode=false)
static setSyncLock(int $id, int $time)