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


PHP CTimeZone::GetOffset方法代码示例

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


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

示例1: Add

	function Add($LOG_ID, $GROUP_CODE)
	{
		global $DB;

		if (is_array($GROUP_CODE))
		{
			foreach($GROUP_CODE as $GROUP_CODE_TMP)
				CSocNetLogRights::Add($LOG_ID, $GROUP_CODE_TMP);
			return false;
		}
		else
		{
			$db_events = GetModuleEvents("socialnetwork", "OnBeforeSocNetLogRightsAdd");
			while ($arEvent = $db_events->Fetch())
				if (ExecuteModuleEventEx($arEvent, array($LOG_ID, &$GROUP_CODE))===false)
					return false;

			$NEW_RIGHT_ID = $DB->Add("b_sonet_log_right", array(
				"LOG_ID" => $LOG_ID,
				"GROUP_CODE" => $GROUP_CODE,
			));
			
			if (preg_match('/^U(\d+)$/', $GROUP_CODE, $matches))
				CSocNetLogFollow::Set($matches[1], "L".$LOG_ID, "Y", ConvertTimeStamp(time() + CTimeZone::GetOffset(), "FULL", SITE_ID));

			if(defined("BX_COMP_MANAGED_CACHE"))
				$GLOBALS["CACHE_MANAGER"]->ClearByTag("SONET_LOG_".intval($LOG_ID));

			return $NEW_RIGHT_ID;
		}
	}
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:31,代码来源:log_rights.php

示例2: storeResult

function storeResult($arResult, $arParams) {
    $iblock = CIBlock::GetList(
        array(),
        array(
            'TYPE' => $arParams['IBLOCK_TYPE'],
            'CODE' => $arParams['IBLOCK_CODE'],
        )
    );
    $iblock = $iblock->Fetch();
    
    $el = new CIBlockElement;

    $props = array();
    foreach ($arResult['FIELDS_LIST'] as $arField) {
        if ($arField['FIELD_TYPE'] == 'TEXT' || $arField['FIELD_TYPE'] == 'NUMBER') {
            $props[$arField['CODE']] = array(
                'VALUE' => $arResult['POST_DATA']['~'.$arField['CODE']],
            );
        } elseif ($arField['FIELD_TYPE'] == 'TEXTAREA') {
            $props[$arField['CODE']] = array(
                'VALUE' => array(
                    'TYPE' => 'text',
                    'TEXT' => $arResult['POST_DATA']['~'.$arField['CODE']],
                ),
            );
        } elseif ($arField['FIELD_TYPE'] == 'LIST') {
            $propEnum = CIBlockPropertyEnum::GetList(
                array(),
                array(
                    'XML_ID' => $arResult['POST_DATA']['~'.$arField['CODE']],
                    'CODE' => $arField['CODE'],
                    'IBLOCK_ID' => $iblock['ID'],
                )
            );
            $propEnum = $propEnum->Fetch();
            if ( ! $propEnum) return false;

            $props[$arField['CODE']] = array(
                'VALUE' => $propEnum['ID'],
            );
        }
    }

    $res = $el->Add(array(
        'IBLOCK_TYPE' => $arParams['IBLOCK_TYPE'],
        'IBLOCK_ID' => $iblock['ID'],
        'ACTIVE' => 'Y',
        'PROPERTY_VALUES' => $props,
        'ACTIVE_FROM' => ConvertTimeStamp(time()+CTimeZone::GetOffset(), 'FULL'),
        'NAME' => 'Form result', # !!! NEED TO REPLACE TO DEFAULT VALUE
    ));

    if (!$res) {
        return array(
            'MESSAGE' => $el->LAST_ERROR,
        );
    }

    return true;
}
开发者ID:ASDAFF,项目名称:bitrix-advanced-form,代码行数:60,代码来源:store_result.php

示例3: Add

 public static function Add($settings)
 {
     global $DB, $USER;
     $name = $settings['title'];
     $description = $settings['description'];
     $owner = $settings['owner'];
     unset($settings['title']);
     unset($settings['description']);
     unset($settings['owner']);
     $fields = array('TITLE' => $name, 'DESCRIPTION' => $description, 'OWNER_ID' => $owner, 'CREATED_DATE' => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), time() + CTimeZone::GetOffset()), 'CREATED_BY' => $USER->GetID());
     if (isset($settings['mark_default'])) {
         $fields['MARK_DEFAULT'] = $settings['mark_default'];
         unset($settings['mark_default']);
     }
     $fields['SETTINGS'] = serialize($settings);
     // pre-events
     foreach (GetModuleEvents("report", "OnBeforeReportAdd", true) as $arEvent) {
         if (ExecuteModuleEventEx($arEvent, array(&$fields)) === false) {
             return false;
         }
     }
     // save data
     $ID = $DB->Add("b_report", $fields, array("SETTINGS", "DESCRIPTION"), "report");
     // clear view params
     self::clearViewParams($ID);
     // post-events
     foreach (GetModuleEvents("report", "OnBeforeReportAdd", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array($ID, &$fields));
     }
     return $ID;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:report.php

