예제 #1
0
 /**
  * @return bool
  */
 public function HasVisibleSubFolders()
 {
     $sList = array();
     if ($this->oSubFolders) {
         $sList = $this->oSubFolders->FilterList(function (\MailSo\Mail\Folder $oFolder) {
             return $oFolder->IsSubscribed();
         });
     }
     return 0 < \count($sList);
 }
예제 #2
0
 /**
  * @param \RainLoop\Model\Account $oAccount
  * @param \MailSo\Mail\FolderCollection $oFolders
  * @param array $aResult
  * @param bool $bListFolderTypes = true
  */
 private function recFoldersTypes($oAccount, $oFolders, &$aResult, $bListFolderTypes = true)
 {
     if ($oFolders) {
         $aFolders =& $oFolders->GetAsArray();
         if (\is_array($aFolders) && 0 < \count($aFolders)) {
             if ($bListFolderTypes) {
                 foreach ($aFolders as $oFolder) {
                     $iFolderListType = $oFolder->GetFolderListType();
                     if (!isset($aResult[$iFolderListType]) && \in_array($iFolderListType, array(\MailSo\Imap\Enumerations\FolderType::SENT, \MailSo\Imap\Enumerations\FolderType::DRAFTS, \MailSo\Imap\Enumerations\FolderType::JUNK, \MailSo\Imap\Enumerations\FolderType::TRASH, \MailSo\Imap\Enumerations\FolderType::ALL))) {
                         $aResult[$iFolderListType] = $oFolder->FullNameRaw();
                     }
                 }
                 foreach ($aFolders as $oFolder) {
                     $oSub = $oFolder->SubFolders();
                     if ($oSub && 0 < $oSub->Count()) {
                         $this->recFoldersTypes($oAccount, $oSub, $aResult, true);
                     }
                 }
             }
             $aMap = $this->systemFoldersNames($oAccount);
             foreach ($aFolders as $oFolder) {
                 $sName = $oFolder->Name();
                 $sFullName = $oFolder->FullName();
                 if (isset($aMap[$sName]) || isset($aMap[$sFullName])) {
                     $iFolderType = isset($aMap[$sName]) ? $aMap[$sName] : $aMap[$sFullName];
                     if (!isset($aResult[$iFolderType]) && \in_array($iFolderType, array(\MailSo\Imap\Enumerations\FolderType::SENT, \MailSo\Imap\Enumerations\FolderType::DRAFTS, \MailSo\Imap\Enumerations\FolderType::JUNK, \MailSo\Imap\Enumerations\FolderType::TRASH, \MailSo\Imap\Enumerations\FolderType::ALL))) {
                         $aResult[$iFolderType] = $oFolder->FullNameRaw();
                     }
                 }
             }
             foreach ($aFolders as $oFolder) {
                 $oSub = $oFolder->SubFolders();
                 if ($oSub && 0 < $oSub->Count()) {
                     $this->recFoldersTypes($oAccount, $oSub, $aResult, false);
                 }
             }
         }
     }
 }