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; }
/** * * 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; }
/** * 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; }
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); } } }
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; }
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; }
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); } } }
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; }
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); } } } } }
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; }
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"]; } }
$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()); }
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; }
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;
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 ********************************************************************/
} elseif ($arEvents["EVENT_ID"] == "blog_post_micro") { if (!array_key_exists("microblog", $arSocNetFeaturesSettings) || !CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_USER, $arEvents["ENTITY_ID"], "blog", "view_post", $bCurrentUserIsAdmin)) { continue; } } elseif ($arEvents["EVENT_ID"] == "blog_comment") { if (!array_key_exists("blog", $arSocNetFeaturesSettings) || !CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_USER, $arEvents["ENTITY_ID"], "blog", "view_comment", $bCurrentUserIsAdmin)) { continue; } } else { if (!array_key_exists($arEvents["EVENT_ID"], $arSocNetFeaturesSettings) || !CSocNetFeaturesPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), SONET_ENTITY_USER, $arEvents["ENTITY_ID"], $arEvents["EVENT_ID"], $arSocNetFeaturesSettings[$arEvents["EVENT_ID"]]["minoperation"][0], $bCurrentUserIsAdmin)) { continue; } } $path2Entity = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arEvents["ENTITY_ID"])); } $arDateTmp = ParseDateTime($arEvents["LOG_DATE"], CSite::GetDateFormat('FULL')); $day = IntVal($arDateTmp["DD"]); $month = IntVal($arDateTmp["MM"]); $year = IntVal($arDateTmp["YYYY"]); $dateFormated = $day . ' ' . ToLower(GetMessage('MONTH_' . $month . '_S')) . ' ' . $year; $timeFormated = $arDateTmp["HH"] . ':' . $arDateTmp["MI"] . ':' . $arDateTmp["SS"]; $arEvents["MESSAGE_FORMAT"] = htmlspecialcharsback($arEvents["MESSAGE"]); if (StrLen($arEvents["CALLBACK_FUNC"]) > 0) { if (StrLen($arEvents["MODULE_ID"]) > 0) { CModule::IncludeModule($arEvents["MODULE_ID"]); } $arEvents["MESSAGE_FORMAT"] = call_user_func($arEvents["CALLBACK_FUNC"], $arEvents); } if ($arEvents["EVENT_ID"] == "system" || $arEvents["EVENT_ID"] == "system_friends" || $arEvents["EVENT_ID"] == "system_groups") { $arEvents["TITLE_TEMPLATE"] = ""; $arEvents["URL"] = "";
public function GetDiscount($arParams = array(), $getAll = false) { global $DB, $USER; $adminSection = defined('ADMIN_SECTION') && ADMIN_SECTION === true; $arResult = array(); if (!CCatalog::IsUserExists() || !$USER->IsAuthorized() || !self::IsEnabled()) { return $arResult; } foreach (GetModuleEvents("catalog", "OnGetDiscountSave", true) as $arEvent) { $mxResult = ExecuteModuleEventEx($arEvent, $arParams); if ($mxResult !== true) { return $mxResult; } } if (empty($arParams) || !is_array($arParams)) { return $arResult; } $intUserID = 0; $arUserGroups = array(); $strSiteID = false; if (isset($arParams['USER_ID'])) { $intUserID = (int) $arParams['USER_ID']; } if (isset($arParams['USER_GROUPS'])) { $arUserGroups = $arParams['USER_GROUPS']; } if (isset($arParams['SITE_ID'])) { $strSiteID = $arParams['SITE_ID']; } if (self::GetDiscountUserID() > 0) { $intUserID = (int) self::GetDiscountUserID(); $arUserGroups = array(); } if ($intUserID <= 0 && !$adminSection) { $intUserID = (int) $USER->GetID(); $arUserGroups = array(); } if (empty($arUserGroups)) { if (!isset(self::$userGroups[$intUserID])) { self::$userGroups[$intUserID] = $USER->GetUserGroup($intUserID); } $arUserGroups = self::$userGroups[$intUserID]; } if (empty($arUserGroups) || !is_array($arUserGroups) || $intUserID <= 0) { return $arResult; } $key = array_search(2, $arUserGroups); if ($key !== false) { unset($arUserGroups[$key]); } if (empty($arUserGroups)) { return $arResult; } Main\Type\Collection::normalizeArrayValuesByInt($arUserGroups, true); if (empty($arUserGroups)) { return $arResult; } if ($strSiteID === false) { $strSiteID = SITE_ID; } $cacheKey = md5('U' . implode('_', $arUserGroups)); if (!isset(self::$discountFilterCache[$cacheKey])) { self::$discountFilterCache[$cacheKey] = CCatalogDiscountSave::__GetDiscountIDByGroup($arUserGroups); } if (empty(self::$discountFilterCache[$cacheKey])) { return $arResult; } $arCurrentDiscountID = self::$discountFilterCache[$cacheKey]; if (isset($arParams['ID'])) { Main\Type\Collection::normalizeArrayValuesByInt($arUserGroups, true); if (!empty($arParams['ID'])) { $arCurrentDiscountID = array_intersect($arCurrentDiscountID, $arParams['ID']); } } if (!empty($arCurrentDiscountID)) { $getAll = $getAll === true; $intCurrentTime = getmicrotime(); $strDate = date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), $intCurrentTime); $arFilter = array('ID' => $arCurrentDiscountID, 'SITE_ID' => $strSiteID, 'TYPE' => self::ENTITY_ID, 'ACTIVE' => 'Y', '+<=ACTIVE_FROM' => $strDate, '+>=ACTIVE_TO' => $strDate); CTimeZone::Disable(); $rsDiscSaves = CCatalogDiscountSave::GetList(array(), $arFilter); CTimeZone::Enable(); while ($arDiscSave = $rsDiscSaves->Fetch()) { $arDiscSave['ACTION_SIZE'] = (int) $arDiscSave['ACTION_SIZE']; $arDiscSave['COUNT_SIZE'] = (int) $arDiscSave['COUNT_SIZE']; $arDiscSave['ACTIVE_FROM_UT'] = false; $arDiscSave['ACTIVE_TO_UT'] = false; $arDiscSave['COUNT_FROM_UT'] = false; $arDiscSave['COUNT_TO_UT'] = false; $arDiscSave['TYPE'] = (int) $arDiscSave['TYPE']; $arDiscSave['MODULE_ID'] = 'catalog'; $strCountPeriod = self::COUNT_TIME_ALL; $strActionPeriod = self::ACTION_TIME_ALL; $arCountPeriodBack = array(); $arActionPeriodBack = array(); $arActionPeriod = array(); $arStartDate = false; $arOldOrderSumm = false; $arOrderSumm = false; $boolPeriodInsert = true; $intCountTime = $intCurrentTime; $arOrderFilter = array('USER_ID' => $intUserID, 'LID' => $arDiscSave['SITE_ID'], 'PAYED' => 'Y', 'CANCELED' => 'N'); $arOldOrderFilter = $arOrderFilter; if (!empty($arDiscSave['ACTIVE_FROM']) || !empty($arDiscSave['ACTIVE_TO'])) { $strActionPeriod = self::ACTION_TIME_INTERVAL; if (!empty($arDiscSave['ACTIVE_FROM'])) { $arDiscSave['ACTIVE_FROM_UT'] = MakeTimeStamp($arDiscSave['ACTIVE_FROM']); } if (!empty($arDiscSave['ACTIVE_TO'])) { $arDiscSave['ACTIVE_TO_UT'] = MakeTimeStamp($arDiscSave['ACTIVE_TO']); } } elseif ($arDiscSave['ACTION_SIZE'] > 0 && in_array($arDiscSave['ACTION_TYPE'], array('D', 'M', 'Y'))) { $strActionPeriod = self::ACTION_TIME_PERIOD; $arActionPeriodBack = CCatalogDiscountSave::__GetTimeStampArray($arDiscSave['ACTION_SIZE'], $arDiscSave['ACTION_TYPE']); $arActionPeriod = CCatalogDiscountSave::__GetTimeStampArray($arDiscSave['ACTION_SIZE'], $arDiscSave['ACTION_TYPE'], true); } if (!empty($arDiscSave['COUNT_FROM']) || !empty($arDiscSave['COUNT_TO'])) { $strCountPeriod = self::COUNT_TIME_INTERVAL; if (!empty($arDiscSave['COUNT_FROM'])) { $arDiscSave['COUNT_FROM_UT'] = MakeTimeStamp($arDiscSave['COUNT_FROM']); } if (!empty($arDiscSave['COUNT_TO'])) { $arDiscSave['COUNT_TO_UT'] = MakeTimeStamp($arDiscSave['COUNT_TO']); if ($arDiscSave['COUNT_TO_UT'] > $intCountTime) { $arDiscSave['COUNT_TO_UT'] = $intCountTime; $arDiscSave['COUNT_TO'] = ConvertTimeStamp($intCountTime, 'FULL'); } } } elseif ($arDiscSave['COUNT_SIZE'] > 0 && in_array($arDiscSave['COUNT_TYPE'], array('D', 'M', 'Y'))) { $strCountPeriod = self::COUNT_TIME_PERIOD; $arCountPeriodBack = CCatalogDiscountSave::__GetTimeStampArray($arDiscSave['COUNT_SIZE'], $arDiscSave['COUNT_TYPE']); } if ($strCountPeriod == self::COUNT_TIME_INTERVAL) { if (false !== $arDiscSave['COUNT_FROM_UT']) { if ($arDiscSave['COUNT_FROM_UT'] > $intCountTime) { continue; } if (false !== $arDiscSave['COUNT_TO_UT'] && $arDiscSave['COUNT_TO_UT'] <= $arDiscSave['COUNT_FROM_UT']) { continue; } if (false !== $arDiscSave['ACTIVE_TO_UT'] && $arDiscSave['COUNT_FROM_UT'] >= $arDiscSave['ACTIVE_TO_UT']) { continue; } } if (false !== $arDiscSave['COUNT_TO_UT']) { if ($strActionPeriod == self::ACTION_TIME_PERIOD && $arDiscSave['COUNT_TO_UT'] < AddToTimeStamp($arActionPeriodBack, $intCountTime)) { continue; } } } if ($strActionPeriod == self::ACTION_TIME_PERIOD) { if ($strCountPeriod == self::COUNT_TIME_PERIOD) { $arStartDate = CCatalogDiscountSave::__GetUserInfoByDiscount(array('DISCOUNT_ID' => $arDiscSave['ID'], 'USER_ID' => $intUserID, 'ACTIVE_FROM' => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), AddToTimeStamp($arActionPeriodBack, $intCountTime)))); if (is_array($arStartDate) && !empty($arStartDate)) { $arOldOrderFilter['<DATE_INSERT'] = $arStartDate['ACTIVE_FROM_FORMAT']; $arOldOrderFilter['>=DATE_INSERT'] = date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), AddToTimeStamp($arCountPeriodBack, MakeTimeStamp($arStartDate['ACTIVE_FROM_FORMAT']))); $arOldOrderSumm = CCatalogDiscountSave::__SaleOrderSumm($arOldOrderFilter, $arDiscSave['CURRENCY']); } } else { $arStartDate = CCatalogDiscountSave::__GetUserInfoByDiscount(array('DISCOUNT_ID' => $arDiscSave['ID'], 'USER_ID' => $intUserID), array('ACTIVE_FROM' => false, 'DELETE' => false)); if (is_array($arStartDate) && !empty($arStartDate)) { $intTimeStart = MakeTimeStamp($arStartDate['ACTIVE_FROM_FORMAT']); $intTimeFinish = MakeTimeStamp($arStartDate['ACTIVE_TO_FORMAT']); if (!($intTimeStart <= $intCountTime && $intTimeFinish >= $intCountTime)) { continue; } else { $boolPeriodInsert = false; } } } } $intTimeStart = false; $intTimeFinish = false; if ($strCountPeriod == self::COUNT_TIME_INTERVAL) { $intTimeStart = !empty($arDiscSave['COUNT_FROM']) ? $arDiscSave['COUNT_FROM'] : false; $intTimeFinish = !empty($arDiscSave['COUNT_TO']) ? $arDiscSave['COUNT_TO'] : false; } elseif ($strCountPeriod == self::COUNT_TIME_PERIOD) { $intTimeStart = date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), AddToTimeStamp($arCountPeriodBack, $intCountTime)); } if ($intTimeStart) { $arOrderFilter['>=DATE_INSERT'] = $intTimeStart; } if ($intTimeFinish) { $arOrderFilter['<DATE_INSERT'] = $intTimeFinish; } $arOrderSumm = CCatalogDiscountSave::__SaleOrderSumm($arOrderFilter, $arDiscSave['CURRENCY']); if (is_array($arOldOrderSumm) && 0 < $arOldOrderSumm['RANGE_SUMM']) { if ($arOrderSumm['RANGE_SUMM'] <= $arOldOrderSumm['RANGE_SUMM']) { $arOrderSumm = $arOldOrderSumm; } else { $arOldOrderSumm = false; } } $rsRanges = CCatalogDiscountSave::GetRangeByDiscount(array('RANGE_FROM' => 'DESC'), array('DISCOUNT_ID' => $arDiscSave['ID'], '<=RANGE_FROM' => $arOrderSumm['RANGE_SUMM']), false, array('nTopCount' => 1)); $arRange = $rsRanges->Fetch(); if (!empty($arRange) || $getAll) { if (!empty($arRange)) { if ($strActionPeriod == self::ACTION_TIME_PERIOD) { if ($strCountPeriod == self::COUNT_TIME_PERIOD) { if (!is_array($arOldOrderSumm)) { CCatalogDiscountSave::__UpdateUserInfoByDiscount(array('DISCOUNT_ID' => $arDiscSave['ID'], 'USER_ID' => $intUserID, 'ACTIVE_FROM' => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), $intCountTime), 'ACTIVE_TO' => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), AddToTimeStamp($arActionPeriod, $intCountTime)), 'RANGE_FROM' => -1)); } } else { if ($boolPeriodInsert) { CCatalogDiscountSave::__UpdateUserInfoByDiscount(array('DISCOUNT_ID' => $arDiscSave['ID'], 'USER_ID' => $intUserID, 'ACTIVE_FROM' => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), $intCountTime), 'ACTIVE_TO' => date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL")), AddToTimeStamp($arActionPeriod, $intCountTime)), 'RANGE_FROM' => -1), array('SEARCH' => true, 'DELETE' => false)); } } } } unset($arDiscSave['ACTIVE_FROM_UT'], $arDiscSave['ACTIVE_TO_UT'], $arDiscSave['COUNT_FROM_UT'], $arDiscSave['COUNT_TO_UT']); $arOneResult = $arDiscSave; if (!empty($arRange)) { $arOneResult['VALUE'] = $arRange['VALUE']; $arOneResult['VALUE_TYPE'] = $arRange['TYPE']; $arOneResult['RANGE_FROM'] = $arRange['RANGE_FROM']; $arOneResult['MAX_DISCOUNT'] = 0; } else { $arOneResult['VALUE'] = 0; $arOneResult['VALUE_TYPE'] = self::TYPE_PERCENT; $arOneResult['MAX_DISCOUNT'] = 0; $rsRanges = CCatalogDiscountSave::GetRangeByDiscount(array('RANGE_FROM' => 'ASC'), array('DISCOUNT_ID' => $arDiscSave['ID']), false, array('nTopCount' => 1)); $arRange = $rsRanges->Fetch(); $arOneResult['NEXT_RANGE_FROM'] = $arRange['RANGE_FROM']; $arOneResult['NEXT_VALUE'] = $arRange['VALUE']; $arOneResult['NEXT_VALUE_TYPE'] = $arRange['TYPE']; } $arOneResult['SUMM'] = $arOrderSumm['SUMM']; $arOneResult['SUMM_CURRENCY'] = $arOrderSumm['CURRENCY']; $arOneResult['RANGE_SUMM'] = $arOrderSumm['RANGE_SUMM']; $arOneResult['LAST_ORDER_DATE'] = $arOrderSumm['LAST_ORDER_DATE']; $arResult[] = $arOneResult; } } } return $arResult; }
if (!empty($ar)) { foreach ($ar as $name => $tags) { $arr = array("TAG_NAME" => $tags, "TAG_URL" => CComponentEngine::MakePathFromTemplate($arParams["~SEARCH_URL"], array())); $arr["TAG_URL"] .= (strpos($arr["TAG_URL"], "?") === false ? "?" : "&") . "tags=" . $tags; $arElement["TAGS_LIST"][] = $arr; } } } if ($arElement["PREVIEW_TEXT"] == "" && $arElement["NAME"] != "" && !preg_match('/\\d{3,}/', $arElement["NAME"])) { $arElement["~NAME"] = preg_replace(array('/\\.jpg/i', '/\\.jpeg/i', '/\\.gif/i', '/\\.png/i', '/\\.bmp/i'), '', $arElement["~NAME"]); $arElement["~PREVIEW_TEXT"] = $arElement["~NAME"]; $arElement["PREVIEW_TEXT"] = htmlspecialcharsbx($arElement["~PREVIEW_TEXT"]); } unset($arElement["DETAIL_PICTURE"]); $arElements[$arElement["ID"]] = $arElement; $arElementsJS[$arElement["ID"]] = array("id" => intVal($arElement["ID"]), "active" => $arElement["ACTIVE"] == "Y" ? "Y" : "N", "title" => $arElement["NAME"], "album_id" => $arElement["IBLOCK_SECTION_ID"], "album_name" => $arSections[$arElement["IBLOCK_SECTION_ID"]]["NAME"], "gallery_id" => $arGallery["CODE"], "description" => $arElement["~PREVIEW_TEXT"], "shows" => $arElement["SHOW_COUNTER"], "index" => $index, "author_id" => $arElement['CREATED_BY'], "date" => FormatDate('x', MakeTimeStamp($arElement["DATE_CREATE"], CSite::GetDateFormat())), "author_name" => CUser::FormatName($arParams['NAME_TEMPLATE'], $arUsers[$arElement['CREATED_BY']], $arParams["SHOW_LOGIN"] != 'N'), "comments" => $arParams["SHOW_COMMENTS"] == "Y" ? intVal($arParams["COMMENTS_TYPE"] != "BLOG" ? $arElement["PROPERTIES"]["FORUM_MESSAGE_CNT"]["VALUE"] : $arElement["PROPERTIES"]["BLOG_COMMENTS_CNT"]["VALUE"]) : "", "detail_url" => $arElement["~URL"]); if ($arParams['DRAG_SORT'] == "Y") { $arElementsJS[$arElement["ID"]]['sort'] = $arElement["SORT"]; } if ($arParams["SHOW_TAGS"]) { $arElementsJS[$arElement["ID"]]['tags'] = $arElement["TAGS"]; if ($bParseTags) { $arElementsJS[$arElement["ID"]]['tags_array'] = $arElement["TAGS_LIST"]; } } $index++; } $strFileId = trim($strFileId, " ,"); if (strLen($strFileId) > 0) { $rsFile = CFile::GetList(array(), array("@ID" => $strFileId)); $upload = COption::GetOptionString("main", "upload_dir", "upload");
$arParams['SHOW_LOGIN'] = $arParams['SHOW_LOGIN'] != "N" ? "Y" : "N"; if (!array_key_exists("PM_URL", $arParams)) { $arParams["PM_URL"] = "/company/personal/messages/chat/#USER_ID#/"; } if (!array_key_exists("PATH_TO_CONPANY_DEPARTMENT", $arParams)) { $arParams["PATH_TO_CONPANY_DEPARTMENT"] = "/company/structure.php?set_filter_structure=Y&structure_UF_DEPARTMENT=#ID#"; } if (IsModuleInstalled("video") && !array_key_exists("PATH_TO_VIDEO_CALL", $arParams)) { $arParams["PATH_TO_VIDEO_CALL"] = "/company/personal/video/#USER_ID#/"; } } if (!array_key_exists("GADGETS_FIXED", $arParams) || !is_array($arParams["GADGETS_FIXED"])) { $arParams["GADGETS_FIXED"] = array(); } $arParams["DATE_TIME_FORMAT"] = trim(empty($arParams["DATE_TIME_FORMAT"]) ? $DB->DateFormatToPHP(CSite::GetDateFormat("FULL")) : $arParams["DATE_TIME_FORMAT"]); $arParams["DATE_FORMAT"] = trim(empty($arParams["DATE_FORMAT"]) ? $DB->DateFormatToPHP(CSite::GetDateFormat("SHORT")) : $arParams["DATE_FORMAT"]); $arResult = array(); if ($USER->IsAuthorized() && $APPLICATION->GetFileAccessPermission($APPLICATION->GetCurPage(true)) > "R" && !$arParams["DEFAULT_ID"]) { $arResult["PERMISSION"] = "X"; } elseif ($USER->IsAuthorized() && $arParams["DEFAULT_ID"] && ($USER->IsAdmin() || CModule::IncludeModule('socialnetwork') && CSocNetUser::IsCurrentUserModuleAdmin())) { $arResult["PERMISSION"] = "X"; } elseif ($USER->IsAuthorized() && $arParams["CAN_EDIT"] == "Y") { $arResult["PERMISSION"] = "W"; } else { $arResult["PERMISSION"] = "R"; } $arParams["PERMISSION"] = $arResult["PERMISSION"]; if ($USER->IsAuthorized() && $arResult["PERMISSION"] > "R" && check_bitrix_sessid()) { if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($_POST['holderid'] == $arParams["ID"]) { $gdid = $_POST['gid'];
$arFilter[">LAST_POST_ID"] = 0; } $dbBlog = CBlog::GetList($SORT, $arFilter, false, array("nPageSize" => $arParams["BLOG_COUNT"], "bShowAll" => false), $arSelectFields); $arResult["NAV_STRING"] = $dbBlog->GetPageNavString(GetMessage("B_B_GR_TITLE"), $arParams["NAV_TEMPLATE"], false, $component); $arResult["BLOG"] = array(); while ($arBlog = $dbBlog->GetNext()) { $arBlog["urlToPost"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_POST"], array("blog" => $arBlog["URL"], "post_id" => $arBlog["LAST_POST_ID"], "user_id" => $arBlog["OWNER_ID"])); $arBlog["urlToBlog"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_BLOG"], array("blog" => $arBlog["URL"], "user_id" => $arBlog["OWNER_ID"])); $arBlog["urlToAuthor"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arBlog["OWNER_ID"])); $arBlog["AuthorName"] = CBlogUser::GetUserName($arBlog["BLOG_USER_ALIAS"], $arBlog["OWNER_NAME"], $arBlog["OWNER_LAST_NAME"], $arBlog["OWNER_LOGIN"]); $arBlog["BLOG_USER_AVATAR_ARRAY"] = CFile::GetFileArray($arBlog["BLOG_USER_AVATAR"]); if ($arBlog["BLOG_USER_AVATAR_ARRAY"] !== false) { $arBlog["Avatar_resized"] = CFile::ResizeImageGet($arBlog["BLOG_USER_AVATAR_ARRAY"], array("width" => 100, "height" => 100), BX_RESIZE_IMAGE_EXACT, false); $arBlog["BLOG_USER_AVATAR_IMG"] = CFile::ShowImage($arBlog["Avatar_resized"]["src"], 100, 100, 'align="right"'); } $arBlog["LAST_POST_DATE_FORMATED"] = FormatDate($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($arBlog["LAST_POST_DATE"], CSite::GetDateFormat("FULL"))); $arResult["BLOG"][] = $arBlog; } if ($arParams["CACHE_TIME"] > 0) { $cache->EndDataCache(array("templateCachedData" => $this->GetTemplateCachedData(), "arResult" => $arResult)); } } } else { $arResult["FATAL_ERROR"] = GetMessage("B_B_GR_NO_GROUP"); CHTTP::SetStatus("404 Not Found"); } } else { $arResult["FATAL_ERROR"] = GetMessage("B_B_GR_NO_GROUP"); CHTTP::SetStatus("404 Not Found"); } $this->IncludeComponentTemplate();
{ if ($i>1) { ?> </td> </tr> <? } //endif($i>1); ?> <tr> <td> <?php echo $arrF["FILTER_TITLE"] ? $arrF['FILTER_TITLE'] : $arrF['TITLE']; ?> <?php echo $arrF["FILTER_TYPE"] == "date" ? " (" . CSite::GetDateFormat("SHORT") . ")" : ""; ?> </td> <td> <? } //endif ($fname!=$prev_fname) ; ?> <? switch($arrF["FILTER_TYPE"]){ case "text": echo CForm::GetTextFilter($arrF["FID"]); break; case "date": echo CForm::GetDateFilter($arrF["FID"]); break; case "integer":
<?php if ($code == "SHOW_COUNTER") { ?> <div class="bx-newslist-view"><i class="fa fa-eye"></i> <?php echo GetMessage("IBLOCK_FIELD_" . $code); ?> : <?php echo intval($value); ?> </div> <?php } elseif ($value && ($code == "SHOW_COUNTER_START" || $code == "DATE_ACTIVE_FROM" || $code == "ACTIVE_FROM" || $code == "DATE_ACTIVE_TO" || $code == "ACTIVE_TO" || $code == "DATE_CREATE" || $code == "TIMESTAMP_X")) { ?> <?php $value = CIBlockFormatProperties::DateFormat($arParams["ACTIVE_DATE_FORMAT"], MakeTimeStamp($value, CSite::GetDateFormat())); ?> <div class="bx-newslist-date"><i class="fa fa-calendar-o"></i> <?php echo GetMessage("IBLOCK_FIELD_" . $code); ?> : <?php echo $value; ?> </div> <?php } elseif ($code == "TAGS" && $value) { ?> <div class="bx-newslist-tags"><i class="fa fa-tag"></i> <?php echo GetMessage("IBLOCK_FIELD_" . $code); ?>
/** * <p>Вставка полей ответа на вопрос в шаблон. Параметры поля ввода задаются в настройках вопроса.</p> * * * @param string $FIELD_SID Строковой идентификатор поля вопроса. Обязательный параметр. * * @param $string CSS-класс для подписи к полю ввода. Необязательный параметр. * * @param mixed $CSSClass = ""] * * @return string <p>Возвращается HTML-код для вставки полей формы</p> <a * name="examples"></a><h4>Использование</h4> <pre class="syntax"> <?=$FORM->ShowInput('MYFIELD_5')?> * </pre> * * <h4>See Also</h4> * <menu> <li><a href="http://dev.1c-bitrix.ru/api_help/form/classes/cformoutput/index.php">Класс CFormOutput</a></li> * <li><a * href="http://dev.1c-bitrix.ru/api_help/form/classes/cformoutput/showinputcaption.php">CFormOutput::ShowInputCaption</a></li> * <li><a * href="http://dev.1c-bitrix.ru/api_help/form/classes/cformoutput/showinputcaptionimage.php">CFormOutput::ShowInputCaptionImage</a></li> * </menu></b<br><br> * * * @static * @link http://dev.1c-bitrix.ru/api_help/form/classes/cformoutput/showinput.php * @author Bitrix */ public function ShowInput($FIELD_SID, $caption_css_class = '') { $arrVALUES = $this->arrVALUES; if (is_array($this->arAnswers[$FIELD_SID])) { $res = ""; reset($this->arAnswers[$FIELD_SID]); if (is_array($this->arDropDown[$FIELD_SID])) { reset($this->arDropDown[$FIELD_SID]); } if (is_array($this->arMutiselect[$FIELD_SID])) { reset($this->arMutiselect[$FIELD_SID]); } while (list($key, $arAnswer) = each($this->arAnswers[$FIELD_SID])) { if ($arAnswer["FIELD_TYPE"] == "dropdown" && $show_dropdown == "Y") { continue; } if ($arAnswer["FIELD_TYPE"] == "multiselect" && $show_multiselect == "Y") { continue; } if ($key > 0) { $res .= "<br />"; } switch ($arAnswer["FIELD_TYPE"]) { case "radio": $ans_id = "form_checkbox_" . $FIELD_SID . "_" . $arAnswer['ID']; $arAnswer['FIELD_PARAM'] .= ' id="' . $ans_id . '"'; $value = CForm::GetRadioValue($FIELD_SID, $arAnswer, $arrVALUES); $input = CForm::GetRadioField($FIELD_SID, $arAnswer["ID"], $value, $arAnswer["FIELD_PARAM"]); if (strlen($ans_id) > 0) { $res .= $input; $res .= "<label for=\"" . $ans_id . "\">"; $res .= "<span class=\"" . $caption_css_class . "\"> " . $arAnswer["MESSAGE"] . "</span></label>"; } else { $res .= "<label>"; $res .= $input; $res .= "<span class=\"" . $caption_css_class . "\"> " . $arAnswer["MESSAGE"] . "</span></label>"; } break; case "checkbox": $ans_id = "form_checkbox_" . $FIELD_SID . "_" . $arAnswer['ID']; $arAnswer['FIELD_PARAM'] .= ' id="' . $ans_id . '"'; $value = CForm::GetCheckBoxValue($FIELD_SID, $arAnswer, $arrVALUES); $input = CForm::GetCheckBoxField($FIELD_SID, $arAnswer["ID"], $value, $arAnswer["FIELD_PARAM"]); if (strlen($ans_id) > 0) { $res .= $input; $res .= "<label for=\"" . $ans_id . "\">"; $res .= "<span class=\"" . $caption_css_class . "\"> " . $arAnswer["MESSAGE"] . "</span></label>"; } else { $res .= "<label>"; $res .= $input; $res .= "<span class=\"" . $caption_css_class . "\"> " . $arAnswer["MESSAGE"] . "</span></label>"; } break; case "dropdown": if ($show_dropdown != "Y") { $value = CForm::GetDropDownValue($FIELD_SID, $this->arDropDown, $arrVALUES); $res .= CForm::GetDropDownField($FIELD_SID, $this->arDropDown[$FIELD_SID], $value, $arAnswer["FIELD_PARAM"]); $show_dropdown = "Y"; } break; case "multiselect": if ($show_multiselect != "Y") { $value = CForm::GetMultiSelectValue($FIELD_SID, $this->arMultiSelect, $arrVALUES); $res .= CForm::GetMultiSelectField($FIELD_SID, $this->arMultiSelect[$FIELD_SID], $value, $arAnswer["FIELD_HEIGHT"], $arAnswer["FIELD_PARAM"]); $show_multiselect = "Y"; } break; case "text": if (strlen(trim($arAnswer["MESSAGE"])) > 0) { $res .= "<span class=\"" . $caption_css_class . "\">" . $arAnswer["MESSAGE"] . "</span><br />"; } $value = CForm::GetTextValue($arAnswer["ID"], $arAnswer, $arrVALUES); $res .= CForm::GetTextField($arAnswer["ID"], $value, $arAnswer["FIELD_WIDTH"], $arAnswer["FIELD_PARAM"]); break; case "hidden": /* if (strlen(trim($arAnswer["MESSAGE"]))>0) { $res .= "<span class=\"".$caption_css_class."\">".$arAnswer["MESSAGE"]."</span><br />"; } */ $value = CForm::GetHiddenValue($arAnswer["ID"], $arAnswer, $arrVALUES); $res .= CForm::GetHiddenField($arAnswer["ID"], $value, $arAnswer["FIELD_PARAM"]); break; case "password": if (strlen(trim($arAnswer["MESSAGE"])) > 0) { $res .= "<span class=\"" . $caption_css_class . "\">" . $arAnswer["MESSAGE"] . "</span><br />"; } $value = CForm::GetPasswordValue($arAnswer["ID"], $arAnswer, $arrVALUES); $res .= CForm::GetPasswordField($arAnswer["ID"], $value, $arAnswer["FIELD_WIDTH"], $arAnswer["FIELD_PARAM"]); break; case "email": if (strlen(trim($arAnswer["MESSAGE"])) > 0) { $res .= "<span class=\"" . $caption_css_class . "\">" . $arAnswer["MESSAGE"] . "</span><br />"; } $value = CForm::GetEmailValue($arAnswer["ID"], $arAnswer, $arrVALUES); $res .= CForm::GetEmailField($arAnswer["ID"], $value, $arAnswer["FIELD_WIDTH"], $arAnswer["FIELD_PARAM"]); break; case "url": if (strlen(trim($arAnswer["MESSAGE"])) > 0) { $res .= "<span class=\"" . $caption_css_class . "\">" . $arAnswer["MESSAGE"] . "</span><br />"; } $value = CForm::GetUrlValue($arAnswer["ID"], $arAnswer, $arrVALUES); $res .= CForm::GetUrlField($arAnswer["ID"], $value, $arAnswer["FIELD_WIDTH"], $arAnswer["FIELD_PARAM"]); break; case "textarea": if (strlen(trim($arAnswer["MESSAGE"])) > 0) { $res .= "<span class=\"" . $caption_css_class . "\">" . $arAnswer["MESSAGE"] . "</span><br />"; } $value = CForm::GetTextAreaValue($arAnswer["ID"], $arAnswer, $arrVALUES); $res .= CForm::GetTextAreaField($arAnswer["ID"], $arAnswer["FIELD_WIDTH"], $arAnswer["FIELD_HEIGHT"], $arAnswer["FIELD_PARAM"], $value); break; case "date": if (strlen(trim($arAnswer["MESSAGE"])) > 0) { $res .= "<span class=\"" . $caption_css_class . "\">" . $arAnswer["MESSAGE"] . " (" . CSite::GetDateFormat("SHORT") . ")</span><br />"; } $value = CForm::GetDateValue($arAnswer["ID"], $arAnswer, $arrVALUES); $res .= CForm::GetDateField($arAnswer["ID"], $this->arForm["SID"], $value, $arAnswer["FIELD_WIDTH"], $arAnswer["FIELD_PARAM"]); break; case "image": if (strlen(trim($arAnswer["MESSAGE"])) > 0) { $res .= "<span class=\"" . $caption_css_class . "\">" . $arAnswer["MESSAGE"] . "</span><br />"; } if ($this->RESULT_ID) { if ($arFile = CFormResult::GetFileByAnswerID($this->RESULT_ID, $arAnswer["ID"])) { if (intval($arFile["USER_FILE_ID"]) > 0) { if ($arFile["USER_FILE_IS_IMAGE"] == "Y") { $res .= CFile::ShowImage($arFile["USER_FILE_ID"], 0, 0, "border=0", "", true); $res .= "<br />"; } //endif; } //endif; } // endif } // endif $res .= CForm::GetFileField($arAnswer["ID"], $arAnswer["FIELD_WIDTH"], "IMAGE", 0, "", $arAnswer["FIELD_PARAM"]); break; case "file": if (strlen(trim($arAnswer["MESSAGE"])) > 0) { $res .= "<span class=\"" . $caption_css_class . "\">" . $arAnswer["MESSAGE"] . "</span><br />"; } if ($this->RESULT_ID) { if ($arFile = CFormResult::GetFileByAnswerID($this->RESULT_ID, $arAnswer["ID"])) { if (intval($arFile["USER_FILE_ID"]) > 0) { $res .= "<a title=\"" . GetMessage("FORM_VIEW_FILE") . "\" target=\"_blank\" class=\"tablebodylink\" href=\"/bitrix/tools/form_show_file.php?rid=" . $this->RESULT_ID . "&hash=" . $arFile["USER_FILE_HASH"] . "&lang=" . LANGUAGE_ID . "\">" . htmlspecialcharsbx($arFile["USER_FILE_NAME"]) . "</a> ("; $res .= CFile::FormatSize($arFile["USER_FILE_SIZE"]); $res .= ") [ <a title=\"" . str_replace("#FILE_NAME#", $arFile["USER_FILE_NAME"], GetMessage("FORM_DOWNLOAD_FILE")) . "\" class=\"tablebodylink\" href=\"/bitrix/tools/form_show_file.php?rid=" . $this->RESULT_ID . "&hash=" . $arFile["USER_FILE_HASH"] . "&lang=" . LANGUAGE_ID . "&action=download\">" . GetMessage("FORM_DOWNLOAD") . "</a> ]"; $res .= "<br /><br />"; } //endif; } //endif; } $res .= CForm::GetFileField($arAnswer["ID"], $arAnswer["FIELD_WIDTH"], "FILE", 0, "", $arAnswer["FIELD_PARAM"]); break; } //endswitch; } //endwhile; return $res; } elseif (is_array($this->arQuestions[$FIELD_SID]) && $this->arQuestions[$FIELD_SID]["ADDITIONAL"] == "Y") { $res = ""; switch ($this->arQuestions[$FIELD_SID]["FIELD_TYPE"]) { case "text": $value = CForm::GetTextAreaValue("ADDITIONAL_" . $this->arQuestions[$FIELD_SID]["ID"], array(), $this->arrVALUES); $res .= CForm::GetTextAreaField("ADDITIONAL_" . $this->arQuestions[$FIELD_SID]["ID"], "60", "5", "", $value); break; case "integer": $value = CForm::GetTextValue("ADDITIONAL_" . $this->arQuestions[$FIELD_SID]["ID"], array(), $this->arrVALUES); $res .= CForm::GetTextField("ADDITIONAL_" . $this->arQuestions[$FIELD_SID]["ID"], $value); break; case "date": $value = CForm::GetDateValue("ADDITIONAL_" . $this->arQuestions[$FIELD_SID]["ID"], array(), $this->arrVALUES); $res .= CForm::GetDateField("ADDITIONAL_" . $this->arQuestions[$FIELD_SID]["ID"], $arForm["SID"], $value); break; } //endswitch; return $res; } else { return ""; } }
function RemindPayment() { $reminder = COption::GetOptionString("sale", "pay_reminder", ""); $arReminder = unserialize($reminder); if (!empty($arReminder)) { $arSites = array(); $minDay = mktime(); foreach ($arReminder as $key => $val) { if ($val["use"] == "Y") { $arSites[] = $key; $days = array(); for ($i = 0; $i <= floor($val["period"] / $val["frequency"]); $i++) { $day = AddToTimeStamp(array("DD" => -($val["after"] + $val["period"] - $val["frequency"] * $i))); if ($day < mktime()) { if ($minDay > $day) { $minDay = $day; } $day = ConvertTimeStamp($day); $days[] = $day; } } $arReminder[$key]["days"] = $days; } } if (!empty($arSites)) { $bTmpUser = False; if (!isset($GLOBALS["USER"]) || !is_object($GLOBALS["USER"])) { $bTmpUser = True; $GLOBALS["USER"] = new CUser(); } $arFilter = array("LID" => $arSites, "PAYED" => "N", "CANCELED" => "N", "ALLOW_DELIVERY" => "N", ">=DATE_INSERT" => ConvertTimeStamp($minDay)); $dbOrder = CSaleOrder::GetList(array("ID" => "DESC"), $arFilter, false, false, array("ID", "DATE_INSERT", "PAYED", "USER_ID", "LID", "PRICE", "CURRENCY")); while ($arOrder = $dbOrder->GetNext()) { $date_insert = ConvertDateTime($arOrder["DATE_INSERT"], CSite::GetDateFormat("SHORT")); if (in_array($date_insert, $arReminder[$arOrder["LID"]]["days"])) { $strOrderList = ""; $dbBasketTmp = CSaleBasket::GetList(array("NAME" => "ASC"), array("ORDER_ID" => $arOrder["ID"]), false, false, array("ID", "NAME", "QUANTITY")); while ($arBasketTmp = $dbBasketTmp->Fetch()) { $strOrderList .= $arBasketTmp["NAME"] . " (" . $arBasketTmp["QUANTITY"] . ")"; $strOrderList .= "\n"; } $payerEMail = ""; $dbOrderProp = CSaleOrderPropsValue::GetList(array(), array("ORDER_ID" => $arOrder["ID"], "PROP_IS_EMAIL" => "Y")); if ($arOrderProp = $dbOrderProp->Fetch()) { $payerEMail = $arOrderProp["VALUE"]; } $payerName = ""; $dbUser = CUser::GetByID($arOrder["USER_ID"]); if ($arUser = $dbUser->Fetch()) { if (strlen($payerName) <= 0) { $payerName = $arUser["NAME"] . (strlen($arUser["NAME"]) <= 0 || strlen($arUser["LAST_NAME"]) <= 0 ? "" : " ") . $arUser["LAST_NAME"]; } if (strlen($payerEMail) <= 0) { $payerEMail = $arUser["EMAIL"]; } } $arFields = array("ORDER_ID" => $arOrder["ID"], "ORDER_DATE" => $date_insert, "ORDER_USER" => $payerName, "PRICE" => SaleFormatCurrency($arOrder["PRICE"], $arOrder["CURRENCY"]), "BCC" => COption::GetOptionString("sale", "order_email", "order@" . $_SERVER["SERVER_NAME"]), "EMAIL" => $payerEMail, "ORDER_LIST" => $strOrderList, "SALE_EMAIL" => COption::GetOptionString("sale", "order_email", "order@" . $SERVER_NAME)); $eventName = "SALE_ORDER_REMIND_PAYMENT"; $bSend = true; foreach (GetModuleEvents("sale", "OnOrderRemindSendEmail", true) as $arEvent) { if (ExecuteModuleEventEx($arEvent, array($arOrder["ID"], &$eventName, &$arFields)) === false) { $bSend = false; } } if ($bSend) { $event = new CEvent(); $event->Send($eventName, $arOrder["LID"], $arFields, "N"); } } } if ($bTmpUser) { unset($GLOBALS["USER"]); } } } return "CSaleOrder::RemindPayment();"; }
if ($itemCnt == 0) { $arTmp["FIRST"] = "Y"; } $text = preg_replace("#\\[img\\](.+?)\\[/img\\]#is", "", $arPost["~DETAIL_TEXT"]); $text = preg_replace("#\\[url(.+?)\\](.*?)\\[/url\\]#is", "\\2", $text); $text = preg_replace("#\\[video(.+?)\\](.+?)\\[/video\\]#is", "", $text); $text = preg_replace("#^(.+?)<cut[\\s]*(/>|>).*?\$#is", "\\1", $text); $text = preg_replace("#^(.+?)\\[cut[\\s]*(/\\]|\\]).*?\$#is", "\\1", $text); $text = preg_replace("#(\\[|<)(/?)(b|u|i|list|code|quote|url|img|color|font|/*)(.*?)(\\]|>)#is", "", $text); $text = TruncateText($text, $arParams["MESSAGE_LENGTH"]); $text1 = $text; $title = $p->convert($text1, true, false, array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => "N", "NL2BR" => "N")); $text = $p->convert($text, true, false, array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "LIST" => "N", "SMILES" => "Y", "NL2BR" => "N")); $text = CBlogTools::DeleteDoubleBR($text); $arTmp["TEXT_FORMATED"] = $text; $arTmp["DATE_PUBLISH_FORMATED"] = FormatDate($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($arTmp["DATE_PUBLISH"], CSite::GetDateFormat("FULL"))); if ($arTmp["MICRO"] == "Y") { $arTmp["TITLE"] = TruncateText(str_replace(array("<br />", "<br>", "'", """, "<", ">"), "", $title), 60); $arTmp["~TITLE"] = htmlspecialcharsback($arTmp["TITLE"]); } $itemCnt++; $arResult[] = $arTmp; $ids[] = $arTmp["ID"]; } $arResult["IDS"] = $ids; } if ($arParams["CACHE_TIME"] > 0) { $cache->EndDataCache(array("templateCachedData" => $this->GetTemplateCachedData(), "arResult" => $arResult)); } } if ($arParams["SHOW_RATING"] == "Y" && !empty($arResult["IDS"])) {
$arUsers = array(); foreach ($arUserIDs as $ar) { $arUsers = array_merge($arUsers, $ar); } $arFilterUser = array(); $arFilterUser['USER_ID'] = $arUsers; $dbRes = CUser::GetList($by = 'ID', $order = 'ASC', array('ID' => implode('|', $arUsers), 'ACTIVE' => 'Y'), array('SELECT' => array('*', 'UF_DEPARTMENT'))); while ($arRes = $dbRes->GetNext()) { $res['USERS'][$arRes['ID']] = array('ID' => $arRes['ID'], 'NAME' => CUser::FormatName(CSite::GetNameFormat(false), array('USER_ID' => $arRes['ID'], 'NAME' => $arRes['NAME'], 'LAST_NAME' => $arRes['LAST_NAME'], 'SECOND_NAME' => $arRes['SECOND_NAME']), true, false), 'DEPARTMENT' => $arRes['UF_DEPARTMENT'][0], 'URL' => str_replace(array('#ID#', '#USER_ID#'), $arRes['ID'], COption::GetOptionString('intranet', 'path_user', '/company/personal/user/#USER_ID#/', $_REQUEST['site_id'])), 'SETTINGS' => array()); $arFilterReport = array(); $arFilterReport[] = array("LOGIC" => "OR", array("LOGIC" => "AND", "<DATE_TO" => $date_to, ">=DATE_TO" => $date_from), array("LOGIC" => "AND", "<DATE_FROM" => $date_to, ">=DATE_FROM" => $date_from)); //fix this in future $arFilterReport[] = array("LOGIC" => "AND", array("USER_ID" => $arRes["ID"])); $arFilterReport[] = array("LOGIC" => "AND", array("ACTIVE" => "Y")); $res["USERS"][$arRes['ID']]["FULL_REPORT"] = array(); $datefomat = CSite::GetDateFormat("SHORT", SITE_ID); $res["USERS"][$arRes['ID']]["FULL_REPORT_INFO"]["BAD"] = 0; $res["USERS"][$arRes['ID']]["FULL_REPORT_INFO"]["COUNT"] = 0; $arSelect = array("ID", "USER_ID", "DATE_FROM", "DATE_TO", "MARK", "FORUM_TOPIC_ID"); //$arSelect = Array(); $dbres = CTimeManReportFull::GetList(array("ID" => "desc"), $arFilterReport, $arSelect); $res["USERS"][$arRes['ID']]["FULL_REPORT_INFO"]["GOOD"] = 0; $res["USERS"][$arRes['ID']]["FULL_REPORT_INFO"]["MARKED"] = 0; while ($report = $dbres->Fetch()) { if ($report["MARK"] != "X") { $res["USERS"][$arRes['ID']]["FULL_REPORT_INFO"]["MARKED"]++; } if ($report["MARK"] == "G") { $res["USERS"][$arRes['ID']]["FULL_REPORT_INFO"]["GOOD"]++; } $res["USERS"][$arRes['ID']]["FULL_REPORT_INFO"]["COUNT"]++;
// add fresh vReports CReport::addFreshDefaultReports($vReports, $ownerId); } } } } // create default reports by user request if ($isPost && !empty($_POST['CREATE_DEFAULT'])) { $dReports = call_user_func(array($helperClassName, 'getDefaultReports')); foreach ($dReports as $moduleVer => $vReports) { CReport::addFreshDefaultReports($vReports, $ownerId); } LocalRedirect($arParams['PATH_TO_REPORT_LIST']); } // main action $arResult['list'] = array(); $result = Bitrix\Report\ReportTable::getList(array('order' => array('ID' => 'ASC'), 'select' => array('ID', 'TITLE', 'DESCRIPTION', 'CREATED_DATE'), 'filter' => array('=CREATED_BY' => $USER->GetID(), '=OWNER_ID' => $ownerId))); while ($row = $result->fetch()) { $arResult['list'][] = $row; } // add default reports always if them isn't present if (empty($arResult['list'])) { $dReports = call_user_func(array($helperClassName, 'getDefaultReports')); foreach ($dReports as $moduleVer => $vReports) { CReport::addFreshDefaultReports($vReports, $ownerId); } LocalRedirect($arParams['PATH_TO_REPORT_LIST']); } global $DB; $arResult['dateFormat'] = $DB->DateFormatToPHP(CSite::GetDateFormat("SHORT")); $this->IncludeComponentTemplate();
function UpdateLog($postID, $arPost, $arBlog, $arParams) { if (!CModule::IncludeModule('socialnetwork')) { return; } global $DB; $parserBlog = new blogTextParser(false, $arParams["PATH_TO_SMILE"]); preg_match("#^(.*?)<cut[\\s]*(/>|>).*?\$#is", $arPost["DETAIL_TEXT"], $arMatches); if (count($arMatches) <= 0) { preg_match("#^(.*?)\\[cut[\\s]*(/\\]|\\]).*?\$#is", $arPost["DETAIL_TEXT"], $arMatches); } if (count($arMatches) > 0) { $cut_suffix = "#CUT#"; } else { $cut_suffix = ""; } $arImages = array(); $res = CBlogImage::GetList(array("ID" => "ASC"), array("POST_ID" => $postID, "BLOG_ID" => $arBlog["ID"], "IS_COMMENT" => "N")); while ($arImage = $res->Fetch()) { $arImages[$arImage['ID']] = $arImage['FILE_ID']; } if ($arPost["DETAIL_TEXT_TYPE"] == "html" && $arParams["allowHTML"] == "Y" && $arBlog["ALLOW_HTML"] == "Y") { $arAllow = array("HTML" => "Y", "ANCHOR" => "Y", "IMG" => "Y", "SMILES" => "N", "NL2BR" => "N", "VIDEO" => "Y", "QUOTE" => "Y", "CODE" => "Y"); if ($arParams["allowVideo"] != "Y") { $arAllow["VIDEO"] = "N"; } $text4message = $parserBlog->convert($arPost["DETAIL_TEXT"], true, $arImages, $arAllow); } else { $arAllow = array("HTML" => "N", "ANCHOR" => "N", "BIU" => "N", "IMG" => "N", "QUOTE" => "N", "CODE" => "N", "FONT" => "N", "TABLE" => "N", "LIST" => "N", "SMILES" => "N", "NL2BR" => "N", "VIDEO" => "N"); $text4message = $parserBlog->convert($arPost["DETAIL_TEXT"], true, $arImages, $arAllow, array("isSonetLog" => true)); } $text4message .= $cut_suffix; $arSoFields = array("TITLE_TEMPLATE" => "#USER_NAME# " . GetMessage("BLG_SONET_TITLE"), "TITLE" => $arPost["TITLE"], "MESSAGE" => $text4message, "TEXT_MESSAGE" => $text4mail, "ENABLE_COMMENTS" => array_key_exists("ENABLE_COMMENTS", $arPost) && $arPost["ENABLE_COMMENTS"] == "N" ? "N" : "Y", "=LOG_UPDATE" => strlen($arPost["DATE_PUBLISH"]) > 0 ? MakeTimeStamp($arPost["DATE_PUBLISH"], CSite::GetDateFormat("FULL", $SITE_ID)) > time() + CTimeZone::GetOffset() ? $DB->CharToDateFunction($arPost["DATE_PUBLISH"], "FULL", SITE_ID) : $DB->CurrentTimeFunction() : $DB->CurrentTimeFunction()); $dbRes = CSocNetLog::GetList(array("ID" => "DESC"), array("EVENT_ID" => "blog_post", "SOURCE_ID" => $postID), false, false, array("ID", "ENTITY_TYPE", "ENTITY_ID")); if ($arRes = $dbRes->Fetch()) { CSocNetLog::Update($arRes["ID"], $arSoFields); $socnetPerms = CBlogPost::GetSocNetPermsCode($postID); if (!in_array("U" . $arPost["AUTHOR_ID"], $socnetPerms)) { $socnetPerms[] = "U" . $arPost["AUTHOR_ID"]; } if (CModule::IncludeModule("extranet")) { $arSiteID = CExtranet::GetSitesByLogDestinations($socnetPerms); CSocNetLog::Update($arRes["ID"], array("SITE_ID" => $arSiteID)); } $socnetPerms[] = "SA"; // socnet admin CSocNetLogRights::DeleteByLogID($arRes["ID"]); CSocNetLogRights::Add($arRes["ID"], $socnetPerms); } }
if ($GLOBALS["USER"]->IsAuthorized()) { $dbAffiliate = CSaleAffiliate::GetList(array("TRANSACT_DATE" => "ASC"), array("USER_ID" => IntVal($GLOBALS["USER"]->GetID()), "SITE_ID" => SITE_ID), false, false, array("ID", "PLAN_ID", "ACTIVE", "PAID_SUM", "APPROVED_SUM", "PENDING_SUM", "LAST_CALCULATE")); if ($arAffiliate = $dbAffiliate->Fetch()) { $arResult = array(); if ($arAffiliate["ACTIVE"] == "Y") { $arResult["FIELDS"] = $arAffiliate; if (strlen($_REQUEST["del_filter"]) > 0) { DelFilter(array("filter_date_from", "filter_date_to")); } else { InitFilter(array("filter_date_from", "filter_date_to")); } $filter_date_from = $_REQUEST["filter_date_from"]; $filter_date_to = $_REQUEST["filter_date_to"]; if (StrLen($filter_date_from) <= 0 && StrLen($filter_date_to) <= 0) { $filter_date_from = date($DB->DateFormatToPHP(CSite::GetDateFormat("SHORT")), mktime(0, 0, 0, date("m") - 3, 1, date("Y"))); $filter_date_to = date($DB->DateFormatToPHP(CSite::GetDateFormat("SHORT")), mktime(0, 0, 0, date("m"), date("d") + 1, date("Y"))); } $arResult["FILTER"] = array("filter_date_from" => $filter_date_from, "filter_date_to" => $filter_date_to); $arResult["CURRENT_PAGE_PARAM"] = $APPLICATION->GetCurPageParam("", array("filter_date_from", "filter_date_to")); $arResult["CURRENT_PAGE"] = $APPLICATION->GetCurPage(); $arFilter = array("=AFFILIATE_ID" => $arAffiliate["ID"], "=ALLOW_DELIVERY" => "Y", "=CANCELED" => "N", "=LID" => SITE_ID); if (StrLen($filter_date_from) > 0) { $arFilter[">=DATE_ALLOW_DELIVERY"] = Trim($filter_date_from); } if (StrLen($filter_date_to) > 0) { $arFilter["<=DATE_ALLOW_DELIVERY"] = Trim($filter_date_to); } $dbItemsList = \Bitrix\Sale\Internals\OrderTable::getList(array('filter' => $arFilter, 'select' => array("BASKET_NAME" => 'BASKET.NAME', "BASKET_PRODUCT_ID" => 'BASKET.PRODUCT_ID', "BASKET_MODULE" => 'BASKET.MODULE', "BASKET_PRICE" => 'BASKET.PRICE', "BASKET_CURRENCY" => 'BASKET.CURRENCY', "BASKET_DISCOUNT_PRICE" => 'BASKET.DISCOUNT_PRICE', 'BASKET_QUANTITY' => 'SUM_BASKET_QUANTITY'), 'runtime' => array(new \Bitrix\Main\Entity\ExpressionField('SUM_BASKET_QUANTITY', 'SUM(%s)', array('BASKET.QUANTITY'))), 'order' => array("BASKET.MODULE" => "ASC", "BASKET.NAME" => "ASC", "BASKET.PRODUCT_ID" => "ASC"), 'group' => array("BASKET.MODULE", "BASKET.PRODUCT_ID", "BASKET.NAME", "BASKET.PRICE", "BASKET.CURRENCY", "BASKET.DISCOUNT_PRICE"))); $arResult["ROWS"] = False; if ($arItemsList = $dbItemsList->Fetch()) { $affiliateCurrency = CSaleLang::GetLangCurrency(SITE_ID);
$arNavigation = CDBResult::GetNavParams($arNavParams); if ($this->StartResultCache($arParams["CACHE_TIME"], array($arFilterForum, $arForumAddParams, $arNavigation))) { $arForumAddParams['nav_result'] = false; $dbForumNav = CForumNew::GetListEx($arForumOrder, $arFilterForum, false, false, $arForumAddParams); $arForumAddParams['nav_result'] = $dbForumNav; $dbForum = CForumNew::GetListEx($arForumOrder, $arFilterForum, false, false, $arForumAddParams); $arResult["NAV_RESULT"] = $dbForumNav; $arResult["NAV_STRING"] = $dbForumNav->GetPageNavStringEx($navComponentObject, GetMessage("F_FORUM"), $arParams["PAGE_NAVIGATION_TEMPLATE"]); $arResult["NAV_PAGE"] = $dbForumNav->NavNum . ':' . $dbForumNav->NavPageNomer; $arForums = array(); while ($res = $dbForum->GetNext()) { $res["MODERATE"] = array("TOPICS" => 0, "POSTS" => intVal($res["POSTS_UNAPPROVED"])); $res["mCnt"] = $res["MODERATE"]["POSTS"]; $res["TITLE"] = $parser->wrap_long_words($res["TITLE"]); $res["LAST_POSTER_NAME"] = $parser->wrap_long_words($res["LAST_POSTER_NAME"]); $res["LAST_POST_DATE"] = intval($res["LAST_MESSAGE_ID"]) > 0 ? CForumFormat::DateFormat($arParams["DATE_TIME_FORMAT"], MakeTimeStamp($res["LAST_POST_DATE"], CSite::GetDateFormat())) : ""; $res["URL"] = array("MODERATE_MESSAGE" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE_APPR"], array("FID" => $res["ID"], "TID" => "s")), "TOPICS" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_LIST"], array("FID" => $res["ID"])), "MESSAGE" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_MESSAGE"], array("FID" => $res["ID"], "TID" => $res["TID"], "TITLE_SEO" => $res["TITLE_SEO"], "MID" => $res["LAST_MESSAGE_ID"])) . "#message" . $res["LAST_MESSAGE_ID"], "AUTHOR" => CComponentEngine::MakePathFromTemplate($arParams["URL_TEMPLATES_PROFILE_VIEW"], array("UID" => $res["LAST_POSTER_ID"]))); /************** For custom template ********************************/ $res["topic_list"] = $res["URL"]["TOPICS"]; $res["message_appr"] = $res["URL"]["MODERATE_MESSAGE"]; $res["message_list"] = $res["URL"]["MESSAGE"]; $res["profile_view"] = $res["URL"]["AUTHOR"]; /*******************************************************************/ $res["FORUM_GROUP_ID"] = intVal($res["FORUM_GROUP_ID"]); $arGroupForum[$res["FORUM_GROUP_ID"]]["FORUM"][] = $res; $arResult["FORUMS_LIST"][$res["ID"]] = $res["ID"]; CForumCacheManager::SetTag($this->GetCachePath(), "forum_msg_count" . $res["ID"]); } $arGroups = array(); if (!function_exists("__array_merge")) { function __array_merge($arr1, $arr2)