示例4: CheckExpireAgent

	public static function CheckExpireAgent()
	{
		global $DB;
		if (!CPullOptions::ModuleEnable())
			return false;

		CAgent::RemoveAgent("CPullWatch::CheckExpireAgent();", "pull");

		$strSql = "SELECT count(ID) CNT FROM b_pull_watch WHERE DATE_CREATE < DATE_SUB(NOW(), INTERVAL 30 MINUTE)";
		$dbRes = $DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
		if ($arRes = $dbRes->Fetch())
		{
			$strSql = "DELETE FROM b_pull_watch WHERE DATE_CREATE < DATE_SUB(NOW(), INTERVAL 30 MINUTE) LIMIT 1000";
			$DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);

			if ($arRes['CNT'] > 1000)
			{
				CAgent::AddAgent("CPullWatch::CheckExpireAgent();", "pull", "N", 180, "", "Y", ConvertTimeStamp(time()+CTimeZone::GetOffset()+180, "FULL"));
				return false;
			}
		}

		CAgent::AddAgent("CPullWatch::CheckExpireAgent();", "pull", "N", 600, "", "Y", ConvertTimeStamp(time()+CTimeZone::GetOffset()+600, "FULL"));
		return false;
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:25,代码来源:pull_watch.php

示例5: InstallDB

 function InstallDB()
 {
     global $DB, $APPLICATION;
     $this->errors = false;
     if (!$DB->Query("SELECT 'x' FROM b_im_chat", true)) {
         $this->errors = $DB->RunSQLBatch($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/im/install/db/" . strtolower($DB->type) . "/install.sql");
     }
     if ($this->errors !== false) {
         $APPLICATION->ThrowException(implode("", $this->errors));
         return false;
     }
     RegisterModule("im");
     RegisterModuleDependences('main', 'OnAddRatingVote', 'im', 'CIMEvent', 'OnAddRatingVote');
     RegisterModuleDependences('main', 'OnCancelRatingVote', 'im', 'CIMEvent', 'OnCancelRatingVote');
     RegisterModuleDependences('main', 'OnAfterUserUpdate', 'im', 'CIMEvent', 'OnAfterUserUpdate');
     RegisterModuleDependences('main', 'OnUserDelete', 'im', 'CIMEvent', 'OnUserDelete');
     RegisterModuleDependences("pull", "OnGetDependentModule", "im", "CIMEvent", "OnGetDependentModule");
     RegisterModuleDependences("main", "OnProlog", "main", "", "", 3, "/modules/im/ajax_hit.php");
     RegisterModuleDependences("perfmon", "OnGetTableSchema", "im", "CIMTableSchema", "OnGetTableSchema");
     RegisterModuleDependences("im", "OnGetNotifySchema", "im", "CIMNotifySchema", "OnGetNotifySchema");
     RegisterModuleDependences("main", "OnFileDelete", "im", "CIMEvent", "OnFileDelete");
     RegisterModuleDependences("main", "OnApplicationsBuildList", "im", "DesktopApplication", "OnApplicationsBuildList");
     CAgent::AddAgent("CIMMail::MailNotifyAgent();", "im", "N", 600);
     CAgent::AddAgent("CIMMail::MailMessageAgent();", "im", "N", 600);
     CAgent::AddAgent("CIMDisk::RemoveTmpFileAgent();", "im", "N", 43200);
     CModule::IncludeModule("im");
     if (CIMConvert::ConvertCount() > 0) {
         Cmodule::IncludeModule("im");
         CAdminNotify::Add(array("MESSAGE" => GetMessage("IM_CONVERT_MESSAGE", array("#A_TAG_START#" => '<a href="/bitrix/admin/im_convert.php?lang=' . LANGUAGE_ID . '">', "#A_TAG_END#" => "</a>")), "TAG" => "IM_CONVERT", "MODULE_ID" => "IM", "ENABLE_CLOSE" => "Y"));
         CAgent::AddAgent("CIMConvert::UndeliveredMessageAgent();", "im", "N", 20, "", "Y", ConvertTimeStamp(time() + CTimeZone::GetOffset() + 20, "FULL"));
     }
     return true;
 }
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:33,代码来源:index.php

示例6: InstallDB

 function InstallDB()
 {
     global $DB, $APPLICATION;
     $this->errors = false;
     if (!$DB->Query("SELECT 'x' FROM b_pull_stack", true)) {
         $this->errors = $DB->RunSQLBatch($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/pull/install/db/" . strtolower($DB->type) . "/install.sql");
     }
     if ($this->errors !== false) {
         $APPLICATION->ThrowException(implode("", $this->errors));
         return false;
     }
     RegisterModule("pull");
     RegisterModuleDependences("main", "OnProlog", "main", "", "", 3, "/modules/pull/ajax_hit.php");
     RegisterModuleDependences("main", "OnEpilog", "pull", "CPullWatch", "DeferredSql");
     RegisterModuleDependences("main", "OnEpilog", "pull", "CPullOptions", "OnEpilog");
     RegisterModuleDependences("perfmon", "OnGetTableSchema", "pull", "CPullTableSchema", "OnGetTableSchema");
     RegisterModuleDependences("main", "OnAfterRegisterModule", "pull", "CPullOptions", "ClearCheckCache");
     RegisterModuleDependences("main", "OnAfterUnRegisterModule", "pull", "CPullOptions", "ClearCheckCache");
     if (IsModuleInstalled('intranet')) {
         RegisterModuleDependences("main", "OnAfterUserAuthorize", "pull", "CPullChannel", "OnAfterUserAuthorize");
         RegisterModuleDependences("main", "OnAfterUserLogout", "pull", "CPullChannel", "OnAfterUserLogout");
     }
     CAgent::AddAgent("CPullOptions::ClearAgent();", "pull", "N", 30, "", "Y", ConvertTimeStamp(time() + CTimeZone::GetOffset() + 30, "FULL"));
     return true;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:25,代码来源:index.php

示例7: CallBack_AddComment

 public static function CallBack_AddComment($arFields)
 {
     if (!CModule::IncludeModule('blog')) {
         return false;
     }
     $arResult = array();
     $arLog = CSocNetLog::GetList(array("ID" => "DESC"), array("TMP_ID" => $arFields["LOG_ID"]), false, false, array("ID", "SOURCE_ID", "SITE_ID", "RATING_ENTITY_ID"))->Fetch();
     if ($arLog) {
         $arIdeaPost = CBlogPost::GetById($arLog["SOURCE_ID"]);
         if ($arIdeaPost) {
             $UserIP = CBlogUser::GetUserIP();
             $IdeaCommentId = CBlogComment::Add(array("BLOG_ID" => $arIdeaPost["BLOG_ID"], "POST_ID" => $arIdeaPost["ID"], "AUTHOR_ID" => $arFields["USER_ID"], "POST_TEXT" => $arFields["MESSAGE"], "DATE_CREATE" => ConvertTimeStamp(time() + CTimeZone::GetOffset(), "FULL"), "PARENT_ID" => false, "AUTHOR_IP" => $UserIP[0], "AUTHOR_IP1" => $UserIP[1]));
             $arResult = array("SOURCE_ID" => $IdeaCommentId);
             if ($arLog["RATING_ENTITY_ID"] > 0) {
                 $arResult["RATING_TYPE_ID"] = "BLOG_COMMENT";
                 $arResult["RATING_ENTITY_ID"] = $IdeaCommentId;
             }
             if (intval($IdeaCommentId) == 0) {
                 global $APPLICATION;
                 if ($ex = $APPLICATION->GetException()) {
                     $arResult["ERROR"] = $ex->GetString();
                 }
             } else {
                 //clear cache on succcess
                 BXClearCache(True, "/" . SITE_ID . "/idea/" . $arIdeaPost["BLOG_ID"] . "/first_page/");
                 BXClearCache(True, "/" . SITE_ID . "/idea/" . $arIdeaPost["BLOG_ID"] . "/pages/");
                 BXClearCache(True, "/" . SITE_ID . "/idea/" . $arIdeaPost["BLOG_ID"] . "/comment/" . $arIdeaPost["ID"] . "/");
                 BXClearCache(True, "/" . SITE_ID . "/idea/" . $arIdeaPost["BLOG_ID"] . "/post/" . $arIdeaPost["ID"] . "/");
             }
         }
     }
     return $arResult;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:33,代码来源:idea_sonet_notify.php

示例8: InstallDB

	function InstallDB()
	{
		global $DB, $APPLICATION;

		$this->errors = false;
		if(!$DB->Query("SELECT 'x' FROM b_pull_stack", true))
			$this->errors = $DB->RunSQLBatch($_SERVER['DOCUMENT_ROOT']."/bitrix/modules/pull/install/db/".strtolower($DB->type)."/install.sql");

		if($this->errors !== false)
		{
			$APPLICATION->ThrowException(implode("", $this->errors));
			return false;
		}

		RegisterModule("pull");
		RegisterModuleDependences("main", "OnProlog", "main", "", "", 3, "/modules/pull/ajax_hit.php");
		RegisterModuleDependences("perfmon", "OnGetTableSchema", "pull", "CPullTableSchema", "OnGetTableSchema");
		RegisterModuleDependences("main", "OnAfterRegisterModule", "pull", "CPullOptions", "ClearCheckCache");
		RegisterModuleDependences("main", "OnAfterUnRegisterModule", "pull", "CPullOptions", "ClearCheckCache");

		COption::SetOptionString("pull", "path_to_listener", (CMain::IsHTTPS() ? "https" : "http")."://#DOMAIN#".(CMain::IsHTTPS() ? ":8894" : ":8893").'/bitrix/sub/');
		COption::SetOptionString("pull", "path_to_websocket", (CMain::IsHTTPS() ? "wss" : "ws")."://#DOMAIN#".(CMain::IsHTTPS() ? ":8894" : ":8893").'/bitrix/subws/');
		COption::SetOptionString("pull", "path_to_publish", 'http://127.0.0.1:8895/bitrix/pub/');
		COption::SetOptionString("pull", "websocket", 'N');
		COption::SetOptionString("pull", "nginx", 'N');
		COption::SetOptionString("pull", "push", 'N');

		CAgent::AddAgent("CPullOptions::ClearAgent();", "pull", "N", 30, "", "Y", ConvertTimeStamp(time()+CTimeZone::GetOffset()+30, "FULL"));

		return true;
	}
开发者ID:ASDAFF,项目名称:bitrix-5,代码行数:31,代码来源:index.php

示例9: SendMessage

 public static function SendMessage($ENTRY_ID, $SEND_TYPE = false)
 {
     global $DB, $APPLICATION, $USER;
     $ENTRY_ID = intval($ENTRY_ID);
     if ($ENTRY_ID <= 0) {
         return false;
     }
     $dbEntry = CTimeManEntry::GetList(array(), array("ID" => $ENTRY_ID), false, false, array("ID", "USER_ID", "DATE_START", "USER_GENDER", "INACTIVE_OR_ACTIVATED"));
     if (CModule::IncludeModule("socialnetwork") && ($arEntry = $dbEntry->Fetch())) {
         $arRights = self::GetRights($arEntry["USER_ID"]);
         if (!$arRights) {
             return false;
         }
         $date = strlen($arEntry["DATE_START"]) > 0 ? MakeTimeStamp($arEntry["DATE_START"], CSite::GetDateFormat("FULL", $site_id)) > time() + CTimeZone::GetOffset() ? $DB->CharToDateFunction($arEntry["DATE_START"], "FULL", $site_id) : $DB->CurrentTimeFunction() : $DB->CurrentTimeFunction();
         $arSoFields = array("EVENT_ID" => "timeman_entry", "=LOG_DATE" => $date, "MODULE_ID" => "timeman", "TITLE_TEMPLATE" => "#TITLE#", "TITLE" => GetMessage("TIMEMAN_NOTIFY_TITLE") . $date_text, "MESSAGE" => '', "TEXT_MESSAGE" => '', "CALLBACK_FUNC" => false, "SOURCE_ID" => $ENTRY_ID, "SITE_ID" => SITE_ID, "ENABLE_COMMENTS" => "Y", "PARAMS" => serialize(array("FORUM_ID" => COption::GetOptionInt("timeman", "report_forum_id", ""))));
         $arSoFields["ENTITY_TYPE"] = SONET_TIMEMAN_ENTRY_ENTITY;
         $arSoFields["ENTITY_ID"] = $arEntry["USER_ID"];
         $arSoFields["USER_ID"] = $USER->GetID();
         //$arEntry["USER_ID"];
         $dbRes = CSocNetLog::GetList(array(), array('ENTITY_TYPE' => $arSoFields['ENTITY_TYPE'], 'ENTITY_ID' => $arSoFields['ENTITY_ID'], 'EVENT_ID' => $arSoFields['EVENT_ID'], 'SOURCE_ID' => $arSoFields['SOURCE_ID']));
         $arRes = $dbRes->Fetch();
         $bSend = false;
         if ($arRes) {
             $logID = $arRes['ID'];
             if ($SEND_TYPE != 'A') {
                 $arSoFields["=LOG_UPDATE"] = $date;
                 CSocNetLog::Update($logID, $arSoFields);
                 $bSend = true;
                 if (IsModuleInstalled("im")) {
                     $arEntry["LOG_ID"] = $logID;
                     $arEntry["DATE_TEXT"] = FormatDate("j F", MakeTimeStamp($arEntry["DATE_START"], CSite::GetDateFormat("FULL", SITE_ID)));
                     if ($SEND_TYPE == "U") {
                         self::NotifyImApprove($arEntry);
                     } else {
                         self::NotifyImNew($arEntry);
                     }
                 }
             }
         } else {
             if ($SEND_TYPE != 'U') {
                 $logID = CSocNetLog::Add($arSoFields, false);
                 if (intval($logID) > 0) {
                     CSocNetLog::Update($logID, array("TMP_ID" => $logID));
                     CSocNetLogRights::Add($logID, $arRights);
                     if ($arEntry["INACTIVE_OR_ACTIVATED"] == "Y" && IsModuleInstalled("im")) {
                         $arEntry["LOG_ID"] = $logID;
                         $arEntry["DATE_TEXT"] = FormatDate("j F", MakeTimeStamp($arEntry["DATE_START"], CSite::GetDateFormat("FULL", SITE_ID)));
                         self::NotifyImNew($arEntry);
                     }
                     $bSend = true;
                 }
             }
         }
         if ($bSend && intval($logID) > 0) {
             CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $logID);
         }
         return $logID;
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:59,代码来源:timeman_notify.php

示例10: Add

 public static function Add($LOG_ID, $GROUP_CODE, $bShare = false, $followSet = true)
 {
     global $DB;
     if (is_array($GROUP_CODE)) {
         foreach ($GROUP_CODE as $GROUP_CODE_TMP) {
             CSocNetLogRights::Add($LOG_ID, $GROUP_CODE_TMP, $bShare, $followSet);
         }
         return false;
     } else {
         $db_events = GetModuleEvents("socialnetwork", "OnBeforeSocNetLogRightsAdd");
         while ($arEvent = $db_events->Fetch()) {
             if (ExecuteModuleEventEx($arEvent, array($LOG_ID, $GROUP_CODE)) === false) {
                 return false;
             }
         }
         $NEW_RIGHT_ID = $DB->Add("b_sonet_log_right", array("LOG_ID" => $LOG_ID, "GROUP_CODE" => $GROUP_CODE), array(), "", true);
         if ($NEW_RIGHT_ID) {
             if (preg_match('/^U(\\d+)$/', $GROUP_CODE, $matches)) {
                 if ($followSet) {
                     CSocNetLogFollow::Set($matches[1], "L" . $LOG_ID, "Y", ConvertTimeStamp(time() + CTimeZone::GetOffset(), "FULL", SITE_ID));
                 }
             } elseif ($bShare && preg_match('/^SG(\\d+)$/', $GROUP_CODE, $matches)) {
                 // get all members who unfollow and set'em unfollow from the date
                 $arUserIDToCheck = array();
                 $rsGroupMembers = CSocNetUserToGroup::GetList(array(), array("GROUP_ID" => $matches[1], "USER_ACTIVE" => "Y", "<=ROLE" => SONET_ROLES_USER), false, false, array("USER_ID"));
                 while ($arGroupMembers = $rsGroupMembers->Fetch()) {
                     $arUserIDToCheck[] = $arGroupMembers["USER_ID"];
                 }
                 if (!empty($arUserIDToCheck)) {
                     $arUserIDFollowDefault = array("Y" => array(), "N" => array());
                     $arUserIDAlreadySaved = array();
                     $default_follow_type = COption::GetOptionString("socialnetwork", "follow_default_type", "Y");
                     $rsFollow = CSocNetLogFollow::GetList(array("USER_ID" => $arUserIDToCheck, "CODE" => "**"), array("USER_ID", "TYPE"));
                     while ($arFollow = $rsFollow->Fetch()) {
                         $arUserIDFollowDefault[$arFollow["TYPE"]][] = $arFollow["USER_ID"];
                     }
                     $rsFollow = CSocNetLogFollow::GetList(array("USER_ID" => $arUserIDToCheck, "CODE" => "L" . $LOG_ID), array("USER_ID"));
                     while ($arFollow = $rsFollow->Fetch()) {
                         $arUserIDAlreadySaved[] = $arFollow["USER_ID"];
                     }
                     foreach ($arUserIDToCheck as $iUserID) {
                         // for them who not followed by default and not already saved follow/unfollow for the log entry
                         if (!in_array($iUserID, $arUserIDAlreadySaved) && ($default_follow_type == "N" && !in_array($iUserID, $arUserIDFollowDefault["Y"]) || $default_follow_type == "Y" && in_array($iUserID, $arUserIDFollowDefault["N"]))) {
                             CSocNetLogFollow::Add($iUserID, "L" . $LOG_ID, "N", ConvertTimeStamp(time() + CTimeZone::GetOffset(), "FULL", SITE_ID));
                         }
                     }
                 }
             }
         }
         if (defined("BX_COMP_MANAGED_CACHE")) {
             $GLOBALS["CACHE_MANAGER"]->ClearByTag("SONET_LOG_" . intval($LOG_ID));
         }
         return $NEW_RIGHT_ID;
     }
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:55,代码来源:log_rights.php

示例11: getTimeZoneId

 public static function getTimeZoneId($userId = null, $date = null)
 {
     $dateKey = $date === null ? 0 : $date;
     $userIdKey = $userId === null ? 0 : $userId;
     if ($userId === null) {
         $userId = $GLOBALS["USER"]->GetId();
     }
     static $timezoneCache = array();
     if (isset($timezoneCache[$userIdKey]) && isset($timezoneCache[$userIdKey][$dateKey])) {
         return $timezoneCache[$userIdKey][$dateKey];
     }
     $autoTimeZone = $userZone = '';
     $factOffset = 0;
     if ($date === null) {
         $date = time();
     }
     static $userCache = array();
     if ($userId === null) {
         $autoTimeZone = trim($GLOBALS["USER"]->GetParam("AUTO_TIME_ZONE"));
         $userZone = $GLOBALS["USER"]->GetParam("TIME_ZONE");
     } else {
         if (!isset($userCache[$userId])) {
             $dbUser = CUser::GetByID($userId);
             if ($arUser = $dbUser->Fetch()) {
                 $userCache[$userId] = array("AUTO_TIME_ZONE" => trim($arUser["AUTO_TIME_ZONE"]), "TIME_ZONE" => $arUser["TIME_ZONE"], "TIME_ZONE_OFFSET" => $arUser["TIME_ZONE_OFFSET"]);
             }
         }
         if (isset($userCache[$userId])) {
             $autoTimeZone = $userCache[$userId]["AUTO_TIME_ZONE"];
             $userZone = $userCache[$userId]["TIME_ZONE"];
             $factOffset = $userCache[$userId]["TIME_ZONE_OFFSET"];
         }
     }
     if (CTimeZone::IsAutoTimeZone($autoTimeZone)) {
         static $userOffsetCache = array();
         if (!isset($userOffsetCache[$userId === null ? 0 : $userId])) {
             $userOffsetCache[$userIdKey] = CTimeZone::GetOffset($userId);
         }
         $userOffset = $userOffsetCache[$userIdKey];
         $localTime = new DateTime();
         $localOffset = $localTime->getOffset();
         $timezoneCache[$userIdKey][$dateKey] = CDavICalendarTimeZone::getTimezoneByOffset($date, $userOffset + $localOffset);
     } else {
         if ($userZone != '' && isset(self::$arTimeZones[$userZone])) {
             $timezoneCache[$userIdKey][$dateKey] = $userZone;
         } else {
             $localTime = new DateTime();
             $localOffset = $localTime->getOffset();
             $timezoneCache[$userIdKey][$dateKey] = CDavICalendarTimeZone::getTimezoneByOffset($date, $factOffset + $localOffset);
         }
     }
     return $timezoneCache[$userIdKey][$dateKey];
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:53,代码来源:icalendartimezone.php

示例12: GetNextStartDate

 function GetNextStartDate($CHANNEL_ID)
 {
     global $DB;
     $err_mess = CVote::err_mess() . "<br>Function: GetNextStartDate<br>Line: ";
     $CHANNEL_ID = intval($CHANNEL_ID);
     $strSql = "\n\t\t\tSELECT\n\t\t\t\t" . $DB->DateToCharFunction("max(DATE_ADD(DATE_END, INTERVAL 1 SECOND))") . " MIN_DATE_START\n\t\t\tFROM\n\t\t\t\tb_vote\n\t\t\tWHERE\n\t\t\t\tCHANNEL_ID = '{$CHANNEL_ID}'\n\t\t\t";
     $z = $DB->Query($strSql, false, $err_mess . __LINE__);
     $zr = $z->Fetch();
     if (strlen($zr["MIN_DATE_START"]) <= 0) {
         return GetTime(time() + CTimeZone::GetOffset(), "FULL");
     } else {
         return $zr["MIN_DATE_START"];
     }
 }
开发者ID:Satariall,项目名称:izurit,代码行数:14,代码来源:vote.php

示例13: checkAction

 function checkAction($event)
 {
     $arActionID = array();
     $rsTriggers = CFTrigger::GetList($by = "s_today_hits", $order = "desc", array("EVENT_ID" => $event["ID"]));
     while ($arTrigger = $rsTriggers->GetNext()) {
         $TriggerList[] = $arTrigger;
         $returnValue = unserialize(base64_decode($arTrigger["ACTION_ID"]));
         if (is_array($returnValue)) {
             $arActionID = array_merge($returnValue, $arActionID);
         } else {
             $arActionID[] = $arTrigger["ACTION_ID"];
         }
         $TriggerActionList[$arTrigger["ID"]][] = $returnValue;
     }
     if (!empty($arActionID)) {
         $ActionTypesID = array();
         $rsActions = CFTriggerActions::GetList($order, $by, array("ID" => $arActionID));
         while ($arAction = $rsActions->GetNext()) {
             $ActionList[$arAction["ID"]] = $arAction;
         }
         $rsActionTypes = CFTriggerActionTypes::GetList();
         while ($arActionType = $rsActionTypes->GetNext()) {
             $arActionTypeList[$arActionType["ID"]] = $arActionType["CODE"];
         }
         if (!empty($ActionList)) {
             foreach ($TriggerActionList as $key => $triggerAction) {
                 foreach ($triggerAction as $actionID) {
                     if (is_array($actionID)) {
                         foreach ($actionID as $k => $value) {
                             if (intval($ActionList[$value]["ACTION_TYPE"]) > 0 && isset($arActionTypeList[$ActionList[$value]["ACTION_TYPE"]])) {
                                 //Проверяем и выполняем действие
                                 CFoodclubEventDoAction::doAction(array("ID" => $ActionList[$value]["ID"], "NAME" => $ActionList[$value]["NAME"], "ACTION_TYPE" => $ActionList[$value]["ACTION_TYPE"], "ACTION_CODE" => $arActionTypeList[$ActionList[$value]["ACTION_TYPE"]], "ADDITIONAL_PROPS" => $ActionList[$value]["ADDITIONAL_PROPS"], "BODY_PARAMS" => $ActionList[$value]["BODY_PARAMS"]));
                                 //Заносим в журнал
                                 CFTriggerLog::Add(array("NAME" => $ActionList[$value]["NAME"], "TRIGGER_ID" => $key, "DATE_CREATE" => ConvertTimeStamp(time() + CTimeZone::GetOffset(), "FULL"), "CREATED_BY" => CUser::GetID()));
                             }
                         }
                     } else {
                         if (intval($ActionList[$actionID]["ACTION_TYPE"]) > 0 && isset($arActionTypeList[$ActionList[$actionID]["ACTION_TYPE"]])) {
                             //Проверяем и выполняем действие
                             CFoodclubEventDoAction::doAction(array("ID" => $ActionList[$actionID]["ID"], "NAME" => $ActionList[$actionID]["NAME"], "ACTION_TYPE" => $ActionList[$actionID]["ACTION_TYPE"], "ACTION_CODE" => $arActionTypeList[$ActionList[$actionID]["ACTION_TYPE"]], "ADDITIONAL_PROPS" => $ActionList[$actionID]["ADDITIONAL_PROPS"], "BODY_PARAMS" => $ActionList[$actionID]["BODY_PARAMS"]));
                             //Заносим в журнал
                             CFTriggerLog::Add(array("NAME" => $ActionList[$actionID]["NAME"], "TRIGGER_ID" => $key, "DATE_CREATE" => ConvertTimeStamp(time() + CTimeZone::GetOffset(), "FULL"), "CREATED_BY" => CUser::GetID()));
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:ASDAFF,项目名称:trigger-module,代码行数:49,代码来源:DoActionClass.php

示例14: createAlbum

 /**
  * Creates new section in iblock
  * @param $arParams
  * @param $arResult
  * @param $name
  * @return bool|int
  */
 public static function createAlbum($arParams, $arResult, &$name)
 {
     if (!CModule::IncludeModule("iblock")) {
         return false;
     }
     $name = trim($name);
     $name = strlen($name) > 0 ? $name : GetMessage("P_NEW_ALBUM");
     $name = strlen($name) > 0 ? $name : "New album";
     $arFields = array("ACTIVE" => "Y", "IBLOCK_ID" => $arParams["IBLOCK_ID"], "IBLOCK_SECTION_ID" => $arParams["BEHAVIOUR"] == "USER" ? $arResult["GALLERY"]["ID"] : 0, "DATE" => ConvertTimeStamp(time() + CTimeZone::GetOffset()), "UF_DATE" => ConvertTimeStamp(time() + CTimeZone::GetOffset()), "NAME" => $name);
     $GLOBALS["UF_DATE"] = $arFields["UF_DATE"];
     $bs = new CIBlockSection();
     $GLOBALS["USER_FIELD_MANAGER"]->EditFormAddFields("IBLOCK_" . $arParams["IBLOCK_ID"] . "_SECTION", $arFields);
     $ID = $bs->Add($arFields);
     if ($ID > 0) {
         CIBlockSection::ReSort($arParams["IBLOCK_ID"]);
         $arPropertiesNeed = array();
         // Array of properties to create
         foreach ($arParams['converters'] as $val) {
             if ($val['code'] == "real_picture" || $val['code'] == "thumbnail") {
                 continue;
             }
             $db_res = CIBlock::GetProperties($arParams["IBLOCK_ID"], array(), array("CODE" => $val['code']));
             if (!($db_res && ($res = $db_res->Fetch()))) {
                 $arPropertiesNeed[] = $val['code'];
             }
         }
         if (count($arPropertiesNeed) > 0) {
             $obProperty = new CIBlockProperty();
             foreach ($arPropertiesNeed as $key) {
                 $res = $obProperty->Add(array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "ACTIVE" => "Y", "PROPERTY_TYPE" => "F", "MULTIPLE" => "N", "NAME" => strLen(GetMessage("P_" . strToUpper($key))) > 0 ? GetMessage("P_" . strToUpper($key)) : strToUpper($key), "CODE" => strToUpper($key), "FILE_TYPE" => "jpg, gif, bmp, png, jpeg"));
             }
         }
         // Check Public property
         $arPropertiesNeed = array();
         foreach (array("PUBLIC_ELEMENT", "APPROVE_ELEMENT") as $key) {
             $db_res = CIBlock::GetProperties($arParams["IBLOCK_ID"], array(), array("CODE" => $key));
             if (!$db_res || !($res = $db_res->Fetch())) {
                 $arPropertiesNeed[] = $key;
             }
         }
         if (count($arPropertiesNeed) > 0) {
             $obProperty = new CIBlockProperty();
             foreach ($arPropertiesNeed as $key) {
                 $obProperty->Add(array("IBLOCK_ID" => $arParams["IBLOCK_ID"], "ACTIVE" => "Y", "PROPERTY_TYPE" => "S", "MULTIPLE" => "N", "NAME" => strLen(GetMessage("P_" . $key)) > 0 ? GetMessage("P_" . $key) : $key, "DEFAULT_VALUE" => "N", "CODE" => $key));
             }
         }
     }
     return $ID > 0 ? $ID : false;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:56,代码来源:functions.php

示例15: Update

 public static function Update($params)
 {
     if (isset($params['DATE_CREATE'])) {
         $params['DATE_CREATE'] = $params['DATE_CREATE'] ? ConvertTimeStamp($params['DATE_CREATE'] + CTimeZone::GetOffset() + date("Z"), 'SHORT') : '';
         COption::SetOptionString("voximplant", "phone_order_date_create", $params['DATE_CREATE']);
     }
     if (isset($params['DATE_MODIFY'])) {
         $params['DATE_MODIFY'] = $params['DATE_MODIFY'] ? ConvertTimeStamp($params['DATE_MODIFY'] + CTimeZone::GetOffset() + date("Z"), 'SHORT') : '';
         COption::SetOptionString("voximplant", "phone_order_date_modify", $params['DATE_MODIFY']);
     }
     if (isset($params['OPERATOR_STATUS'])) {
         COption::SetOptionString("voximplant", "phone_order_operator_status", $params['OPERATOR_STATUS']);
     }
     if (isset($params['OPERATOR_CONTRACT'])) {
         COption::SetOptionString("voximplant", "phone_order_operator_contract", $params['OPERATOR_CONTRACT']);
     }
     return false;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:18,代码来源:vi_phone_order.php


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