• Модуль: mail
  • Путь к файлу: ~/bitrix/modules/mail/lib/helper/mailboxdirectoryhelper.php
  • Класс: BitrixMailHelperMailboxDirectoryHelper
  • Вызов: MailboxDirectoryHelper::orderByName
private function orderByName($dirs)
{
	usort($dirs, function ($a, $b)
	{
		$aSort = $a->getName();
		$bSort = $b->getName();

		if (
			$a->isSpam() ||
			$a->isTrash() ||
			$a->isDraft() ||
			$a->isOutcome()
		)
		{
			$aSort = 1000;
		}

		if (
			$b->isSpam() ||
			$b->isTrash() ||
			$b->isDraft() ||
			$b->isOutcome()
		)
		{
			$bSort = 1000;
		}

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

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

	return $dirs;
}