当前位置: 首页>>代码示例>>PHP>>正文


PHP DateTime::createFromTimestamp方法代码示例

本文整理汇总了PHP中Bitrix\Main\Type\DateTime::createFromTimestamp方法的典型用法代码示例。如果您正苦于以下问题:PHP DateTime::createFromTimestamp方法的具体用法?PHP DateTime::createFromTimestamp怎么用?PHP DateTime::createFromTimestamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Bitrix\Main\Type\DateTime的用法示例。


在下文中一共展示了DateTime::createFromTimestamp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: load

 /**
  * Load coupons for existing order.
  *
  * @return void
  */
 public static function load()
 {
     if (self::$useMode != self::MODE_ORDER) {
         return;
     }
     self::$checkActivity = false;
     $couponsList = array();
     $couponIterator = Internals\OrderCouponsTable::getList(array('select' => array('*', 'MODULE' => 'ORDER_DISCOUNT.MODULE_ID', 'DISCOUNT_ID' => 'ORDER_DISCOUNT.DISCOUNT_ID', 'DISCOUNT_NAME' => 'ORDER_DISCOUNT.NAME'), 'filter' => array('=ORDER_ID' => self::$orderId), 'order' => array('ID' => 'ASC')));
     while ($coupon = $couponIterator->fetch()) {
         $couponData = $coupon['DATA'];
         $couponData['COUPON'] = $coupon['COUPON'];
         $couponData['STATUS'] = self::STATUS_ENTERED;
         $couponData['CHECK_CODE'] = self::COUPON_CHECK_OK;
         $couponData['MODULE'] = $coupon['MODULE'];
         $couponData['ID'] = $coupon['COUPON_ID'];
         $couponData['DISCOUNT_ID'] = $coupon['DISCOUNT_ID'];
         $couponData['DISCOUNT_NAME'] = (string) $coupon['DISCOUNT_NAME'];
         $couponData['DISCOUNT_ACTIVE'] = 'Y';
         $couponData['TYPE'] = $coupon['TYPE'];
         $couponData['ACTIVE'] = 'Y';
         $couponData['SAVED'] = 'Y';
         foreach (self::$timeFields as $fieldName) {
             if (isset($couponData[$fieldName])) {
                 $couponData[$fieldName] = Main\Type\DateTime::createFromTimestamp($couponData[$fieldName]);
             }
         }
         unset($fieldName);
         if (empty($couponData['USER_INFO']) && $couponData['MODE'] == self::COUPON_MODE_FULL) {
             $couponData['USER_INFO'] = array('USER_ID' => 0, 'MAX_USE' => 0, 'USE_COUNT' => 0, 'ACTIVE_FROM' => null, 'ACTIVE_TO' => null);
         }
         if (!empty($couponData['USER_INFO'])) {
             foreach (self::$timeFields as $fieldName) {
                 if (isset($couponData['USER_INFO'][$fieldName])) {
                     $couponData['USER_INFO'][$fieldName] = Main\Type\DateTime::createFromTimestamp($couponData['USER_INFO'][$fieldName]);
                 }
             }
             unset($fieldName);
             foreach ($couponData['USER_INFO'] as $fieldName => $fieldValue) {
                 $couponData[$fieldName] = $fieldValue;
             }
         }
         $couponsList[$couponData['COUPON']] = $couponData;
     }
     unset($coupon, $couponIterator);
     if (!empty($couponsList)) {
         self::setCoupons($couponsList, false);
     }
     self::$checkActivity = true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:54,代码来源:discountcoupon.php

示例2: fixColdStart

 /**
  * Fixes cold start, when we don't have any data in RecentlyUsedTable.
  * @param mixed|int|User|\CAllUser $user User.
  * @return bool
  * @throws \Bitrix\Main\ArgumentException
  */
 private function fixColdStart($user)
 {
     $userId = User::resolveUserId($user);
     if (!$userId) {
         $this->errorCollection->addOne(new Error('Could not get user id.'));
         return false;
     }
     $storage = Driver::getInstance()->getStorageByUserId($userId);
     if (!$storage) {
         $this->errorCollection->addOne(new Error('Could not get storage by user id.'));
         return false;
     }
     $fromDate = DateTime::createFromTimestamp(time() - 14 * 24 * 3600);
     $objects = array();
     $query = FileTable::getList(array('select' => array('ID', 'UPDATE_TIME'), 'filter' => array('STORAGE_ID' => $storage->getId(), 'TYPE' => ObjectTable::TYPE_FILE, 'DELETED_TYPE' => ObjectTable::DELETED_TYPE_NONE, '>UPDATE_TIME' => $fromDate, array('LOGIC' => 'OR', array('CREATED_BY' => $userId), array('UPDATED_BY' => $userId))), 'order' => array('UPDATE_TIME' => 'DESC'), 'limit' => RecentlyUsedTable::MAX_COUNT_FOR_USER));
     while ($row = $query->fetch()) {
         $objects[] = array('USER_ID' => $userId, 'OBJECT_ID' => $row['ID'], 'CREATE_TIME' => $row['UPDATE_TIME']);
     }
     unset($row, $query, $fromDate);
     Collection::sortByColumn($objects, array('CREATE_TIME' => SORT_ASC));
     RecentlyUsedTable::insertBatch($objects);
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:29,代码来源:recentlyusedmanager.php

示例3: refreshTrackingStatusAction

 protected function refreshTrackingStatusAction()
 {
     $shipmentId = !empty($this->request["shipmentId"]) && intval($this->request["shipmentId"]) > 0 ? intval($this->request["shipmentId"]) : 0;
     $trackingNumber = !empty($this->request["trackingNumber"]) && strlen($this->request["trackingNumber"]) > 0 ? $this->request["trackingNumber"] : '';
     if ($shipmentId <= 0) {
         throw new ArgumentNullException('shipmentId');
     }
     $manager = Sale\Delivery\Tracking\Manager::getInstance();
     $result = $manager->getStatusByShipmentId($shipmentId, $trackingNumber);
     if ($result->isSuccess()) {
         $this->addResultData('TRACKING_STATUS', Sale\Delivery\Tracking\Manager::getStatusName($result->status));
         $this->addResultData('TRACKING_DESCRIPTION', $result->description);
         $this->addResultData('TRACKING_LAST_CHANGE', \Bitrix\Main\Type\DateTime::createFromTimestamp($result->lastChangeTimestamp)->toString());
         $res = $manager->updateShipment($shipmentId, $result);
         if (!$res->isSuccess()) {
             $this->addResultError(implode(", ", $res->getErrorMessages()));
         }
     } else {
         $this->addResultError(implode("\n", $result->getErrorMessages()));
     }
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:21,代码来源:order_ajax.php

示例4: InstallDB


//.........这里部分代码省略.........
				{
					case 'kz':
						$addCurrency = array(
							array('CURRENCY' => 'KZT', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1),
							array('CURRENCY' => 'RUB', 'AMOUNT' => 1, 'AMOUNT_CNT' => 4.72, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 4.72),
							array('CURRENCY' => 'USD', 'AMOUNT' => 1, 'AMOUNT_CNT' => 154.52, 'SORT' => 300, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 154.52),
							array('CURRENCY' => 'EUR', 'AMOUNT' => 1, 'AMOUNT_CNT' => 212.73, 'SORT' => 400, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 212.73)
						);
						break;
					case 'ua':
						$addCurrency = array(
							array('CURRENCY' => 'UAH', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1),
							array('CURRENCY' => 'RUB', 'AMOUNT' => 2.54, 'AMOUNT_CNT' => 10, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.254),
							array('CURRENCY' => 'USD', 'AMOUNT' => 799.3, 'AMOUNT_CNT' => 100, 'SORT' => 300, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 7.993),
							array('CURRENCY' => 'EUR', 'AMOUNT' => 1083.37, 'AMOUNT_CNT' => 100, 'SORT' => 400, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 10.8337)
						);
						break;
					case 'ru':
						$addCurrency = array(
							array('CURRENCY' => 'RUB', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1),
							array('CURRENCY' => 'USD', 'AMOUNT' => 32.30, 'AMOUNT_CNT' => 1, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 32.30),
							array('CURRENCY' => 'EUR', 'AMOUNT' => 43.80, 'AMOUNT_CNT' => 1, 'SORT' => 300, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 43.80),
							array('CURRENCY' => 'UAH', 'AMOUNT' => 39.41, 'AMOUNT_CNT' => 10, 'SORT' => 400, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 3.941),
							array('CURRENCY' => 'BYR', 'AMOUNT' => 36.72, 'AMOUNT_CNT' => 10000, 'SORT' => 500, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.003672)
						);
						break;
					case 'de':
						$addCurrency = array(
							array('CURRENCY' => 'EUR', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1),
							array('CURRENCY' => 'USD', 'AMOUNT' => 0.74, 'AMOUNT_CNT' => 1, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.74)
						);
						break;
					default:
					case 'en':
						$addCurrency = array(
							array('CURRENCY' => 'USD', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1),
							array('CURRENCY' => 'EUR', 'AMOUNT' => 1.36, 'AMOUNT_CNT' => 1, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 1.36)
						);
						break;
				}
				foreach ($addCurrency as &$fields)
				{
					$fields['CREATED_BY'] = null;
					$fields['MODIFIED_BY'] = null;
					$fields['DATE_CREATE'] = $datetimeEntity;
					$fields['DATE_UPDATE'] = $datetimeEntity;
					$currencyResult = CurrencyTable::add($fields);
					if ($currencyResult->isSuccess())
						$currencyList[] = $fields['CURRENCY'];
				}
				unset($currencyResult, $fields);

				if (!empty($currencyList))
				{
					Option::set('currency', 'installed_currencies', implode(',', $currencyList), '');
					$languageIterator = LanguageTable::getList(array(
						'select' => array('ID'),
						'filter' => array('ACTIVE' => 'Y')
					));
					while ($existLanguage = $languageIterator->fetch())
					{
						$CACHE_MANAGER->Clean('currency_currency_list_'.$existLanguage['ID']);
						$messList = Loc::loadLanguageFile($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/currency/install_lang.php', $existLanguage['ID']);
						foreach($currencyList as &$oneCurrency)
						{
							$fields = array(
								'LID' => $existLanguage['ID'],
								'CURRENCY' => $oneCurrency,
								'THOUSANDS_SEP' => false,
								'DECIMALS' => 2,
								'HIDE_ZERO' => 'Y',
								'FORMAT_STRING' => $messList['CUR_INSTALL_'.$oneCurrency.'_FORMAT_STRING'],
								'FULL_NAME' => $messList['CUR_INSTALL_'.$oneCurrency.'_FULL_NAME'],
								'DEC_POINT' => $messList['CUR_INSTALL_'.$oneCurrency.'_DEC_POINT'],
								'THOUSANDS_VARIANT' => $messList['CUR_INSTALL_'.$oneCurrency.'_THOUSANDS_SEP'],
								'CREATED_BY' => null,
								'MODIFIED_BY' => null,
								'DATE_CREATE' => $datetimeEntity,
								'TIMESTAMP_X' => $datetimeEntity
							);
							$resultCurrencyLang = CurrencyLangTable::add($fields);
						}
						unset($oneCurrency);
					}
					unset($existLanguage, $languageIterator);
					if (!$bitrix24)
					{
						$checkDate = DateTime::createFromTimestamp(strtotime('tomorrow 00:01:00'));;
						CAgent::AddAgent('\Bitrix\Currency\CurrencyTable::currencyBaseRateAgent();', 'currency', 'Y', 86400, '', 'Y', $checkDate->toString(), 100, false, true);
					}
				}
			}
		}
		$stackCacheManager->Clear("currency_currency_lang");
		$CACHE_MANAGER->Clean("currency_currency_list", 'b_catalog_currency');
		$CACHE_MANAGER->Clean("currency_base_currency", 'b_catalog_currency');
		$stackCacheManager->Clear("currency_rate");

		return true;
	}
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:101,代码来源:index.php

示例5: updateAgent

 public static function updateAgent()
 {
     $engine = new self();
     if ($engine->getAuthSettings()) {
         try {
             $dbRes = YandexCampaignTable::getList(array('filter' => array('<LAST_UPDATE' => DateTime::createFromTimestamp(time() - YandexCampaignTable::CACHE_LIFETIME), '=ENGINE_ID' => $engine->getId()), 'select' => array('CNT'), 'runtime' => array(new ExpressionField('CNT', 'COUNT(*)'))));
             $res = $dbRes->fetch();
             if ($res['CNT'] > 0) {
                 $engine->updateCampaignManual();
             }
             $availableCampaigns = array();
             $campaignList = $engine->getCampaignList();
             foreach ($campaignList as $campaignInfo) {
                 $availableCampaigns[] = $campaignInfo['CampaignID'];
             }
             if (count($availableCampaigns) > 0) {
                 $dbRes = YandexBannerTable::getList(array('group' => array('CAMPAIGN_ID'), 'filter' => array('<LAST_UPDATE' => DateTime::createFromTimestamp(time() - YandexBannerTable::CACHE_LIFETIME), '=ENGINE_ID' => $engine->getId(), '=CAMPAIGN.XML_ID' => $availableCampaigns), 'select' => array('CAMPAIGN_ID')));
                 $campaignId = array();
                 while ($res = $dbRes->fetch()) {
                     $campaignId[] = $res['CAMPAIGN_ID'];
                 }
                 if (count($campaignId) > 0) {
                     $engine->updateBannersManual($campaignId);
                 }
             }
         } catch (YandexDirectException $e) {
         }
     }
     return __CLASS__ . "::updateAgent();";
 }
开发者ID:Satariall,项目名称:izurit,代码行数:30,代码来源:yandexdirect.php

示例6: updateFile

 /**
  * @param         $name
  * @param         $targetElementId
  * @param TmpFile $tmpFile
  * @param array   $data
  * @return array|bool
  * @throws AccessDeniedException
  */
 public function updateFile($name, $targetElementId, TmpFile $tmpFile, array $data = array())
 {
     /** @var File $file */
     $file = File::loadById($targetElementId);
     if (!$file) {
         $this->errorCollection->add(array(new Error("Could not " . __METHOD__ . " by id {$targetElementId}", 11154)));
         $tmpFile->delete();
         return false;
     }
     if (!$file->canUpdate($this->storage->getCurrentUserSecurityContext())) {
         $tmpFile->delete();
         throw new AccessDeniedException();
     }
     /** @var array $fileArray */
     if ($tmpFile->isCloud() && $tmpFile->getContentType()) {
         /** @noinspection PhpDynamicAsStaticMethodCallInspection */
         $fileId = \CFile::saveFile(array('name' => $tmpFile->getFilename(), 'tmp_name' => $tmpFile->getAbsolutePath(), 'type' => $tmpFile->getContentType()), Driver::INTERNAL_MODULE_ID, true, true);
         /** @noinspection PhpDynamicAsStaticMethodCallInspection */
         $fileArray = \CFile::getFileArray($fileId);
         if (!$fileArray) {
             $this->errorCollection->add(array(new Error("Could not " . __METHOD__ . " getFileArray", 1115541)));
             $tmpFile->delete();
             return false;
         }
         if (!empty($data['originalTimestamp'])) {
             $fileArray['UPDATE_TIME'] = DateTime::createFromTimestamp($this->convertFromExternalVersion($data['originalTimestamp']));
         }
         if ($file->addVersion($fileArray, $this->getUser()->getId())) {
             $tmpFile->delete();
             $this->loadFormattedFolderTreeAndBreadcrumbs();
             return $this->formatFileToResponse($file);
         } else {
             \CFile::delete($fileId);
         }
     } else {
         $fileArray = \CFile::makeFileArray($tmpFile->getAbsolutePath());
         if (!$fileArray) {
             $this->errorCollection->add(array(new Error("Could not " . __METHOD__ . " MakeFileArray", 11155)));
             $tmpFile->delete();
             return false;
         }
         if (!empty($data['originalTimestamp'])) {
             $fileArray['UPDATE_TIME'] = DateTime::createFromTimestamp($this->convertFromExternalVersion($data['originalTimestamp']));
         }
         if ($file->uploadVersion($fileArray, $this->getUser()->getId())) {
             $tmpFile->delete();
             $this->loadFormattedFolderTreeAndBreadcrumbs();
             return $this->formatFileToResponse($file);
         }
     }
     $this->errorCollection->add(array(new Error("Could not " . __METHOD__ . ", uploadVersion", 11156)));
     $this->errorCollection->add($file->getErrors());
     $tmpFile->delete();
     return false;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:63,代码来源:diskstorage.php

示例7: sendDataSftp

 protected function sendDataSftp()
 {
     $directory = new \Bitrix\Main\IO\Directory($this->path . "/zip");
     if (!$directory->isExists()) {
         throw new SystemException("Directory" . $this->path . "/zip does not exist! " . __METHOD__);
     }
     $filesToSend = $directory->getChildren();
     if (empty($filesToSend)) {
         return false;
     }
     $sftp = \Bitrix\Sale\TradingPlatform\Ebay\Helper::getSftp($this->siteId);
     $sftp->connect();
     for ($i = 0; $i < count($filesToSend); $i++) {
         $directoryEntry = $filesToSend[$i];
         $localPath = $directoryEntry->getPath();
         if (!$directoryEntry instanceof \Bitrix\Main\IO\File || GetFileExtension($localPath) != "zip") {
             continue;
         }
         $remote = $this->remotePath . "/" . $directoryEntry->getName();
         while (!$this->checkOuterConditions($sftp)) {
             if ($this->timer !== null && !$this->timer->check(15)) {
                 return false;
             }
             sleep(10);
         }
         if ($sftp->uploadFile($localPath, $remote)) {
             $directoryEntry->delete();
             ResultsTable::add(array("FILENAME" => $directoryEntry->getName(), "FEED_TYPE" => $this->feedType, "UPLOAD_TIME" => DateTime::createFromTimestamp(time())));
             Ebay::log(Logger::LOG_LEVEL_INFO, "EBAY_DATA_PROCESSOR_SFTPQUEUE_SEND", $remote, "File sent successfully.", $this->siteId);
         }
     }
     return true;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:33,代码来源:sftpqueue.php

示例8: toView

 /**
  * @param string $action
  * @return array
  */
 protected function toView($action = null)
 {
     /** @global CMain $APPLICATION */
     global $APPLICATION;
     $error = $this->checkRequirements();
     if ($error) {
         return array('MESSAGE' => $error);
     }
     $result = array();
     switch ($action) {
         case 'download':
             $codes = $this->getRecoveryCodes(true, true);
             $response = '';
             $counter = 0;
             foreach ($codes as $code) {
                 $counter++;
                 $response .= sprintf("%d. %s\r\n", $counter, $code['VALUE']);
             }
             $result['PLAIN_RESPONSE'] = $response;
             break;
         case 'print':
             $result['CODES'] = $this->getRecoveryCodes(true, true);
             break;
         case 'view':
         default:
             $result['CODES'] = $this->getRecoveryCodes(false, true);
             break;
     }
     $result['ISSUER'] = Option::get('main', 'server_name');
     if (!$result['ISSUER']) {
         $result['ISSUER'] = Option::get('security', 'otp_issuer', 'Bitrix');
     }
     $result['CREATE_DATE'] = CUserOptions::GetOption('security', 'recovery_codes_generated', null);
     if ($result['CREATE_DATE']) {
         $result['CREATE_DATE'] = Type\DateTime::createFromTimestamp($result['CREATE_DATE']);
     }
     return $result;
 }
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:42,代码来源:class.php

示例9: updateShipment

 /**
  * @param int $shipmentId
  * @param StatusResult $params
  * @param bool|false $isStatusChanged
  * @return Result
  * @throws ArgumentNullException
  * @throws \Exception
  */
 public function updateShipment($shipmentId, StatusResult $params)
 {
     if ($shipmentId <= 0) {
         throw new ArgumentNullException('id');
     }
     $dateTime = new \Bitrix\Main\Type\DateTime();
     return ShipmentTable::update($shipmentId, array('TRACKING_STATUS' => $params->status, 'TRACKING_LAST_CHECK' => $dateTime, 'TRACKING_LAST_CHANGE' => \Bitrix\Main\Type\DateTime::createFromTimestamp($params->lastChangeTimestamp), 'TRACKING_DESCRIPTION' => $params->description, 'TRACKING_NUMBER' => $params->trackingNumber));
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:16,代码来源:manager.php

示例10: createInvoices

 public function createInvoices(array $params)
 {
     $count = isset($params['COUNT']) ? (int) $params['COUNT'] : 0;
     if ($count <= 0) {
         return;
     }
     $sum = isset($params['SUM']) ? (int) $params['SUM'] : 0;
     if ($sum <= 0) {
         return;
     }
     $dealID = isset($params['DEAL_ID']) ? (int) $params['DEAL_ID'] : 0;
     $companyID = isset($params['COMPANY_ID']) ? (int) $params['COMPANY_ID'] : 0;
     $contactID = isset($params['CONTACT_ID']) ? (int) $params['CONTACT_ID'] : 0;
     $userIDs = isset($params['USER_IDS']) && is_array($params['USER_IDS']) ? $params['USER_IDS'] : array();
     if (empty($userIDs)) {
         $userIDs[] = \CCrmSecurityHelper::GetCurrentUserID();
     }
     $prefix = isset($params['PREFIX']) ? $params['PREFIX'] : '';
     if ($prefix === '') {
         $prefix = $this->id;
     }
     $date = isset($params['DATE']) ? $params['DATE'] : null;
     if (!$date) {
         $date = $date = new Date();
     }
     $maxDateOffset = isset($params['MAX_DATE_OFFSET']) ? (int) $params['MAX_DATE_OFFSET'] : 0;
     $dateFormat = Date::convertFormatToPhp(FORMAT_DATE);
     $dateTimeFormat = Date::convertFormatToPhp(FORMAT_DATETIME);
     $isWon = isset($params['IS_WON']) ? $params['IS_WON'] : false;
     if ($isWon) {
         $totalSum = $sum;
     } else {
         $totalSum = $sum - mt_rand((int) ($sum / 3), $sum);
     }
     $entity = new \CCrmInvoice(false);
     $invoiceSum = (int) $totalSum / $count;
     $totalInvoiceSum = 0;
     for ($i = 1; $i <= $count; $i++) {
         if ($i == $count) {
             $invoiceSum = $totalSum - $totalInvoiceSum;
         }
         $totalInvoiceSum += $invoiceSum;
         $time = DateTime::createFromTimestamp($date->getTimestamp());
         if ($maxDateOffset > 0) {
             $time->add(mt_rand(0, $maxDateOffset) . ' days');
         }
         $time->setTime(mt_rand(8, 20), mt_rand(0, 59), 0);
         $siteTime = $time->format($dateTimeFormat);
         $siteDate = $time->format($dateFormat);
         \CCrmOwnerType::GetCaption(\CCrmOwnerType::Company, $companyID, false);
         $companyInfo = self::getCompanyInfo($companyID);
         $contactInfo = self::getContactInfo($contactID);
         $fields = array('ORDER_TOPIC' => "{$prefix} invoice # {$i}", 'STATUS_ID' => $isWon ? 'P' : 'N', 'DATE_INSERT' => $siteTime, 'DATE_BILL' => $siteDate, 'RESPONSIBLE_ID' => self::getRandomItem($userIDs), 'UF_DEAL_ID' => $dealID, 'UF_COMPANY_ID' => $companyID, 'UF_CONTACT_ID' => $contactID, 'PERSON_TYPE_ID' => 1, 'PAY_SYSTEM_ID' => 1, 'INVOICE_PROPERTIES' => array(10 => $companyInfo['TITLE'], 11 => $companyInfo['FULL_ADDRESS'], 12 => $contactInfo['FULL_NAME'], 13 => $contactInfo['EMAIL'], 14 => $contactInfo['PHONE']), 'PRODUCT_ROWS' => array(array('ID' => 0, 'PRODUCT_NAME' => "{$prefix} product", 'QUANTITY' => 1, 'PRICE' => $invoiceSum, 'PRODUCT_ID' => 0, 'CUSTOMIZED' => 'Y')));
         $ID = $entity->Add($fields);
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:56,代码来源:datagenerator.php

示例11: catch

            $fromDate = new Type\DateTime($arParams['CUSTOM_DAY'] . ' 00:00:00', 'Y-m-d H:i:s');
        } catch (\Bitrix\Main\ObjectException $e) {
            $fromDate = Type\DateTime::createFromTimestamp(mktime(0, 0, 0));
        }
        $toDate = clone $fromDate;
        $toDate->add('+23 hour 59 minute');
        // day, because we need empty records for all users
        $interval = 'day';
        $dateFormat = 'Y-m-d H:00:00';
        $axisDateFormat = "H";
        $axisCursorDateFormat = "d M Y\n" . (IsAmPmMode() ? "g:i a" : "H:i");
        break;
    default:
        // for today, from 00:00 till 23:59
        $fromDate = Type\DateTime::createFromTimestamp(mktime(0, 0, 0));
        $toDate = Type\DateTime::createFromTimestamp(mktime(23, 59, 59));
        // day, because we need empty records for all users
        $interval = 'day';
        $dateFormat = 'Y-m-d H:00:00';
        $axisDateFormat = "H";
        $axisCursorDateFormat = array("today" => "today, " . (IsAmPmMode() ? "g:i a" : "H:i"));
}
$sectionField = empty($arParams['SECTION']) ? 'TOTAL' : $arParams['SECTION'];
$arParams['NON_INVOLVED'] = isset($arParams['NON_INVOLVED']) && $arParams['NON_INVOLVED'] || isset($_REQUEST['LIST']) && $_REQUEST['LIST'] === 'involve';
if (!isset($arParams['OFFSET'])) {
    $arParams['OFFSET'] = isset($_REQUEST['OFFSET']) ? (int) $_REQUEST['OFFSET'] : 0;
}
if (!isset($arParams['TOP_ACTIVITY']) && isset($_REQUEST['TOP_ACTIVITY'])) {
    $arParams['TOP_ACTIVITY'] = $_REQUEST['TOP_ACTIVITY'];
}
$data = \Bitrix\Intranet\UStat\UStat::getUsersTop(1, 0, $fromDate, $toDate, $interval, $sectionField, $arParams['NON_INVOLVED'], $arParams['OFFSET'], 20);
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例12: update

 /**
  * Overrides parent update  to sate update date to current.
  * @param mixed $primary Primary key.
  * @param array $data Data fields.
  * @return Entity\UpdateResult
  */
 public static function update($primary, array $data)
 {
     $data["LAST_UPDATE"] = DateTime::createFromTimestamp(time());
     return parent::update($primary, $data);
 }
开发者ID:Satariall,项目名称:izurit,代码行数:11,代码来源:category.php

示例13: installCurrencies


//.........这里部分代码省略.........
     if ($languageID == '') {
         $languageID = 'en';
     }
     $currencyList = array();
     $currencySetID = '';
     switch ($languageID) {
         case 'ua':
         case 'de':
         case 'en':
         case 'la':
         case 'tc':
         case 'sc':
         case 'in':
             $currencySetID = $languageID;
             break;
         case 'ru':
             if (!$bitrix24) {
                 $languageIterator = LanguageTable::getList(array('select' => array('ID'), 'filter' => array('=ID' => 'kz', '=ACTIVE' => 'Y')));
                 if ($existLanguage = $languageIterator->fetch()) {
                     $currencySetID = $existLanguage['ID'];
                 }
                 if ($currencySetID == '') {
                     $languageIterator = LanguageTable::getList(array('select' => array('ID'), 'filter' => array('=ID' => 'ua', '=ACTIVE' => 'Y')));
                     if ($existLanguage = $languageIterator->fetch()) {
                         $currencySetID = $existLanguage['ID'];
                     }
                 }
                 unset($existLanguage, $languageIterator);
             }
             if ($currencySetID == '') {
                 $currencySetID = $languageID;
             }
             break;
         default:
             $currencySetID = 'en';
             break;
     }
     $datetimeEntity = new Main\DB\SqlExpression(Main\Application::getConnection()->getSqlHelper()->getCurrentDateTimeFunction());
     switch ($currencySetID) {
         case 'kz':
             $addCurrency = array(array('CURRENCY' => 'KZT', 'NUMCODE' => '398', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1), array('CURRENCY' => 'RUB', 'NUMCODE' => '643', 'AMOUNT' => 4.4, 'AMOUNT_CNT' => 1, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 4.4), array('CURRENCY' => 'USD', 'NUMCODE' => '840', 'AMOUNT' => 283.17, 'AMOUNT_CNT' => 1, 'SORT' => 300, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 283.17), array('CURRENCY' => 'EUR', 'NUMCODE' => '978', 'AMOUNT' => 310.78, 'AMOUNT_CNT' => 1, 'SORT' => 400, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 310.78));
             break;
         case 'ua':
             $addCurrency = array(array('CURRENCY' => 'UAH', 'NUMCODE' => '980', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1), array('CURRENCY' => 'RUB', 'NUMCODE' => '643', 'AMOUNT' => 3.61, 'AMOUNT_CNT' => 10, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.361), array('CURRENCY' => 'USD', 'NUMCODE' => '840', 'AMOUNT' => 2322.93, 'AMOUNT_CNT' => 100, 'SORT' => 300, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 23.2293), array('CURRENCY' => 'EUR', 'NUMCODE' => '978', 'AMOUNT' => 2548.19, 'AMOUNT_CNT' => 100, 'SORT' => 400, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 25.4819));
             break;
         case 'ru':
             $addCurrency = array(array('CURRENCY' => 'RUB', 'NUMCODE' => '643', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1), array('CURRENCY' => 'USD', 'NUMCODE' => '840', 'AMOUNT' => 64.36, 'AMOUNT_CNT' => 1, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 64.36), array('CURRENCY' => 'EUR', 'NUMCODE' => '978', 'AMOUNT' => 70.59999999999999, 'AMOUNT_CNT' => 1, 'SORT' => 300, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 70.59999999999999), array('CURRENCY' => 'UAH', 'NUMCODE' => '980', 'AMOUNT' => 27.69, 'AMOUNT_CNT' => 10, 'SORT' => 400, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 2.769), array('CURRENCY' => 'BYR', 'NUMCODE' => '974', 'AMOUNT' => 36.9, 'AMOUNT_CNT' => 10000, 'SORT' => 500, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.00369));
             break;
         case 'de':
         case 'la':
             $addCurrency = array(array('CURRENCY' => 'EUR', 'NUMCODE' => '978', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1), array('CURRENCY' => 'USD', 'NUMCODE' => '840', 'AMOUNT' => 0.91, 'AMOUNT_CNT' => 1, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.91), array('CURRENCY' => 'CNY', 'NUMCODE' => '156', 'AMOUNT' => 14.35, 'AMOUNT_CNT' => 100, 'SORT' => 300, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.1435), array('CURRENCY' => 'BRL', 'NUMCODE' => '986', 'AMOUNT' => 23.21, 'AMOUNT_CNT' => 100, 'SORT' => 400, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.2321), array('CURRENCY' => 'INR', 'NUMCODE' => '356', 'AMOUNT' => 13.97, 'AMOUNT_CNT' => 1000, 'SORT' => 500, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.01397));
             break;
         case 'tc':
         case 'sc':
             $addCurrency = array(array('CURRENCY' => 'CNY', 'NUMCODE' => '156', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1), array('CURRENCY' => 'USD', 'NUMCODE' => '840', 'AMOUNT' => 6.36, 'AMOUNT_CNT' => 1, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 6.36), array('CURRENCY' => 'EUR', 'NUMCODE' => '978', 'AMOUNT' => 6.97, 'AMOUNT_CNT' => 1, 'SORT' => 300, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 6.97), array('CURRENCY' => 'BRL', 'NUMCODE' => '986', 'AMOUNT' => 1.61, 'AMOUNT_CNT' => 1, 'SORT' => 400, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 1.61), array('CURRENCY' => 'INR', 'NUMCODE' => '356', 'AMOUNT' => 9.74, 'AMOUNT_CNT' => 100, 'SORT' => 500, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.09737));
             break;
         case 'in':
             $addCurrency = array(array('CURRENCY' => 'INR', 'NUMCODE' => '356', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1), array('CURRENCY' => 'USD', 'NUMCODE' => '840', 'AMOUNT' => 65.31, 'AMOUNT_CNT' => 1, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 65.31), array('CURRENCY' => 'EUR', 'NUMCODE' => '978', 'AMOUNT' => 71.56, 'AMOUNT_CNT' => 1, 'SORT' => 300, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 71.56), array('CURRENCY' => 'CNY', 'NUMCODE' => '156', 'AMOUNT' => 10.27, 'AMOUNT_CNT' => 1, 'SORT' => 400, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 10.27), array('CURRENCY' => 'BRL', 'NUMCODE' => '986', 'AMOUNT' => 16.56, 'AMOUNT_CNT' => 1, 'SORT' => 500, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 16.56));
             break;
         case 'br':
             $addCurrency = array(array('CURRENCY' => 'BRL', 'NUMCODE' => '986', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1), array('CURRENCY' => 'USD', 'NUMCODE' => '840', 'AMOUNT' => 3.9, 'AMOUNT_CNT' => 1, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 3.9), array('CURRENCY' => 'EUR', 'NUMCODE' => '978', 'AMOUNT' => 4.29, 'AMOUNT_CNT' => 1, 'SORT' => 300, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 4.29), array('CURRENCY' => 'CNY', 'NUMCODE' => '156', 'AMOUNT' => 61.44, 'AMOUNT_CNT' => 100, 'SORT' => 400, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.6143999999999999), array('CURRENCY' => 'INR', 'NUMCODE' => '356', 'AMOUNT' => 5.99, 'AMOUNT_CNT' => 100, 'SORT' => 500, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.0599));
             break;
         default:
         case 'en':
             $addCurrency = array(array('CURRENCY' => 'USD', 'NUMCODE' => '840', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1), array('CURRENCY' => 'EUR', 'NUMCODE' => '978', 'AMOUNT' => 1.1, 'AMOUNT_CNT' => 1, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 1.1), array('CURRENCY' => 'CNY', 'NUMCODE' => '156', 'AMOUNT' => 15.73, 'AMOUNT_CNT' => 100, 'SORT' => 300, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.1573), array('CURRENCY' => 'BRL', 'NUMCODE' => '986', 'AMOUNT' => 25.35, 'AMOUNT_CNT' => 100, 'SORT' => 400, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.2535), array('CURRENCY' => 'INR', 'NUMCODE' => '356', 'AMOUNT' => 15.31, 'AMOUNT_CNT' => 1000, 'SORT' => 500, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.01531));
             break;
     }
     foreach ($addCurrency as &$fields) {
         $fields['CREATED_BY'] = null;
         $fields['MODIFIED_BY'] = null;
         $fields['DATE_CREATE'] = $datetimeEntity;
         $fields['DATE_UPDATE'] = $datetimeEntity;
         $currencyResult = \Bitrix\Currency\CurrencyTable::add($fields);
         if ($currencyResult->isSuccess()) {
             $currencyList[] = $fields['CURRENCY'];
         }
     }
     unset($currencyResult, $fields);
     if (!empty($currencyList)) {
         Option::set('currency', 'installed_currencies', implode(',', $currencyList), '');
         $languageIterator = LanguageTable::getList(array('select' => array('ID'), 'filter' => array('=ACTIVE' => 'Y')));
         while ($existLanguage = $languageIterator->fetch()) {
             $messList = Loc::loadLanguageFile($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/currency/install_lang.php', $existLanguage['ID']);
             foreach ($currencyList as &$oneCurrency) {
                 $fields = array('LID' => $existLanguage['ID'], 'CURRENCY' => $oneCurrency, 'THOUSANDS_SEP' => false, 'DECIMALS' => 2, 'HIDE_ZERO' => 'Y', 'FORMAT_STRING' => $messList['CUR_INSTALL_' . $oneCurrency . '_FORMAT_STRING'], 'FULL_NAME' => $messList['CUR_INSTALL_' . $oneCurrency . '_FULL_NAME'], 'DEC_POINT' => $messList['CUR_INSTALL_' . $oneCurrency . '_DEC_POINT'], 'THOUSANDS_VARIANT' => $messList['CUR_INSTALL_' . $oneCurrency . '_THOUSANDS_SEP'], 'CREATED_BY' => null, 'MODIFIED_BY' => null, 'DATE_CREATE' => $datetimeEntity, 'TIMESTAMP_X' => $datetimeEntity);
                 $resultCurrencyLang = \Bitrix\Currency\CurrencyLangTable::add($fields);
                 unset($resultCurrencyLang);
             }
             unset($oneCurrency, $messList);
         }
         unset($existLanguage, $languageIterator);
         if (!$bitrix24) {
             $checkDate = Main\Type\DateTime::createFromTimestamp(strtotime('tomorrow 00:01:00'));
             CAgent::AddAgent('\\Bitrix\\Currency\\CurrencyTable::currencyBaseRateAgent();', 'currency', 'Y', 86400, '', 'Y', $checkDate->toString(), 100, false, true);
             unset($checkDate);
         }
         \Bitrix\Currency\CurrencyManager::clearCurrencyCache();
     }
     unset($datetimeEntity);
 }
开发者ID:Satariall,项目名称:izurit,代码行数:101,代码来源:index.php

示例14: processActionSaveSettingsExternalLink

 protected function processActionSaveSettingsExternalLink()
 {
     /** @var File $file */
     /** @var ExternalLink $extLink */
     list($file, $extLink) = $this->getFileAndExternalLink();
     if (!$extLink) {
         $this->sendJsonErrorResponse();
     }
     if ($this->request->getPost('deathTime')) {
         $extLink->changeDeathTime(DateTime::createFromTimestamp(time() + (int) $this->request->getPost('deathTime')));
     }
     if ($this->request->getPost('password')) {
         $extLink->changePassword($this->request->getPost('password'));
     }
     $this->sendJsonSuccessResponse(array('object' => array('name' => $file->getName(), 'size' => \CFile::formatSize($file->getSize()), 'date' => (string) $file->getUpdateTime()), 'linkData' => array('hasPassword' => $extLink->hasPassword(), 'hasDeathTime' => $extLink->hasDeathTime(), 'hash' => $extLink->getHash(), 'link' => Driver::getInstance()->getUrlManager()->getShortUrlExternalLink(array('hash' => $extLink->getHash(), 'action' => 'default'), true))));
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:16,代码来源:ajax.php

示例15: installCurrencies


//.........这里部分代码省略.........
					array('CURRENCY' => 'RUB', 'NUMCODE' => '643', 'AMOUNT' => 4.00, 'AMOUNT_CNT' => 10, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.4),
					array('CURRENCY' => 'USD', 'NUMCODE' => '840', 'AMOUNT' => 2355.70, 'AMOUNT_CNT' => 100, 'SORT' => 300, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 23.557),
					array('CURRENCY' => 'EUR', 'NUMCODE' => '978', 'AMOUNT' => 2579.49, 'AMOUNT_CNT' => 100, 'SORT' => 400, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 25.7949)
				);
				break;
			case 'ru':
				$addCurrency = array(
					array('CURRENCY' => 'RUB', 'NUMCODE' => '643', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1),
					array('CURRENCY' => 'USD', 'NUMCODE' => '840', 'AMOUNT' => 57.39, 'AMOUNT_CNT' => 1, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 57.39),
					array('CURRENCY' => 'EUR', 'NUMCODE' => '978', 'AMOUNT' => 62.77, 'AMOUNT_CNT' => 1, 'SORT' => 300, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 62.77),
					array('CURRENCY' => 'UAH', 'NUMCODE' => '980', 'AMOUNT' => 24.53, 'AMOUNT_CNT' => 10, 'SORT' => 400, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 2.453),
					array('CURRENCY' => 'BYR', 'NUMCODE' => '974', 'AMOUNT' => 39.44, 'AMOUNT_CNT' => 10000, 'SORT' => 500, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.003944)
				);
				break;
			case 'de':
			case 'la':
				$addCurrency = array(
					array('CURRENCY' => 'EUR', 'NUMCODE' => '978', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1),
					array('CURRENCY' => 'USD', 'NUMCODE' => '840', 'AMOUNT' => 0.91, 'AMOUNT_CNT' => 1, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.91),
					array('CURRENCY' => 'CNY', 'NUMCODE' => '156', 'AMOUNT' => 14.65, 'AMOUNT_CNT' => 100, 'SORT' => 300, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.1465),
					array('CURRENCY' => 'BRL', 'NUMCODE' => '986', 'AMOUNT' => 29.12, 'AMOUNT_CNT' => 100, 'SORT' => 400, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.2912),
					array('CURRENCY' => 'INR', 'NUMCODE' => '356', 'AMOUNT' => 14.59, 'AMOUNT_CNT' => 1000, 'SORT' => 500, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.01459)
				);
				break;
			case 'tc':
			case 'sc':
				$addCurrency = array(
					array('CURRENCY' => 'CNY', 'NUMCODE' => '156', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1),
					array('CURRENCY' => 'USD', 'NUMCODE' => '840', 'AMOUNT' => 6.21, 'AMOUNT_CNT' => 1, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.1610),
					array('CURRENCY' => 'EUR', 'NUMCODE' => '978', 'AMOUNT' => 6.75, 'AMOUNT_CNT' => 1, 'SORT' => 300, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.1482),
					array('CURRENCY' => 'BRL', 'NUMCODE' => '986', 'AMOUNT' => 1.93, 'AMOUNT_CNT' => 1, 'SORT' => 400, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.5181),
					array('CURRENCY' => 'INR', 'NUMCODE' => '356', 'AMOUNT' => 9,94, 'AMOUNT_CNT' => 100, 'SORT' => 500, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.0994)
				);
				break;
			default:
			case 'en':
				$addCurrency = array(
					array('CURRENCY' => 'USD', 'NUMCODE' => '840', 'AMOUNT' => 1, 'AMOUNT_CNT' => 1, 'SORT' => 100, 'BASE' => 'Y', 'CURRENT_BASE_RATE' => 1),
					array('CURRENCY' => 'EUR', 'NUMCODE' => '978', 'AMOUNT' => 1.09, 'AMOUNT_CNT' => 1, 'SORT' => 200, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 1.09),
					array('CURRENCY' => 'CNY', 'NUMCODE' => '156', 'AMOUNT' => 16.09, 'AMOUNT_CNT' => 100, 'SORT' => 300, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.1609),
					array('CURRENCY' => 'BRL', 'NUMCODE' => '986', 'AMOUNT' => 31.24, 'AMOUNT_CNT' => 100, 'SORT' => 400, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.3124),
					array('CURRENCY' => 'INR', 'NUMCODE' => '356', 'AMOUNT' => 16.02, 'AMOUNT_CNT' => 1000, 'SORT' => 500, 'BASE' => 'N', 'CURRENT_BASE_RATE' => 0.01602)
				);
				break;
		}
		foreach ($addCurrency as &$fields)
		{
			$fields['CREATED_BY'] = null;
			$fields['MODIFIED_BY'] = null;
			$fields['DATE_CREATE'] = $datetimeEntity;
			$fields['DATE_UPDATE'] = $datetimeEntity;
			$currencyResult = \Bitrix\Currency\CurrencyTable::add($fields);
			if ($currencyResult->isSuccess())
				$currencyList[] = $fields['CURRENCY'];
		}
		unset($currencyResult, $fields);

		if (!empty($currencyList))
		{
			Option::set('currency', 'installed_currencies', implode(',', $currencyList), '');
			$languageIterator = LanguageTable::getList(array(
				'select' => array('ID'),
				'filter' => array('=ACTIVE' => 'Y')
			));
			while ($existLanguage = $languageIterator->fetch())
			{
				$messList = Loc::loadLanguageFile($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/currency/install_lang.php', $existLanguage['ID']);
				foreach($currencyList as &$oneCurrency)
				{
					$fields = array(
						'LID' => $existLanguage['ID'],
						'CURRENCY' => $oneCurrency,
						'THOUSANDS_SEP' => false,
						'DECIMALS' => 2,
						'HIDE_ZERO' => 'Y',
						'FORMAT_STRING' => $messList['CUR_INSTALL_'.$oneCurrency.'_FORMAT_STRING'],
						'FULL_NAME' => $messList['CUR_INSTALL_'.$oneCurrency.'_FULL_NAME'],
						'DEC_POINT' => $messList['CUR_INSTALL_'.$oneCurrency.'_DEC_POINT'],
						'THOUSANDS_VARIANT' => $messList['CUR_INSTALL_'.$oneCurrency.'_THOUSANDS_SEP'],
						'CREATED_BY' => null,
						'MODIFIED_BY' => null,
						'DATE_CREATE' => $datetimeEntity,
						'TIMESTAMP_X' => $datetimeEntity
					);
					$resultCurrencyLang = \Bitrix\Currency\CurrencyLangTable::add($fields);
					unset($resultCurrencyLang);
				}
				unset($oneCurrency, $messList);
			}
			unset($existLanguage, $languageIterator);
			if (!$bitrix24)
			{
				$checkDate = Main\Type\DateTime::createFromTimestamp(strtotime('tomorrow 00:01:00'));;
				CAgent::AddAgent('\Bitrix\Currency\CurrencyTable::currencyBaseRateAgent();', 'currency', 'Y', 86400, '', 'Y', $checkDate->toString(), 100, false, true);
				unset($checkDate);
			}
			\Bitrix\Currency\CurrencyManager::clearCurrencyCache();
		}
		unset($datetimeEntity);
	}
开发者ID:nycmic,项目名称:bittest,代码行数:101,代码来源:index.php


注:本文中的Bitrix\Main\Type\DateTime::createFromTimestamp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。