$arResult["SECTION_DESCRIPTION"] = ""; if ($this->SECTION_ID > 0) { $arSelect = array("ID", "IBLOCK_ID", "LEFT_MARGIN", "RIGHT_MARGIN"); if ($arParams["SECTION_TITLE"] !== "") { $arSelect[] = $arParams["SECTION_TITLE"]; } if ($arParams["SECTION_DESCRIPTION"] !== "") { $arSelect[] = $arParams["SECTION_DESCRIPTION"]; } $sectionList = CIBlockSection::GetList(array(), array("=ID" => $this->SECTION_ID, "IBLOCK_ID" => $this->IBLOCK_ID), false, $arSelect); $arResult["SECTION"] = $sectionList->GetNext(); if ($arResult["SECTION"]) { $arResult["SECTION_TITLE"] = $arResult["SECTION"][$arParams["SECTION_TITLE"]]; if ($arParams["SECTION_DESCRIPTION"] !== "") { $obParser = new CTextParser(); $arResult["SECTION_DESCRIPTION"] = $obParser->html_cut($arResult["SECTION"][$arParams["SECTION_DESCRIPTION"]], 200); } } } } $this->EndResultCache(); } else { $this->facet->setPrices($arResult["PRICES"]); $this->facet->setSectionId($this->SECTION_ID); } /*Handle checked for checkboxes and html control value for numbers*/ if (isset($_REQUEST["ajax"]) && $_REQUEST["ajax"] === "y") { $_CHECK =& $_REQUEST; } elseif (isset($_REQUEST["del_filter"])) { $_CHECK = array(); } elseif (isset($_GET["set_filter"])) {
$arResult["PRICES"] = CIBlockPriceTools::GetCatalogPrices(0, $arParams["PRICE_CODE"]); } else { $arResult["PRICES"] = array(); } $arSelect = array("ID", "IBLOCK_ID", "PREVIEW_TEXT", "PREVIEW_PICTURE", "DETAIL_PICTURE"); $arFilter = array("IBLOCK_LID" => SITE_ID, "IBLOCK_ACTIVE" => "Y", "ACTIVE_DATE" => "Y", "ACTIVE" => "Y", "CHECK_PERMISSIONS" => "Y", "MIN_PERMISSION" => "R"); foreach ($arResult["PRICES"] as $value) { $arSelect[] = $value["SELECT"]; $arFilter["CATALOG_SHOP_QUANTITY_" . $value["ID"]] = 1; } $arFilter["=ID"] = $arResult["ELEMENTS"]; $rsElements = CIBlockElement::GetList(array(), $arFilter, false, false, $arSelect); while ($arElement = $rsElements->Fetch()) { $arElement["PRICES"] = CIBlockPriceTools::GetItemPrices($arElement["IBLOCK_ID"], $arResult["PRICES"], $arElement, $arParams['PRICE_VAT_INCLUDE'], $arConvertParams); if ($arParams["PREVIEW_TRUNCATE_LEN"] > 0) { $arElement["PREVIEW_TEXT"] = $obParser->html_cut($arElement["PREVIEW_TEXT"], $arParams["PREVIEW_TRUNCATE_LEN"]); } $arResult["ELEMENTS"][$arElement["ID"]] = $arElement; } } foreach ($arResult["SEARCH"] as $i => $arItem) { switch ($arItem["MODULE_ID"]) { case "iblock": if (array_key_exists($arItem["ITEM_ID"], $arResult["ELEMENTS"])) { $arElement =& $arResult["ELEMENTS"][$arItem["ITEM_ID"]]; if ($arParams["SHOW_PREVIEW"] == "Y") { if ($arElement["PREVIEW_PICTURE"] > 0) { $arElement["PICTURE"] = CFile::ResizeImageGet($arElement["PREVIEW_PICTURE"], array("width" => $PREVIEW_WIDTH, "height" => $PREVIEW_HEIGHT), BX_RESIZE_IMAGE_PROPORTIONAL, true); } elseif ($arElement["DETAIL_PICTURE"] > 0) { $arElement["PICTURE"] = CFile::ResizeImageGet($arElement["DETAIL_PICTURE"], array("width" => $PREVIEW_WIDTH, "height" => $PREVIEW_HEIGHT), BX_RESIZE_IMAGE_PROPORTIONAL, true); }
"NAME" => $arSection["NAME"], "LINK" => $arSection["SECTION_PAGE_URL"] ); } } foreach($arResult["ITEMS"] as $k => $arItem){ $previewPicture = CFile::ResizeImageGet( $arItem["PREVIEW_PICTURE"], array("width"=>$arParams["PREVIEW_PICTURE_MAX_WIDTH"],"height"=>$arParams["PREVIEW_PICTURE_MAX_HEIGHT"]), BX_RESIZE_IMAGE_EXACT ); $detailPicture = CFile::ResizeImageGet( $arItem["DETAIL_PICTURE"], array("width"=>$arParams["DETAIL_PICTURE_MAX_WIDTH"],"height"=>$arParams["DETAIL_PICTURE_MAX_HEIGHT"]), BX_RESIZE_IMAGE_EXACT ); $obParser = new CTextParser; $arResult["DATA"]["ARTICLES"][] = array( "ID" => $arItem["ID"], "NAME" => $arItem["NAME"], "SECTION_ID" => $arItem["IBLOCK_SECTION_ID"], "PREVIEW_PICTURE" => $previewPicture, "PREVIEW_TEXT" => $obParser->html_cut($arItem["PREVIEW_TEXT"], 120), "PREVIEW_TEXT_FULL" => $arItem["PREVIEW_TEXT"], "DETAIL_PICTURE" => $detailPicture, "DETAIL_TEXT" => $arItem["DETAIL_TEXT"], "DETAIL_PAGE_URL" => $arItem["DETAIL_PAGE_URL"] ); } $arResult["DATA_JSON"] = json_encode($arResult["DATA"]); ?>
/** * [ID] => 2 [UF_CODE] => pena-dney-20160409004500-0300 [UF_DATE_START] => 09.04.2016 00:45:00 [UF_DATE_END] => 09.04.2016 03:10:00 [UF_DATE] => 09.04.2016 [UF_CHANNEL_ID] => 30 [UF_PROG_ID] => 2 [UF_TITLE] => Пена дней [UF_SUB_TITLE] => [UF_IMG_PATH] => /upload/epg_original/48870.jpg [UF_RATING] => [DATE_START] => 09.04.2016 00:45:00 [DATE_END] => 09.04.2016 03:10:00 [DATE] => 09.04.2016 [PROG_ID] => 2 [DETAIL_PAGE_URL] => /channels/1tv/pena-dney-20160409004500-0300/ [UF_HD] => 1 */ public static function getProgInfoChannel($arProg, $arParams) { if ($arProg["CLASS"] == "one") { $arProg["PICTURE"]["SRC"] = \Hawkart\Megatv\CFile::getCropedPath($arProg["UF_IMG_PATH"], array(600, 550)); } if ($arProg["CLASS"] == "half") { $arProg["PICTURE"]["SRC"] = \Hawkart\Megatv\CFile::getCropedPath($arProg["UF_IMG_PATH"], array(300, 550)); } $start = $arProg["DATE_START"]; $end = $arProg["DATE_END"]; $arStatus = self::status($arProg); $status = $arStatus["status"]; $status_icon = $arStatus["status-icon"]; $datetime = $arParams["DATETIME"]["SERVER_DATETIME_WITH_OFFSET"]; $time_pointer = false; if (\CTimeEx::dateDiff($start, $datetime) && \CTimeEx::dateDiff($datetime, $end)) { $time_pointer = true; } ob_start(); ?> <div class="item<?php if ($status) { ?> status-<?php echo $status; } if ($time_pointer && $arParams["NEED_POINTER"]) { ?> js-time-pointer<?php } if (empty($arProg["PICTURE"]["SRC"])) { ?> is-noimage<?php } if ($arProg["CLASS"] == "double") { ?> double-item<?php } ?> " data-type="broadcast" data-broadcast-id="<?php echo $arProg["ID"]; ?> " > <div class="item-image-holder"> <img data-src="<?php echo $arProg["PICTURE"]["SRC"]; ?> " alt=""> </div> <?php if ($time_pointer) { ?> <span class="badge" data-channel-id="<?php echo $arProg["UF_CHANNEL_ID"]; ?> ">в эфире</span> <?php } ?> <?php echo $status_icon; ?> <?php echo self::driveNotifyMessage(); ?> <div class="item-header"> <time><?php echo substr($arProg["DATE_START"], 11, 5); ?> </time> <a href="<?php echo $arProg["DETAIL_PAGE_URL"]; ?> "> <?php echo self::cutName(\Hawkart\Megatv\ProgTable::getName($arProg)); ?> </a> </div> <div class="item-header"> <?php if (\CTimeEx::dateDiff($start, $datetime) && \CTimeEx::dateDiff($datetime, $end)) { ?> <?php $allSecs = strtotime($end) - strtotime($start); $secs = strtotime($datetime) - strtotime($start); $proc = ceil($secs / ($allSecs / 100)); $duration = \CTimeEx::secToStr($secs); ?> <div class="timeline" data-progress="<?php echo $proc; ?> "> <span class="progress-bg"></span> <span>прошло <?php echo $duration; ?> </span> </div> <?php } ?> <span class="descr-trigger" data-type="descr-trigger"><span>×</span></span> <time><?php echo substr($arProg["DATE_START"], 11, 5); ?> </time> <a href="<?php echo $arProg["DETAIL_PAGE_URL"]; ?> "> <?php echo self::cutName(\Hawkart\Megatv\ProgTable::getName($arProg)); ?> </a> <div class="item-descr"> <?php $obParser = new \CTextParser(); ?> <p><?php echo $obParser->html_cut($arProg["UF_DESC"], 600); ?> </p> </div> </div> </div> <?php $content = ob_get_contents(); ob_end_clean(); return $content; }
public static function MailNotifyAgent() { global $DB; $defSiteID = CSite::GetDefSite(); $arMark = array(); $arGroupNotify = array(); $arGroupNotifyUser = array(); $arUnsendNotify = CIMNotify::GetUnsendNotify(); foreach ($arUnsendNotify as $id => $arNotify) { if (!isset($arMark[$arNotify["CHAT_ID"]]) || $arMark[$arNotify["CHAT_ID"]] < $arNotify["ID"]) { $arMark[$arNotify["CHAT_ID"]] = $arNotify["ID"]; } if ($arNotify['TO_USER_ACTIVE'] != 'Y') { unset($arUnsendNotify[$id]); continue; } if (isset($arNotify["NOTIFY_MODULE"]) && isset($arNotify["NOTIFY_EVENT"]) && !CIMNotifySchema::CheckEnableFeature($arNotify["NOTIFY_MODULE"], $arNotify["NOTIFY_EVENT"], IM_FEATURE_MAIL)) { unset($arUnsendNotify[$id]); continue; } $siteID = $arNotify["TO_USER_LID"]; if ($siteID == false || StrLen($siteID) <= 0) { $siteID = $defSiteID; if ($siteID == false || StrLen($siteID) <= 0) { unset($arUnsendNotify[$id]); continue; } } if (strlen($arNotify["MESSAGE_OUT"]) <= 0) { $arNotify["MESSAGE_OUT"] = $arNotify["MESSAGE"]; } if (!(isset($arNotify["EMAIL_TEMPLATE"]) && strlen($arNotify["EMAIL_TEMPLATE"]) > 0)) { $arNotify["EMAIL_TEMPLATE"] = "IM_NEW_NOTIFY"; } $arNotify["USER"] = htmlspecialcharsback(CUser::FormatName(CSite::GetNameFormat(false), array("NAME" => $arNotify["TO_USER_NAME"], "LAST_NAME" => $arNotify["TO_USER_LAST_NAME"], "SECOND_NAME" => $arNotify["TO_USER_SECOND_NAME"], "LOGIN" => $arNotify["TO_USER_LOGIN"]), true)); $arNotify["FROM_USER"] = htmlspecialcharsback(CUser::FormatName(CSite::GetNameFormat(false), array("NAME" => $arNotify["FROM_USER_NAME"], "LAST_NAME" => $arNotify["FROM_USER_LAST_NAME"], "SECOND_NAME" => $arNotify["FROM_USER_SECOND_NAME"], "LOGIN" => $arNotify["FROM_USER_LOGIN"]), true)); $arNotify['NOTIFY_TAG_MD5'] = md5($arNotify['NOTIFY_TAG']); if ($arNotify["EMAIL_TEMPLATE"] == "IM_NEW_NOTIFY" && $arNotify['NOTIFY_TAG'] != '') { if (isset($arGroupNotify[$arNotify['NOTIFY_TAG_MD5']])) { $arGroupNotifyUser[$arNotify['NOTIFY_TAG_MD5']][$arNotify["FROM_USER_ID"]] = $arNotify["FROM_USER"]; unset($arUnsendNotify[$id]); } else { $arGroupNotifyUser[$arNotify['NOTIFY_TAG_MD5']][$arNotify["FROM_USER_ID"]] = $arNotify["FROM_USER"]; $arGroupNotify[$arNotify['NOTIFY_TAG_MD5']] = true; } } $arUnsendNotify[$id] = $arNotify; } foreach ($arMark as $chatId => $lastSendId) { CIMNotify::SetLastSendId($chatId, $lastSendId); } $CTP = new CTextParser(); foreach ($arUnsendNotify as $id => $arNotify) { $arFields = array("MESSAGE_ID" => $arNotify["ID"], "USER" => $arNotify["USER"], "USER_ID" => $arNotify["TO_USER_ID"], "USER_LOGIN" => $arNotify["TO_USER_LOGIN"], "USER_NAME" => $arNotify["TO_USER_NAME"], "USER_LAST_NAME" => $arNotify["TO_USER_LAST_NAME"], "USER_SECOND_NAME" => $arNotify["TO_USER_SECOND_NAME"], "DATE_CREATE" => $arNotify["DATE_CREATE"], "FROM_USER_ID" => $arNotify["FROM_USER_ID"], "FROM_USER_LOGIN" => $arNotify["FROM_USER_LOGIN"], "FROM_USER" => $arNotify["FROM_USER"], "SENDER_ID" => $arNotify["FROM_USER_ID"], "SENDER_LOGIN" => $arNotify["FROM_USER_LOGIN"], "SENDER_NAME" => $arNotify["FROM_USER_NAME"], "SENDER_LAST_NAME" => $arNotify["FROM_USER_LAST_NAME"], "SENDER_SECOND_NAME" => $arNotify["FROM_USER_SECOND_NAME"], "EMAIL_TO" => $arNotify["TO_USER_EMAIL"], "TITLE" => trim($arNotify["NOTIFY_TITLE"]), "MESSAGE" => CTextParser::convert4mail(str_replace("#BR#", "\n", strip_tags($arNotify["MESSAGE_OUT"]))), "MESSAGE_50" => $CTP->html_cut(str_replace(array("<br>", "<br/>", "<br />", "#BR#"), array(" ", " ", " ", " "), nl2br(CTextParser::convert4mail(strip_tags($arNotify["MESSAGE_OUT"])))), 50)); if (strlen($arFields['TITLE']) > 0) { $arFields["MESSAGE_50"] = $arFields['TITLE']; } else { $arFields["TITLE"] = $arFields['MESSAGE_50']; } if (isset($arGroupNotifyUser[$arNotify['NOTIFY_TAG_MD5']]) && count($arGroupNotifyUser[$arNotify['NOTIFY_TAG_MD5']]) > 1) { $arNotify["EMAIL_TEMPLATE"] = "IM_NEW_NOTIFY_GROUP"; $arFields['FROM_USERS'] = implode(', ', $arGroupNotifyUser[$arNotify['NOTIFY_TAG_MD5']]); unset($arFields['FROM_USER']); } $event = new CEvent(); $event->Send($arNotify["EMAIL_TEMPLATE"], $siteID, $arFields, "N"); } return "CIMMail::MailNotifyAgent();"; }