• Модуль: mail
  • Путь к файлу: ~/bitrix/modules/mail/lib/helper/mailboxdirectoryhelper.php
  • Класс: BitrixMailHelperMailboxDirectoryHelper
  • Вызов: MailboxDirectoryHelper::orderByTime
private function orderByTime($dirs)
{
	usort($dirs, function ($a, $b)
	{
		$aSort = $a->getSyncTime() ?: ($a->isIncome() ? 100 : ($a->isOutcome() ? 200 : ($a->isTrash() ? 300 : ($a->isSpam() ? 400 : $a->getLevel() * 1000))));
		$bSort = $b->getSyncTime() ?: ($b->isIncome() ? 100 : ($b->isOutcome() ? 200 : ($b->isTrash() ? 300 : ($b->isSpam() ? 400 : $b->getLevel() * 1000))));

		if ($aSort === $bSort)
		{
			return 0;
		}

		return $aSort > $bSort ? 1 : -1;
	});

	return $dirs;
}