Beispiel #1
1
 static function GetProductSkuProps($ID, $IBLOCK_ID = '', $getExt = false)
 {
     $getExt = $getExt === true;
     $arSkuProps = array();
     $ID = (int) $ID;
     $IBLOCK_ID = (int) $IBLOCK_ID;
     if ($ID > 0 && \Bitrix\Main\Loader::includeModule('catalog')) {
         $filter = array('ID' => $ID, 'ACTIVE' => 'Y');
         if ($IBLOCK_ID > 0) {
             $filter['IBLOCK_ID'] = $IBLOCK_ID;
         }
         $res = CIBlockElement::GetList(array(), $filter, false, false, array("ID", "IBLOCK_ID"));
         $arElement = $res->Fetch();
         if ($arElement) {
             $arElement['ID'] = (int) $arElement['ID'];
             $arParent = CCatalogSku::GetProductInfo($ID, $arElement["IBLOCK_ID"]);
             if ($arParent) {
                 $arElement['PROPERTIES'] = array();
                 $arElementLink = array($arElement['ID'] => &$arElement);
                 $arFilter = array('ID' => $arElement['ID'], 'IBLOCK_ID' => $arElement["IBLOCK_ID"]);
                 CIBlockElement::GetPropertyValuesArray($arElementLink, $arElement["IBLOCK_ID"], $arFilter);
                 if (!empty($arElement['PROPERTIES'])) {
                     foreach ($arElement['PROPERTIES'] as &$prop) {
                         if ($prop['XML_ID'] == 'CML2_LINK' || $prop['PROPERTY_TYPE'] == 'F') {
                             continue;
                         }
                         $boolArr = is_array($prop["VALUE"]);
                         if ($boolArr && !empty($prop["VALUE"]) || !$boolArr && strlen($prop["VALUE"]) > 0) {
                             $displayProperty = CIBlockFormatProperties::GetDisplayValue($arElement, $prop, '');
                             $mxValues = '';
                             if ('E' == $prop['PROPERTY_TYPE']) {
                                 if (!empty($displayProperty['LINK_ELEMENT_VALUE'])) {
                                     $mxValues = array();
                                     foreach ($displayProperty['LINK_ELEMENT_VALUE'] as $arTempo) {
                                         $mxValues[] = $arTempo['NAME'] . ' [' . $arTempo['ID'] . ']';
                                     }
                                 }
                             } elseif ('G' == $prop['PROPERTY_TYPE']) {
                                 if (!empty($displayProperty['LINK_SECTION_VALUE'])) {
                                     $mxValues = array();
                                     foreach ($displayProperty['LINK_SECTION_VALUE'] as $arTempo) {
                                         $mxValues[] = $arTempo['NAME'] . ' [' . $arTempo['ID'] . ']';
                                     }
                                 }
                             }
                             if (empty($mxValues)) {
                                 $mxValues = $displayProperty["DISPLAY_VALUE"];
                             }
                             if ($getExt) {
                                 $arSkuProps[$prop["ID"]] = array('ID' => $prop["ID"], 'CODE' => $prop['CODE'], 'NAME' => $prop["NAME"], 'VALUE' => strip_tags(is_array($mxValues) ? implode("/ ", $mxValues) : $mxValues));
                             } else {
                                 $arSkuProps[$prop["NAME"]] = strip_tags(is_array($mxValues) ? implode("/ ", $mxValues) : $mxValues);
                             }
                         }
                     }
                     unset($prop);
                 }
             }
         }
     }
     return $arSkuProps;
 }
Beispiel #2
0
 /**
  * Геттер
  * @param $var
  * @return int
  */
 public function __get($var)
 {
     if (strpos($var, 'printable_') === 0) {
         $varName = substr($var, strlen('printable_'));
         $param = $this->getParam($varName);
         if (!is_array($param) || !isset($param['PROPERTY_TYPE'])) {
             return $param;
         }
         switch ($param['PROPERTY_TYPE']) {
             case 'G':
                 $printable = \CIBlockSection::GetList(array(), array('ID' => $param['VALUE']), false, array("NAME"))->GetNext();
                 return $printable['NAME'];
             default:
                 $printable = \CIBlockFormatProperties::GetDisplayValue(array('NAME' => ''), $param, "");
                 return $printable['DISPLAY_VALUE'];
         }
     } else {
         switch ($var) {
             case 'id':
             case 'ID':
                 return $this->id;
             case 'IBLOCK_ID':
             case 'iblockId':
                 return $this->iblockId;
             default:
                 return $this->getParam($var);
         }
     }
 }
 public static function formatDisplayDate($date, $format)
 {
     if (empty($date)) {
         return '';
     } else {
         return \CIBlockFormatProperties::DateFormat($format, MakeTimeStamp($date, \CSite::GetDateFormat()));
     }
 }
