當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CCatalogDiscountSave::__GetTimeStampArray方法代碼示例

本文整理匯總了PHP中CCatalogDiscountSave::__GetTimeStampArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP CCatalogDiscountSave::__GetTimeStampArray方法的具體用法?PHP CCatalogDiscountSave::__GetTimeStampArray怎麽用?PHP CCatalogDiscountSave::__GetTimeStampArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CCatalogDiscountSave的用法示例。


在下文中一共展示了CCatalogDiscountSave::__GetTimeStampArray方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: GetDiscount


//.........這裏部分代碼省略.........
         $rsDiscSaves = CCatalogDiscountSave::GetList(array(), $arFilter);
         CTimeZone::Enable();
         while ($arDiscSave = $rsDiscSaves->Fetch()) {
             $arDiscSave['ACTION_SIZE'] = (int) $arDiscSave['ACTION_SIZE'];
             $arDiscSave['COUNT_SIZE'] = (int) $arDiscSave['COUNT_SIZE'];
             $arDiscSave['ACTIVE_FROM_UT'] = false;
             $arDiscSave['ACTIVE_TO_UT'] = false;
             $arDiscSave['COUNT_FROM_UT'] = false;
             $arDiscSave['COUNT_TO_UT'] = false;
             $arDiscSave['TYPE'] = (int) $arDiscSave['TYPE'];
             $arDiscSave['MODULE_ID'] = 'catalog';
             $strCountPeriod = self::COUNT_TIME_ALL;
             $strActionPeriod = self::ACTION_TIME_ALL;
             $arCountPeriodBack = array();
             $arActionPeriodBack = array();
             $arActionPeriod = array();
             $arStartDate = false;
             $arOldOrderSumm = false;
             $arOrderSumm = false;
             $boolPeriodInsert = true;
             $intCountTime = $intCurrentTime;
             $arOrderFilter = array('USER_ID' => $intUserID, 'LID' => $arDiscSave['SITE_ID'], 'PAYED' => 'Y', 'CANCELED' => 'N');
             $arOldOrderFilter = $arOrderFilter;
             if (!empty($arDiscSave['ACTIVE_FROM']) || !empty($arDiscSave['ACTIVE_TO'])) {
                 $strActionPeriod = self::ACTION_TIME_INTERVAL;
                 if (!empty($arDiscSave['ACTIVE_FROM'])) {
                     $arDiscSave['ACTIVE_FROM_UT'] = MakeTimeStamp($arDiscSave['ACTIVE_FROM']);
                 }
                 if (!empty($arDiscSave['ACTIVE_TO'])) {
                     $arDiscSave['ACTIVE_TO_UT'] = MakeTimeStamp($arDiscSave['ACTIVE_TO']);
                 }
             } elseif ($arDiscSave['ACTION_SIZE'] > 0 && in_array($arDiscSave['ACTION_TYPE'], array('D', 'M', 'Y'))) {
                 $strActionPeriod = self::ACTION_TIME_PERIOD;
                 $arActionPeriodBack = CCatalogDiscountSave::__GetTimeStampArray($arDiscSave['ACTION_SIZE'], $arDiscSave['ACTION_TYPE']);
                 $arActionPeriod = CCatalogDiscountSave::__GetTimeStampArray($arDiscSave['ACTION_SIZE'], $arDiscSave['ACTION_TYPE'], true);
             }
             if (!empty($arDiscSave['COUNT_FROM']) || !empty($arDiscSave['COUNT_TO'])) {
                 $strCountPeriod = self::COUNT_TIME_INTERVAL;
                 if (!empty($arDiscSave['COUNT_FROM'])) {
                     $arDiscSave['COUNT_FROM_UT'] = MakeTimeStamp($arDiscSave['COUNT_FROM']);
                 }
                 if (!empty($arDiscSave['COUNT_TO'])) {
                     $arDiscSave['COUNT_TO_UT'] = MakeTimeStamp($arDiscSave['COUNT_TO']);
                     if ($arDiscSave['COUNT_TO_UT'] > $intCountTime) {
                         $arDiscSave['COUNT_TO_UT'] = $intCountTime;
                         $arDiscSave['COUNT_TO'] = ConvertTimeStamp($intCountTime, 'FULL');
                     }
                 }
             } elseif ($arDiscSave['COUNT_SIZE'] > 0 && in_array($arDiscSave['COUNT_TYPE'], array('D', 'M', 'Y'))) {
                 $strCountPeriod = self::COUNT_TIME_PERIOD;
                 $arCountPeriodBack = CCatalogDiscountSave::__GetTimeStampArray($arDiscSave['COUNT_SIZE'], $arDiscSave['COUNT_TYPE']);
             }
             if ($strCountPeriod == self::COUNT_TIME_INTERVAL) {
                 if (false !== $arDiscSave['COUNT_FROM_UT']) {
                     if ($arDiscSave['COUNT_FROM_UT'] > $intCountTime) {
                         continue;
                     }
                     if (false !== $arDiscSave['COUNT_TO_UT'] && $arDiscSave['COUNT_TO_UT'] <= $arDiscSave['COUNT_FROM_UT']) {
                         continue;
                     }
                     if (false !== $arDiscSave['ACTIVE_TO_UT'] && $arDiscSave['COUNT_FROM_UT'] >= $arDiscSave['ACTIVE_TO_UT']) {
                         continue;
                     }
                 }
                 if (false !== $arDiscSave['COUNT_TO_UT']) {
                     if ($strActionPeriod == self::ACTION_TIME_PERIOD && $arDiscSave['COUNT_TO_UT'] < AddToTimeStamp($arActionPeriodBack, $intCountTime)) {
開發者ID:Satariall,項目名稱:izurit,代碼行數:67,代碼來源:discount_save.php

示例2: GetDiscount

 public function GetDiscount($arParams = array())
 {
     global $DB;
     global $USER;
     $arResult = array();
     if (!(isset($USER) && $USER instanceof CUser && 'CUser' == get_class($USER))) {
         return $arResult;
     }
     if (!$USER->IsAuthorized()) {
         return $arResult;
     }
     if (!self::IsEnabled()) {
         return $arResult;
     }
     foreach (GetModuleEvents("catalog", "OnGetDiscountSave", true) as $arEvent) {
         $mxResult = ExecuteModuleEventEx($arEvent, $arParams);
         if (true !== $mxResult) {
             return $mxResult;
         }
     }
     if (!is_array($arParams) || empty($arParams)) {
         return $arResult;
     }
     $intUserID = 0;
     $arUserGroups = array();
     $strSiteID = false;
     if (isset($arParams['USER_ID'])) {
         $intUserID = $arParams['USER_ID'];
     }
     if (isset($arParams['USER_GROUPS'])) {
         $arUserGroups = $arParams['USER_GROUPS'];
     }
     if (isset($arParams['SITE_ID'])) {
         $strSiteID = $arParams['SITE_ID'];
     }
     if (0 < self::GetDiscountUserID()) {
         $intUserID = self::GetDiscountUserID();
         $arUserGroups = $USER->GetUserGroup($intUserID);
     } else {
         $intUserID = intval($intUserID);
         if (0 >= $intUserID) {
             $intUserID = $USER->GetID();
             $arUserGroups = $USER->GetUserGroupArray();
         } else {
             if (empty($arUserGroups)) {
                 $arUserGroups = $USER->GetUserGroup($intUserID);
             }
         }
     }
     if (!is_array($arUserGroups) || empty($arUserGroups) || 0 >= $intUserID) {
         return $arResult;
     }
     $key = array_search(2, $arUserGroups);
     if (false !== $key) {
         unset($arUserGroups[$key]);
     }
     if (empty($arUserGroups)) {
         return $arResult;
     }
     if ($strSiteID === false) {
         $strSiteID = SITE_ID;
     }
     $arCurrentDiscountID = CCatalogDiscountSave::__GetDiscountIDByGroup($arUserGroups);
     if (!empty($arCurrentDiscountID)) {
         $intCurrentTime = getmicrotime();
         $arFilter = array("ID" => $arCurrentDiscountID, 'SITE_ID' => $strSiteID, "TYPE" => DISCOUNT_TYPE_SAVE, 'ACTIVE' => 'Y', "+<=ACTIVE_FROM" => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), $intCurrentTime), "+>=ACTIVE_TO" => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), $intCurrentTime));
         $rsDiscSaves = CCatalogDiscountSave::GetList(array(), $arFilter);
         while ($arDiscSave = $rsDiscSaves->Fetch()) {
             $arDiscSave['ACTION_SIZE'] = intval($arDiscSave['ACTION_SIZE']);
             $arDiscSave['COUNT_SIZE'] = intval($arDiscSave['COUNT_SIZE']);
             $arDiscSave['ACTIVE_FROM_UT'] = false;
             $arDiscSave['ACTIVE_TO_UT'] = false;
             $arDiscSave['COUNT_FROM_UT'] = false;
             $arDiscSave['COUNT_TO_UT'] = false;
             $strCountPeriod = 'U';
             $strActionPeriod = 'U';
             $arCountPeriodBack = array();
             $arActionPeriodBack = array();
             $arActionPeriod = array();
             $arStartDate = false;
             $arOldOrderSumm = false;
             $arOrderSumm = false;
             $boolPeriodInsert = true;
             $intCountTime = $intCurrentTime;
             $arOrderFilter = array("USER_ID" => $intUserID, "LID" => $arDiscSave['SITE_ID'], "PAYED" => "Y", "CANCELED" => "N");
             $arOldOrderFilter = $arOrderFilter;
             if (!empty($arDiscSave['ACTIVE_FROM']) || !empty($arDiscSave['ACTIVE_TO'])) {
                 $strActionPeriod = 'D';
                 if (!empty($arDiscSave['ACTIVE_FROM'])) {
                     $arDiscSave['ACTIVE_FROM_UT'] = MakeTimeStamp($arDiscSave['ACTIVE_FROM']);
                 }
                 if (!empty($arDiscSave['ACTIVE_TO'])) {
                     $arDiscSave['ACTIVE_TO_UT'] = MakeTimeStamp($arDiscSave['ACTIVE_TO']);
                 }
             } elseif (0 < $arDiscSave['ACTION_SIZE'] && in_array($arDiscSave['ACTION_TYPE'], array('D', 'M', 'Y'))) {
                 $strActionPeriod = 'P';
                 $arActionPeriodBack = CCatalogDiscountSave::__GetTimeStampArray($arDiscSave['ACTION_SIZE'], $arDiscSave['ACTION_TYPE']);
                 $arActionPeriod = CCatalogDiscountSave::__GetTimeStampArray($arDiscSave['ACTION_SIZE'], $arDiscSave['ACTION_TYPE'], true);
             }
             if (!empty($arDiscSave['COUNT_FROM']) || !empty($arDiscSave['COUNT_TO'])) {
//.........這裏部分代碼省略.........
開發者ID:k-kalashnikov,項目名稱:geekcon_new,代碼行數:101,代碼來源:discount_save.php


注:本文中的CCatalogDiscountSave::__GetTimeStampArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。