Your IP : 18.221.7.151
<?php
IncludeModuleLangFile(__FILE__);
class CKDAExportUtils {
protected static $moduleId = 'esolutions.exportexcel';
public static function GetOfferIblock($IBLOCK_ID, $retarray=false)
{
if(!$IBLOCK_ID || !CModule::IncludeModule('catalog')) return false;
$dbRes = CCatalog::GetList(array(), array('IBLOCK_ID'=>$IBLOCK_ID));
$arFields = $dbRes->Fetch();
if($arFields['OFFERS_IBLOCK_ID'])
{
if($retarray) return $arFields;
else return $arFields['OFFERS_IBLOCK_ID'];
}
else
{
$dbRes = CCatalog::GetList(array(), array('PRODUCT_IBLOCK_ID'=>$IBLOCK_ID));
if($arFields2 = $dbRes->Fetch())
{
$arFields = array_merge($arFields2, array(
'IBLOCK_ID' => $arFields2['PRODUCT_IBLOCK_ID'],
'YANDEX_EXPORT' => $arFields2['YANDEX_EXPORT'],
'SUBSCRIPTION' => $arFields2['SUBSCRIPTION'],
'VAT_ID' => $arFields2['VAT_ID'],
'PRODUCT_IBLOCK_ID' => 0,
'SKU_PROPERTY_ID' => 0,
'OFFERS_PROPERTY_ID' => $arFields2['SKU_PROPERTY_ID'],
'OFFERS_IBLOCK_ID' => $arFields2['IBLOCK_ID'],
'ID' => $arFields2['PRODUCT_IBLOCK_ID'],
));
if($retarray) return $arFields;
else return $arFields['OFFERS_IBLOCK_ID'];
}
}
return false;
}
public static function GetFileName($fn)
{
global $APPLICATION;
if(file_exists($_SERVER['DOCUMENT_ROOT'].$fn)) return $fn;
if(defined("BX_UTF")) $tmpfile = $APPLICATION->ConvertCharsetArray($fn, LANG_CHARSET, 'CP1251');
else $tmpfile = $APPLICATION->ConvertCharsetArray($fn, LANG_CHARSET, 'UTF-8');
if(file_exists($_SERVER['DOCUMENT_ROOT'].$tmpfile)) return $tmpfile;
return false;
}
public static function Win1251Utf8($str)
{
global $APPLICATION;
return $APPLICATION->ConvertCharset($str, "Windows-1251", "UTF-8");
}
public static function GetFileLinesCount($fn)
{
if(!file_exists($fn)) return 0;
$cnt = 0;
$handle = fopen($fn, 'r');
while (!feof($handle)) {
$buffer = trim(fgets($handle));
if($buffer) $cnt++;
}
fclose($handle);
return $cnt;
}
public static function SortFileIds($fn)
{
if(!file_exists($fn)) return 0;
$arIds = array();
$handle = fopen($fn, 'r');
while (!feof($handle)) {
$buffer = trim(fgets($handle, 128));
if($buffer) $arIds[] = (int)$buffer;
}
fclose($handle);
sort($arIds, SORT_NUMERIC);
unlink($fn);
$handle = fopen($fn, 'a');
$cnt = count($arIds);
$step = 10000;
for($i=0; $i<$cnt; $i+=$step)
{
fwrite($handle, implode("\r\n", array_slice($arIds, $i, $step))."\r\n");
}
fclose($handle);
if($cnt > 0) return end($arIds);
else return 0;
}
public static function GetPartIdsFromFile($fn, $min)
{
if(!file_exists($fn)) return array();
$cnt = 0;
$maxCnt = 5000;
$arIds = array();
$handle = fopen($fn, 'r');
while (!feof($handle) && $maxCnt>$cnt) {
$buffer = (int)trim(fgets($handle, 128));
if($buffer > $min)
{
$arIds[] = (int)$buffer;
$cnt++;
}
}
fclose($handle);
return $arIds;
}
function SaveFile($arFile, $strSavePath, $bForceMD5=false, $bSkipExt=false)
{
$strFileName = GetFileName($arFile["name"]); /* filename.gif */
if(isset($arFile["del"]) && $arFile["del"] <> '')
{
CFile::DoDelete($arFile["old_file"]);
if($strFileName == '')
return "NULL";
}
if($arFile["name"] == '')
{
if(isset($arFile["description"]) && intval($arFile["old_file"])>0)
{
CFile::UpdateDesc($arFile["old_file"], $arFile["description"]);
}
return false;
}
if (isset($arFile["content"]))
{
if (!isset($arFile["size"]))
{
$arFile["size"] = CUtil::BinStrlen($arFile["content"]);
}
}
else
{
try
{
$file = new \Bitrix\Main\IO\File(\Bitrix\Main\IO\Path::convertPhysicalToLogical($arFile["tmp_name"]));
$arFile["size"] = $file->getSize();
}
catch(IO\IoException $e)
{
$arFile["size"] = 0;
}
}
$arFile["ORIGINAL_NAME"] = $strFileName;
//translit, replace unsafe chars, etc.
$strFileName = self::transformName($strFileName, $bForceMD5, $bSkipExt);
//transformed name must be valid, check disk quota, etc.
if (self::validateFile($strFileName, $arFile) !== "")
{
return false;
}
if($arFile["type"] == "image/pjpeg" || $arFile["type"] == "image/jpg")
{
$arFile["type"] = "image/jpeg";
}
$bExternalStorage = false;
/*foreach(GetModuleEvents("main", "OnFileSave", true) as $arEvent)
{
if(ExecuteModuleEventEx($arEvent, array(&$arFile, $strFileName, $strSavePath, $bForceMD5, $bSkipExt)))
{
$bExternalStorage = true;
break;
}
}*/
if(!$bExternalStorage)
{
$upload_dir = COption::GetOptionString("main", "upload_dir", "upload");
$io = CBXVirtualIo::GetInstance();
if($bForceMD5 != true)
{
$dir_add = '';
$i=0;
while(true)
{
$dir_add = substr(md5(uniqid("", true)), 0, 3);
if(!$io->FileExists($_SERVER["DOCUMENT_ROOT"]."/".$upload_dir."/".$strSavePath."/".$dir_add."/".$strFileName))
{
break;
}
if($i >= 25)
{
$j=0;
while(true)
{
$dir_add = substr(md5(mt_rand()), 0, 3)."/".substr(md5(mt_rand()), 0, 3);
if(!$io->FileExists($_SERVER["DOCUMENT_ROOT"]."/".$upload_dir."/".$strSavePath."/".$dir_add."/".$strFileName))
{
break;
}
if($j >= 25)
{
$dir_add = substr(md5(mt_rand()), 0, 3)."/".md5(mt_rand());
break;
}
$j++;
}
break;
}
$i++;
}
if(substr($strSavePath, -1, 1) <> "/")
$strSavePath .= "/".$dir_add;
else
$strSavePath .= $dir_add."/";
}
else
{
$strFileExt = ($bSkipExt == true || ($ext = GetFileExtension($strFileName)) == ''? '' : ".".$ext);
while(true)
{
if(substr($strSavePath, -1, 1) <> "/")
$strSavePath .= "/".substr($strFileName, 0, 3);
else
$strSavePath .= substr($strFileName, 0, 3)."/";
if(!$io->FileExists($_SERVER["DOCUMENT_ROOT"]."/".$upload_dir."/".$strSavePath."/".$strFileName))
break;
//try the new name
$strFileName = md5(uniqid("", true)).$strFileExt;
}
}
$arFile["SUBDIR"] = $strSavePath;
$arFile["FILE_NAME"] = $strFileName;
$strDirName = $_SERVER["DOCUMENT_ROOT"]."/".$upload_dir."/".$strSavePath."/";
$strDbFileNameX = $strDirName.$strFileName;
$strPhysicalFileNameX = $io->GetPhysicalName($strDbFileNameX);
CheckDirPath($strDirName);
if(is_set($arFile, "content"))
{
$f = fopen($strPhysicalFileNameX, "ab");
if(!$f)
return false;
if(fwrite($f, $arFile["content"]) === false)
return false;
fclose($f);
}
elseif(
!copy($arFile["tmp_name"], $strPhysicalFileNameX)
&& !move_uploaded_file($arFile["tmp_name"], $strPhysicalFileNameX)
)
{
CFile::DoDelete($arFile["old_file"]);
return false;
}
if(isset($arFile["old_file"]))
CFile::DoDelete($arFile["old_file"]);
@chmod($strPhysicalFileNameX, BX_FILE_PERMISSIONS);
//flash is not an image
$flashEnabled = !CFile::IsImage($arFile["ORIGINAL_NAME"], $arFile["type"]);
$imgArray = CFile::GetImageSize($strDbFileNameX, false, $flashEnabled);
if(is_array($imgArray))
{
$arFile["WIDTH"] = $imgArray[0];
$arFile["HEIGHT"] = $imgArray[1];
if($imgArray[2] == IMAGETYPE_JPEG)
{
$exifData = CFile::ExtractImageExif($io->GetPhysicalName($strDbFileNameX));
if ($exifData && isset($exifData['Orientation']))
{
//swap width and height
if ($exifData['Orientation'] >= 5 && $exifData['Orientation'] <= 8)
{
$arFile["WIDTH"] = $imgArray[1];
$arFile["HEIGHT"] = $imgArray[0];
}
$properlyOriented = CFile::ImageHandleOrientation($exifData['Orientation'], $io->GetPhysicalName($strDbFileNameX));
if ($properlyOriented)
{
$jpgQuality = intval(COption::GetOptionString('main', 'image_resize_quality', '95'));
if($jpgQuality <= 0 || $jpgQuality > 100)
$jpgQuality = 95;
imagejpeg($properlyOriented, $io->GetPhysicalName($strDbFileNameX), $jpgQuality);
}
}
}
}
else
{
$arFile["WIDTH"] = 0;
$arFile["HEIGHT"] = 0;
}
}
if($arFile["WIDTH"] == 0 || $arFile["HEIGHT"] == 0)
{
//mock image because we got false from CFile::GetImageSize()
if(strpos($arFile["type"], "image/") === 0)
{
$arFile["type"] = "application/octet-stream";
}
}
if($arFile["type"] == '' || !is_string($arFile["type"]))
{
$arFile["type"] = "application/octet-stream";
}
/****************************** QUOTA ******************************/
if (COption::GetOptionInt("main", "disk_space") > 0)
{
CDiskQuota::updateDiskQuota("file", $arFile["size"], "insert");
}
/****************************** QUOTA ******************************/
$NEW_IMAGE_ID = CFile::DoInsert(array(
"HEIGHT" => $arFile["HEIGHT"],
"WIDTH" => $arFile["WIDTH"],
"FILE_SIZE" => $arFile["size"],
"CONTENT_TYPE" => $arFile["type"],
"SUBDIR" => $arFile["SUBDIR"],
"FILE_NAME" => $arFile["FILE_NAME"],
"MODULE_ID" => $arFile["MODULE_ID"],
"ORIGINAL_NAME" => $arFile["ORIGINAL_NAME"],
"DESCRIPTION" => isset($arFile["description"])? $arFile["description"]: '',
"HANDLER_ID" => isset($arFile["HANDLER_ID"])? $arFile["HANDLER_ID"]: '',
"EXTERNAL_ID" => isset($arFile["external_id"])? $arFile["external_id"]: md5(mt_rand()),
));
CFile::CleanCache($NEW_IMAGE_ID);
return $NEW_IMAGE_ID;
}
protected function transformName($name, $bForceMD5 = false, $bSkipExt = false)
{
//safe filename without path
$fileName = GetFileName($name);
$originalName = ($bForceMD5 != true);
if($originalName)
{
//transforming original name:
//transliteration
if(COption::GetOptionString("main", "translit_original_file_name", "N") == "Y")
{
$fileName = CUtil::translit($fileName, LANGUAGE_ID, array("max_len"=>1024, "safe_chars"=>".", "replace_space" => '-'));
}
//replace invalid characters
if(COption::GetOptionString("main", "convert_original_file_name", "Y") == "Y")
{
$io = CBXVirtualIo::GetInstance();
$fileName = $io->RandomizeInvalidFilename($fileName);
}
}
//.jpe is not image type on many systems
if($bSkipExt == false && strtolower(GetFileExtension($fileName)) == "jpe")
{
$fileName = substr($fileName, 0, -4).".jpg";
}
//double extension vulnerability
$fileName = RemoveScriptExtension($fileName);
if(!$originalName)
{
//name is md5-generated:
$fileName = md5(uniqid("", true)).($bSkipExt == true || ($ext = GetFileExtension($fileName)) == ''? '' : ".".$ext);
}
return $fileName;
}
protected function validateFile($strFileName, $arFile)
{
if($strFileName == '')
return GetMessage("FILE_BAD_FILENAME");
$io = CBXVirtualIo::GetInstance();
if(!$io->ValidateFilenameString($strFileName))
return GetMessage("MAIN_BAD_FILENAME1");
if(strlen($strFileName) > 255)
return GetMessage("MAIN_BAD_FILENAME_LEN");
//check .htaccess etc.
if(IsFileUnsafe($strFileName))
return GetMessage("FILE_BAD_TYPE");
//nginx returns octet-stream for .jpg
if(GetFileNameWithoutExtension($strFileName) == '')
return GetMessage("FILE_BAD_FILENAME");
if (COption::GetOptionInt("main", "disk_space") > 0)
{
$quota = new CDiskQuota();
if (!$quota->checkDiskQuota($arFile))
return GetMessage("FILE_BAD_QUOTA");
}
return "";
}
public static function ShowFilter($sTableID, $listIndex, $SETTINGS, $SETTINGS_DEFAULT)
{
global $APPLICATION;
CJSCore::Init('file_input');
$IBLOCK_ID = $SETTINGS_DEFAULT['IBLOCK_ID'];
$changeIblockId = (bool)($SETTINGS['CHANGE_IBLOCK_ID'][$listIndex]=='Y');
if($changeIblockId && $SETTINGS['LIST_IBLOCK_ID'][$listIndex])
{
$IBLOCK_ID = $SETTINGS['LIST_IBLOCK_ID'][$listIndex];
}
CModule::IncludeModule('iblock');
$bCatalog = CModule::IncludeModule('catalog');
$bSale = CModule::IncludeModule('sale');
if($bCatalog)
{
$arCatalog = CCatalog::GetByID($IBLOCK_ID);
if($arCatalog)
{
if(is_callable(array('CCatalogAdminTools', 'getIblockProductTypeList')))
{
$productTypeList = CCatalogAdminTools::getIblockProductTypeList($IBLOCK_ID, true);
}
$arStores = array();
$dbRes = CCatalogStore::GetList(array("SORT"=>"ID"), array(), false, false, array("ID", "TITLE", "ADDRESS"));
while($arStore = $dbRes->Fetch())
{
if(strlen($arStore['TITLE'])==0 && $arStore['ADDRESS']) $arStore['TITLE'] = $arStore['ADDRESS'];
$arStores[] = $arStore;
}
$arPrices = array();
$dbPriceType = CCatalogGroup::GetList(array("SORT" => "ASC"));
while($arPriceType = $dbPriceType->Fetch())
{
if(strlen($arPriceType["NAME_LANG"])==0 && $arPriceType['NAME']) $arPriceType['NAME_LANG'] = $arPriceType['NAME'];
$arPrices[] = $arPriceType;
}
}
if(!$arCatalog) $bCatalog = false;
}
$boolSKU = false;
$strSKUName = '';
if($OFFERS_IBLOCK_ID = self::GetOfferIblock($IBLOCK_ID))
{
$boolSKU = true;
$strSKUName = GetMessage('KDA_EE_IBLIST_A_OFFERS');
}
$arFields = (is_array($SETTINGS['FILTER'][$listIndex]) ? $SETTINGS['FILTER'][$listIndex] : array());
$dbrFProps = CIBlockProperty::GetList(
array(
"SORT"=>"ASC",
"NAME"=>"ASC"
),
array(
"IBLOCK_ID"=>$IBLOCK_ID,
"CHECK_PERMISSIONS"=>"N",
)
);
$arProps = array();
while ($arProp = $dbrFProps->GetNext())
{
if ($arProp["ACTIVE"] == "Y")
{
$arProp["PROPERTY_USER_TYPE"] = ('' != $arProp["USER_TYPE"] ? CIBlockProperty::GetUserType($arProp["USER_TYPE"]) : array());
$arProps[] = $arProp;
}
}
?>
<!--<form method="GET" name="find_form" id="find_form" action="">-->
<div class="find_form_inner">
<?
$arFindFields = Array();
$arFindFields["IBEL_A_F_ID"] = GetMessage("KDA_EE_IBEL_A_F_ID");
$arFindFields["IBEL_A_F_PARENT"] = GetMessage("KDA_EE_IBEL_A_F_PARENT");
$arFindFields["IBEL_A_F_MODIFIED_WHEN"] = GetMessage("KDA_EE_IBEL_A_F_MODIFIED_WHEN");
$arFindFields["IBEL_A_F_MODIFIED_BY"] = GetMessage("KDA_EE_IBEL_A_F_MODIFIED_BY");
$arFindFields["IBEL_A_F_CREATED_WHEN"] = GetMessage("KDA_EE_IBEL_A_F_CREATED_WHEN");
$arFindFields["IBEL_A_F_CREATED_BY"] = GetMessage("KDA_EE_IBEL_A_F_CREATED_BY");
$arFindFields["IBEL_A_F_ACTIVE_FROM"] = GetMessage("KDA_EE_IBEL_A_ACTFROM");
$arFindFields["IBEL_A_F_ACTIVE_TO"] = GetMessage("KDA_EE_IBEL_A_ACTTO");
$arFindFields["IBEL_A_F_ACT"] = GetMessage("KDA_EE_IBEL_A_F_ACT");
$arFindFields["IBEL_A_F_NAME"] = GetMessage("KDA_EE_IBEL_A_F_NAME");
$arFindFields["IBEL_A_F_DESC"] = GetMessage("KDA_EE_IBEL_A_F_DESC");
$arFindFields["IBEL_A_CODE"] = GetMessage("KDA_EE_IBEL_A_CODE");
$arFindFields["IBEL_A_EXTERNAL_ID"] = GetMessage("KDA_EE_IBEL_A_EXTERNAL_ID");
$arFindFields["IBEL_A_PREVIEW_PICTURE"] = GetMessage("KDA_EE_IBEL_A_PREVIEW_PICTURE");
$arFindFields["IBEL_A_DETAIL_PICTURE"] = GetMessage("KDA_EE_IBEL_A_DETAIL_PICTURE");
$arFindFields["IBEL_A_TAGS"] = GetMessage("KDA_EE_IBEL_A_TAGS");
if ($bCatalog)
{
if(is_array($productTypeList)) $arFindFields["CATALOG_TYPE"] = GetMessage("KDA_EE_CATALOG_TYPE");
$arFindFields["CATALOG_BUNDLE"] = GetMessage("KDA_EE_CATALOG_BUNDLE");
$arFindFields["CATALOG_AVAILABLE"] = GetMessage("KDA_EE_CATALOG_AVAILABLE");
$arFindFields["CATALOG_QUANTITY"] = GetMessage("KDA_EE_CATALOG_QUANTITY");
if(is_array($arStores))
{
foreach($arStores as $arStore)
{
$arFindFields["CATALOG_STORE".$arStore['ID']."_QUANTITY"] = sprintf(GetMessage("KDA_EE_CATALOG_STORE_QUANTITY"), $arStore['TITLE']);
}
if(count($arStores) > 0) $arFindFields["CATALOG_STORE_ANY_QUANTITY"] = GetMessage("KDA_EE_CATALOG_STORE_ANY_QUANTITY");
}
if(is_array($arPrices))
{
foreach($arPrices as $arPrice)
{
$arFindFields["CATALOG_PRICE_".$arPrice['ID']] = sprintf(GetMessage("KDA_EE_CATALOG_PRICE"), $arPrice['NAME_LANG']);
}
}
if($bSale)
{
$arFindFields["SALE_ORDER"] = GetMessage("KDA_EE_EL_A_SALE_ORDER");
}
}
foreach($arProps as $arProp)
if($arProp["FILTRABLE"]=="Y" && $arProp["PROPERTY_TYPE"]!="F")
$arFindFields["IBEL_A_PROP_".$arProp["ID"]] = $arProp["NAME"];
if($boolSKU)
{
$arFindFields["IBEL_A_SUB_F_MODIFIED_WHEN"] = ('' != $strSKUName ? $strSKUName.' - ' : '').GetMessage("KDA_EE_IBEL_A_F_MODIFIED_WHEN");
$arFindFields["IBEL_A_SUB_F_ACT"] = ('' != $strSKUName ? $strSKUName.' - ' : '').GetMessage("KDA_EE_IBEL_A_F_ACT");
if($bCatalog)
{
$arFindFields["SUB_CATALOG_QUANTITY"] = ('' != $strSKUName ? $strSKUName.' - ' : '').GetMessage("KDA_EE_CATALOG_QUANTITY");
if(is_array($arStores))
{
foreach($arStores as $arStore)
{
$arFindFields["SUB_CATALOG_STORE".$arStore['ID']."_QUANTITY"] = ('' != $strSKUName ? $strSKUName.' - ' : '').sprintf(GetMessage("KDA_EE_CATALOG_STORE_QUANTITY"), $arStore['TITLE']);
}
if(count($arStores) > 0) $arFindFields["SUB_CATALOG_STORE_ANY_QUANTITY"] = ('' != $strSKUName ? $strSKUName.' - ' : '').GetMessage("KDA_EE_CATALOG_STORE_ANY_QUANTITY");
}
if(is_array($arPrices))
{
foreach($arPrices as $arPrice)
{
$arFindFields["SUB_CATALOG_PRICE_".$arPrice['ID']] = ('' != $strSKUName ? $strSKUName.' - ' : '').sprintf(GetMessage("KDA_EE_CATALOG_PRICE"), $arPrice['NAME_LANG']);
}
}
}
}
/*if ($boolSKU && $boolSKUFiltrable)
{
foreach($arSKUProps as $arProp)
{
$arFindFields["IBEL_A_SUB_PROP_".$arProp["ID"]] = ('' != $strSKUName ? $strSKUName.' - ' : '').$arProp["NAME"];
}
}*/
$oFilter = new CAdminFilter($sTableID."_filter", $arFindFields);
$oFilter->Begin();
?>
<tr>
<td><?echo GetMessage("KDA_EE_FILTER_FROMTO_ID")?>:</td>
<td nowrap>
<input type="text" name="SETTINGS[FILTER][<?=$listIndex?>][find_el_id_start]" size="10" value="<?echo htmlspecialcharsex($arFields['find_el_id_start'])?>">
...
<input type="text" name="SETTINGS[FILTER][<?=$listIndex?>][find_el_id_end]" size="10" value="<?echo htmlspecialcharsex($arFields['find_el_id_end'])?>">
</td>
</tr>
<tr>
<td><?echo GetMessage("KDA_EE_FIELD_SECTION_ID")?>:</td>
<td>
<select name="SETTINGS[FILTER][<?=$listIndex?>][find_section_section][]" multiple size="5">
<option value="-1"><?echo GetMessage("KDA_EE_VALUE_ANY")?></option>
<option value="0"<?if((is_array($arFields['find_section_section']) && in_array("0", $arFields['find_section_section'])) || $arFields['find_section_section']=="0")echo" selected"?>><?echo GetMessage("KDA_EE_UPPER_LEVEL")?></option>
<?
$bsections = CIBlockSection::GetTreeList(Array("IBLOCK_ID"=>$IBLOCK_ID), array("ID", "NAME", "DEPTH_LEVEL"));
while($ar = $bsections->GetNext()):
?><option value="<?echo $ar["ID"]?>"<?if((is_array($arFields['find_section_section']) && in_array($ar["ID"], $arFields['find_section_section'])) || $ar["ID"]==$arFields['find_section_section'])echo " selected"?>><?echo str_repeat(" . ", $ar["DEPTH_LEVEL"])?><?echo $ar["NAME"]?></option><?
endwhile;
?>
</select><br>
<input type="checkbox" name="SETTINGS[FILTER][<?=$listIndex?>][find_el_subsections]" value="Y"<?if($arFields['find_el_subsections']=="Y")echo" checked"?>> <?echo GetMessage("KDA_EE_INCLUDING_SUBSECTIONS")?>
</td>
</tr>
<?
$GLOBALS["SETTINGS[FILTER][".$listIndex."][find_el_timestamp_from]_FILTER_PERIOD"] = $arFields['find_el_timestamp_from_FILTER_PERIOD'];
$GLOBALS["SETTINGS[FILTER][".$listIndex."][find_el_timestamp_from]_FILTER_DIRECTION"] = $arFields['find_el_timestamp_from_FILTER_DIRECTION'];
?>
<tr>
<td><?echo GetMessage("KDA_EE_FIELD_TIMESTAMP_X")?>:</td>
<td data-filter-period="<?echo htmlspecialcharsex($arFields['find_el_timestamp_from_FILTER_PERIOD'])?>" data-filter-last-days="<?echo htmlspecialcharsex($arFields['find_el_timestamp_from_FILTER_LAST_DAYS'])?>"><?echo CalendarPeriod("SETTINGS[FILTER][".$listIndex."][find_el_timestamp_from]", htmlspecialcharsex($arFields['find_el_timestamp_from']), "SETTINGS[FILTER][".$listIndex."][find_el_timestamp_to]", htmlspecialcharsex($arFields['find_el_timestamp_to']), "dataload", "Y")?></font></td>
</tr>
<tr>
<td><?=GetMessage("KDA_EE_FIELD_MODIFIED_BY")?>:</td>
<td>
<?echo FindUserID(
"SETTINGS[FILTER][".$listIndex."][find_el_modified_user_id]",
$arFields['find_el_modified_user_id'],
"",
"dataload",
"5",
"",
" ... ",
"",
""
);?>
</td>
</tr>
<?
$GLOBALS["SETTINGS[FILTER][".$listIndex."][find_el_created_from]_FILTER_PERIOD"] = $arFields['find_el_created_from_FILTER_PERIOD'];
$GLOBALS["SETTINGS[FILTER][".$listIndex."][find_el_created_from]_FILTER_DIRECTION"] = $arFields['find_el_created_from_FILTER_DIRECTION'];
?>
<tr>
<td><?echo GetMessage("KDA_EE_EL_ADMIN_DCREATE")?>:</td>
<td data-filter-period="<?echo htmlspecialcharsex($arFields['find_el_created_from_FILTER_PERIOD'])?>" data-filter-last-days="<?echo htmlspecialcharsex($arFields['find_el_created_from_FILTER_LAST_DAYS'])?>"><?echo CalendarPeriod("SETTINGS[FILTER][".$listIndex."][find_el_created_from]", htmlspecialcharsex($arFields['find_el_created_from']), "SETTINGS[FILTER][".$listIndex."][find_el_created_to]", htmlspecialcharsex($arFields['find_el_created_to']), "dataload", "Y")?></td>
</tr>
<tr>
<td><?echo GetMessage("KDA_EE_EL_ADMIN_WCREATE")?></td>
<td>
<?echo FindUserID(
"SETTINGS[FILTER][".$listIndex."][find_el_created_user_id]",
$arFields['find_el_created_user_id'],
"",
"dataload",
"5",
"",
" ... ",
"",
""
);?>
</td>
</tr>
<tr>
<td><?echo GetMessage("KDA_EE_EL_A_ACTFROM")?>:</td>
<td><?echo CalendarPeriod("SETTINGS[FILTER][".$listIndex."][find_el_date_active_from_from]", htmlspecialcharsex($arFields['find_el_date_active_from_from']), "SETTINGS[FILTER][".$listIndex."][find_el_date_active_from_to]", htmlspecialcharsex($arFields['find_el_date_active_from_to']), "dataload")?></td>
</tr>
<tr>
<td><?echo GetMessage("KDA_EE_EL_A_ACTTO")?>:</td>
<td><?echo CalendarPeriod("SETTINGS[FILTER][".$listIndex."][find_el_date_active_to_from]", htmlspecialcharsex($arFields['find_el_date_active_to_from']), "SETTINGS[FILTER][".$listIndex."][find_el_date_active_to_to]", htmlspecialcharsex($arFields['find_el_date_active_to_to']), "dataload")?></td>
</tr>
<tr>
<td><?echo GetMessage("KDA_EE_FIELD_ACTIVE")?>:</td>
<td>
<select name="SETTINGS[FILTER][<?=$listIndex?>][find_el_active]">
<option value=""><?=htmlspecialcharsex(GetMessage('KDA_EE_VALUE_ANY'))?></option>
<option value="Y"<?if($arFields['find_el_active']=="Y")echo " selected"?>><?=htmlspecialcharsex(GetMessage("KDA_EE_YES"))?></option>
<option value="N"<?if($arFields['find_el_active']=="N")echo " selected"?>><?=htmlspecialcharsex(GetMessage("KDA_EE_NO"))?></option>
</select>
</td>
</tr>
<tr>
<td><?echo GetMessage("KDA_EE_FIELD_NAME")?>:</td>
<td><input type="text" name="SETTINGS[FILTER][<?=$listIndex?>][find_el_name]" value="<?echo htmlspecialcharsex($arFields['find_el_name'])?>" size="30"> <?=ShowFilterLogicHelp()?></td>
</tr>
<tr>
<td><?echo GetMessage("KDA_EE_EL_ADMIN_DESC")?></td>
<td><input type="text" name="SETTINGS[FILTER][<?=$listIndex?>][find_el_intext]" value="<?echo htmlspecialcharsex($arFields['find_el_intext'])?>" size="30"> <?=ShowFilterLogicHelp()?></td>
</tr>
<tr>
<td><?=GetMessage("KDA_EE_EL_A_CODE")?>:</td>
<td><input type="text" name="SETTINGS[FILTER][<?=$listIndex?>][find_el_code]" value="<?echo htmlspecialcharsex($arFields['find_el_code'])?>" size="30"> <?=ShowFilterLogicHelp()?></td>
</tr>
<tr>
<td><?=GetMessage("KDA_EE_EL_A_EXTERNAL_ID")?>:</td>
<td><input type="text" name="SETTINGS[FILTER][<?=$listIndex?>][find_el_external_id]" value="<?echo htmlspecialcharsex($arFields['find_el_external_id'])?>" size="30"></td>
</tr>
<tr>
<td><?=GetMessage("KDA_EE_EL_A_PREVIEW_PICTURE")?>:</td>
<td>
<select name="SETTINGS[FILTER][<?=$listIndex?>][find_el_preview_picture]">
<option value=""><?=htmlspecialcharsex(GetMessage('KDA_EE_VALUE_ANY'))?></option>
<option value="Y"<?if($arFields['find_el_preview_picture']=="Y")echo " selected"?>><?=htmlspecialcharsex(GetMessage("KDA_EE_IS_NOT_EMPTY"))?></option>
<option value="N"<?if($arFields['find_el_preview_picture']=="N")echo " selected"?>><?=htmlspecialcharsex(GetMessage("KDA_EE_IS_EMPTY"))?></option>
</select>
</td>
</tr>
<tr>
<td><?=GetMessage("KDA_EE_EL_A_DETAIL_PICTURE")?>:</td>
<td>
<select name="SETTINGS[FILTER][<?=$listIndex?>][find_el_detail_picture]">
<option value=""><?=htmlspecialcharsex(GetMessage('KDA_EE_VALUE_ANY'))?></option>
<option value="Y"<?if($arFields['find_el_detail_picture']=="Y")echo " selected"?>><?=htmlspecialcharsex(GetMessage("KDA_EE_IS_NOT_EMPTY"))?></option>
<option value="N"<?if($arFields['find_el_detail_picture']=="N")echo " selected"?>><?=htmlspecialcharsex(GetMessage("KDA_EE_IS_EMPTY"))?></option>
</select>
</td>
</tr>
<tr>
<td><?=GetMessage("KDA_EE_EL_A_TAGS")?>:</td>
<td>
<input type="text" name="SETTINGS[FILTER][<?=$listIndex?>][find_el_tags]" value="<?echo htmlspecialcharsex($arFields['find_el_tags'])?>" size="30">
</td>
</tr>
<?
if ($bCatalog)
{
if(is_array($productTypeList))
{
?><tr>
<td><?=GetMessage("KDA_EE_CATALOG_TYPE"); ?>:</td>
<td>
<select name="SETTINGS[FILTER][<?=$listIndex?>][find_el_catalog_type][]" multiple>
<option value=""><?=htmlspecialcharsex(GetMessage('KDA_EE_VALUE_ANY'))?></option>
<?
$catalogTypes = (!empty($arFields['find_el_catalog_type']) ? $arFields['find_el_catalog_type'] : array());
foreach ($productTypeList as $productType => $productTypeName)
{
?>
<option value="<? echo $productType; ?>"<? echo (in_array($productType, $catalogTypes) ? ' selected' : ''); ?>><? echo htmlspecialcharsex($productTypeName); ?></option><?
}
unset($productType, $productTypeName, $catalogTypes);
?>
</select>
</td>
</tr>
<?
}
?>
<tr>
<td><?echo GetMessage("KDA_EE_CATALOG_BUNDLE")?>:</td>
<td>
<select name="SETTINGS[FILTER][<?=$listIndex?>][find_el_catalog_bundle]">
<option value=""><?=htmlspecialcharsex(GetMessage('KDA_EE_VALUE_ANY'))?></option>
<option value="Y"<?if($arFields['find_el_catalog_bundle']=="Y")echo " selected"?>><?=htmlspecialcharsex(GetMessage("KDA_EE_YES"))?></option>
<option value="N"<?if($arFields['find_el_catalog_bundle']=="N")echo " selected"?>><?=htmlspecialcharsex(GetMessage("KDA_EE_NO"))?></option>
</select>
</td>
</tr>
<tr>
<td><?echo GetMessage("KDA_EE_CATALOG_AVAILABLE")?>:</td>
<td>
<select name="SETTINGS[FILTER][<?=$listIndex?>][find_el_catalog_available]">
<option value=""><?=htmlspecialcharsex(GetMessage('KDA_EE_VALUE_ANY'))?></option>
<option value="Y"<?if($arFields['find_el_catalog_available']=="Y")echo " selected"?>><?=htmlspecialcharsex(GetMessage("KDA_EE_YES"))?></option>
<option value="N"<?if($arFields['find_el_catalog_available']=="N")echo " selected"?>><?=htmlspecialcharsex(GetMessage("KDA_EE_NO"))?></option>
</select>
</td>
</tr>
<tr>
<td><?echo GetMessage("KDA_EE_CATALOG_QUANTITY")?>:</td>
<td>
<select name="SETTINGS[FILTER][<?=$listIndex?>][find_el_catalog_quantity_comp]">
<option value="eq" <?if($arFields['find_el_catalog_quantity_comp']=='eq'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_EQ')?></option>
<option value="gt" <?if($arFields['find_el_catalog_quantity_comp']=='gt'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_GT')?></option>
<option value="geq" <?if($arFields['find_el_catalog_quantity_comp']=='geq'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_GEQ')?></option>
<option value="lt" <?if($arFields['find_el_catalog_quantity_comp']=='lt'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_LT')?></option>
<option value="leq" <?if($arFields['find_el_catalog_quantity_comp']=='leq'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_LEQ')?></option>
</select>
<input type="text" name="SETTINGS[FILTER][<?=$listIndex?>][find_el_catalog_quantity]" value="<?echo htmlspecialcharsex($arFields['find_el_catalog_quantity'])?>" size="10">
</td>
</tr>
<?
if(is_array($arStores))
{
foreach($arStores as $arStore)
{
?>
<tr>
<td><?echo sprintf(GetMessage("KDA_EE_CATALOG_STORE_QUANTITY"), $arStore['TITLE'])?>:</td>
<td>
<select name="SETTINGS[FILTER][<?=$listIndex?>][find_el_catalog_store<?echo $arStore['ID'];?>_quantity_comp]">
<option value="eq" <?if($arFields['find_el_catalog_store'.$arStore['ID'].'_quantity_comp']=='eq'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_EQ')?></option>
<option value="gt" <?if($arFields['find_el_catalog_store'.$arStore['ID'].'_quantity_comp']=='gt'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_GT')?></option>
<option value="geq" <?if($arFields['find_el_catalog_store'.$arStore['ID'].'_quantity_comp']=='geq'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_GEQ')?></option>
<option value="lt" <?if($arFields['find_el_catalog_store'.$arStore['ID'].'_quantity_comp']=='lt'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_LT')?></option>
<option value="leq" <?if($arFields['find_el_catalog_store'.$arStore['ID'].'_quantity_comp']=='leq'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_LEQ')?></option>
</select>
<input type="text" name="SETTINGS[FILTER][<?=$listIndex?>][find_el_catalog_store<?echo $arStore['ID'];?>_quantity]" value="<?echo htmlspecialcharsex($arFields['find_el_catalog_store'.$arStore['ID'].'_quantity'])?>" size="10">
</td>
</tr>
<?
}
if(count($arStores) > 0)
{
?>
<tr>
<td><?echo GetMessage("KDA_EE_CATALOG_STORE_ANY_QUANTITY")?>:</td>
<td>
<select name="SETTINGS[FILTER][<?=$listIndex?>][find_el_catalog_store_any_quantity_stores][]" multiple>
<?foreach($arStores as $arStore){?>
<option value="<?echo $arStore['ID']?>" <?if(is_array($arFields['find_el_catalog_store_any_quantity_stores']) && in_array($arStore['ID'], $arFields['find_el_catalog_store_any_quantity_stores'])){echo 'selected';}?>><?echo $arStore['TITLE']?></option>
<?}?>
</select>
<select name="SETTINGS[FILTER][<?=$listIndex?>][find_el_catalog_store_any_quantity_comp]">
<option value="eq" <?if($arFields['find_el_catalog_store_any_quantity_comp']=='eq'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_EQ')?></option>
<option value="gt" <?if($arFields['find_el_catalog_store_any_quantity_comp']=='gt'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_GT')?></option>
<option value="geq" <?if($arFields['find_el_catalog_store_any_quantity_comp']=='geq'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_GEQ')?></option>
<option value="lt" <?if($arFields['find_el_catalog_store_any_quantity_comp']=='lt'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_LT')?></option>
<option value="leq" <?if($arFields['find_el_catalog_store_any_quantity_comp']=='leq'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_LEQ')?></option>
</select>
<input type="text" name="SETTINGS[FILTER][<?=$listIndex?>][find_el_catalog_store_any_quantity]" value="<?echo htmlspecialcharsex($arFields['find_el_catalog_store_any_quantity'])?>" size="10">
</td>
</tr>
<?
}
}
if(is_array($arPrices))
{
foreach($arPrices as $arPrice)
{
?>
<tr>
<td><?echo sprintf(GetMessage("KDA_EE_CATALOG_PRICE"), $arPrice['NAME_LANG'])?>:</td>
<td>
<select name="SETTINGS[FILTER][<?=$listIndex?>][find_el_catalog_price_<?echo $arPrice['ID'];?>_comp]">
<option value="eq" <?if($arFields['find_el_catalog_price_'.$arPrice['ID'].'_comp']=='eq'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_EQ')?></option>
<option value="empty" <?if($arFields['find_el_catalog_price_'.$arPrice['ID'].'_comp']=='empty'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_EMPTY')?></option>
<option value="gt" <?if($arFields['find_el_catalog_price_'.$arPrice['ID'].'_comp']=='gt'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_GT')?></option>
<option value="geq" <?if($arFields['find_el_catalog_price_'.$arPrice['ID'].'_comp']=='geq'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_GEQ')?></option>
<option value="lt" <?if($arFields['find_el_catalog_price_'.$arPrice['ID'].'_comp']=='lt'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_LT')?></option>
<option value="leq" <?if($arFields['find_el_catalog_price_'.$arPrice['ID'].'_comp']=='leq'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_LEQ')?></option>
</select>
<input type="text" name="SETTINGS[FILTER][<?=$listIndex?>][find_el_catalog_price_<?echo $arPrice['ID'];?>]" value="<?echo htmlspecialcharsex($arFields['find_el_catalog_price_'.$arPrice['ID']])?>" size="10">
</td>
</tr>
<?
}
}
if($bSale)
{
?>
<tr>
<td><?=GetMessage("KDA_EE_EL_A_SALE_ORDER")?>:</td>
<td>
<input type="text" name="SETTINGS[FILTER][<?=$listIndex?>][find_el_sale_order]" value="<?echo htmlspecialcharsex($arFields['find_el_sale_order'])?>" size="30">
</td>
</tr>
<?
}
}
foreach($arProps as $arProp):
if($arProp["FILTRABLE"]=="Y" && $arProp["PROPERTY_TYPE"]!="F"):
?>
<tr>
<td><?=$arProp["NAME"]?>:</td>
<td>
<?if(array_key_exists("GetAdminFilterHTML", $arProp["PROPERTY_USER_TYPE"])):
$fieldName = "filter_".$listIndex."_find_el_property_".$arProp["ID"];
$GLOBALS[$fieldName] = $arFields["find_el_property_".$arProp["ID"]];
$GLOBALS['set_filter'] = 'Y';
echo call_user_func_array($arProp["PROPERTY_USER_TYPE"]["GetAdminFilterHTML"], array(
$arProp,
array(
"VALUE" => $fieldName,
"TABLE_ID" => $sTableID,
),
));
elseif($arProp["PROPERTY_TYPE"]=='S'):?>
<input type="text" name="SETTINGS[FILTER][<?=$listIndex?>][find_el_property_<?=$arProp["ID"]?>]" value="<?echo htmlspecialcharsex($arFields["find_el_property_".$arProp["ID"]])?>" size="30"> <?=ShowFilterLogicHelp()?>
<?elseif($arProp["PROPERTY_TYPE"]=='N' || $arProp["PROPERTY_TYPE"]=='E'):?>
<input type="text" name="SETTINGS[FILTER][<?=$listIndex?>][find_el_property_<?=$arProp["ID"]?>]" value="<?echo htmlspecialcharsex($arFields["find_el_property_".$arProp["ID"]])?>" size="30">
<?elseif($arProp["PROPERTY_TYPE"]=='L'):?>
<?
$propVal = $arFields["find_el_property_".$arProp["ID"]];
if(!is_array($propVal)) $propVal = array($propVal);
?>
<select name="SETTINGS[FILTER][<?=$listIndex?>][find_el_property_<?=$arProp["ID"]?>][]" multiple size="5">
<option value=""><?echo GetMessage("KDA_EE_VALUE_ANY")?></option>
<option value="NOT_REF"<?if(in_array("NOT_REF", $propVal))echo " selected"?>><?echo GetMessage("KDA_EE_ELEMENT_EDIT_NOT_SET")?></option><?
$dbrPEnum = CIBlockPropertyEnum::GetList(Array("SORT"=>"ASC", "NAME"=>"ASC"), Array("PROPERTY_ID"=>$arProp["ID"]));
while($arPEnum = $dbrPEnum->GetNext()):
?>
<option value="<?=$arPEnum["ID"]?>"<?if(in_array($arPEnum["ID"], $propVal))echo " selected"?>><?=$arPEnum["VALUE"]?></option>
<?
endwhile;
?></select>
<?
elseif($arProp["PROPERTY_TYPE"]=='G'):
echo self::ShowGroupPropertyField2('SETTINGS[FILTER]['.$listIndex.'][find_el_property_'.$arProp["ID"].']', $arProp, $arFields["find_el_property_".$arProp["ID"]]);
endif;
?>
</td>
</tr>
<?
endif;
endforeach;
if($boolSKU){
?>
<?
$GLOBALS["SETTINGS[FILTER][".$listIndex."][find_sub_el_timestamp_from]_FILTER_PERIOD"] = $arFields['find_sub_el_timestamp_from_FILTER_PERIOD'];
$GLOBALS["SETTINGS[FILTER][".$listIndex."][find_sub_el_timestamp_from]_FILTER_DIRECTION"] = $arFields['find_sub_el_timestamp_from_FILTER_DIRECTION'];
?>
<tr>
<td><?echo ('' != $strSKUName ? $strSKUName.' - ' : '').GetMessage("KDA_EE_FIELD_TIMESTAMP_X")?>:</td>
<td data-filter-period="<?echo htmlspecialcharsex($arFields['find_sub_el_timestamp_from_FILTER_PERIOD'])?>" data-filter-last-days="<?echo htmlspecialcharsex($arFields['find_sub_el_timestamp_from_FILTER_LAST_DAYS'])?>"><?echo CalendarPeriod("SETTINGS[FILTER][".$listIndex."][find_sub_el_timestamp_from]", htmlspecialcharsex($arFields['find_sub_el_timestamp_from']), "SETTINGS[FILTER][".$listIndex."][find_sub_el_timestamp_to]", htmlspecialcharsex($arFields['find_sub_el_timestamp_to']), "dataload", "Y")?></font></td>
</tr>
<tr>
<td><?echo ('' != $strSKUName ? $strSKUName.' - ' : '').GetMessage("KDA_EE_FIELD_ACTIVE")?>:</td>
<td>
<select name="SETTINGS[FILTER][<?=$listIndex?>][find_sub_el_active]">
<option value=""><?=htmlspecialcharsex(GetMessage('KDA_EE_VALUE_ANY'))?></option>
<option value="Y"<?if($arFields['find_sub_el_active']=="Y")echo " selected"?>><?=htmlspecialcharsex(GetMessage("KDA_EE_YES"))?></option>
<option value="N"<?if($arFields['find_sub_el_active']=="N")echo " selected"?>><?=htmlspecialcharsex(GetMessage("KDA_EE_NO"))?></option>
</select>
</td>
</tr>
<tr>
<td><?echo ('' != $strSKUName ? $strSKUName.' - ' : '').GetMessage("KDA_EE_CATALOG_QUANTITY")?>:</td>
<td>
<select name="SETTINGS[FILTER][<?=$listIndex?>][find_sub_el_catalog_quantity_comp]">
<option value="eq" <?if($arFields['find_sub_el_catalog_quantity_comp']=='eq'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_EQ')?></option>
<option value="gt" <?if($arFields['find_sub_el_catalog_quantity_comp']=='gt'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_GT')?></option>
<option value="geq" <?if($arFields['find_sub_el_catalog_quantity_comp']=='geq'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_GEQ')?></option>
<option value="lt" <?if($arFields['find_sub_el_catalog_quantity_comp']=='lt'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_LT')?></option>
<option value="leq" <?if($arFields['find_sub_el_catalog_quantity_comp']=='leq'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_LEQ')?></option>
</select>
<input type="text" name="SETTINGS[FILTER][<?=$listIndex?>][find_sub_el_catalog_quantity]" value="<?echo htmlspecialcharsex($arFields['find_sub_el_catalog_quantity'])?>" size="10">
</td>
</tr>
<?
if(is_array($arStores))
{
foreach($arStores as $arStore)
{
?>
<tr>
<td><?echo ('' != $strSKUName ? $strSKUName.' - ' : '').sprintf(GetMessage("KDA_EE_CATALOG_STORE_QUANTITY"), $arStore['TITLE'])?>:</td>
<td>
<select name="SETTINGS[FILTER][<?=$listIndex?>][find_sub_el_catalog_store<?echo $arStore['ID'];?>_quantity_comp]">
<option value="eq" <?if($arFields['find_sub_el_catalog_store'.$arStore['ID'].'_quantity_comp']=='eq'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_EQ')?></option>
<option value="gt" <?if($arFields['find_sub_el_catalog_store'.$arStore['ID'].'_quantity_comp']=='gt'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_GT')?></option>
<option value="geq" <?if($arFields['find_sub_el_catalog_store'.$arStore['ID'].'_quantity_comp']=='geq'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_GEQ')?></option>
<option value="lt" <?if($arFields['find_sub_el_catalog_store'.$arStore['ID'].'_quantity_comp']=='lt'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_LT')?></option>
<option value="leq" <?if($arFields['find_sub_el_catalog_store'.$arStore['ID'].'_quantity_comp']=='leq'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_LEQ')?></option>
</select>
<input type="text" name="SETTINGS[FILTER][<?=$listIndex?>][find_sub_el_catalog_store<?echo $arStore['ID'];?>_quantity]" value="<?echo htmlspecialcharsex($arFields['find_sub_el_catalog_store'.$arStore['ID'].'_quantity'])?>" size="10">
</td>
</tr>
<?
}
if(count($arStores) > 0)
{
?>
<tr>
<td><?echo ('' != $strSKUName ? $strSKUName.' - ' : '').GetMessage("KDA_EE_CATALOG_STORE_ANY_QUANTITY")?>:</td>
<td>
<select name="SETTINGS[FILTER][<?=$listIndex?>][find_sub_el_catalog_store_any_quantity_stores][]" multiple>
<?foreach($arStores as $arStore){?>
<option value="<?echo $arStore['ID']?>" <?if(is_array($arFields['find_sub_el_catalog_store_any_quantity_stores']) && in_array($arStore['ID'], $arFields['find_sub_el_catalog_store_any_quantity_stores'])){echo 'selected';}?>><?echo $arStore['TITLE']?></option>
<?}?>
</select>
<select name="SETTINGS[FILTER][<?=$listIndex?>][find_sub_el_catalog_store_any_quantity_comp]">
<option value="eq" <?if($arFields['find_sub_el_catalog_store_any_quantity_comp']=='eq'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_EQ')?></option>
<option value="gt" <?if($arFields['find_sub_el_catalog_store_any_quantity_comp']=='gt'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_GT')?></option>
<option value="geq" <?if($arFields['find_sub_el_catalog_store_any_quantity_comp']=='geq'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_GEQ')?></option>
<option value="lt" <?if($arFields['find_sub_el_catalog_store_any_quantity_comp']=='lt'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_LT')?></option>
<option value="leq" <?if($arFields['find_sub_el_catalog_store_any_quantity_comp']=='leq'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_LEQ')?></option>
</select>
<input type="text" name="SETTINGS[FILTER][<?=$listIndex?>][find_sub_el_catalog_store_any_quantity]" value="<?echo htmlspecialcharsex($arFields['find_sub_el_catalog_store_any_quantity'])?>" size="10">
</td>
</tr>
<?
}
}
if(is_array($arPrices))
{
foreach($arPrices as $arPrice)
{
?>
<tr>
<td><?echo ('' != $strSKUName ? $strSKUName.' - ' : '').sprintf(GetMessage("KDA_EE_CATALOG_PRICE"), $arPrice['NAME_LANG'])?>:</td>
<td>
<select name="SETTINGS[FILTER][<?=$listIndex?>][find_sub_el_catalog_price_<?echo $arPrice['ID'];?>_comp]">
<option value="eq" <?if($arFields['find_sub_el_catalog_price_'.$arPrice['ID'].'_comp']=='eq'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_EQ')?></option>
<option value="empty" <?if($arFields['find_sub_el_catalog_price_'.$arPrice['ID'].'_comp']=='empty'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_EMPTY')?></option>
<option value="gt" <?if($arFields['find_sub_el_catalog_price_'.$arPrice['ID'].'_comp']=='gt'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_GT')?></option>
<option value="geq" <?if($arFields['find_sub_el_catalog_price_'.$arPrice['ID'].'_comp']=='geq'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_GEQ')?></option>
<option value="lt" <?if($arFields['find_sub_el_catalog_price_'.$arPrice['ID'].'_comp']=='lt'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_LT')?></option>
<option value="leq" <?if($arFields['find_sub_el_catalog_price_'.$arPrice['ID'].'_comp']=='leq'){echo 'selected';}?>><?=GetMessage('KDA_EE_COMPARE_LEQ')?></option>
</select>
<input type="text" name="SETTINGS[FILTER][<?=$listIndex?>][find_sub_el_catalog_price_<?echo $arPrice['ID'];?>]" value="<?echo htmlspecialcharsex($arFields['find_sub_el_catalog_price_'.$arPrice['ID']])?>" size="10">
</td>
</tr>
<?
}
}
}
/*if ($boolSKU && $boolSKUFiltrable)
{
foreach($arSKUProps as $arProp)
{
?>
<tr>
<td><? echo ('' != $strSKUName ? $strSKUName.' - ' : ''), $arProp["NAME"]; ?>:</td>
<td>
<?if(!empty($arProp["PROPERTY_USER_TYPE"]) && isset($arProp["PROPERTY_USER_TYPE"]["GetAdminFilterHTML"]))
{
echo call_user_func_array($arProp["PROPERTY_USER_TYPE"]["GetAdminFilterHTML"], array(
$arProp,
array(
"VALUE" => "find_sub_el_property_".$arProp["ID"],
"TABLE_ID" => $sTableID,
),
));
}
elseif($arProp["PROPERTY_TYPE"]=='S')
{
?><input type="text" name="find_sub_el_property_<?=$arProp["ID"]?>" value="<?echo htmlspecialcharsex(${"find_sub_el_property_".$arProp["ID"]})?>" size="30"> <?=ShowFilterLogicHelp(); ?><?
}
elseif($arProp["PROPERTY_TYPE"]=='N' || $arProp["PROPERTY_TYPE"]=='E')
{
?><input type="text" name="find_sub_el_property_<?=$arProp["ID"]?>" value="<?echo htmlspecialcharsex(${"find_sub_el_property_".$arProp["ID"]})?>" size="30"><?
}
elseif($arProp["PROPERTY_TYPE"]=='L')
{
?><select name="find_sub_el_property_<?=$arProp["ID"]?>">
<option value=""><?echo GetMessage("IBLOCK_VALUE_ANY")?></option>
<option value="NOT_REF"><?echo GetMessage("IBLOCK_ELEMENT_EDIT_NOT_SET")?></option><?
$dbrPEnum = CIBlockPropertyEnum::GetList(array("SORT"=>"ASC", "NAME"=>"ASC"), array("PROPERTY_ID"=>$arProp["ID"]));
while($arPEnum = $dbrPEnum->GetNext())
{
?><option value="<?=$arPEnum["ID"]?>"<?if(${"find_sub_el_property_".$arProp["ID"]} == $arPEnum["ID"])echo " selected"?>><?=$arPEnum["VALUE"]?></option><?
}
?></select><?
}
elseif($arProp["PROPERTY_TYPE"]=='G')
{
echo self::ShowGroupPropertyField2('find_sub_el_property_'.$arProp["ID"], $arProp, ${'find_sub_el_property_'.$arProp["ID"]});
}
?>
</td>
</tr>
<?
}
}*/
$oFilter->Buttons();
?><span class="adm-btn-wrap"><input type="submit" class="adm-btn" name="set_filter" value="<? echo GetMessage("admin_lib_filter_set_butt"); ?>" title="<? echo GetMessage("admin_lib_filter_set_butt_title"); ?>" onClick="return EList.ApplyFilter(this);"></span>
<span class="adm-btn-wrap"><input type="submit" class="adm-btn" name="del_filter" value="<? echo GetMessage("admin_lib_filter_clear_butt"); ?>" title="<? echo GetMessage("admin_lib_filter_clear_butt_title"); ?>" onClick="return EList.DeleteFilter(this);"></span>
<?
$oFilter->End();
?>
<!--</form>-->
</div>
<?
}
public static function ShowFilterHighload($sTableID, $listIndex, $SETTINGS, $SETTINGS_DEFAULT)
{
global $APPLICATION, $USER_FIELD_MANAGER;
CJSCore::Init('file_input');
$HLBL_ID = $SETTINGS_DEFAULT['HIGHLOADBLOCK_ID'];
$arFields = (is_array($SETTINGS['FILTER'][$listIndex]) ? $SETTINGS['FILTER'][$listIndex] : array());
$ufEntityId = 'HLBLOCK_'.$HLBL_ID;
?>
<!--<form method="GET" name="find_form" id="find_form" action="">-->
<div class="find_form_inner">
<?
$filterValues = array();
$arFindFields = array('ID');
$USER_FIELD_MANAGER->AdminListAddFilterFields($ufEntityId, $filterFields);
$USER_FIELD_MANAGER->AddFindFields($ufEntityId, $arFindFields);
$oFilter = new CAdminFilter($sTableID."_filter", $arFindFields);
$oFilter->Begin();
?>
<tr>
<td>ID</td>
<td><input type="text" name="SETTINGS[FILTER][<?=$listIndex?>][find_ID]" size="47" value="<?echo htmlspecialcharsbx($arFields['find_ID'])?>"><?=ShowFilterLogicHelp()?></td>
</tr>
<?
//$USER_FIELD_MANAGER->AdminListShowFilter($ufEntityId);
$arUserFields = $USER_FIELD_MANAGER->GetUserFields($ufEntityId, 0, LANGUAGE_ID);
foreach($arUserFields as $FIELD_NAME=>$arUserField)
{
if($arUserField["SHOW_FILTER"]!="N" && $arUserField["USER_TYPE"]["BASE_TYPE"]!="file")
{
echo $USER_FIELD_MANAGER->GetFilterHTML($arUserField, 'SETTINGS[FILTER]['.$listIndex.'][find_'.$FIELD_NAME.']', $arFields['find_'.$FIELD_NAME]);
}
}
$oFilter->Buttons();
?><span class="adm-btn-wrap"><input type="submit" class="adm-btn" name="set_filter" value="<? echo GetMessage("admin_lib_filter_set_butt"); ?>" title="<? echo GetMessage("admin_lib_filter_set_butt_title"); ?>" onClick="return EList.ApplyFilter(this);"></span>
<span class="adm-btn-wrap"><input type="submit" class="adm-btn" name="del_filter" value="<? echo GetMessage("admin_lib_filter_clear_butt"); ?>" title="<? echo GetMessage("admin_lib_filter_clear_butt_title"); ?>" onClick="return EList.DeleteFilter(this);"></span>
<?
$oFilter->End();
?>
<!--</form>-->
</div>
<?
}
public static function ShowGroupPropertyField2($name, $property_fields, $values)
{
if(!is_array($values)) $values = Array();
$res = "";
$result = "";
$bWas = false;
$sections = CIBlockSection::GetTreeList(Array("IBLOCK_ID"=>$property_fields["LINK_IBLOCK_ID"]), array("ID", "NAME", "DEPTH_LEVEL"));
while($ar = $sections->GetNext())
{
$res .= '<option value="'.$ar["ID"].'"';
if(in_array($ar["ID"], $values))
{
$bWas = true;
$res .= ' selected';
}
$res .= '>'.str_repeat(" . ", $ar["DEPTH_LEVEL"]).$ar["NAME"].'</option>';
}
$result .= '<select name="'.$name.'[]" size="'.($property_fields["MULTIPLE"]=="Y" ? "5":"1").'" '.($property_fields["MULTIPLE"]=="Y"?"multiple":"").'>';
$result .= '<option value=""'.(!$bWas?' selected':'').'>'.GetMessage("IBLOCK_ELEMENT_EDIT_NOT_SET").'</option>';
$result .= $res;
$result .= '</select>';
return $result;
}
public static function GetCellStyleFormatted($arStyles = array(), $arParams = array())
{
if(!is_array($arStyles)) $arStyles = array();
//if(empty($arStyles)) return '';
$style = '';
if(!$arStyles['FONT_FAMILY'] && $arParams['FONT_FAMILY']) $arStyles['FONT_FAMILY'] = $arParams['FONT_FAMILY'];
if(!$arStyles['FONT_SIZE'] && $arParams['FONT_SIZE']) $arStyles['FONT_SIZE'] = $arParams['FONT_SIZE'];
if(!$arStyles['FONT_COLOR'] && $arParams['FONT_COLOR']) $arStyles['FONT_COLOR'] = $arParams['FONT_COLOR'];
if(!$arStyles['STYLE_BOLD'] && $arParams['STYLE_BOLD']) $arStyles['STYLE_BOLD'] = $arParams['STYLE_BOLD'];
if(!$arStyles['STYLE_ITALIC'] && $arParams['STYLE_ITALIC']) $arStyles['STYLE_ITALIC'] = $arParams['STYLE_ITALIC'];
if($arStyles['FONT_FAMILY']) $style .= 'font-family:'.htmlspecialcharsex($arStyles['FONT_FAMILY']).';';
if((int)$arStyles['FONT_SIZE'] > 0) $style .= 'font-size:'.((int)$arStyles['FONT_SIZE'] + 2).'px;';
if($arStyles['FONT_COLOR']) $style .= 'color:'.htmlspecialcharsex($arStyles['FONT_COLOR']).';';
if($arStyles['STYLE_BOLD']=='Y') $style .= 'font-weight:bold;';
if($arStyles['STYLE_ITALIC']=='Y') $style .= 'font-style:italic;';
if($arStyles['BACKGROUND_COLOR']) $style .= 'background-color:'.htmlspecialcharsex($arStyles['BACKGROUND_COLOR']).';';
if($arStyles['INDENT']) $style .= 'padding-left:'.(intval($arStyles['INDENT'])*15).'px;';
$textAlign = ToLower($arStyles['TEXT_ALIGN'] ? $arStyles['TEXT_ALIGN'] : $arParams['DISPLAY_TEXT_ALIGN']);
if(!$textAlign) $textAlign = 'left';
$style .= 'text-align:'.htmlspecialcharsex($textAlign).';';
$verticalAlign = ToLower($arStyles['VERTICAL_ALIGN'] ? $arStyles['VERTICAL_ALIGN'] : $arParams['DISPLAY_VERTICAL_ALIGN']);
if(!$verticalAlign) $verticalAlign = 'top';
$style .= 'vertical-align:'.htmlspecialcharsex($verticalAlign).';';
if(strlen($style) > 0) $style = 'style="'.$style.'"';
return $style;
}
public static function PrepareTextRows(&$rows, $arParams=array(), $arStepParams=array())
{
if(is_array($rows))
{
foreach($rows as $listIndex=>$arRows)
{
if(is_array($rows[$listIndex]))
{
$rowsCount = (int)$arStepParams['rows2'][$listIndex];
if(is_array($arParams['TEXT_ROWS_TOP'])) $rowsCount += count($arParams['TEXT_ROWS_TOP']);
if($arParams['HIDE_COLUMN_TITLES']!='Y') $rowsCount += 1;
if(is_array($arParams['TEXT_ROWS_TOP2'])) $rowsCount += count($arParams['TEXT_ROWS_TOP2']);
foreach($rows[$listIndex] as $k=>$row)
{
$row = str_replace('{MAX_ROW_NUM}', $rowsCount, $row);
$row = preg_replace_callback('/\{DATE_(\S*)\}/', array('CKDAExportUtils', 'GetDateFormat'), $row);
$rows[$listIndex][$k] = $row;
}
}
}
}
}
public static function PrepareExportFileName($name)
{
return preg_replace_callback('/\{DATE_(\S*)\}/', array('CKDAExportUtils', 'GetDateFormat'), $name);
}
public static function GetDateFormat($m)
{
$format = str_replace('_', ' ', $m[1]);
return ToLower(CIBlockFormatProperties::DateFormat($format, time()));
}
public static function RemoveTmpFiles($maxTime = 5)
{
$timeBegin = time();
$docRoot = $_SERVER["DOCUMENT_ROOT"];
$tmpDir = $docRoot.'/upload/tmp/'.static::$moduleId.'/';
$arOldDirs = array();
$arActDirs = array();
if(file_exists($tmpDir) && ($dh = opendir($tmpDir)))
{
while(($file = readdir($dh)) !== false)
{
if(in_array($file, array('.', '..'))) continue;
if(is_dir($tmpDir.$file))
{
if(!in_array($file, $arActDirs) && (time() - filemtime($tmpDir.$file) > 24*60*60))
{
$arOldDirs[] = $file;
}
}
elseif(substr($file, -4)=='.txt')
{
$arParams = CUtil::JsObjectToPhp(file_get_contents($tmpDir.$file));
if(is_array($arParams) && isset($arParams['tmpdir']))
{
$actDir = preg_replace('/^.*\/([^\/]+)$/', '$1', trim($arParams['tmpdir'], '/'));
$arActDirs[] = $actDir;
}
}
}
$arOldDirs = array_diff($arOldDirs, $arActDirs);
foreach($arOldDirs as $subdir)
{
$oldDir = substr($tmpDir, strlen($docRoot)).$subdir;
DeleteDirFilesEx($oldDir);
if(($maxTime > 0) && (time() - $timeBegin >= $maxTime)) return;
}
closedir($dh);
}
$tmpDir = $docRoot.'/upload/tmp/';
if(file_exists($tmpDir) && ($dh = opendir($tmpDir)))
{
while(($file = readdir($dh)) !== false)
{
if(!preg_match('/^[0-9a-f]{3}$/', $file)) continue;
$subdir = $tmpDir.$file;
if(is_dir($subdir))
{
$subdir .= '/';
if(time() - filemtime($subdir) > 24*60*60)
{
if($dh2 = opendir($subdir))
{
$emptyDir = true;
while(($file2 = readdir($dh2)) !== false)
{
if(in_array($file2, array('.', '..'))) continue;
if(time() - filemtime($subdir) > 24*60*60)
{
if(is_dir($subdir.$file2))
{
$oldDir = substr($subdir.$file2, strlen($docRoot));
DeleteDirFilesEx($oldDir);
}
else
{
unlink($subdir.$file2);
}
}
else
{
$emptyDir = false;
}
}
closedir($dh2);
if($emptyDir)
{
unlink($subdir);
}
}
if(($maxTime > 0) && (time() - $timeBegin >= $maxTime)) return;
}
}
}
closedir($dh);
}
}
public static function getSiteEncoding()
{
if (defined('BX_UTF'))
$logicalEncoding = "utf-8";
elseif (defined("SITE_CHARSET") && (strlen(SITE_CHARSET) > 0))
$logicalEncoding = SITE_CHARSET;
elseif (defined("LANG_CHARSET") && (strlen(LANG_CHARSET) > 0))
$logicalEncoding = LANG_CHARSET;
elseif (defined("BX_DEFAULT_CHARSET"))
$logicalEncoding = BX_DEFAULT_CHARSET;
else
$logicalEncoding = "windows-1251";
return strtolower($logicalEncoding);
}
}
?>