Beispiel #4
0
 $arUsers = array();
 // Starting index of image on page
 $index = $rsElements->NavPageSize * ($rsElements->NavPageNomer - 1);
 while ($obElement = $rsElements->GetNextElement()) {
     $arElement = $obElement->GetFields();
     // PROPERIES
     $props = $obElement->GetProperties();
     $arElement["PROPERTIES"] = array();
     foreach ($props as $key => $value) {
         $arElement["PROPERTIES"][$key] = array("VALUE" => $value["VALUE"]);
     }
     $arElement["DISPLAY_PROPERTIES"] = array();
     foreach ($arParams["PROPERTY_CODE"] as $pid) {
         $prop =& $arElement["PROPERTIES"][$pid];
         if (is_array($prop["VALUE"]) && count($prop["VALUE"]) > 0 || !is_array($prop["VALUE"]) && strlen($prop["VALUE"]) > 0) {
             $arItem["DISPLAY_PROPERTIES"][$pid] = CIBlockFormatProperties::GetDisplayValue($arItem, $prop, "news_out");
         }
     }
     if (empty($arSections[$arElement["IBLOCK_SECTION_ID"]])) {
         $db_res = CIBlockSection::GetList(array(), array("IBLOCK_ID" => $arElement["IBLOCK_ID"], "ID" => $arElement["IBLOCK_SECTION_ID"]), false, array("ID", "LEFT_MARGIN", "RIGHT_MARGIN", "NAME", "UF_PASSWORD", "ACTIVE"));
         $res = $oPhoto->GetSection($arElement["IBLOCK_SECTION_ID"], $arSections[$arElement["IBLOCK_SECTION_ID"]]);
         //if ($db_res && $res = $db_res->Fetch())
         //	$arSections[$arElement["IBLOCK_SECTION_ID"]] = $res;
     }
     if (!$oPhoto->CheckPermission($arParams["PERMISSION"], $arSections[$arElement["IBLOCK_SECTION_ID"]], false)) {
         continue;
     }
     //if (!isset($arSections[$arElement["IBLOCK_SECTION_ID"]]['~R']))
     //	$arSections[$arElement["IBLOCK_SECTION_ID"]]['~R'] = $oPhoto->CheckPermission('R', $arSections[$arElement["IBLOCK_SECTION_ID"]], false);
     //if (!$arSections[$arElement["IBLOCK_SECTION_ID"]]['~R'])
     //	continue;
Beispiel #5
0
 /**
  * @param array $arProduct
  * @return array
  */
 protected function getProductSku($arProduct)
 {
     $productId = (int) $arProduct['ID'];
     $productName = trim($arProduct['NAME']);
     if ($productId <= 0) {
         return false;
     }
     $arResult = array();
     if (!empty($this->offers[$productId])) {
         $arSku = array();
         foreach ($this->offers[$productId] as $arOffer) {
             $arSkuTmp = array();
             $arSkuTmp['PROPERTIES'] = array();
             $arSkuTmp['PROPERTIES_SHOW'] = array();
             $arOffer["CAN_BUY"] = "N";
             if (!empty($arOffer['PROPERTIES'])) {
                 foreach ($arOffer['PROPERTIES'] as $pid => $property) {
                     if ($property['PROPERTY_TYPE'] == 'F') {
                         continue;
                     }
                     $property = \CIBlockFormatProperties::GetDisplayValue($arOffer, $property, "catalog_out");
                     if (empty($property["DISPLAY_VALUE"])) {
                         continue;
                     }
                     $arSkuTmp['PROPERTIES'][$property["ID"]] = array();
                     if ($property['MULTIPLE'] == 'Y' && is_array($property["PROPERTY_VALUE_ID"])) {
                         foreach ($property["PROPERTY_VALUE_ID"] as $key => $propertyValueId) {
                             $arSkuTmp['PROPERTIES'][$property["ID"]][$propertyValueId] = $property["PROPERTY_TYPE"] === "L" ? $property["VALUE_ENUM"][$key] : $property["VALUE"][$key];
                         }
                         unset($key, $propertyValueId);
                     } else {
                         $arSkuTmp['PROPERTIES'][$property["ID"]][$property["PROPERTY_VALUE_ID"]] = $property["PROPERTY_TYPE"] === "L" ? $property["VALUE_ENUM"] : $property["VALUE"];
                     }
                     $mxValues = '';
                     if ('E' == $property['PROPERTY_TYPE']) {
                         if (!empty($property['LINK_ELEMENT_VALUE'])) {
                             $mxValues = array();
                             foreach ($property['LINK_ELEMENT_VALUE'] as $arTempo) {
                                 $mxValues[] = $arTempo['NAME'] . ' [' . $arTempo['ID'] . ']';
                             }
                         }
                     } elseif ('G' == $property['PROPERTY_TYPE']) {
                         if (!empty($property['LINK_SECTION_VALUE'])) {
                             $mxValues = array();
                             foreach ($property['LINK_SECTION_VALUE'] as $arTempo) {
                                 $mxValues[] = $arTempo['NAME'] . ' [' . $arTempo['ID'] . ']';
                             }
                         }
                     }
                     if (empty($mxValues)) {
                         $mxValues = $property["DISPLAY_VALUE"];
                     }
                     if ($mxValues) {
                         $arSkuTmp['PROPERTIES_SHOW'][$property["NAME"]] = strip_tags(is_array($mxValues) ? implode("/ ", $mxValues) : $mxValues);
                     }
                 }
             }
             $arSkuTmp["BALANCE"] = $arOffer["CATALOG_QUANTITY"];
             $arSkuTmp["USER_ID"] = $this->getUserId();
             $arSkuTmp["ID"] = $arOffer["ID"];
             $arSkuTmp["TYPE"] = $arOffer["CATALOG_TYPE"];
             $arSkuTmp["NAME"] = \CUtil::JSEscape($arOffer["NAME"]);
             $arSkuTmp["PRODUCT_NAME"] = \CUtil::JSEscape(htmlspecialcharsbx($productName));
             $arSkuTmp["PRODUCT_ID"] = $productId;
             $arSkuTmp["CAN_BUY"] = $arOffer["CAN_BUY"];
             $arSkuTmp["ACTIVE"] = $arOffer["ACTIVE"];
             $arSkuTmp["EXTERNAL_ID"] = $arOffer['EXTERNAL_ID'];
             if (isset($arOffer['PREVIEW_PICTURE'])) {
                 $arSkuTmp['PREVIEW_PICTURE'] = $arOffer['PREVIEW_PICTURE'];
             }
             if (isset($arOffer['DETAIL_PICTURE'])) {
                 $arSkuTmp['DETAIL_PICTURE'] = $arOffer['DETAIL_PICTURE'];
             }
             $arSku[] = $arSkuTmp;
         }
         $arResult["SKU_ELEMENTS"] = $arSku;
     }
     return $arResult;
 }
Beispiel #6
0
?>
</div>
					<div class="page-events-item__time <?php 
echo $arItem['PREVIEW_PICTURE'] ? 'page-events-item__time_color_white' : '';
?>
"><?php 
echo GetMessage('EVENTS_MAIN_FROM');
?>
 <?php 
echo CIBlockFormatProperties::DateFormat('H:i', MakeTimeStamp($arItem['ACTIVE_FROM'], @CSite::GetDateFormat()));
?>
 <?php 
echo GetMessage('EVENTS_MAIN_TO');
?>
 <?php 
echo CIBlockFormatProperties::DateFormat('H:i', MakeTimeStamp($arItem['ACTIVE_TO'], @CSite::GetDateFormat()));
?>
</div>
					<div class="page-events-item__description <?php 
echo $arItem['PREVIEW_PICTURE'] ? 'page-events-item__description_color_white' : '';
?>
">
						<?php 
echo $arItem['NAME'];
?>
					</div>
				</a>
			</div>
			<?endforeach;?>
			<div class="clearfix"></div>
		</div>
Beispiel #7
0
				)
				{
					$arResult["DISPLAY_PROPERTIES"][$pid] = CIBlockFormatProperties::GetDisplayValue($arResult, $prop, "catalog_out");
				}
			}
            $arResult["DISPLAY_PROPERTIES_ZAKREPI"] = array();
            foreach($arResult["PROPERTIES"] as $pid)
            {
                if(!in_array($pid['CODE'],$arParams["NOT_PROPERTY_CODE"])) {
                    $prop = &$pid;
                    $boolArr = is_array($prop["VALUE"]);
                    if (
                        ($boolArr && !empty($prop["VALUE"]))
                        || (!$boolArr && strlen($prop["VALUE"]) > 0)
                    ) {
                        $arResult["DISPLAY_PROPERTIES_ZAKREPI"][$pid['CODE']] = CIBlockFormatProperties::GetDisplayValue($arResult, $prop, "catalog_out");
                    }
                }
            }


			$arResult["PRODUCT_PROPERTIES"] = array();
			$arResult['PRODUCT_PROPERTIES_FILL'] = array();
			if ($arParams['ADD_PROPERTIES_TO_BASKET'] == 'Y' && !empty($arParams["PRODUCT_PROPERTIES"]))
			{
				$arResult["PRODUCT_PROPERTIES"] = CIBlockPriceTools::GetProductProperties(
					$arParams["IBLOCK_ID"],
					$arResult["ID"],
					$arParams["PRODUCT_PROPERTIES"],
					$arResult["PROPERTIES"]
				);
Beispiel #8
0
<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?>
<div class="news-list-cnt">
    <ul class="news-list">
    	<?foreach ($arResult["ITEMS"] as $key => $arItems) :?>
    		<?if ($key > 0 && $key%3 == 0):?>
    			</ul><ul class="news-list">
    		<?endif?>
	        <li>
	        	<a href="<?=$arItems["~DETAIL_PAGE_URL"]?>">
	                <div class="img-cnt">
	                	<img src="<?=CFile::GetPath($arItems["~PREVIEW_PICTURE"])?>" alt="" class="cover"/>
	                </div>
	                <div class="news-info">
	                    <p class="news-date">
	                    	<?=CIBlockFormatProperties::DateFormat("H:i", MakeTimeStamp($arItems["ACTIVE_FROM"], FORMAT_DATETIME));?>, 
	                    	<?=CIBlockFormatProperties::DateFormat("d F Y", MakeTimeStamp($arItems["ACTIVE_FROM"], FORMAT_DATETIME));?>
	                    </p>
	                    <p class="news-announce"><?=$arItems["NAME"]?></p>
	                </div>
	            </a>
	        </li>
       	<?endforeach?>
    </ul>
</div>
<?if($arParams["DISPLAY_BOTTOM_PAGER"]):?>
	<?=$arResult["NAV_STRING"]?>
<?endif;?>
Beispiel #9
0
                 $arResult["DELETED_OFFER_PROPERTIES"][$pid] = $arOffer["PROPERTIES"][$pid];
             }
         } else {
             if (!array_key_exists($pid, $arResult["SHOW_OFFER_PROPERTIES"])) {
                 $arResult["SHOW_OFFER_PROPERTIES"][$pid] = $arOffer["PROPERTIES"][$pid];
             }
         }
     }
 }
 if (count($arParams["PROPERTY_CODE"]) > 0) {
     $arItem["PROPERTIES"] = $obElement->GetProperties();
 }
 $arItem["DISPLAY_PROPERTIES"] = array();
 foreach ($arParams["PROPERTY_CODE"] as $pid) {
     if (!array_key_exists($pid, $_SESSION[$arParams["NAME"]][$arParams["IBLOCK_ID"]]["DELETE_PROP"])) {
         $arItem["DISPLAY_PROPERTIES"][$pid] = CIBlockFormatProperties::GetDisplayValue($arItem, $arItem["PROPERTIES"][$pid], "catalog_out");
     }
     if (array_key_exists($pid, $_SESSION[$arParams["NAME"]][$arParams["IBLOCK_ID"]]["DELETE_PROP"])) {
         if (!array_key_exists($pid, $arResult["DELETED_PROPERTIES"])) {
             $arResult["DELETED_PROPERTIES"][$pid] = $arItem["PROPERTIES"][$pid];
         }
     } else {
         if (!array_key_exists($pid, $arResult["SHOW_PROPERTIES"])) {
             $arResult["SHOW_PROPERTIES"][$pid] = $arItem["DISPLAY_PROPERTIES"][$pid];
         }
     }
 }
 if ($arOffer) {
     if ($arParams["USE_PRICE_COUNT"]) {
         if (CModule::IncludeModule("catalog")) {
             $arItem["PRICE_MATRIX"] = CatalogGetPriceTableEx($arOffer["ID"], 0, $arPriceTypeID, 'Y', $arConvertParams);
Beispiel #10
0
 /**
  * Get items for view.
  * @return mixed[]  array('ID' => array(), 'ID' => array(), ...)
  */
 protected function getItems()
 {
     if (empty($this->productIdsMap) || empty($this->arParams['SHOW_PRODUCTS'])) {
         return array();
     }
     $this->separateItemsByIblock();
     $defaultMeasure = $this->data['DEFAULT_MEASURE'];
     $items = array();
     foreach (array_keys($this->arParams['SHOW_PRODUCTS']) as $iblock) {
         $this->linkItems = array();
         if (empty($this->iblockItems[$iblock])) {
             continue;
         }
         $filter = $this->filter;
         $filter['IBLOCK_ID'] = $iblock;
         $filter['ID'] = $this->iblockItems[$iblock];
         $elementIterator = CIBlockElement::GetList(array(), $filter, false, false, $this->selectFields);
         $elementIterator->SetUrlTemplates($this->arParams['DETAIL_URL']);
         while ($element = $elementIterator->GetNext()) {
             $element['ID'] = (int) $element['ID'];
             $element['ACTIVE_FROM'] = $element['DATE_ACTIVE_FROM'];
             $element['ACTIVE_TO'] = $element['DATE_ACTIVE_TO'];
             $buttons = CIBlock::GetPanelButtons($element['IBLOCK_ID'], $element['ID'], 0, array("SECTION_BUTTONS" => false, "SESSID" => false, "CATALOG" => true));
             $element['EDIT_LINK'] = $buttons['edit']['edit_element']['ACTION_URL'];
             $element['DELETE_LINK'] = $buttons['edit']['delete_element']['ACTION_URL'];
             $ipropValues = new \Bitrix\Iblock\InheritedProperty\ElementValues($element["IBLOCK_ID"], $element["ID"]);
             $element["IPROPERTY_VALUES"] = $ipropValues->getValues();
             $element["PREVIEW_PICTURE"] = $element["PREVIEW_PICTURE"] > 0 ? CFile::GetFileArray($element["PREVIEW_PICTURE"]) : false;
             if ($element["PREVIEW_PICTURE"]) {
                 $element["PREVIEW_PICTURE"]["ALT"] = $element["IPROPERTY_VALUES"]["ELEMENT_PREVIEW_PICTURE_FILE_ALT"];
                 if ($element["PREVIEW_PICTURE"]["ALT"] == "") {
                     $element["PREVIEW_PICTURE"]["ALT"] = $element["NAME"];
                 }
                 $element["PREVIEW_PICTURE"]["TITLE"] = $element["IPROPERTY_VALUES"]["ELEMENT_PREVIEW_PICTURE_FILE_TITLE"];
                 if ($element["PREVIEW_PICTURE"]["TITLE"] == "") {
                     $element["PREVIEW_PICTURE"]["TITLE"] = $element["NAME"];
                 }
             }
             $element["DETAIL_PICTURE"] = $element["DETAIL_PICTURE"] > 0 ? CFile::GetFileArray($element["DETAIL_PICTURE"]) : false;
             if ($element["DETAIL_PICTURE"]) {
                 $element["DETAIL_PICTURE"]["ALT"] = $element["IPROPERTY_VALUES"]["ELEMENT_DETAIL_PICTURE_FILE_ALT"];
                 if ($element["DETAIL_PICTURE"]["ALT"] == "") {
                     $element["DETAIL_PICTURE"]["ALT"] = $element["NAME"];
                 }
                 $element["DETAIL_PICTURE"]["TITLE"] = $element["IPROPERTY_VALUES"]["ELEMENT_DETAIL_PICTURE_FILE_TITLE"];
                 if ($element["DETAIL_PICTURE"]["TITLE"] == "") {
                     $element["DETAIL_PICTURE"]["TITLE"] = $element["NAME"];
                 }
             }
             $element["PROPERTIES"] = array();
             $element["DISPLAY_PROPERTIES"] = array();
             $element["PRODUCT_PROPERTIES"] = array();
             $element['PRODUCT_PROPERTIES_FILL'] = array();
             if (!isset($element["CATALOG_MEASURE_RATIO"])) {
                 $element["CATALOG_MEASURE_RATIO"] = 1;
             }
             if (!isset($element['CATALOG_MEASURE'])) {
                 $element['CATALOG_MEASURE'] = 0;
             }
             $element['CATALOG_MEASURE'] = (int) $element['CATALOG_MEASURE'];
             if ($element['CATALOG_MEASURE'] < 0) {
                 $element['CATALOG_MEASURE'] = 0;
             }
             if (!isset($element['CATALOG_MEASURE_NAME'])) {
                 $element['CATALOG_MEASURE_NAME'] = '';
             }
             $element['CATALOG_MEASURE_NAME'] = $defaultMeasure['SYMBOL_RUS'];
             $element['~CATALOG_MEASURE_NAME'] = $defaultMeasure['~SYMBOL_RUS'];
             $items[$element['ID']] = $element;
             $this->linkItems[$element['ID']] =& $items[$element['ID']];
         }
         unset($element, $elementIterator);
         $propFilter = array('ID' => $this->iblockItems[$iblock], 'IBLOCK_ID' => $iblock);
         CIBlockElement::GetPropertyValuesArray($this->linkItems, $iblock, $propFilter);
         unset($propFilter);
         foreach ($this->linkItems as &$element) {
             CCatalogDiscount::SetProductPropertiesCache($element['ID'], $element['PROPERTIES']);
             if (isset($this->arParams['PROPERTY_CODE'][$iblock])) {
                 $properties = $this->arParams['PROPERTY_CODE'][$iblock];
                 foreach ($properties as $propertyName) {
                     if (!isset($element['PROPERTIES'][$propertyName])) {
                         continue;
                     }
                     $prop =& $element['PROPERTIES'][$propertyName];
                     $boolArr = is_array($prop["VALUE"]);
                     if ($boolArr && !empty($prop["VALUE"]) || !$boolArr && strlen($prop["VALUE"]) > 0) {
                         $element['DISPLAY_PROPERTIES'][$propertyName] = CIBlockFormatProperties::GetDisplayValue($element, $prop, 'catalog_out');
                     }
                     unset($prop);
                 }
             }
             if ($this->arParams['ADD_PROPERTIES_TO_BASKET'] == 'Y' && !empty($this->arParams['CART_PROPERTIES'][$iblock])) {
                 $element["PRODUCT_PROPERTIES"] = CIBlockPriceTools::GetProductProperties($element['IBLOCK_ID'], $element["ID"], $this->arParams['CART_PROPERTIES'][$iblock], $element["PROPERTIES"]);
                 if (!empty($element["PRODUCT_PROPERTIES"])) {
                     $element['PRODUCT_PROPERTIES_FILL'] = CIBlockPriceTools::getFillProductProperties($element['PRODUCT_PROPERTIES']);
                 }
             }
         }
         unset($element, $this->linkItems);
     }
     unset($iblock);
     unset($elementKey);
     return $items;
 }
Beispiel #11
0
">
        <div class="header">
            <div class="author">
                <div class="avatar">
                    <img alt="image" src="<?php 
    $avatar = CFile::ResizeImageGet($arItem["PROPERTIES"]["AVATAR"]["VALUE"], array("width" => 57, "height" => 57), BX_RESIZE_IMAGE_EXACT);
    echo $avatar["src"];
    ?>
">
                </div>
                <h2 class="name"><a href="#"><?php 
    echo $arItem["NAME"];
    ?>
</a></h2>
                <em class="date"><?php 
    echo CIBlockFormatProperties::DateFormat("d F Y H:i:s", MakeTimeStamp($arItem["DATE_CREATE"], CSite::GetDateFormat()));
    ?>
</em>
            </div>
            <div class="votes">
                <a href="javascript:void(0)" id="<?php 
    echo $arItemIDs["VOTE_PLUS"];
    ?>
" class="vote plus"><?php 
    echo intval($arItem["PROPERTIES"]["VOTE_PLUS"]["VALUE"]);
    ?>
</a>
                <a href="javascript:void(0)" id="<?php 
    echo $arItemIDs["VOTE_MINUS"];
    ?>
" class="vote minus"><?php 
Beispiel #12
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
// если отображается свойство USERS_LIKED
if (in_array("USERS_LIKED", $arParams["PROPERTY_CODE"])) {
    // запомним интересующие поля текущего пользователя
    global $USER;
    $id = $USER->GetID();
    $isAuth = $USER->IsAuthorized();
    // подправим всем элементам отображение свойства
    foreach ($arResult["ITEMS"] as $key => $arItem) {
        // пусть свойство всегда будет отображаться
        if (!array_key_exists("USERS_LIKED", $arItem["DISPLAY_PROPERTIES"])) {
            $arResult["ITEMS"][$key]["DISPLAY_PROPERTIES"]["USERS_LIKED"] = CIBlockFormatProperties::GetDisplayValue($arItem, $arItem["PROPERTIES"]["USERS_LIKED"]);
        }
        $value = "<span class=\"users_liked_block\">";
        $usersLiked = $arItem["DISPLAY_PROPERTIES"]["USERS_LIKED"]["VALUE"];
        // если есть, то для всех пользователей выводим список тех, кому понравилось
        if (count($usersLiked) > 0) {
            $rsUser = CUser::GetList($by = "LOGIN", $order = "asc", array("ID" => implode("|", $usersLiked)), array("ID", "LOGIN"));
            while ($arUser = $rsUser->Fetch()) {
                $value .= "{$arUser["LOGIN"]} ";
            }
        } else {
            $value .= "Нет ";
        }
        // для авторизованных выводить кнопки нравится / уже не нравится
        if ($isAuth) {
            if (in_array($id, $usersLiked)) {
Beispiel #13
0
 public static function GetOffersArray($arFilter, $arElementID, $arOrder, $arSelectFields, $arSelectProperties, $limit, $arPrices, $vat_include, $arCurrencyParams = array(), $USER_ID = 0, $LID = SITE_ID)
 {
     global $USER;
     $arResult = array();
     $boolCheckPermissions = false;
     $boolHideNotAvailable = false;
     $showPriceCount = false;
     $IBLOCK_ID = 0;
     if (!empty($arFilter) && is_array($arFilter)) {
         if (isset($arFilter['IBLOCK_ID'])) {
             $IBLOCK_ID = $arFilter['IBLOCK_ID'];
         }
         if (isset($arFilter['HIDE_NOT_AVAILABLE'])) {
             $boolHideNotAvailable = $arFilter['HIDE_NOT_AVAILABLE'] === 'Y';
         }
         if (isset($arFilter['CHECK_PERMISSIONS'])) {
             $boolCheckPermissions = $arFilter['CHECK_PERMISSIONS'] === 'Y';
         }
         if (isset($arFilter['SHOW_PRICE_COUNT'])) {
             $showPriceCount = (int) $arFilter['SHOW_PRICE_COUNT'];
             if ($showPriceCount <= 0) {
                 $showPriceCount = false;
             }
         }
     } else {
         $IBLOCK_ID = $arFilter;
     }
     if (self::$needDiscountCache === null) {
         $pricesAllow = CIBlockPriceTools::GetAllowCatalogPrices($arPrices);
         if (empty($pricesAllow)) {
             self::$needDiscountCache = false;
         } else {
             $USER_ID = (int) $USER_ID;
             $userGroups = $USER_ID > 0 ? CUser::GetUserGroup($USER_ID) : $USER->GetUserGroupArray();
             self::$needDiscountCache = CIBlockPriceTools::SetCatalogDiscountCache($pricesAllow, $userGroups);
             unset($userGroups);
         }
         unset($pricesAllow);
     }
     $arOffersIBlock = CIBlockPriceTools::GetOffersIBlock($IBLOCK_ID);
     if ($arOffersIBlock) {
         $arDefaultMeasure = CCatalogMeasure::getDefaultMeasure(true, true);
         $limit = (int) $limit;
         if (0 > $limit) {
             $limit = 0;
         }
         if (!isset($arOrder["ID"])) {
             $arOrder["ID"] = "DESC";
         }
         $intOfferIBlockID = $arOffersIBlock["OFFERS_IBLOCK_ID"];
         $productProperty = 'PROPERTY_' . $arOffersIBlock['OFFERS_PROPERTY_ID'];
         $productPropertyValue = $productProperty . '_VALUE';
         $arFilter = array("IBLOCK_ID" => $intOfferIBlockID, $productProperty => $arElementID, "ACTIVE" => "Y", "ACTIVE_DATE" => "Y");
         if ($boolHideNotAvailable) {
             $arFilter['CATALOG_AVAILABLE'] = 'Y';
         }
         if ($boolCheckPermissions) {
             $arFilter['CHECK_PERMISSIONS'] = "Y";
             $arFilter['MIN_PERMISSION'] = "R";
         }
         $arSelect = array("ID" => 1, "IBLOCK_ID" => 1, $productProperty => 1, "CATALOG_QUANTITY" => 1);
         foreach ($arPrices as $value) {
             if (!$value['CAN_VIEW'] && !$value['CAN_BUY']) {
                 continue;
             }
             $arSelect[$value["SELECT"]] = 1;
             if ($showPriceCount !== false) {
                 $arFilter['CATALOG_SHOP_QUANTITY_' . $value['ID']] = $showPriceCount;
             }
         }
         foreach ($arSelectFields as $code) {
             $arSelect[$code] = 1;
         }
         //mark to select
         if (!isset($arSelect['PREVIEW_PICTURE'])) {
             $arSelect['PREVIEW_PICTURE'] = 1;
         }
         if (!isset($arSelect['DETAIL_PICTURE'])) {
             $arSelect['DETAIL_PICTURE'] = 1;
         }
         $arOfferIDs = array();
         $arMeasureMap = array();
         $intKey = 0;
         $arOffersPerElement = array();
         $arOffersLink = array();
         $extPrices = array();
         $rsOffers = CIBlockElement::GetList($arOrder, $arFilter, false, false, array_keys($arSelect));
         while ($arOffer = $rsOffers->GetNext()) {
             $arOffer['ID'] = (int) $arOffer['ID'];
             $element_id = (int) $arOffer[$productPropertyValue];
             //No more than limit offers per element
             if ($limit > 0) {
                 $arOffersPerElement[$element_id]++;
                 if ($arOffersPerElement[$element_id] > $limit) {
                     continue;
                 }
             }
             if ($element_id > 0) {
                 $arOffer["LINK_ELEMENT_ID"] = $element_id;
                 $arOffer["PROPERTIES"] = array();
                 $arOffer["DISPLAY_PROPERTIES"] = array();
                 $arOffer['CHECK_QUANTITY'] = 'Y' == $arOffer['CATALOG_QUANTITY_TRACE'] && 'N' == $arOffer['CATALOG_CAN_BUY_ZERO'];
                 $arOffer['CATALOG_TYPE'] = CCatalogProduct::TYPE_OFFER;
                 $arOffer['CATALOG_MEASURE_NAME'] = $arDefaultMeasure['SYMBOL_RUS'];
                 $arOffer['~CATALOG_MEASURE_NAME'] = $arDefaultMeasure['SYMBOL_RUS'];
                 $arOffer["CATALOG_MEASURE_RATIO"] = 1;
                 if (!isset($arOffer['CATALOG_MEASURE'])) {
                     $arOffer['CATALOG_MEASURE'] = 0;
                 }
                 $arOffer['CATALOG_MEASURE'] = (int) $arOffer['CATALOG_MEASURE'];
                 if (0 > $arOffer['CATALOG_MEASURE']) {
                     $arOffer['CATALOG_MEASURE'] = 0;
                 }
                 if (0 < $arOffer['CATALOG_MEASURE']) {
                     if (!isset($arMeasureMap[$arOffer['CATALOG_MEASURE']])) {
                         $arMeasureMap[$arOffer['CATALOG_MEASURE']] = array();
                     }
                     $arMeasureMap[$arOffer['CATALOG_MEASURE']][] = $intKey;
                 }
                 $arOfferIDs[] = $arOffer['ID'];
                 $arResult[$intKey] = $arOffer;
                 if (!isset($arOffersLink[$arOffer['ID']])) {
                     $arOffersLink[$arOffer['ID']] =& $arResult[$intKey];
                 } else {
                     if (!isset($extPrices[$arOffer['ID']])) {
                         $extPrices[$arOffer['ID']] = array();
                     }
                     $extPrices[$arOffer['ID']][] =& $arResult[$intKey];
                 }
                 $intKey++;
             }
         }
         if (!empty($arOfferIDs)) {
             $rsRatios = CCatalogMeasureRatio::getList(array(), array('@PRODUCT_ID' => $arOfferIDs), false, false, array('PRODUCT_ID', 'RATIO'));
             while ($arRatio = $rsRatios->Fetch()) {
                 $arRatio['PRODUCT_ID'] = (int) $arRatio['PRODUCT_ID'];
                 if (isset($arOffersLink[$arRatio['PRODUCT_ID']])) {
                     $intRatio = (int) $arRatio['RATIO'];
                     $dblRatio = (double) $arRatio['RATIO'];
                     $mxRatio = $dblRatio > $intRatio ? $dblRatio : $intRatio;
                     if (CATALOG_VALUE_EPSILON > abs($mxRatio)) {
                         $mxRatio = 1;
                     } elseif (0 > $mxRatio) {
                         $mxRatio = 1;
                     }
                     $arOffersLink[$arRatio['PRODUCT_ID']]['CATALOG_MEASURE_RATIO'] = $mxRatio;
                 }
             }
             if (!empty($arSelectProperties)) {
                 CIBlockElement::GetPropertyValuesArray($arOffersLink, $intOfferIBlockID, $arFilter);
                 foreach ($arResult as &$arOffer) {
                     if (self::$needDiscountCache) {
                         CCatalogDiscount::SetProductPropertiesCache($arOffer['ID'], $arOffer["PROPERTIES"]);
                     }
                     foreach ($arSelectProperties as $pid) {
                         if (!isset($arOffer["PROPERTIES"][$pid])) {
                             continue;
                         }
                         $prop =& $arOffer["PROPERTIES"][$pid];
                         $boolArr = is_array($prop["VALUE"]);
                         if ($boolArr && !empty($prop["VALUE"]) || !$boolArr && strlen($prop["VALUE"]) > 0) {
                             $arOffer["DISPLAY_PROPERTIES"][$pid] = CIBlockFormatProperties::GetDisplayValue($arOffer, $prop, "catalog_out");
                         }
                         unset($prop);
                     }
                 }
                 unset($arOffer);
             }
             if (!empty($extPrices)) {
                 foreach ($extPrices as $origID => $prices) {
                     foreach ($prices as $oneRow) {
                         $oneRow['PROPERTIES'] = $arOffersLink[$origID]['PROPERTIES'];
                         $oneRow['DISPLAY_PROPERTIES'] = $arOffersLink[$origID]['DISPLAY_PROPERTIES'];
                         $oneRow['CATALOG_MEASURE_RATIO'] = $arOffersLink[$origID]['CATALOG_MEASURE_RATIO'];
                     }
                 }
             }
             if (self::$needDiscountCache) {
                 CCatalogDiscount::SetProductSectionsCache($arOfferIDs);
                 CCatalogDiscount::SetDiscountProductCache($arOfferIDs, array('IBLOCK_ID' => $intOfferIBlockID, 'GET_BY_ID' => 'Y'));
             }
             foreach ($arResult as &$arOffer) {
                 $arOffer['CATALOG_QUANTITY'] = 0 < $arOffer['CATALOG_QUANTITY'] && is_float($arOffer['CATALOG_MEASURE_RATIO']) ? (double) $arOffer['CATALOG_QUANTITY'] : (int) $arOffer['CATALOG_QUANTITY'];
                 $arOffer['MIN_PRICE'] = false;
                 $arOffer["PRICES"] = CIBlockPriceTools::GetItemPrices($arOffersIBlock["OFFERS_IBLOCK_ID"], $arPrices, $arOffer, $vat_include, $arCurrencyParams, $USER_ID, $LID);
                 if (!empty($arOffer["PRICES"])) {
                     foreach ($arOffer['PRICES'] as &$arOnePrice) {
                         if ($arOnePrice['MIN_PRICE'] == 'Y') {
                             $arOffer['MIN_PRICE'] = $arOnePrice;
                             break;
                         }
                     }
                     unset($arOnePrice);
                 }
                 $arOffer["CAN_BUY"] = CIBlockPriceTools::CanBuy($arOffersIBlock["OFFERS_IBLOCK_ID"], $arPrices, $arOffer);
             }
             if (isset($arOffer)) {
                 unset($arOffer);
             }
         }
         if (!empty($arMeasureMap)) {
             $rsMeasures = CCatalogMeasure::getList(array(), array('@ID' => array_keys($arMeasureMap)), false, false, array('ID', 'SYMBOL_RUS'));
             while ($arMeasure = $rsMeasures->GetNext()) {
                 $arMeasure['ID'] = (int) $arMeasure['ID'];
                 if (isset($arMeasureMap[$arMeasure['ID']]) && !empty($arMeasureMap[$arMeasure['ID']])) {
                     foreach ($arMeasureMap[$arMeasure['ID']] as &$intOneKey) {
                         $arResult[$intOneKey]['CATALOG_MEASURE_NAME'] = $arMeasure['SYMBOL_RUS'];
                         $arResult[$intOneKey]['~CATALOG_MEASURE_NAME'] = $arMeasure['~SYMBOL_RUS'];
                     }
                     unset($intOneKey);
                 }
             }
         }
     }
     return $arResult;
 }
Beispiel #14
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
//Make all properties present in order
//to prevent html table corruption
foreach ($arResult["ITEMS"] as $key => $arElement) {
    $arRes = array();
    foreach ($arParams["PROPERTY_CODE"] as $pid) {
        $arRes[$pid] = CIBlockFormatProperties::GetDisplayValue($arElement, $arElement["PROPERTIES"][$pid], "catalog_out");
    }
    $arResult["ITEMS"][$key]["DISPLAY_PROPERTIES"] = $arRes;
}
 function GetDateFormat($name, $parent)
 {
     global $DB;
     $timestamp = mktime(7, 30, 45, 2, 22, 2007);
     return array("PARENT" => $parent, "NAME" => $name, "TYPE" => "LIST", "VALUES" => array("d-m-Y" => CIBlockFormatProperties::DateFormat("d-m-Y", $timestamp), "m-d-Y" => CIBlockFormatProperties::DateFormat("m-d-Y", $timestamp), "Y-m-d" => CIBlockFormatProperties::DateFormat("Y-m-d", $timestamp), "d.m.Y" => CIBlockFormatProperties::DateFormat("d.m.Y", $timestamp), "d.M.Y" => CIBlockFormatProperties::DateFormat("d.M.Y", $timestamp), "m.d.Y" => CIBlockFormatProperties::DateFormat("m.d.Y", $timestamp), "j M Y" => CIBlockFormatProperties::DateFormat("j M Y", $timestamp), "M j, Y" => CIBlockFormatProperties::DateFormat("M j, Y", $timestamp), "j F Y" => CIBlockFormatProperties::DateFormat("j F Y", $timestamp), "f j, Y" => CIBlockFormatProperties::DateFormat("f j, Y", $timestamp), "d.m.y g:i A" => CIBlockFormatProperties::DateFormat("d.m.y g:i A", $timestamp), "d.M.y g:i A" => CIBlockFormatProperties::DateFormat("d.M.y g:i A", $timestamp), "d.M.Y g:i A" => CIBlockFormatProperties::DateFormat("d.M.Y g:i A", $timestamp), "d.m.y G:i" => CIBlockFormatProperties::DateFormat("d.m.y G:i", $timestamp), "d.m.Y H:i" => CIBlockFormatProperties::DateFormat("d.m.Y H:i", $timestamp), "SHORT" => GetMessage('COMP_PARAM_DATE_FORMAT_SITE'), "FULL" => GetMessage('COMP_PARAM_DATETIME_FORMAT_SITE')), "DEFAULT" => $DB->DateFormatToPHP(CSite::GetDateFormat("SHORT")), "ADDITIONAL_VALUES" => "Y");
 }
Beispiel #16
0
	public static function GetOffersArray($arFilter, $arElementID, $arOrder, $arSelectFields, $arSelectProperties, $limit, $arPrices, $vat_include, $arCurrencyParams = array(), $USER_ID = 0, $LID = SITE_ID)
	{
		$arResult = array();

		$boolCheckPermissions = false;
		$boolHideNotAvailable = false;
		$IBLOCK_ID = 0;
		if (!empty($arFilter) && is_array($arFilter))
		{
			if (isset($arFilter['IBLOCK_ID']))
				$IBLOCK_ID = $arFilter['IBLOCK_ID'];
			if (isset($arFilter['HIDE_NOT_AVAILABLE']))
				$boolHideNotAvailable = 'Y' === $arFilter['HIDE_NOT_AVAILABLE'];
			if (isset($arFilter['CHECK_PERMISSIONS']))
				$boolCheckPermissions = 'Y' === $arFilter['CHECK_PERMISSIONS'];
		}
		else
		{
			$IBLOCK_ID = $arFilter;
		}

		$arOffersIBlock = CIBlockPriceTools::GetOffersIBlock($IBLOCK_ID);
		if($arOffersIBlock)
		{
			$arDefaultMeasure = CCatalogMeasure::getDefaultMeasure(true, true);

			$limit = intval($limit);
			if (0 > $limit)
				$limit = 0;

			if(!isset($arOrder["ID"]))
				$arOrder["ID"] = "DESC";

			$intOfferIBlockID = $arOffersIBlock["OFFERS_IBLOCK_ID"];

			$arFilter = array(
				"IBLOCK_ID" => $intOfferIBlockID,
				"PROPERTY_".$arOffersIBlock["OFFERS_PROPERTY_ID"] => $arElementID,
				"ACTIVE" => "Y",
				"ACTIVE_DATE" => "Y",
			);
			if ($boolHideNotAvailable)
				$arFilter['CATALOG_AVAILABLE'] = 'Y';
			if ($boolCheckPermissions)
			{
				$arFilter['CHECK_PERMISSIONS'] = "Y";
				$arFilter['MIN_PERMISSION'] = "R";
			}

			$arSelect = array(
				"ID" => 1,
				"IBLOCK_ID" => 1,
				"PROPERTY_".$arOffersIBlock["OFFERS_PROPERTY_ID"] => 1,
				"CATALOG_QUANTITY" => 1
			);
			//if(!$arParams["USE_PRICE_COUNT"])
			{
				foreach($arPrices as $value)
				{
					if (!$value['CAN_VIEW'] && !$value['CAN_BUY'])
						continue;
					$arSelect[$value["SELECT"]] = 1;
				}
			}

			foreach($arSelectFields as $code)
				$arSelect[$code] = 1; //mark to select
			if (!isset($arSelect['PREVIEW_PICTURE']))
				$arSelect['PREVIEW_PICTURE'] = 1;
			if (!isset($arSelect['DETAIL_PICTURE']))
				$arSelect['DETAIL_PICTURE'] = 1;

			$arOfferIDs = array();
			$arMeasureMap = array();
			$intKey = 0;
			$arOffersPerElement = array();
			$arOffersLink = array();
			$rsOffers = CIBlockElement::GetList($arOrder, $arFilter, false, false, array_keys($arSelect));
			while($arOffer = $rsOffers->GetNext())
			{
				$arOffer['ID'] = intval($arOffer['ID']);
				$element_id = $arOffer["PROPERTY_".$arOffersIBlock["OFFERS_PROPERTY_ID"]."_VALUE"];
				//No more than limit offers per element
				if($limit > 0)
				{
					$arOffersPerElement[$element_id]++;
					if($arOffersPerElement[$element_id] > $limit)
						continue;
				}

				if($element_id > 0)
				{
					$arOffer["LINK_ELEMENT_ID"] = intval($element_id);
					$arOffer["PROPERTIES"] = array();
					$arOffer["DISPLAY_PROPERTIES"] = array();

					$arOffer['CHECK_QUANTITY'] = ('Y' == $arOffer['CATALOG_QUANTITY_TRACE'] && 'N' == $arOffer['CATALOG_CAN_BUY_ZERO']);
					$arOffer['CATALOG_TYPE'] = CCatalogProduct::TYPE_OFFER;
					$arOffer['CATALOG_MEASURE_NAME'] = $arDefaultMeasure['SYMBOL_RUS'];
					$arOffer['~CATALOG_MEASURE_NAME'] = $arDefaultMeasure['SYMBOL_RUS'];
					$arOffer["CATALOG_MEASURE_RATIO"] = 1;
					if (!isset($arOffer['CATALOG_MEASURE']))
						$arOffer['CATALOG_MEASURE'] = 0;
					$arOffer['CATALOG_MEASURE'] = intval($arOffer['CATALOG_MEASURE']);
					if (0 > $arOffer['CATALOG_MEASURE'])
						$arOffer['CATALOG_MEASURE'] = 0;
					if (0 < $arOffer['CATALOG_MEASURE'])
					{
						if (!isset($arMeasureMap[$arOffer['CATALOG_MEASURE']]))
							$arMeasureMap[$arOffer['CATALOG_MEASURE']] = array();
						$arMeasureMap[$arOffer['CATALOG_MEASURE']][] = $intKey;
					}

					$arOfferIDs[] = $arOffer['ID'];
					$arResult[$intKey] = $arOffer;
					$arOffersLink[$arOffer['ID']] = &$arResult[$intKey];
					$intKey++;
				}
			}
			if (!empty($arOfferIDs))
			{
				$rsRatios = CCatalogMeasureRatio::getList(
					array(),
					array('PRODUCT_ID' => $arOfferIDs),
					false,
					false,
					array('PRODUCT_ID', 'RATIO')
				);
				while ($arRatio = $rsRatios->Fetch())
				{
					$arRatio['PRODUCT_ID'] = intval($arRatio['PRODUCT_ID']);
					if (isset($arOffersLink[$arRatio['PRODUCT_ID']]))
					{
						$intRatio = intval($arRatio['RATIO']);
						$dblRatio = doubleval($arRatio['RATIO']);
						$mxRatio = ($dblRatio > $intRatio ? $dblRatio : $intRatio);
						if (CATALOG_VALUE_EPSILON > abs($mxRatio))
							$mxRatio = 1;
						elseif (0 > $mxRatio)
							$mxRatio = 1;
						$arOffersLink[$arRatio['PRODUCT_ID']]['CATALOG_MEASURE_RATIO'] = $mxRatio;
					}
				}

				if (!empty($arSelectProperties))
				{
					CIBlockElement::GetPropertyValuesArray($arOffersLink, $intOfferIBlockID, $arFilter);
					foreach ($arResult as &$arOffer)
					{
						CCatalogDiscount::SetProductPropertiesCache($arOffer['ID'], $arOffer["PROPERTIES"]);
						foreach ($arSelectProperties as $pid)
						{
							if (!isset($arOffer["PROPERTIES"][$pid]))
								continue;
							$prop = &$arOffer["PROPERTIES"][$pid];
							$boolArr = is_array($prop["VALUE"]);
							if(
								($boolArr && !empty($prop["VALUE"])) ||
								(!$boolArr && strlen($prop["VALUE"])>0))
							{
								$arOffer["DISPLAY_PROPERTIES"][$pid] = CIBlockFormatProperties::GetDisplayValue($arOffer, $prop, "catalog_out");
							}
						}
						if (isset($arOffer))
							unset($arOffer);
					}
				}

				CCatalogDiscount::SetProductSectionsCache($arOfferIDs);
				CCatalogDiscount::SetDiscountProductCache($arOfferIDs, array('IBLOCK_ID' => $intOfferIBlockID, 'GET_BY_ID' => 'Y'));
				foreach ($arResult as &$arOffer)
				{
					$arOffer['CATALOG_QUANTITY'] = (
						0 < $arOffer['CATALOG_QUANTITY'] && is_float($arOffer['CATALOG_MEASURE_RATIO'])
						? floatval($arOffer['CATALOG_QUANTITY'])
						: intval($arOffer['CATALOG_QUANTITY'])
					);
					$arOffer['MIN_PRICE'] = false;
					$arOffer["PRICES"] = CIBlockPriceTools::GetItemPrices($arOffersIBlock["OFFERS_IBLOCK_ID"], $arPrices, $arOffer, $vat_include, $arCurrencyParams, $USER_ID, $LID);
					if (!empty($arOffer["PRICES"]))
					{
						foreach ($arOffer['PRICES'] as &$arOnePrice)
						{
							if ('Y' == $arOnePrice['MIN_PRICE'])
							{
								$arOffer['MIN_PRICE'] = $arOnePrice;
								break;
							}
						}
						unset($arOnePrice);
					}
					$arOffer["CAN_BUY"] = CIBlockPriceTools::CanBuy($arOffersIBlock["OFFERS_IBLOCK_ID"], $arPrices, $arOffer);
				}
				if (isset($arOffer))
					unset($arOffer);
			}
			if (!empty($arMeasureMap))
			{
				$rsMeasures = CCatalogMeasure::getList(
					array(),
					array('@ID' => array_keys($arMeasureMap)),
					false,
					false,
					array('ID', 'SYMBOL_RUS')
				);
				while ($arMeasure = $rsMeasures->GetNext())
				{
					$arMeasure['ID'] = intval($arMeasure['ID']);
					if (isset($arMeasureMap[$arMeasure['ID']]) && !empty($arMeasureMap[$arMeasure['ID']]))
					{
						foreach ($arMeasureMap[$arMeasure['ID']] as &$intOneKey)
						{
							$arResult[$intOneKey]['CATALOG_MEASURE_NAME'] = $arMeasure['SYMBOL_RUS'];
							$arResult[$intOneKey]['~CATALOG_MEASURE_NAME'] = $arMeasure['~SYMBOL_RUS'];
						}
						unset($intOneKey);
					}
				}
			}
		}

		return $arResult;
	}
Beispiel #17
0
 function ReserveVR($Params)
 {
     $tst = MakeTimeStamp($Params['dateTo']);
     if (date("H:i", $tst) == '00:00') {
         $Params['dateTo'] = CIBlockFormatProperties::DateFormat(getDateFormat(true), $tst + (23 * 60 + 59) * 60);
     }
     //$maxUsers = COption::GetOptionInt("video", "video-room-users", 6);
     //if(count($Params['members']) > $maxUsers)
     //	return "max_users_".$maxUsers;
     $check = CEventCalendar::CheckVR($Params);
     if ($check !== true) {
         return $check;
     }
     $sectionID = 0;
     $dbItem = CIBlockSection::GetList(array(), array("IBLOCK_ID" => $Params['VMiblockId'], "ACTIVE" => "Y"));
     if ($arItem = $dbItem->Fetch()) {
         $sectionID = $arItem["ID"];
     }
     $arFields = array("IBLOCK_ID" => $Params['VMiblockId'], "IBLOCK_SECTION_ID" => $sectionID, "NAME" => $Params['name'], "DATE_ACTIVE_FROM" => $Params['dateFrom'], "DATE_ACTIVE_TO" => $Params['dateTo'], "CREATED_BY" => $GLOBALS["USER"]->GetID(), "DETAIL_TEXT" => $Params['description'], "PROPERTY_VALUES" => array("UF_PERSONS" => $Params['persons'], "PERIOD_TYPE" => $Params['regularity'], "PERIOD_COUNT" => $Params['regularity_count'], "EVENT_LENGTH" => $Params['regularity_length'], "PERIOD_ADDITIONAL" => $Params['regularity_additional'], "MEMBERS" => $Params['members']), "ACTIVE" => "Y");
     $bs = new CIBlockElement();
     $id = $bs->Add($arFields);
     return $id;
 }
Beispiel #18
0
 $arItem["PROPERTIES"] = array();
 $arItem["DISPLAY_PROPERTIES"] = array();
 if (!empty($arParams["PROPERTY_CODE"])) {
     $arItem["PROPERTIES"] = $obElement->GetProperties();
     foreach ($arParams["PROPERTY_CODE"] as &$pid) {
         if (!isset($arItem['PROPERTIES'][$pid])) {
             continue;
         }
         if (!isset($arResult['EMPTY_PROPERTIES'][$pid])) {
             $arResult['EMPTY_PROPERTIES'][$pid] = true;
         }
         if (!isset($_SESSION[$arParams["NAME"]][$arParams["IBLOCK_ID"]]["DELETE_PROP"][$pid])) {
             $prop =& $arItem['PROPERTIES'][$pid];
             $boolArr = is_array($prop['VALUE']);
             if ($boolArr && !empty($prop["VALUE"]) || !$boolArr && strlen($prop["VALUE"]) > 0) {
                 $arItem['DISPLAY_PROPERTIES'][$pid] = CIBlockFormatProperties::GetDisplayValue($arItem, $prop, 'catalog_out');
                 if ($arItem['DISPLAY_PROPERTIES'][$pid]['DISPLAY_VALUE'] !== false) {
                     $arResult['EMPTY_PROPERTIES'][$pid] = false;
                 }
             }
         }
         if (isset($_SESSION[$arParams["NAME"]][$arParams["IBLOCK_ID"]]["DELETE_PROP"][$pid])) {
             $arResult["DELETED_PROPERTIES"][$pid] = $arItem["PROPERTIES"][$pid];
             $arResult['EMPTY_PROPERTIES'][$pid] = false;
         } else {
             $arResult["SHOW_PROPERTIES"][$pid] = $arItem["PROPERTIES"][$pid];
         }
     }
     unset($pid);
 }
 $arItem['PARENT_ID'] = $arItem['ID'];
Beispiel #19
0
	);
	$rsItems = CIBlockElement::GetList($arOrder, $arFilter, false, array("nTopCount"=>$arParams["NEWS_COUNT"]), $arSelect);
	$rsItems->SetUrlTemplates($arParams["DETAIL_URL"]);
	while($arItem = $rsItems->GetNext())
	{
		$arButtons = CIBlock::GetPanelButtons(
			$arItem["IBLOCK_ID"],
			$arItem["ID"],
			0,
			array("SECTION_BUTTONS"=>false, "SESSID"=>false)
		);
		$arItem["EDIT_LINK"] = $arButtons["edit"]["edit_element"]["ACTION_URL"];
		$arItem["DELETE_LINK"] = $arButtons["edit"]["delete_element"]["ACTION_URL"];

		if(strlen($arItem["ACTIVE_FROM"])>0)
			$arItem["DISPLAY_ACTIVE_FROM"] = CIBlockFormatProperties::DateFormat($arParams["ACTIVE_DATE_FORMAT"], MakeTimeStamp($arItem["ACTIVE_FROM"], CSite::GetDateFormat()));
		else
			$arItem["DISPLAY_ACTIVE_FROM"] = "";

		$ipropValues = new \Freetrix\Iblock\InheritedProperty\ElementValues($arItem["IBLOCK_ID"], $arItem["ID"]);
		$arItem["IPROPERTY_VALUES"] = $ipropValues->getValues();

		if(isset($arItem["PREVIEW_PICTURE"]))
		{
			$arItem["PREVIEW_PICTURE"] = (0 < $arItem["PREVIEW_PICTURE"] ? CFile::GetFileArray($arItem["PREVIEW_PICTURE"]) : false);
			if ($arItem["PREVIEW_PICTURE"])
			{
				$arItem["PREVIEW_PICTURE"]["ALT"] = $arItem["IPROPERTY_VALUES"]["ELEMENT_PREVIEW_PICTURE_FILE_ALT"];
				if ($arItem["PREVIEW_PICTURE"]["ALT"] == "")
					$arItem["PREVIEW_PICTURE"]["ALT"] = $arItem["NAME"];
				$arItem["PREVIEW_PICTURE"]["TITLE"] = $arItem["IPROPERTY_VALUES"]["ELEMENT_PREVIEW_PICTURE_FILE_TITLE"];
            $arProperties[$p["CODE"]] = $p;
        }
        if (!array_key_exists($p["CODE"], $arValues)) {
            $arValues[$p["CODE"]] = array();
        }
        $arValues[$p["CODE"]][] = $p;
    }
    //echo'<pre>';print_r($arValues);echo'</pre>';
    $arSelect = array("ID", "NAME", "CODE", "PREVIEW_TEXT", "PREVIEW_TEXT_TYPE", "DETAIL_TEXT", "DETAIL_TEXT_TYPE", "PREVIEW_PICTURE", "DETAIL_PICTURE");
    $arSort = array($arParams["ES_IBLOCK_GROUP_SORT_FIELD"] => $arParams["ES_IBLOCK_GROUP_SORT_ORDER"]);
    $arFilter = array("ACTIVE" => "Y", "GLOBAL_ACTIVE" => "Y", "IBLOCK_ID" => $arParams["ES_IBLOCK_GROUP"], "IBLOCK_ACTIVE" => "Y");
    $arResult = array();
    $arResult["VALUES"] = $arValues;
    $rsElements = CIBlockElement::GetList($arSort, $arFilter, false, false, $arSelect);
    while ($obElement = $rsElements->GetNextElement()) {
        $arItem = array();
        $arItem = $obElement->GetFields();
        $arProp = array();
        foreach ($arParams["ES_GROUP_" . $arItem["CODE"]] as $p) {
            $arProp[$p] = CIBlockFormatProperties::GetDisplayValue($arItem, $arProperties[$p], "catalog_out");
            if ($arParams["ES_REMOVE_HREF"] == "Y" && preg_match("/<(.+)>(.+)<\\/a>/i", $arProp[$p]["DISPLAY_VALUE"], $arValue) == 1) {
                $arProp[$p]["DISPLAY_VALUE"] = $arValue[2];
            }
        }
        /* echo '<pre>';
           print_r($arProp);
           echo '</pre>';*/
        $arResult[] = array("ID" => $arItem["ID"], "NAME" => $arItem["NAME"], "CODE" => $arItem["CODE"], "PREVIEW_TEXT" => $arItem["PREVIEW_TEXT"], "PREVIEW_TEXT_TYPE" => $arItem["PREVIEW_TEXT_TYPE"], "DETAIL_TEXT" => $arItem["DETAIL_TEXT"], "DETAIL_TEXT_TYPE" => $arItem["DETAIL_TEXT_TYPE"], "PREVIEW_PICTURE" => CFile::GetFileArray($arItem["PREVIEW_PICTURE"]), "DETAIL_PICTURE" => CFile::GetFileArray($arItem["DETAIL_PICTURE"]), "PROPERTIES" => $arProp);
    }
    $this->IncludeComponentTemplate();
}
Beispiel #21
0
 public static function ReserveVideoRoom($Params)
 {
     $tst = MakeTimeStamp($Params['dateTo']);
     if (date("H:i", $tst) == '00:00') {
         $Params['dateTo'] = CIBlockFormatProperties::DateFormat(self::DFormat(true), $tst + (23 * 60 + 59) * 60);
     }
     $Params['VMiblockId'] = isset($Params['VMiblockId']) ? $Params['VMiblockId'] : self::$settings['vr_iblock_id'];
     $check = CCalendar::CheckVideoRoom($Params);
     if ($check !== true) {
         return $check;
     }
     $sectionID = 0;
     $dbItem = CIBlockSection::GetList(array(), array("IBLOCK_ID" => $Params['VMiblockId'], "ACTIVE" => "Y"));
     if ($arItem = $dbItem->Fetch()) {
         $sectionID = $arItem["ID"];
     }
     $arFields = array("IBLOCK_ID" => $Params['VMiblockId'], "IBLOCK_SECTION_ID" => $sectionID, "NAME" => $Params['name'], "DATE_ACTIVE_FROM" => $Params['dateFrom'], "DATE_ACTIVE_TO" => $Params['dateTo'], "CREATED_BY" => CCalendar::GetCurUserId(), "DETAIL_TEXT" => $Params['description'], "PROPERTY_VALUES" => array("PERIOD_TYPE" => 'NONE', "UF_PERSONS" => $Params['persons'], "MEMBERS" => $Params['members']), "ACTIVE" => "Y");
     $bs = new CIBlockElement();
     $id = $bs->Add($arFields);
     return $id;
 }
Beispiel #22
0
 /**
  * Get items for view.
  * @return mixed[]  array('ID' => array(), 'ID' => array(), ...)
  */
 protected function getItems()
 {
     if (empty($this->productIdsMap) || empty($this->arParams['SHOW_PRODUCTS'])) {
         return array();
     }
     $elementIterator = CIBlockElement::GetList(array(), $this->filter, false, false, $this->selectFields);
     $elementIterator->SetUrlTemplates($this->arParams["DETAIL_URL"]);
     $defaultMeasure = $this->data['DEFAULT_MEASURE'];
     $items = array();
     while ($elementObj = $elementIterator->GetNextElement()) {
         $item = $elementObj->GetFields();
         $item['ID'] = intval($item['ID']);
         $item['ACTIVE_FROM'] = $item['DATE_ACTIVE_FROM'];
         $item['ACTIVE_TO'] = $item['DATE_ACTIVE_TO'];
         // Inherited Properties
         $ipropValues = new \Bitrix\Iblock\InheritedProperty\ElementValues($item["IBLOCK_ID"], $item["ID"]);
         $item["IPROPERTY_VALUES"] = $ipropValues->getValues();
         $item["PREVIEW_PICTURE"] = 0 < $item["PREVIEW_PICTURE"] ? CFile::GetFileArray($item["PREVIEW_PICTURE"]) : false;
         if ($item["PREVIEW_PICTURE"]) {
             $item["PREVIEW_PICTURE"]["ALT"] = $item["IPROPERTY_VALUES"]["ELEMENT_PREVIEW_PICTURE_FILE_ALT"];
             if ($item["PREVIEW_PICTURE"]["ALT"] == "") {
                 $item["PREVIEW_PICTURE"]["ALT"] = $item["NAME"];
             }
             $item["PREVIEW_PICTURE"]["TITLE"] = $item["IPROPERTY_VALUES"]["ELEMENT_PREVIEW_PICTURE_FILE_TITLE"];
             if ($item["PREVIEW_PICTURE"]["TITLE"] == "") {
                 $item["PREVIEW_PICTURE"]["TITLE"] = $item["NAME"];
             }
         }
         $item["DETAIL_PICTURE"] = 0 < $item["DETAIL_PICTURE"] ? CFile::GetFileArray($item["DETAIL_PICTURE"]) : false;
         if ($item["DETAIL_PICTURE"]) {
             $item["DETAIL_PICTURE"]["ALT"] = $item["IPROPERTY_VALUES"]["ELEMENT_DETAIL_PICTURE_FILE_ALT"];
             if ($item["DETAIL_PICTURE"]["ALT"] == "") {
                 $item["DETAIL_PICTURE"]["ALT"] = $item["NAME"];
             }
             $item["DETAIL_PICTURE"]["TITLE"] = $item["IPROPERTY_VALUES"]["ELEMENT_DETAIL_PICTURE_FILE_TITLE"];
             if ($item["DETAIL_PICTURE"]["TITLE"] == "") {
                 $item["DETAIL_PICTURE"]["TITLE"] = $item["NAME"];
             }
         }
         $itemIblockId = (int) $item['IBLOCK_ID'];
         $needItemProperties = isset($this->arParams['PROPERTY_CODE'][$itemIblockId]) && !empty($this->arParams['PROPERTY_CODE'][$itemIblockId]) || isset($this->arParams['ADDITIONAL_PICT_PROP'][$itemIblockId]) || isset($this->arParams['LABEL_PROP'][$itemIblockId]);
         $item["PROPERTIES"] = array();
         $item["DISPLAY_PROPERTIES"] = array();
         if ($needItemProperties) {
             $item["PROPERTIES"] = $elementObj->getProperties();
             CCatalogDiscount::SetProductPropertiesCache($item['ID'], $item["PROPERTIES"]);
         }
         if (isset($this->arParams['PROPERTY_CODE'][$item['IBLOCK_ID']])) {
             $properties = $this->arParams['PROPERTY_CODE'][$item['IBLOCK_ID']];
             foreach ($properties as $propertyName) {
                 if (!isset($item["PROPERTIES"][$propertyName])) {
                     continue;
                 }
                 $prop =& $item["PROPERTIES"][$propertyName];
                 $boolArr = is_array($prop["VALUE"]);
                 if ($boolArr && !empty($prop["VALUE"]) || !$boolArr && strlen($prop["VALUE"]) > 0) {
                     $item["DISPLAY_PROPERTIES"][$propertyName] = CIBlockFormatProperties::GetDisplayValue($item, $prop, "catalog_out");
                 }
             }
         }
         $item["PRODUCT_PROPERTIES"] = array();
         $item['PRODUCT_PROPERTIES_FILL'] = array();
         if ($this->arParams['ADD_PROPERTIES_TO_BASKET'] == 'Y' && !empty($this->arParams['CART_PROPERTIES'][$item['IBLOCK_ID']])) {
             $item["PRODUCT_PROPERTIES"] = CIBlockPriceTools::GetProductProperties($item['IBLOCK_ID'], $item["ID"], $this->arParams['CART_PROPERTIES'][$item['IBLOCK_ID']], $item["PROPERTIES"]);
             if (!empty($item["PRODUCT_PROPERTIES"])) {
                 $item['PRODUCT_PROPERTIES_FILL'] = CIBlockPriceTools::getFillProductProperties($item['PRODUCT_PROPERTIES']);
             }
         }
         if (!isset($item["CATALOG_MEASURE_RATIO"])) {
             $item["CATALOG_MEASURE_RATIO"] = 1;
         }
         if (!isset($item['CATALOG_MEASURE'])) {
             $item['CATALOG_MEASURE'] = 0;
         }
         $item['CATALOG_MEASURE'] = intval($item['CATALOG_MEASURE']);
         if (0 > $item['CATALOG_MEASURE']) {
             $item['CATALOG_MEASURE'] = 0;
         }
         if (!isset($item['CATALOG_MEASURE_NAME'])) {
             $item['CATALOG_MEASURE_NAME'] = '';
         }
         $item['CATALOG_MEASURE_NAME'] = $defaultMeasure['SYMBOL_RUS'];
         $item['~CATALOG_MEASURE_NAME'] = $defaultMeasure['~SYMBOL_RUS'];
         $items[$item['ID']] = $item;
     }
     return $items;
 }
Beispiel #23
0
	public static function GetDateFormat($name, $parent)
	{
		global $DB;

		$timestamp = mktime(7,30,45,2,22,2007);
		return array(
			"PARENT" => $parent,
			"NAME" => $name,
			"TYPE" => "LIST",
			"SIZE" => 8,
			"VALUES" => array(
				"d-m-Y" => CIBlockFormatProperties::DateFormat("d-m-Y", $timestamp),//"22-02-2007",
				"m-d-Y" => CIBlockFormatProperties::DateFormat("m-d-Y", $timestamp),//"02-22-2007",
				"Y-m-d" => CIBlockFormatProperties::DateFormat("Y-m-d", $timestamp),//"2007-02-22",
				"d.m.Y" => CIBlockFormatProperties::DateFormat("d.m.Y", $timestamp),//"22.02.2007",
				"d.M.Y" => CIBlockFormatProperties::DateFormat("d.M.Y", $timestamp),//"22.Feb.2007",
				"m.d.Y" => CIBlockFormatProperties::DateFormat("m.d.Y", $timestamp),//"02.22.2007",
				"j M Y" => CIBlockFormatProperties::DateFormat("j M Y", $timestamp),//"22 Feb 2007",
				"M j, Y" => CIBlockFormatProperties::DateFormat("M j, Y", $timestamp),//"Feb 22, 2007",
				"j F Y" => CIBlockFormatProperties::DateFormat("j F Y", $timestamp),//"22 February 2007",
				"f j, Y" => CIBlockFormatProperties::DateFormat("f j, Y", $timestamp),//"February 22, 2007",
				"d.m.y g:i A" => CIBlockFormatProperties::DateFormat("d.m.y g:i A", $timestamp),//"22.02.07 1:30 PM",
				"d.M.y g:i A" => CIBlockFormatProperties::DateFormat("d.M.y g:i A", $timestamp),//"22.Feb.07 1:30 PM",
				"d.M.Y g:i A" => CIBlockFormatProperties::DateFormat("d.M.Y g:i A", $timestamp),//"22.Febkate.2007 1:30 PM",
				"d.m.y G:i" => CIBlockFormatProperties::DateFormat("d.m.y G:i", $timestamp),//"22.02.07 7:30",
				"d.m.Y H:i" => CIBlockFormatProperties::DateFormat("d.m.Y H:i", $timestamp),//"22.02.2007 07:30",
				"SHORT" => GetMessage('COMP_PARAM_DATE_FORMAT_SITE'),
				"FULL" => GetMessage('COMP_PARAM_DATETIME_FORMAT_SITE')
			),
			"DEFAULT" => $DB->DateFormatToPHP(CSite::GetDateFormat("SHORT")),
			"ADDITIONAL_VALUES" => "Y",
		);
	}
Beispiel #24
0
	public static function GetOffersArray($IBLOCK_ID, $arElementID, $arOrder, $arSelectFields, $arSelectProperties, $limit, $arPrices, $vat_include, $arCurrencyParams = array(), $USER_ID = 0, $LID = SITE_ID)
	{
		$arResult = array();

		$arOffersIBlock = CIBlockPriceTools::GetOffersIBlock($IBLOCK_ID);
		if($arOffersIBlock)
		{
			$limit = intval($limit);
			if (0 > $limit)
				$limit = 0;

			if(!array_key_exists("ID", $arOrder))
				$arOrder["ID"] = "DESC";

			$arFilter = array(
				"IBLOCK_ID" => $arOffersIBlock["OFFERS_IBLOCK_ID"],
				"PROPERTY_".$arOffersIBlock["OFFERS_PROPERTY_ID"] => $arElementID,
				"ACTIVE" => "Y",
				"ACTIVE_DATE" => "Y",
			);

			$arSelect = array(
				"ID" => 1,
				"IBLOCK_ID" => 1,
				"PROPERTY_".$arOffersIBlock["OFFERS_PROPERTY_ID"] => 1,
			);
			//if(!$arParams["USE_PRICE_COUNT"])
			{
				foreach($arPrices as $value)
				{
					$arSelect[$value["SELECT"]] = 1;
					//$arrFilter["CATALOG_SHOP_QUANTITY_".$value["ID"]] = $arParams["SHOW_PRICE_COUNT"];
				}
			}

			foreach($arSelectFields as $code)
				$arSelect[$code] = 1; //mark to select

			$arOffersPerElement = array();
			$rsOffers = CIBlockElement::GetList($arOrder, $arFilter, false, false, array_keys($arSelect));
			while($obOffer = $rsOffers->GetNextElement())
			{
				$arOffer = $obOffer->GetFields();
				$element_id = $arOffer["PROPERTY_".$arOffersIBlock["OFFERS_PROPERTY_ID"]."_VALUE"];
				//No more than limit offers per element
				if($limit > 0)
				{
					$arOffersPerElement[$element_id]++;
					if($arOffersPerElement[$element_id] > $limit)
						continue;
				}

				if($element_id > 0)
				{
					$arOffer["LINK_ELEMENT_ID"] = $element_id;
					$arOffer["DISPLAY_PROPERTIES"] = array();
					if(!empty($arSelectProperties))
					{
						$arOffer["PROPERTIES"] = $obOffer->GetProperties();
						foreach($arSelectProperties as $pid)
						{
							$prop = &$arOffer["PROPERTIES"][$pid];
							if((is_array($prop["VALUE"]) && count($prop["VALUE"])>0) ||
							(!is_array($prop["VALUE"]) && strlen($prop["VALUE"])>0))
							{
								$arOffer["DISPLAY_PROPERTIES"][$pid] = CIBlockFormatProperties::GetDisplayValue($arOffer, $prop, "catalog_out");
							}
						}
					}

					$arOffer["PRICES"] = CIBlockPriceTools::GetItemPrices($arOffersIBlock["OFFERS_IBLOCK_ID"], $arPrices, $arOffer, $vat_include, $arCurrencyParams, $USER_ID, $LID);
					$arOffer["CAN_BUY"] = CIBlockPriceTools::CanBuy($arOffersIBlock["OFFERS_IBLOCK_ID"], $arPrices, $arOffer);
				}
				$arResult[] = $arOffer;
			}
		}

		return $arResult;
	}
Beispiel #25
0
			<?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);
            ?>
$html .= '</td>';
$html .= '</tr>';
$html .= '</table>';
$html .= '<br>';
$html .= '<p>Итого к оплате без НДС*: ' . number_format($_SESSION["ORDER_ITEM"]['price'], 0, '.', ' ') . ' (' . Number2Word_Rus($_SESSION["ORDER_ITEM"]['price'], 'N') . ') белорусских рублей.</p>';
$html .= '<p style="font-size:80%;">* Стоимость услуг указана без НДС, Исполнитель является плательщиком налогов по УСН.</p>';
$html .= '<table style="width:100%;">';
$html .= '<tr>';
$html .= '<td style="width:50%;background:url(/bitrix/templates/goodidea/images/pechat.jpg) no-repeat 0 0;height:190px;padding-left:70px;vertical-align:top;">';
$html .= '';
$html .= '<p>Исполнитель:</p>';
$html .= '<br><br><br><br>';
$html .= '<p>________________ Р.В. Нестерович</p>';
$html .= '<p>м.п.</p>';
$html .= '<br><br>';
$html .= '<p>' . CIBlockFormatProperties::DateFormat('«j» F Y', time()) . 'г.</p>';
$html .= '</td>';
$html .= '<td style="width:50%;height:190px;padding-left:70px;vertical-align:top;">';
$html .= '';
$html .= '<p>Заказчик:</p>';
$html .= '<br><br><br><br>';
$html .= '<p>________________ ' . $_POST['posContractLName'] . ' ' . $_POST['posContractFName'] . '</p>';
$html .= '<p>м.п.</p>';
$html .= '<br><br>';
$html .= '<p>«___» __________ 201_ г.</p>';
$html .= '</td>';
$html .= '</tr>';
$html .= '</table>';
include $_SERVER['DOCUMENT_ROOT'] . "/mpdf60/mpdf.php";
$mpdf = new mPDF();
$mpdf->charset_in = 'cp1251';
Beispiel #27
0
 /**
  * Convert dates if date template set
  * @param mixed[] array that date conversion performs in
  * @return void
  */
 protected function formatDate(&$arr)
 {
     if (strlen($this->arParams['ACTIVE_DATE_FORMAT'])) {
         foreach ($this->orderDateFields2Convert as $fld) {
             if (!empty($arr[$fld])) {
                 $arr[$fld . "_FORMATED"] = CIBlockFormatProperties::DateFormat($this->arParams['ACTIVE_DATE_FORMAT'], MakeTimeStamp($arr[$fld]));
             }
         }
     }
 }
Beispiel #28
0
 /**
  * Convert dates if date template set
  * @param mixed[] $arr data array to be converted
  * @param string[] $conversion contains sublist of keys of $arr, that will be converted
  * @return void
  */
 protected function formatDate(&$arr, $conversion)
 {
     if (strlen($this->arParams['ACTIVE_DATE_FORMAT']) && self::isNonemptyArray($conversion)) {
         foreach ($conversion as $fld) {
             if (!empty($arr[$fld])) {
                 $arr[$fld . "_FORMATED"] = CIBlockFormatProperties::DateFormat($this->arParams['ACTIVE_DATE_FORMAT'], MakeTimeStamp($arr[$fld]));
             }
         }
     }
 }
Beispiel #29
0
 }
 //ORDER BY
 $arSort = array();
 //EXECUTE
 $rsElement = CIBlockElement::GetList($arSort, $arFilter, false, false, $arSelect);
 $rsElement->SetUrlTemplates($arParams["DETAIL_URL"], $arParams["SECTION_URL"]);
 if ($obElement = $rsElement->GetNextElement()) {
     $arResult = $obElement->GetFields();
     if ($bGetProperty) {
         $arResult["PROPERTIES"] = $obElement->GetProperties();
     }
     $arResult["DISPLAY_PROPERTIES"] = array();
     foreach ($arParams["PROPERTY_CODE"] as $pid) {
         $prop =& $arResult["PROPERTIES"][$pid];
         if (is_array($prop["VALUE"]) && count($prop["VALUE"]) > 0 || !is_array($prop["VALUE"]) && strlen($prop["VALUE"]) > 0) {
             $arResult["DISPLAY_PROPERTIES"][$pid] = CIBlockFormatProperties::GetDisplayValue($arResult, $prop, "photo_out");
         }
     }
     if ($arParams["SECTION_ID"]) {
         $arResult["IBLOCK_SECTION_ID"] = $arParams["SECTION_ID"];
     } elseif ($arParams["SECTION_CODE"]) {
         $arResult["IBLOCK_SECTION_CODE"] = $arParams["SECTION_CODE"];
     }
     if (isset($arResult["PREVIEW_PICTURE"])) {
         $arResult["PREVIEW_PICTURE"] = CFile::GetFileArray($arResult["PREVIEW_PICTURE"]);
     }
     if (isset($arResult["DETAIL_PICTURE"])) {
         $arResult["DETAIL_PICTURE"] = CFile::GetFileArray($arResult["DETAIL_PICTURE"]);
     }
     if (is_array($arResult["DETAIL_PICTURE"])) {
         $arResult["PICTURE"] = $arResult["DETAIL_PICTURE"];
Beispiel #30
0
        $arIBlockPropertiesDateTime = array();
        $dbIBlockProperties = CIBlockProperty::GetList(array("SORT" => "ASC"), array("IBLOCK_ID" => $arGadgetParams["IBLOCK_ID"], "ACTIVE" => "Y"));
        while ($arIBlockProperty = $dbIBlockProperties->Fetch()) {
            $arIBlockProperties[] = $arIBlockProperty["CODE"];
            if ($arIBlockProperty["USER_TYPE"] == "DateTime") {
                $arIBlockPropertiesDateTime[] = $arIBlockProperty["CODE"];
            }
        }
        $dbIBlockElement = CIBlockElement::GetList($arSort, $arFilter, false, array("nTopCount" => $arGadgetParams["ITEMS_COUNT"]));
        while ($obElement = $dbIBlockElement->GetNextElement()) {
            $arIBlockElement = $obElement->GetFields();
            $arIBlockElement["PROPERTIES"] = $obElement->GetProperties();
            foreach ($arIBlockProperties as $pid) {
                $prop = $arIBlockElement["PROPERTIES"][$pid];
                if (is_array($prop["VALUE"]) && count($prop["VALUE"]) > 0 || !is_array($prop["VALUE"]) && strlen($prop["VALUE"]) > 0) {
                    $arIBlockElement["DISPLAY_PROPERTIES"][$pid] = CIBlockFormatProperties::GetDisplayValue($arIBlockElement, $prop, "catalog_out");
                }
            }
            ?>
<div class="bx-gadgets-text" style="clear: both; padding: 0 0 10px 0;"><?php 
            if (strlen($arGadgetParams["DATE_FIELD"]) > 0) {
                $strDate = "";
                if (array_key_exists($arGadgetParams["DATE_FIELD"], $arIBlockElement) && strlen($arIBlockElement[$arGadgetParams["DATE_FIELD"]]) > 0) {
                    if (in_array($arGadgetParams["DATE_FIELD"], array("DATE_CREATE", "TIMESTAMP_X", "DATE_ACTIVE_FROM", "DATE_ACTIVE_TO"))) {
                        $strDate = ToLower(FormatDate("j F Y", MakeTimeStamp($arIBlockElement[$arGadgetParams["DATE_FIELD"]])));
                    } else {
                        $strDate = $arIBlockElement[$arGadgetParams["DATE_FIELD"]];
                    }
                } elseif (strpos($arGadgetParams["DATE_FIELD"], "PROPERTY_") === 0 && array_key_exists(substr($arGadgetParams["DATE_FIELD"], 9), $arIBlockElement["DISPLAY_PROPERTIES"]) && strlen($arIBlockElement["DISPLAY_PROPERTIES"][substr($arGadgetParams["DATE_FIELD"], 9)]["DISPLAY_VALUE"]) > 0) {
                    $val = $arIBlockElement["DISPLAY_PROPERTIES"][substr($arGadgetParams["DATE_FIELD"], 9)]["DISPLAY_VALUE"];
                    if (is_array($val)) {