Ejemplo n.º 1
0
 public function GetCalendarId($siteId, $account, $arPath)
 {
     if (is_null($arPath)) {
         return null;
     }
     if (is_null($account)) {
         if (count($arPath) == 0) {
             return null;
         }
         return array($arPath[0], isset($arPath[1]) ? $arPath[1] : 0, 0, "", 0);
     }
     $arAccount = CDavAccount::GetAccountById($account);
     if ($arAccount["TYPE"] == "user") {
         $iblockId = CEventCalendar::GetUserCalendarIBlockId($siteId);
         if ($iblockId <= 0) {
             return null;
         }
         $accountRootSectionId = CEventCalendar::GetAccountRootSectionId($arAccount["ID"], $arAccount["TYPE"], $iblockId);
         if (!$accountRootSectionId) {
             return null;
         }
         return array($iblockId, $accountRootSectionId, isset($arPath[0]) ? $arPath[0] : 0, "user", $arAccount["ID"]);
     }
     $iblockId = CEventCalendar::GetGroupCalendarIBlockId($arAccount["SITE_ID"]);
     if ($iblockId <= 0) {
         return null;
     }
     $accountRootSectionId = CEventCalendar::GetAccountRootSectionId($arAccount["ID"], $arAccount["TYPE"], $iblockId);
     if (!$accountRootSectionId) {
         return null;
     }
     return array($iblockId, $accountRootSectionId, isset($arPath[0]) ? $arPath[0] : 0, "group", $arAccount["ID"]);
 }