本文整理汇总了PHP中CSite::GetDateFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP CSite::GetDateFormat方法的具体用法?PHP CSite::GetDateFormat怎么用?PHP CSite::GetDateFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSite
的用法示例。
在下文中一共展示了CSite::GetDateFormat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: OrderBasket
/**
*
* return array() BasketList - experation - Send Order
**/
public static function OrderBasket($experation = NULL,$sort = array("ID" => "ASC"), $limit = NULL){
global $DB;
$arItems = array();
if(! $experation){
$experation = 30*24*60*60;
}
$time = date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL", SITE_ID)), time() - $experation);
$arPages = false;
if(! empty($limit)){
$arPages = array('nTopCount' => $limit);
}
$arFilter = array('>=DATE_UPDATE' => $time,
"ORDER_ID" => true,
"CAN_BUY" => "Y");
$arSelect = array("ID", "USER_ID", "PRODUCT_ID", "CAN_BUY", "DELAY", "SUBSCRIBE", "QUANTITY","DATE_UPDATE","DETAIL_PAGE_URL");
$dbBasketList = CSaleBasket::GetList(
$sort,
$arFilter,
false,
$arPages,
$arSelect
);
while($_arItems = $dbBasketList->Fetch()){
$arItems[] = $_arItems;
}
return $arItems;
}
示例3: getAllDiscountByID
/**
* get all discount by product id
*/
function getAllDiscountByID($PRODUCT_ID)
{
global $DB;
global $APPLICATION;
$dbProductDiscounts = CCatalogDiscount::GetList(array("SORT" => "ASC"), array("+PRODUCT_ID" => $PRODUCT_ID, "ACTIVE" => "Y", "!>ACTIVE_FROM" => $DB->FormatDate(date("Y-m-d H:i:s"), "YYYY-MM-DD HH:MI:SS", CSite::GetDateFormat("FULL")), "!<ACTIVE_TO" => $DB->FormatDate(date("Y-m-d H:i:s"), "YYYY-MM-DD HH:MI:SS", CSite::GetDateFormat("FULL")), "COUPON" => ""), false, false, array("ID", "SITE_ID", "ACTIVE", "ACTIVE_FROM", "ACTIVE_TO", "RENEWAL", "NAME", "SORT", "MAX_DISCOUNT", "VALUE_TYPE", "VALUE", "CURRENCY", "PRODUCT_ID"));
$arrAllDiscounts = array();
while ($arProductDiscounts = $dbProductDiscounts->Fetch()) {
$arrAllDiscounts[] = $arProductDiscounts;
}
return $arrAllDiscounts;
}
示例4: DoProcessOrder
static function DoProcessOrder(&$arOrder, $arOptions, &$arErrors)
{
global $DB;
if (!array_key_exists("COUNT_DISCOUNT_4_ALL_QUANTITY", $arOptions)) {
$arOptions["COUNT_DISCOUNT_4_ALL_QUANTITY"] = COption::GetOptionString("sale", "COUNT_DISCOUNT_4_ALL_QUANTITY", "N");
}
$arMinDiscount = null;
$allSum = 0;
foreach ($arOrder["BASKET_ITEMS"] as $arItem) {
$allSum += $arItem["PRICE"] * $arItem["QUANTITY"];
}
$dblMinPrice = $allSum;
$dbDiscount = CSaleDiscount::GetList(array("SORT" => "ASC"), array("LID" => $arOrder["SITE_ID"], "ACTIVE" => "Y", "!>ACTIVE_FROM" => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL"))), "!<ACTIVE_TO" => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL"))), "<=PRICE_FROM" => $arOrder["ORDER_PRICE"], ">=PRICE_TO" => $arOrder["ORDER_PRICE"], "USER_GROUPS" => CUser::GetUserGroup($arOrder["USER_ID"])), false, false, array("*"));
while ($arDiscount = $dbDiscount->Fetch()) {
$dblDiscount = 0;
if ($arDiscount["DISCOUNT_TYPE"] == "P") {
if ($arOptions["COUNT_DISCOUNT_4_ALL_QUANTITY"] == "Y") {
foreach ($arOrder["BASKET_ITEMS"] as $arItem) {
$dblDiscount += roundEx($arItem["PRICE"] * $arItem["QUANTITY"] * $arDiscount["DISCOUNT_VALUE"] / 100, SALE_VALUE_PRECISION);
}
} else {
foreach ($arOrder["BASKET_ITEMS"] as $arItem) {
$dblDiscount += roundEx(roundEx($arItem["PRICE"] * $arDiscount["DISCOUNT_VALUE"] / 100, SALE_VALUE_PRECISION) * $arItem["QUANTITY"], SALE_VALUE_PRECISION);
}
}
} else {
$dblDiscount = roundEx(CCurrencyRates::ConvertCurrency($arDiscount["DISCOUNT_VALUE"], $arDiscount["CURRENCY"], $arOrder["CURRENCY"]), SALE_VALUE_PRECISION);
}
if ($dblMinPrice > $allSum - $dblDiscount) {
$dblMinPrice = $allSum - $dblDiscount;
$arMinDiscount = $arDiscount;
}
}
if ($arMinDiscount != null) {
if ($arMinDiscount["DISCOUNT_TYPE"] == "P") {
$arOrder["DISCOUNT_PERCENT"] = $arMinDiscount["DISCOUNT_VALUE"];
foreach ($arOrder["BASKET_ITEMS"] as &$arItem) {
if ($arOptions["COUNT_DISCOUNT_4_ALL_QUANTITY"] == "Y") {
$curDiscount = roundEx($arItem["PRICE"] * $arItem["QUANTITY"] * $arMinDiscount["DISCOUNT_VALUE"] / 100, SALE_VALUE_PRECISION);
$arOrder["DISCOUNT_PRICE"] += $curDiscount;
} else {
$curDiscount = roundEx($arItem["PRICE"] * $arMinDiscount["DISCOUNT_VALUE"] / 100, SALE_VALUE_PRECISION);
$arOrder["DISCOUNT_PRICE"] += roundEx($curDiscount * $arItem["QUANTITY"], SALE_VALUE_PRECISION);
}
//$arItem["DISCOUNT_PRICE"] = $arItem["PRICE"] - $curDiscount;
}
} else {
$arOrder["DISCOUNT_PRICE"] = CCurrencyRates::ConvertCurrency($arMinDiscount["DISCOUNT_VALUE"], $arMinDiscount["CURRENCY"], $arOrder["CURRENCY"]);
$arOrder["DISCOUNT_PRICE"] = roundEx($arOrder["DISCOUNT_PRICE"], SALE_VALUE_PRECISION);
}
}
}
示例5: add
public function add($data, $parameters = array())
{
global $DB, $USER;
$result = array();
if (!$USER->IsAuthorized()) {
throw new Tasks\Exception("Authentication is required.");
}
$title = isset($data["title"]) ? trim($data["title"]) : "";
$responsible = isset($data["responsible"]) ? intval($data["responsible"]) : $USER->GetID();
$deadline = isset($data["deadline"]) && $DB->FormatDate($data["deadline"], \CSite::GetDateFormat("FULL")) ? $data["deadline"] : "";
$description = isset($data["description"]) ? trim($data["description"]) : "";
$project = isset($data["project"]) ? intval($data["project"]) : 0;
$nameTemplate = isset($data["nameTemplate"]) ? trim($data["nameTemplate"]) : "";
$ganttMode = isset($data["ganttMode"]) && $data["ganttMode"] === "true";
if (strlen($nameTemplate) > 0) {
preg_match_all("/(#NAME#)|(#NOBR#)|(#\\/NOBR#)|(#LAST_NAME#)|(#SECOND_NAME#)|(#NAME_SHORT#)|(#SECOND_NAME_SHORT#)|\\s|\\,/", $nameTemplate, $matches);
$nameTemplate = implode("", $matches[0]);
} else {
$nameTemplate = \CSite::GetNameFormat(false);
}
$fields = array("TITLE" => $title, "DESCRIPTION" => $description, "RESPONSIBLE_ID" => $responsible, "DEADLINE" => $deadline, "SITE_ID" => $data["siteId"], "GROUP_ID" => $project, "NAME_TEMPLATE" => $nameTemplate, 'DESCRIPTION_IN_BBCODE' => "Y");
$taskItem = \CTaskItem::add($fields, $USER->GetId());
$task = $taskItem->getData();
$task["GROUP_NAME"] = "";
if ($task["GROUP_ID"]) {
$socGroup = \CSocNetGroup::GetByID($task["GROUP_ID"]);
if ($socGroup) {
$task["GROUP_NAME"] = $socGroup["~NAME"];
}
}
\Bitrix\Main\FinderDestTable::merge(array("CONTEXT" => "TASK_RESPONSIBLE", "CODE" => array("U" . $task["RESPONSIBLE_ID"], "SG" . $task["GROUP_ID"])));
$taskId = $taskItem->getId();
$arPaths = array("PATH_TO_TASKS_TASK" => isset($data["pathToTask"]) ? trim($data["pathToTask"]) : "", "PATH_TO_USER_PROFILE" => isset($data["pathToUser"]) ? trim($data["pathToUser"]) : "", "PATH_TO_USER_TASKS_TASK" => isset($data["pathToUserTasksTask"]) ? trim($data["pathToUserTasksTask"]) : "");
$columnsOrder = null;
if (isset($data["columnsOrder"]) && is_array($data["columnsOrder"])) {
$columnsOrder = array_map("intval", $data["columnsOrder"]);
}
$order = isset($data["order"]) && checkSerializedData($data["order"]) ? unserialize($data["order"]) : array();
$filter = isset($data["filter"]) && checkSerializedData($data["filter"]) ? unserialize($data["filter"]) : array();
$navigation = isset($data["navigation"]) && checkSerializedData($data["navigation"]) ? unserialize($data["navigation"]) : array();
$select = isset($data["select"]) && checkSerializedData($data["select"]) ? unserialize($data["select"]) : array();
$result["taskRaw"] = $task;
$result["taskId"] = $task["ID"];
$result["taskPath"] = \CComponentEngine::MakePathFromTemplate($arPaths["PATH_TO_TASKS_TASK"], array("task_id" => $task["ID"], "action" => "view"));
$result["position"] = $this->getTaskPosition($taskId, $order, $filter, $navigation, $select);
if ($ganttMode) {
$result["task"] = $this->getJson($task, $arPaths, $nameTemplate);
} else {
$result["html"] = $this->getHtml($task, $arPaths, $nameTemplate, $columnsOrder);
}
return $result;
}
示例6: getNearestEntities
public static function getNearestEntities($entityID, $currentDate, $startDate = '', $responsibleID = 0, $intervalInDays = 7, $checkPermissions = true, $limit = 5)
{
if (!is_string($startDate) || $startDate === '') {
$startDate = $currentDate;
}
$site = new \CSite();
$dateFormat = $site->GetDateFormat('SHORT');
$curretTime = $currentDate !== '' ? MakeTimeStamp($currentDate, $dateFormat) : false;
$startTime = $startDate !== '' ? MakeTimeStamp($startDate, $dateFormat) : false;
if ($startTime === false) {
return array();
}
$dt = new \DateTime();
$dt->setTimestamp($startTime);
$dt->add(new \DateInterval("P{$intervalInDays}D"));
$endTime = $dt->getTimeStamp();
$currentSorting = self::internalPrepareSorting($curretTime);
$startSorting = self::internalPrepareSorting($startTime);
$endSorting = self::internalPrepareSorting($endTime);
$result = array();
if ($entityID === \CCrmOwnerType::Lead) {
$filter = array('>=BIRTHDAY_SORT' => $startSorting, '<=BIRTHDAY_SORT' => $endSorting, 'CHECK_PERMISSIONS' => $checkPermissions ? 'Y' : 'N');
if ($responsibleID > 0) {
$filter['=ASSIGNED_BY_ID'] = $responsibleID;
}
$dbResult = \CCrmLead::GetListEx(array(), $filter, false, array('nTopCount' => $limit), array('ID', 'BIRTHDATE', 'BIRTHDAY_SORT', 'HONORIFIC', 'NAME', 'SECOND_NAME', 'LAST_NAME'));
while ($fields = $dbResult->Fetch()) {
$fields['ENTITY_TYPE_ID'] = \CCrmOwnerType::Lead;
$fields['IMAGE_ID'] = 0;
$sorting = isset($fields['BIRTHDAY_SORT']) ? (int) $fields['BIRTHDAY_SORT'] : 512;
$fields['IS_BIRTHDAY'] = $sorting === $currentSorting;
$result[] = $fields;
}
} elseif ($entityID === \CCrmOwnerType::Contact) {
$filter = array('>=BIRTHDAY_SORT' => $startSorting, '<=BIRTHDAY_SORT' => $endSorting, 'CHECK_PERMISSIONS' => $checkPermissions ? 'Y' : 'N');
if ($responsibleID > 0) {
$filter['=ASSIGNED_BY_ID'] = $responsibleID;
}
$dbResult = \CCrmContact::GetListEx(array(), $filter, false, array('nTopCount' => $limit), array('ID', 'BIRTHDATE', 'BIRTHDAY_SORT', 'HONORIFIC', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'PHOTO'));
while ($fields = $dbResult->Fetch()) {
$fields['ENTITY_TYPE_ID'] = \CCrmOwnerType::Contact;
$fields['IMAGE_ID'] = isset($fields['PHOTO']) ? (int) $fields['PHOTO'] : 0;
$sorting = isset($fields['BIRTHDAY_SORT']) ? (int) $fields['BIRTHDAY_SORT'] : 512;
$fields['IS_BIRTHDAY'] = $sorting === $currentSorting;
$result[] = $fields;
}
}
return $result;
}
示例7: DoProcessOrder
public static function DoProcessOrder(&$arOrder, $arOptions, &$arErrors)
{
global $DB;
if (!array_key_exists("COUNT_DISCOUNT_4_ALL_QUANTITY", $arOptions)) {
$arOptions["COUNT_DISCOUNT_4_ALL_QUANTITY"] = COption::GetOptionString("sale", "COUNT_DISCOUNT_4_ALL_QUANTITY", "N");
}
$arIDS = array();
$rsDiscountIDs = CSaleDiscount::GetDiscountGroupList(array(), array('GROUP_ID' => CUser::GetUserGroup($arOrder["USER_ID"])), false, false, array('DISCOUNT_ID'));
while ($arDiscountID = $rsDiscountIDs->Fetch()) {
$arDiscountID['DISCOUNT_ID'] = intval($arDiscountID['DISCOUNT_ID']);
if (0 < $arDiscountID['DISCOUNT_ID']) {
$arIDS[] = $arDiscountID['DISCOUNT_ID'];
}
}
if (!empty($arIDS)) {
$arIDS = array_values(array_unique($arIDS));
$rsDiscounts = CSaleDiscount::GetList(array("PRIORITY" => "DESC", "SORT" => "ASC"), array('ID' => $arIDS, "LID" => $arOrder["SITE_ID"], "ACTIVE" => "Y", "!>ACTIVE_FROM" => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL"))), "!<ACTIVE_TO" => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")))), false, false, array("ID", "PRIORITY", "LAST_DISCOUNT", "UNPACK", "APPLICATION"));
while ($arDiscount = $rsDiscounts->Fetch()) {
if (self::__Unpack($arOrder, $arDiscount['UNPACK'])) {
self::__ApplyActions($arOrder, $arDiscount['APPLICATION']);
}
if ('Y' == $arDiscount['LAST_DISCOUNT']) {
break;
}
}
$arOrder["ORDER_PRICE"] = 0;
$arOrder["ORDER_WEIGHT"] = 0;
$arOrder["USE_VAT"] = false;
$arOrder["VAT_RATE"] = 0;
$arOrder["VAT_SUM"] = 0;
$arOrder["DISCOUNT_PRICE"] = 0.0;
$arOrder["DISCOUNT_VALUE"] = $arOrder["DISCOUNT_PRICE"];
$arOrder["DELIVERY_PRICE"] = $arOrder["PRICE_DELIVERY"];
foreach ($arOrder['BASKET_ITEMS'] as &$arShoppingCartItem) {
$arOrder["ORDER_PRICE"] += $arShoppingCartItem["PRICE"] * $arShoppingCartItem["QUANTITY"];
$arOrder["ORDER_WEIGHT"] += $arShoppingCartItem["WEIGHT"] * $arShoppingCartItem["QUANTITY"];
if ($arShoppingCartItem["VAT_RATE"] > 0) {
$arOrder["USE_VAT"] = true;
if ($arShoppingCartItem["VAT_RATE"] > $arOrder["VAT_RATE"]) {
$arOrder["VAT_RATE"] = $arShoppingCartItem["VAT_RATE"];
}
$arOrder["VAT_SUM"] += $arShoppingCartItem["VAT_VALUE"] * $arShoppingCartItem["QUANTITY"];
}
}
if (isset($arShoppingCartItem)) {
unset($arShoppingCartItem);
}
}
}
示例8: CheckAccess
function CheckAccess($userID, $itemMD5, $periodLength, $periodType)
{
global $DB;
$userID = IntVal($userID);
if ($userID <= 0) {
return false;
}
$itemMD5 = Trim($itemMD5);
if (strlen($itemMD5) <= 0) {
return false;
}
$periodLength = IntVal($periodLength);
if ($periodLength <= 0) {
return False;
}
$periodType = Trim($periodType);
$periodType = ToUpper($periodType);
if (strlen($periodType) <= 0) {
return False;
}
$checkVal = 0;
if ($periodType == "I") {
$checkVal = mktime(date("H"), date("i") - $periodLength, date("s"), date("m"), date("d"), date("Y"));
} elseif ($periodType == "H") {
$checkVal = mktime(date("H") - $periodLength, date("i"), date("s"), date("m"), date("d"), date("Y"));
} elseif ($periodType == "D") {
$checkVal = mktime(date("H"), date("i"), date("s"), date("m"), date("d") - $periodLength, date("Y"));
} elseif ($periodType == "W") {
$checkVal = mktime(date("H"), date("i"), date("s"), date("m"), date("d") - 7 * $periodLength, date("Y"));
} elseif ($periodType == "M") {
$checkVal = mktime(date("H"), date("i"), date("s"), date("m") - $periodLength, date("d"), date("Y"));
} elseif ($periodType == "Q") {
$checkVal = mktime(date("H"), date("i"), date("s"), date("m") - 3 * $periodLength, date("d"), date("Y"));
} elseif ($periodType == "S") {
$checkVal = mktime(date("H"), date("i"), date("s"), date("m") - 6 * $periodLength, date("d"), date("Y"));
} elseif ($periodType == "Y") {
$checkVal = mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y") - $periodLength);
}
if ($checkVal <= 0) {
return False;
}
$dbAuxiliary = CSaleAuxiliary::GetList(array(), array("USER_ID" => $userID, "ITEM_MD5" => $itemMD5, ">=DATE_INSERT" => Date($GLOBALS["DB"]->DateFormatToPHP(CSite::GetDateFormat("FULL", SITE_ID)), $checkVal)), false, false, array("*"));
if ($arAuxiliary = $dbAuxiliary->Fetch()) {
return $arAuxiliary;
}
return false;
}
示例9: SyncModifyTaskItem
public static function SyncModifyTaskItem($arModifyEventArray)
{
global $DB;
$ID = $arModifyEventArray["ID"];
$arFields = array("RESPONSIBLE_ID" => $arModifyEventArray["USER_ID"], "SITE_ID" => SITE_ID, "EXCHANGE_ID" => $arModifyEventArray["XML_ID"], "EXCHANGE_MODIFIED" => $arModifyEventArray["MODIFICATION_LABEL"], "TITLE" => $arModifyEventArray["SUBJECT"], "DESCRIPTION" => $arModifyEventArray["BODY"], "CREATED_DATE" => $arModifyEventArray["DATE_CREATE"], "PRIORITY" => self::$PriorityMapping[strtolower($arModifyEventArray["IMPORTANCE"])], "DURATION_FACT" => ceil($arModifyEventArray["ACTUAL_WORK"] / 60), "START_DATE_PLAN" => $arModifyEventArray["START_DATE"], "DEADLINE" => $arModifyEventArray["DUE_DATE"], "STATUS" => self::$StatusMapping[strtolower($arModifyEventArray["STATUS"])], "DURATION_PLAN" => ceil($arModifyEventArray["TOTAL_WORK"] / 60), "DURATION_TYPE" => "hours");
$arExtraFields = array();
if (isset($arModifyEventArray['ExtendedProperty']) && is_array($arModifyEventArray['ExtendedProperty'])) {
foreach ($arModifyEventArray['ExtendedProperty'] as $arExtendedProperty) {
$arExtraFields[$arExtendedProperty['Name']] = $arExtendedProperty['Value'];
}
}
if ($ID == 0) {
$arFields["STATUS_CHANGED_BY"] = $arFields["CHANGED_BY"] = $arFields["CREATED_BY"] = $arFields["RESPONSIBLE_ID"];
$arFields["STATUS_CHANGED_DATE"] = $arFields["CHANGED_DATE"] = $arFields["CREATED_DATE"];
$ID = $DB->Add("b_tasks", $arFields, array("DESCRIPTION"), "tasks");
if ($ID) {
$arFields["ID"] = $ID;
CTaskNotifications::SendAddMessage($arFields);
$arLogFields = array("TASK_ID" => $ID, "USER_ID" => $arFields["CREATED_BY"], "CREATED_DATE" => $arFields["CREATED_DATE"], "FIELD" => "NEW");
$log = new CTaskLog();
$log->Add($arLogFields);
}
} else {
$strUpdate = $DB->PrepareUpdate("b_tasks", $arFields, "tasks");
$strSql = "UPDATE b_tasks SET " . $strUpdate . " WHERE ID=" . $ID;
$arBinds = array('DESCRIPTION' => $arFields['DESCRIPTION']);
$result = $DB->QueryBind($strSql, $arBinds, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if ($result) {
$rsTask = CTasks::GetByID($ID, false);
if ($arTask = $rsTask->Fetch()) {
$arFields["CHANGED_BY"] = $arFields["RESPONSIBLE_ID"];
$arFields["CHANGED_DATE"] = date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), time() + CTimeZone::GetOffset());
CTaskNotifications::SendUpdateMessage($arFields, $arTask);
$arChanges = CTaskLog::GetChanges($arTask, $arFields);
foreach ($arChanges as $key => $value) {
$arLogFields = array("TASK_ID" => $ID, "USER_ID" => $arFields["CHANGED_BY"], "CREATED_DATE" => $arFields["CHANGED_DATE"], "FIELD" => $key, "FROM_VALUE" => $value["FROM_VALUE"], "TO_VALUE" => $value["TO_VALUE"]);
$log = new CTaskLog();
$log->Add($arLogFields);
}
}
}
}
}
示例10: CheckFilter
function CheckFilter()
{
$str = "";
if (strlen($_REQUEST["find_timestamp_x_1"]) > 0) {
if (!CheckDateTime($_REQUEST["find_timestamp_x_1"], CSite::GetDateFormat("FULL"))) {
$str .= GetMessage("MAIN_EVENTLOG_WRONG_TIMESTAMP_X_FROM") . "<br>";
}
}
if (strlen($_REQUEST["find_timestamp_x_2"]) > 0) {
if (!CheckDateTime($_REQUEST["find_timestamp_x_2"], CSite::GetDateFormat("FULL"))) {
$str .= GetMessage("MAIN_EVENTLOG_WRONG_TIMESTAMP_X_TO") . "<br>";
}
}
if (strlen($str) > 0) {
global $lAdmin;
$lAdmin->AddFilterError($str);
return false;
}
return true;
}
示例11: array
if (count($arNewDep) > 0) {
$dbRes = CIBlockSection::GetList(array('SORT' => 'ASC'), array('ID' => $arNewDep));
while ($arSect = $dbRes->Fetch()) {
$arDepCache[] = $arSect['ID'];
$arDepCacheValue[$arSect['ID']] = $arSect['NAME'];
}
}
foreach ($arUser['UF_DEPARTMENT'] as $key => $sect) {
$arDep[$sect] = $arDepCacheValue[$sect];
}
}
$arUser['UF_DEPARTMENT'] = $arDep;
$arUser["DETAIL_URL"] = $arItem["URL"];
$arUser['IS_ONLINE'] = $bSoNet && $arUser['IS_ONLINE'] == "Y";
if ($arUser['PERSONAL_BIRTHDAY']) {
$arBirthDate = ParseDateTime($arUser['PERSONAL_BIRTHDAY'], CSite::GetDateFormat('SHORT'));
$arUser['IS_BIRTHDAY'] = intval($arBirthDate['MM']) == date('n') && intval($arBirthDate['DD']) == date('j');
}
$arUser['IS_FEATURED'] = CIntranetUtils::IsUserHonoured($arUser['ID']);
$arUser['IS_ABSENT'] = CIntranetUtils::IsUserAbsent($arUser['ID']);
$arResult["SEARCH"][$i]["USER"] = $arUser;
}
}
}
$arResult['USER_PROP'] = array();
$arRes = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("USER", 0, LANGUAGE_ID);
if (!empty($arRes)) {
foreach ($arRes as $key => $val) {
$arResult['USER_PROP'][$val["FIELD_NAME"]] = strLen($val["EDIT_FORM_LABEL"]) > 0 ? $val["EDIT_FORM_LABEL"] : $val["FIELD_NAME"];
}
}
示例12: urlencode
$arResult["order"]["~topic"] = $APPLICATION->GetCurPageParam("q=" . urlencode($q) . (!empty($arParams["FID"]) ? "&FORUM_ID=" . $arParams["FID"] : "") . "&order=topic", array("FORUM_ID", "q", "order", "s", BX_AJAX_PARAM_ID));
$arResult["order"]["~date"] = $APPLICATION->GetCurPageParam("q=" . urlencode($q) . (!empty($arParams["FID"]) ? "&FORUM_ID=" . $arParams["FID"] : "") . "&order=date", array("FORUM_ID", "q", "order", "s", BX_AJAX_PARAM_ID));
$arResult["order"]["relevance"] = htmlspecialcharsbx($arResult["order"]["~relevance"]);
$arResult["order"]["topic"] = htmlspecialcharsbx($arResult["order"]["~topic"]);
$arResult["order"]["date"] = htmlspecialcharsbx($arResult["order"]["~date"]);
$arResult["EMPTY"] = "N";
do {
if (intVal($res["ITEM_ID"]) > 0) {
$res["URL"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("FID" => $res["PARAM1"], "TID" => $res["PARAM2"], "TITLE_SEO" => $res["PARAM2"], "MID" => $res["ITEM_ID"]));
$res["~URL"] = CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_MESSAGE"], array("FID" => $res["PARAM1"], "TID" => $res["PARAM2"], "TITLE_SEO" => $res["PARAM2"], "MID" => $res["ITEM_ID"]));
} else {
$res["URL"] = CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_READ"], array("FID" => $res["PARAM1"], "TID" => $res["PARAM2"], "TITLE_SEO" => $res["PARAM2"], "MID" => "s"));
$res["~URL"] = CComponentEngine::MakePathFromTemplate($arParams["~URL_TEMPLATES_READ"], array("FID" => $res["PARAM1"], "TID" => $res["PARAM2"], "TITLE_SEO" => $res["PARAM2"], "MID" => "s"));
}
$res["BODY_FORMATED"] = preg_replace("#\\[/?(quote|b|i|u|code|url).*?\\]#i", "", $res["BODY_FORMATED"]);
$res["DATE_CHANGE"] = CForumFormat::DateFormat($arParams["DATE_FORMAT"], MakeTimeStamp($res["DATE_CHANGE"], CSite::GetDateFormat()));
if (strpos($res["SITE_URL"], "#message") !== false) {
$res["SITE_URL"] = substr($res["SITE_URL"], 0, strpos($res["SITE_URL"], "#message"));
}
$res["TAGS"] = array();
if (!empty($res["~TAGS_FORMATED"])) {
foreach ($res["~TAGS_FORMATED"] as $name => $tag) {
$tags = $tag;
$res["TAGS"][] = array("URL" => $APPLICATION->GetCurPageParam("tags=" . urlencode($tags), array("tags")), "TAG_NAME" => htmlspecialcharsbx($name));
}
}
$topics[$res["PARAM2"]] = !!$topics[$res["PARAM2"]] ? $topics[$res["PARAM2"]] : array();
$topics[$res["PARAM2"]][] = count($arResult["TOPICS"]);
$arResult["TOPICS"][] = $res;
} while ($res = $obSearch->GetNext());
}
示例13: GetAbsenceData
static function GetAbsenceData($arParams = array(), $MODE = BX_INTRANET_ABSENCE_ALL)
{
global $DB;
$arDefaultParams = array('CALENDAR_IBLOCK_ID' => false, 'ABSENCE_IBLOCK_ID' => COption::GetOptionInt('intranet', 'iblock_absence'), 'DATE_START' => date($DB->DateFormatToPHP(CSite::GetDateFormat('FULL')), strtotime(date('Y-m-01'))), 'DATE_FINISH' => date($DB->DateFormatToPHP(CSite::GetDateFormat('FULL')), strtotime('+1 month', strtotime(date('Y-m-01')))), 'USERS' => false, 'PER_USER' => true, 'SELECT' => array('ID', 'IBLOCK_ID', 'DATE_ACTIVE_FROM', 'DATE_ACTIVE_TO', 'NAME', 'PREVIEW_TEXT', 'DETAIL_TEXT', 'PROPERTY_USER', 'PROPERTY_FINISH_STATE', 'PROPERTY_STATE', 'PROPERTY_ABSENCE_TYPE'));
foreach ($arDefaultParams as $key => $value) {
if (!isset($arParams[$key])) {
$arParams[$key] = $value;
}
}
$arParams['SELECT'] = array_merge($arParams['SELECT'], array_diff(array('DATE_ACTIVE_FROM', 'DATE_ACTIVE_TO', 'PROPERTY_USER'), $arParams['SELECT']));
$calendar2 = COption::GetOptionString("intranet", "calendar_2", "N") == "Y";
$bLoadCalendar = ($arParams['CALENDAR_IBLOCK_ID'] > 0 || $calendar2) && ($MODE & BX_INTRANET_ABSENCE_PERSONAL) > 0;
$bLoadAbsence = $arParams['ABSENCE_IBLOCK_ID'] > 0;
$arResult = array();
$arEntries = array();
$format = $DB->DateFormatToPHP(CLang::GetDateFormat("FULL"));
if ($bLoadCalendar) {
$arMethodParams = array('iblockId' => $arParams['CALENDAR_IBLOCK_ID'], 'arUserIds' => $arParams['USERS'], 'bList' => true);
if ($arParams['DATE_START']) {
$arMethodParams['fromLimit'] = date($format, MakeTimeStamp($arParams['DATE_START'], FORMAT_DATE));
}
if ($arParams['DATE_FINISH']) {
$arMethodParams['toLimit'] = date($format, MakeTimeStamp($arParams['DATE_FINISH'], FORMAT_DATE) + 86399);
}
if ($calendar2 && CModule::IncludeModule('calendar')) {
$arCalendarEntries = CCalendar::GetAbsentEvents($arMethodParams);
} else {
$arCalendarEntries = CEventCalendar::GetAbsentEvents($arMethodParams);
}
if (is_array($arCalendarEntries)) {
foreach ($arCalendarEntries as $key => $arEntry) {
$arCalendarEntries[$key]['ENTRY_TYPE'] = BX_INTRANET_ABSENCE_PERSONAL;
}
$arEntries = array_merge($arEntries, $arCalendarEntries);
}
if ($arParams['PER_USER']) {
foreach ($arEntries as $key => $arEntry) {
if (!isset($arResult[$arEntry['USER_ID']])) {
$arResult[$arEntry['USER_ID']] = array();
}
$arResult[$arEntry['USER_ID']][] = $arEntry;
}
} else {
$arResult = $arEntries;
}
}
if ($bLoadAbsence) {
if ($arParams['USERS'] === false || is_array($arParams['USERS']) && count($arParams['USERS']) > 0) {
$arFilter = array('IBLOCK_ID' => $arParams['ABSENCE_IBLOCK_ID'], 'ACTIVE' => 'Y');
if ($arParams['DATE_START']) {
$arFilter['>=DATE_ACTIVE_TO'] = date($format, MakeTimeStamp($arParams['DATE_START'], FORMAT_DATE));
}
if ($arParams['DATE_FINISH']) {
$arFilter['<DATE_ACTIVE_FROM'] = date($format, MakeTimeStamp($arParams['DATE_FINISH'], FORMAT_DATE) + 86399);
}
if (is_array($arParams['USERS'])) {
$arFilter['PROPERTY_USER'] = $arParams['USERS'];
}
$dbRes = CIBlockElement::GetList(array('DATE_ACTIVE_FROM' => 'ASC', 'DATE_ACTIVE_TO' => 'ASC'), $arFilter, false, false, $arParams['SELECT']);
while ($arRes = $dbRes->Fetch()) {
$arRes['USER_ID'] = $arRes['PROPERTY_USER_VALUE'];
$arRes['DATE_FROM'] = $arRes['DATE_ACTIVE_FROM'];
$arRes['DATE_TO'] = $arRes['DATE_ACTIVE_TO'];
$arRes['ENTRY_TYPE'] = BX_INTRANET_ABSENCE_HR;
if ($arParams['PER_USER']) {
if (!isset($arResult[$arRes['USER_ID']])) {
$arResult[$arRes['USER_ID']] = array();
}
$arResult[$arRes['USER_ID']][] = $arRes;
} else {
$arResult[] = $arRes;
}
}
}
}
return $arResult;
}
示例14: foreach
foreach ($URL_NAME_DEFAULT as $URL => $URL_VALUE) {
$arParams[strToUpper($URL) . "_URL"] = trim($arParams[strToUpper($URL) . "_URL"]);
if (empty($arParams[strToUpper($URL) . "_URL"])) {
$arParams[strToUpper($URL) . "_URL"] = $GLOBALS["APPLICATION"]->GetCurPageParam($URL_VALUE, array("PAGE_NAME", "USER_ALIAS", "GALLERY_ID", "ACTION", "AJAX_CALL", "USER_ID", "sessid", "save", "login", "order", "group_by"));
}
$arParams["~" . strToUpper($URL) . "_URL"] = $arParams[strToUpper($URL) . "_URL"];
$arParams[strToUpper($URL) . "_URL"] = htmlspecialcharsbx($arParams["~" . strToUpper($URL) . "_URL"]);
}
/***************** ADDITIONAL **************************************/
$arParams["ONLY_ONE_GALLERY"] = $arParams["ONLY_ONE_GALLERY"] == "N" ? "N" : "Y";
$arParams["GALLERY_GROUPS"] = is_array($arParams["GALLERY_GROUPS"]) ? $arParams["GALLERY_GROUPS"] : array();
$arParams["GALLERY_SIZE"] = intVal($arParams["GALLERY_SIZE"]);
$arParams["PAGE_ELEMENTS"] = intVal($arParams["PAGE_ELEMENTS"]);
$arParams["PAGE_NAVIGATION_TEMPLATE"] = trim($arParams["PAGE_NAVIGATION_TEMPLATE"]);
$arParams["PAGE_NAVIGATION_WINDOW"] = intVal(intVal($arParams["PAGE_NAVIGATION_WINDOW"]) > 0 ? $arParams["PAGE_NAVIGATION_WINDOW"] : 5);
$arParams["DATE_TIME_FORMAT"] = trim(empty($arParams["DATE_TIME_FORMAT"]) ? $GLOBALS["DB"]->DateFormatToPHP(CSite::GetDateFormat("FULL")) : $arParams["DATE_TIME_FORMAT"]);
$arParams["SHOW_PHOTO_USER"] = $arParams["SHOW_PHOTO_USER"] == "Y" ? "Y" : "N";
// hidden params for custom components
$arParams["GALLERY_AVATAR_SIZE"] = intVal(intVal($arParams["GALLERY_AVATAR_SIZE"]) > 0 ? $arParams["GALLERY_AVATAR_SIZE"] : 50);
$arParams["SECTION_SELECT_FIELDS"] = is_array($arParams["SECTION_SELECT_FIELDS"]) ? $arParams["SECTION_SELECT_FIELDS"] : array();
$arParams["SECTION_FILTER"] = is_array($arParams["SECTION_FILTER"]) ? $arParams["SECTION_FILTER"] : array();
// hidden params
$arParams["SET_STATUS_404"] = $arParams["SET_STATUS_404"] == "Y" ? "Y" : "N";
/***************** STANDART ****************************************/
if (!isset($arParams["CACHE_TIME"])) {
$arParams["CACHE_TIME"] = 3600;
}
if ($arParams["CACHE_TYPE"] == "Y" || $arParams["CACHE_TYPE"] == "A" && COption::GetOptionString("main", "component_cache_on", "Y") == "Y") {
$arParams["CACHE_TIME"] = intval($arParams["CACHE_TIME"]);
} else {
$arParams["CACHE_TIME"] = 0;
示例15: strToLower
if ($sTemplateName != "default") {
$arParams["MAX_WIDTH"] = $arParams["MAX_HEIGHT"] = $arParams["THUMBNAIL_SIZE"];
} else {
$arParams["MAX_WIDTH"] = $arResult["ELEMENTS"]["MAX_WIDTH"] < $arParams["THUMBNAIL_SIZE"] ? $arResult["ELEMENTS"]["MAX_WIDTH"] : $arParams["THUMBNAIL_SIZE"];
$arParams["MAX_HEIGHT"] = $arResult["ELEMENTS"]["MAX_HEIGHT"] < $arParams["THUMBNAIL_SIZE"] ? $arResult["ELEMENTS"]["MAX_HEIGHT"] : $arParams["THUMBNAIL_SIZE"];
}
$arParams["SHOW_RATING"] = $arParams["SHOW_RATING"] == "Y" ? "Y" : "N";
$arParams["SHOW_SHOWS"] = $arParams["SHOW_SHOWS"] == "Y" ? "Y" : "N";
$arParams["SHOW_COMMENTS"] = $arParams["SHOW_COMMENTS"] == "Y" ? "Y" : "N";
$arParams["COMMENTS_TYPE"] = strToLower($arParams["COMMENTS_TYPE"]) == "forum" ? "forum" : "blog";
$arParams["SHOW_DATETIME"] = $arParams["SHOW_DATETIME"] == "Y" ? "Y" : "N";
$arParams["SHOW_ANCHOR"] = $arResult["USER_HAVE_ACCESS"];
$arParams["SHOW_DESCRIPTION"] = $arParams["SHOW_DESCRIPTION"] == "Y" ? "Y" : "N";
// PAGE
$arParams["SHOW_PAGE_NAVIGATION"] = in_array($arParams["SHOW_PAGE_NAVIGATION"], array("none", "top", "bottom", "both")) ? $arParams["SHOW_PAGE_NAVIGATION"] : "bottom";
$arParams["NEW_DATE_TIME_FORMAT"] = trim(!empty($arParams["NEW_DATE_TIME_FORMAT"]) ? $arParams["NEW_DATE_TIME_FORMAT"] : $DB->DateFormatToPHP(CSite::GetDateFormat("SHORT")));
// FORM & CONTROLS
$arParams["SHOW_FORM"] = ($arParams["SHOW_INPUTS"] == "Y" || $arParams["SHOW_CONTROLS"] == "Y" || $arParams["SHOW_FORM"] == "Y") && $arParams["PERMISSION"] >= "U" ? "Y" : "N";
$arParams["GROUP_DATE"] = $arParams["GROUP_DATE"] == "Y" ? "Y" : "N";
/********************************************************************
Input params
********************************************************************/
$arParams["mode"] = $arParams["SHOW_FORM"] == "Y" ? "edit" : "view";
$_REQUEST["items"] = is_array($_REQUEST["items"]) ? $_REQUEST["items"] : array();
/********************************************************************
Actions
********************************************************************/
include_once str_replace(array("\\", "//"), "/", dirname(__FILE__) . "/template_" . $sTemplateName . ".php");
/********************************************************************
/Actions
********************************************************************/