2013-07-23 17:02:37 +04:00
|
|
|
<?php
|
2013-08-06 19:13:49 +04:00
|
|
|
|
2013-07-23 17:02:37 +04:00
|
|
|
if(!check_bitrix_sessid()) return;
|
2013-08-06 19:13:49 +04:00
|
|
|
IncludeModuleLangFile(__FILE__);
|
|
|
|
__IncludeLang(GetLangFileName($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/intaro.intarocrm/lang/", "/icml_export_setup.php"));
|
2013-08-19 10:43:59 +04:00
|
|
|
?>
|
|
|
|
<h3><?=GetMessage("EXPORT_CATALOGS_INFO");?></h3>
|
|
|
|
<?php
|
|
|
|
if(isset($arResult['errCode']) && $arResult['errCode'])
|
|
|
|
echo CAdminMessage::ShowMessage(GetMessage($arResult['errCode']));
|
2013-08-20 12:53:32 +04:00
|
|
|
global $oldValues;
|
|
|
|
if (!empty($oldValues)) {
|
|
|
|
$IBLOCK_EXPORT = $oldValues['IBLOCK_EXPORT'];
|
|
|
|
$IBLOCK_PROPERTY_ARTICLE = $oldValues['IBLOCK_PROPERTY_ARTICLE'];
|
|
|
|
$SETUP_FILE_NAME = $oldValues['SETUP_FILE_NAME'];
|
|
|
|
$SETUP_PROFILE_NAME = $oldValues['SETUP_PROFILE_NAME'];
|
|
|
|
}
|
2013-08-06 19:13:49 +04:00
|
|
|
?>
|
|
|
|
<form method="post" action="<?php echo $APPLICATION->GetCurPage(); ?>" >
|
|
|
|
<font class="text"><?=GetMessage("EXPORT_CATALOGS");?><br><br></font>
|
|
|
|
<?
|
|
|
|
if (!isset($IBLOCK_EXPORT) || !is_array($IBLOCK_EXPORT))
|
|
|
|
{
|
|
|
|
$IBLOCK_EXPORT = array();
|
|
|
|
}
|
2013-08-19 10:43:59 +04:00
|
|
|
|
2013-08-06 19:13:49 +04:00
|
|
|
$boolAll = false;
|
|
|
|
$intCountChecked = 0;
|
|
|
|
$intCountAvailIBlock = 0;
|
|
|
|
$arIBlockList = array();
|
|
|
|
$db_res = CIBlock::GetList(Array("IBLOCK_TYPE"=>"ASC", "NAME"=>"ASC"),array('CHECK_PERMISSIONS' => 'Y','MIN_PERMISSION' => 'W'));
|
|
|
|
while ($res = $db_res->Fetch())
|
|
|
|
{
|
|
|
|
if ($arCatalog = CCatalog::GetByIDExt($res["ID"]))
|
|
|
|
{
|
|
|
|
if($arCatalog['CATALOG_TYPE'] == "D" || $arCatalog['CATALOG_TYPE'] == "X" || $arCatalog['CATALOG_TYPE'] == "P")
|
|
|
|
{
|
|
|
|
$arSiteList = array();
|
|
|
|
$rsSites = CIBlock::GetSite($res["ID"]);
|
|
|
|
while ($arSite = $rsSites->Fetch())
|
|
|
|
{
|
|
|
|
$arSiteList[] = $arSite["SITE_ID"];
|
|
|
|
}
|
|
|
|
$db_properties = CIBlock::GetProperties($res['ID'], Array());
|
|
|
|
|
|
|
|
$properties = Array();
|
2013-08-19 10:43:59 +04:00
|
|
|
while($prop = $db_properties->Fetch())
|
2013-08-06 19:13:49 +04:00
|
|
|
$properties[] = $prop;
|
2013-08-19 10:43:59 +04:00
|
|
|
|
2013-08-20 12:53:32 +04:00
|
|
|
if (count($IBLOCK_EXPORT) != 0)
|
|
|
|
$boolExport = (in_array($res['ID'], $IBLOCK_EXPORT));
|
|
|
|
else
|
|
|
|
$boolExport = true;
|
2013-08-19 10:43:59 +04:00
|
|
|
|
2013-08-06 19:13:49 +04:00
|
|
|
$arIBlockList[] = array(
|
|
|
|
'ID' => $res['ID'],
|
|
|
|
'NAME' => $res['NAME'],
|
|
|
|
'IBLOCK_TYPE_ID' => $res['IBLOCK_TYPE_ID'],
|
|
|
|
'IBLOCK_EXPORT' => $boolExport,
|
|
|
|
'PROPERTIES' => $properties,
|
2013-08-20 12:53:32 +04:00
|
|
|
'OLD_PROPERTY_SELECT' => $IBLOCK_PROPERTY_ARTICLE[$res['ID']] != "" ? $IBLOCK_PROPERTY_ARTICLE[$res['ID']] : null,
|
2013-08-06 19:13:49 +04:00
|
|
|
'SITE_LIST' => '('.implode(' ',$arSiteList).')',
|
|
|
|
);
|
2013-08-19 10:43:59 +04:00
|
|
|
|
2013-08-06 19:13:49 +04:00
|
|
|
if ($boolExport)
|
|
|
|
$intCountChecked++;
|
|
|
|
$intCountAvailIBlock++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-08-20 12:53:32 +04:00
|
|
|
if (count($IBLOCK_EXPORT) != 0) {
|
|
|
|
if ($intCountChecked == $intCountAvailIBlock)
|
|
|
|
$boolAll = true;
|
|
|
|
} else {
|
|
|
|
$intCountChecked = $intCountAvailIBlock;
|
|
|
|
$boolAll = true;
|
|
|
|
}
|
2013-08-19 10:43:59 +04:00
|
|
|
|
2013-08-06 19:13:49 +04:00
|
|
|
?>
|
2013-08-19 10:43:59 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
2013-08-06 19:13:49 +04:00
|
|
|
<table class="adm-list-table" id="export_setup">
|
|
|
|
<thead>
|
|
|
|
<tr class="adm-list-table-header">
|
|
|
|
<td class="adm-list-table-cell">
|
|
|
|
<div class="adm-list-table-cell-inner"><?echo GetMessage("CATALOG");?></div>
|
|
|
|
</td>
|
|
|
|
<td class="adm-list-table-cell">
|
|
|
|
<div class="adm-list-table-cell-inner">
|
|
|
|
<?echo GetMessage("EXPORT2INTAROCML");?>
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
<td class="adm-list-table-cell">
|
|
|
|
<div class="adm-list-table-cell-inner"><?echo GetMessage("PROPERTY");?></div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<tr class="adm-list-table-row">
|
|
|
|
<td class="adm-list-table-cell">
|
|
|
|
<?echo GetMessage("ALL_CATALOG");?>
|
|
|
|
</td>
|
|
|
|
<td class="adm-list-table-cell">
|
|
|
|
<input style="vertical-align: middle;" type="checkbox" name="icml_export_all" id="icml_export_all" value="Y" onclick="checkAll(this,<? echo $intCountAvailIBlock; ?>);"<? echo ($boolAll ? ' checked' : ''); ?>>
|
|
|
|
|
|
|
|
</td>
|
|
|
|
<td class="adm-list-table-cell">
|
|
|
|
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<?
|
|
|
|
foreach ($arIBlockList as $key => $arIBlock)
|
|
|
|
{
|
|
|
|
?>
|
|
|
|
<tr class="adm-list-table-row">
|
|
|
|
<td class="adm-list-table-cell" style="padding-left: 5em">
|
|
|
|
<? echo htmlspecialcharsex("[".$arIBlock["IBLOCK_TYPE_ID"]."] ".$arIBlock["NAME"]." ".$arIBlock['SITE_LIST']); ?>
|
|
|
|
</td>
|
|
|
|
<td class="adm-list-table-cell">
|
|
|
|
<font class="tablebodytext">
|
|
|
|
<input
|
|
|
|
type="checkbox"
|
2013-08-20 12:53:32 +04:00
|
|
|
name="IBLOCK_EXPORT[<?=$arIBlock["ID"]?>]"
|
|
|
|
id="IBLOCK_EXPORT<?=$arIBlock["ID"]?>"
|
2013-08-06 19:13:49 +04:00
|
|
|
value="<?=$arIBlock["ID"]?>"
|
|
|
|
<? if ($arIBlock['IBLOCK_EXPORT']) echo " checked"; ?>
|
|
|
|
onclick="checkOne(this,<? echo $intCountAvailIBlock; ?>);"
|
|
|
|
>
|
|
|
|
</font>
|
|
|
|
</td>
|
|
|
|
<td class="adm-list-table-cell">
|
2013-08-20 12:53:32 +04:00
|
|
|
<select
|
|
|
|
style="width: 200px;"
|
|
|
|
id="IBLOCK_PROPERTY_ARTICLE<?=$arIBlock["ID"]?>"
|
|
|
|
name="IBLOCK_PROPERTY_ARTICLE[<?=$arIBlock["ID"]?>]"
|
|
|
|
class="property-export">
|
2013-08-21 18:40:45 +04:00
|
|
|
<option value=""></option>
|
2013-08-06 19:13:49 +04:00
|
|
|
<?
|
|
|
|
foreach ($arIBlock['PROPERTIES'] as $prop)
|
|
|
|
{
|
|
|
|
?>
|
|
|
|
<option value="<?=$prop['CODE'] ?>"
|
2013-08-20 12:53:32 +04:00
|
|
|
<?
|
|
|
|
if ($arIBlock['OLD_PROPERTY_SELECT'] == $prop["CODE"]){
|
|
|
|
echo " selected";
|
|
|
|
} else {
|
|
|
|
if ($prop["CODE"] == "ARTICLE" ||
|
|
|
|
$prop["CODE"] == "ART" ||
|
|
|
|
$prop["CODE"] == "ARTNUMBER" )
|
|
|
|
echo " selected";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
?>
|
2013-08-06 19:13:49 +04:00
|
|
|
>
|
|
|
|
<?=$prop["NAME"];?>
|
|
|
|
</option>
|
|
|
|
<?
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</select>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<?
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<input type="hidden" name="count_checked" id="count_checked" value="<? echo $intCountChecked; ?>">
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
|
|
|
|
<font class="text"><?=GetMessage("FILENAME");?><br><br></font>
|
|
|
|
<input type="text" name="SETUP_FILE_NAME"
|
|
|
|
value="<?=htmlspecialcharsbx(strlen($SETUP_FILE_NAME) > 0 ?
|
|
|
|
$SETUP_FILE_NAME :
|
|
|
|
(COption::GetOptionString(
|
|
|
|
'catalog',
|
|
|
|
'export_default_path',
|
|
|
|
'/bitrix/catalog_export/'))
|
2013-08-16 16:29:11 +04:00
|
|
|
.'intarocrm'/* .mt_rand(0, 999999) */.'.xml'
|
2013-08-06 19:13:49 +04:00
|
|
|
); ?>" size="50">
|
2013-08-19 10:43:59 +04:00
|
|
|
|
2013-08-06 19:13:49 +04:00
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
<br>
|
2013-08-19 10:43:59 +04:00
|
|
|
|
2013-08-06 19:13:49 +04:00
|
|
|
<font class="text"><?=GetMessage("LOAD_PERIOD");?><br><br></font>
|
2013-08-15 14:46:13 +04:00
|
|
|
<input type="radio" name="TYPE_LOADING" value="none" onclick="checkProfile(this);"><?=GetMessage("NOT_LOADING");?><Br>
|
2013-08-06 19:13:49 +04:00
|
|
|
<input type="radio" name="TYPE_LOADING" value="cron" onclick="checkProfile(this);"><?=GetMessage("CRON_LOADING");?><Br>
|
2013-08-15 14:46:13 +04:00
|
|
|
<input type="radio" name="TYPE_LOADING" value="agent" checked onclick="checkProfile(this);"><?=GetMessage("AGENT_LOADING");?><Br>
|
2013-08-06 19:13:49 +04:00
|
|
|
<br>
|
2013-08-19 10:43:59 +04:00
|
|
|
<br>
|
2013-08-06 19:13:49 +04:00
|
|
|
<font class="text"><?=GetMessage("LOAD_NOW");?> </font>
|
2013-08-15 18:01:03 +04:00
|
|
|
<input id="load-now" type="checkbox" name="LOAD_NOW" value="now" checked >
|
2013-08-06 19:13:49 +04:00
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
<br>
|
2013-08-19 10:43:59 +04:00
|
|
|
|
2013-08-15 14:46:13 +04:00
|
|
|
<div id="profile-field" >
|
2013-08-06 19:13:49 +04:00
|
|
|
<font class="text"><?=GetMessage("PROFILE_NAME");?> </font>
|
2013-08-19 10:43:59 +04:00
|
|
|
<input
|
|
|
|
type="text"
|
|
|
|
name="SETUP_PROFILE_NAME"
|
2013-08-20 12:53:32 +04:00
|
|
|
value="<?= ($SETUP_PROFILE_NAME ? $SETUP_PROFILE_NAME: GetMessage("PROFILE_NAME_EXAMPLE"));?>"
|
2013-08-06 19:13:49 +04:00
|
|
|
size="30">
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
</div>
|
2013-08-19 10:43:59 +04:00
|
|
|
|
2013-08-06 19:13:49 +04:00
|
|
|
<script type="text/javascript" src="/bitrix/js/main/jquery/jquery-1.7.min.js"></script>
|
|
|
|
<script type="text/javascript">
|
|
|
|
function checkAll(obj,cnt)
|
|
|
|
{
|
|
|
|
var boolCheck = obj.checked;
|
|
|
|
for (i = 0; i < cnt; i++)
|
|
|
|
{
|
|
|
|
BX('IBLOCK_EXPORT'+i).checked = boolCheck;
|
|
|
|
}
|
|
|
|
BX('count_checked').value = (boolCheck ? cnt : 0);
|
|
|
|
};
|
|
|
|
function checkOne(obj,cnt)
|
|
|
|
{
|
2013-08-20 12:53:32 +04:00
|
|
|
var boolCheck = obj.checked;
|
|
|
|
var intCurrent = parseInt(BX('count_checked').value);
|
|
|
|
intCurrent += (boolCheck ? 1 : -1);
|
|
|
|
BX('icml_export_all').checked = (intCurrent < cnt ? false : true);
|
|
|
|
BX('count_checked').value = intCurrent;
|
|
|
|
if (!boolCheck)
|
|
|
|
BX(obj.id.replace('IBLOCK_EXPORT','IBLOCK_PROPERTY_ARTICLE')).value = 'none';
|
2013-08-06 19:13:49 +04:00
|
|
|
};
|
|
|
|
function checkProfile(obj)
|
|
|
|
{
|
|
|
|
if (obj.value !== 'none')
|
|
|
|
$('#profile-field').show();
|
|
|
|
else
|
|
|
|
$('#profile-field').hide();
|
|
|
|
};
|
|
|
|
</script>
|
2013-08-19 10:43:59 +04:00
|
|
|
|
|
|
|
|
2013-08-06 19:13:49 +04:00
|
|
|
<?//Следующие переменные должны быть обязательно установлены?>
|
|
|
|
<?=bitrix_sessid_post();?>
|
2013-08-19 10:43:59 +04:00
|
|
|
|
2013-08-06 19:13:49 +04:00
|
|
|
<input type="hidden" name="lang" value="<?php echo LANG; ?>">
|
|
|
|
<input type="hidden" name="id" value="intaro.intarocrm">
|
|
|
|
<input type="hidden" name="install" value="Y">
|
|
|
|
<input type="hidden" name="step" value="5">
|
|
|
|
<input type="hidden" name="continue" value="4">
|
|
|
|
<div style="padding: 1px 13px 2px; height:28px;">
|
|
|
|
<div align="right" style="float:right; width:50%; position:relative;">
|
|
|
|
<input type="submit" name="inst" value="<?php echo GetMessage("MOD_NEXT_STEP"); ?>" class="adm-btn-save">
|
|
|
|
</div>
|
|
|
|
<div align="left" style="float:right; width:50%; position:relative;">
|
|
|
|
<input type="submit" name="back" value="<?php echo GetMessage("MOD_PREV_STEP"); ?>" class="adm-btn-save">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
|
2013-08-20 12:53:32 +04:00
|
|
|
|