Skip to content

Instantly share code, notes, and snippets.

@geff21st
Last active May 2, 2018 18:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save geff21st/b0851e1ec22e008581e4 to your computer and use it in GitHub Desktop.
Save geff21st/b0851e1ec22e008581e4 to your computer and use it in GitHub Desktop.
<?
define('LOG_FILENAME', __DIR__.'/log/'.date('Ymd').'.log');
require_once($_SERVER["DOCUMENT_ROOT"].'/bitrix/modules/main/include/prolog_before.php');
use Bitrix\Main\Loader;
Loader::includeModule("iblock");
Uplab\Helper::loadMainMsg();
use Bitrix\Main\Localization\Loc;
<!-- for result_modifier.php -->
<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
foreach ($arResult['ITEMS'] as &$arItem) {
$pic = $arItem['PREVIEW_PICTURE']['SRC'] ? $arItem['PREVIEW_PICTURE'] : $arItem['DETAIL_PICTURE'];
//$pic = $arItem['DETAIL_PICTURE'] ? $arItem['DETAIL_PICTURE'] : $arItem['PREVIEW_PICTURE'];
$picture = CFile::ResizeImageGet(
$pic,
array('width'=>140, 'height'=>40),
BX_RESIZE_IMAGE_PROPORTIONAL_ALT,
// BX_RESIZE_IMAGE_EXACT,
false
);
$pic = $arItem['PREVIEW_PICTURE'] ? $arItem['PREVIEW_PICTURE'] : $arItem['DETAIL_PICTURE'];
if($pic){
$arSpeaker['PICTURE'] = CFile::ResizeImageGet(
CFile::MakeFileArray($pic),
array('width'=>208, 'height'=>208),
// BX_RESIZE_IMAGE_PROPORTIONAL_ALT,
BX_RESIZE_IMAGE_EXACT,
false
)['src'];
}
$pic['SRC'] = $picture['src'];
$pic['ALT'] = $pic['DESCRIPTION'] ? $pic['DESCRIPTION'] : $pic['ALT'];
$pic['TITLE'] = $pic['DESCRIPTION'] ? $pic['DESCRIPTION'] : $pic['TITLE'];
$arItem['PICTURE'] = $pic;
$pic = $arItem['PREVIEW_PICTURE']['SRC'] ? $arItem['PREVIEW_PICTURE'] : $arItem['DETAIL_PICTURE'];
//$pic = $arItem['DETAIL_PICTURE'] ? $arItem['DETAIL_PICTURE'] : $arItem['PREVIEW_PICTURE'];
$arItem['PICTURE'] = CFile::ResizeImageGet(
$pic,
array('width'=>140, 'height'=>40),
BX_RESIZE_IMAGE_PROPORTIONAL_ALT,
// BX_RESIZE_IMAGE_EXACT,
false
);
$arItem['PICTURE'] = $arItem['PICTURE']['src'];
$arItem['LINK'] = $arItem['PROPERTIES']['LINK']['VALUE'];
$date = $arItem['DATE_ACTIVE_FROM'] ? $arItem['DATE_ACTIVE_FROM'] : $arItem['TIMESTAMP_X'];
$arItem['META_DATE'] = FormatDate('Y-m-d',strtotime($date)); $arItem['PROPERTIES']['SIGN']['VALUE'];
$obParser = new CTextParser;
if($arParams["PREVIEW_TRUNCATE_LEN"] > 0)
$arItem["DETAIL_TEXT"] = $obParser->html_cut($arItem["DETAIL_TEXT"], $arParams["PREVIEW_TRUNCATE_LEN"]);
}
$cp = $this->__component; // объект компонента
if (is_object($cp))
{
// добавляем поля в arResult компонента
$cp->arResult['MY_TITLE'] = $title;
$cp->arResult['MY_DESCR'] = $descr;
$cp->SetResultCacheKeys(array('MY_TITLE','MY_DESCR'));
}
new dBug($arResult,'',true);
?>
<!-- for template.php -->
<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?>
<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
use Bitrix\Main\Localization\Loc;
?>
<?=Loc::getMessage("")?>
<?=Loc::getMessage('')?>
<?
foreach ($arResult['ITEMS'] as $arItem):
$this->AddEditAction($arItem['ID'], $arItem['EDIT_LINK'], CIBlock::GetArrayByID($arItem["IBLOCK_ID"], "ELEMENT_EDIT"));
$this->AddDeleteAction($arItem['ID'], $arItem['DELETE_LINK'], CIBlock::GetArrayByID($arItem["IBLOCK_ID"], "ELEMENT_DELETE"),
array("CONFIRM" => GetMessage('CT_BNL_ELEMENT_DELETE_CONFIRM')));
?>
id="<?=$this->GetEditAreaId($arItem['ID']);?>"
<?=$arItem['NAME']?>
<?=$arItem['']?>
<?endforeach;?>
<!-- for component_epilog.php -->
<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
if($arResult['MY_TITLE'])
$APPLICATION->SetPageProperty("title", $arResult['MY_TITLE']);
if($arResult['MY_DESCR'])
$APPLICATION->SetPageProperty("description", $arResult['MY_DESCR']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment