Example #1
0
<?php

IncludeModuleLangFile(__FILE__);
?>
<div id="PROFILE_CONDITION">
<?php 
$obCond = new CAcritExportproCatalogCond();
CAcritExportproProps::$arIBlockFilter = $profileUtils->PrepareIBlock($arProfile["IBLOCK_ID"], $arProfile["USE_SKU"]);
$boolCond = $obCond->Init(BT_COND_MODE_DEFAULT, BT_COND_BUILD_CATALOG, array("FORM_NAME" => "exportpro_form", "CONT_ID" => "PROFILE_CONDITION", "JS_NAME" => "JSCatCond", "PREFIX" => "PROFILE[CONDITION]"));
if (!$boolCond) {
    if ($ex = $APPLICATION->GetException()) {
        echo $ex->GetString() . "<br>";
    }
}
$obCond->Show($arProfile["CONDITION"]);
?>
</div>
Example #2
0
function change_type()
{
    global $APPLICATION, $PROFILE;
    $profile = new CExportproProfile();
    $types = $profile->GetTypes();
    $siteEncoding = array('utf-8' => 'utf8', 'UTF8' => 'utf8', 'UTF-8' => 'utf8', 'WINDOWS-1251' => 'cp1251', 'windows-1251' => 'cp1251', 'CP1251' => 'cp1251');
    if (!isset($_REQUEST["ID"])) {
        $obProfile = new CExportproProfileDB();
        $dbProcessProfiles = $obProfile->GetProcessList(array($by => $order), array());
        $arActualProfileNames = array();
        while ($arProcessProfile = $dbProcessProfiles->Fetch()) {
            $arActualProfileNames[] = $arProcessProfile["NAME"];
        }
        if (!in_array($PROFILE["TYPE"], $arActualProfileNames)) {
            $profileCode = $PROFILE["TYPE"];
        } else {
            $bCorrentProfileName = false;
            $iProfileNameIndex = 1;
            while (!$bCorrentProfileName) {
                if (!in_array($PROFILE["TYPE"] . $iProfileNameIndex, $arActualProfileNames)) {
                    $profileCode = $PROFILE["TYPE"] . $iProfileNameIndex;
                    $bCorrentProfileName = true;
                }
                $iProfileNameIndex++;
            }
        }
        ob_start();
        ?>
        <input type="text" size="30" name="PROFILE[NAME]" value="<?php 
        echo $profileCode;
        ?>
"/>
        <?php 
        $dataProfileName = ob_get_clean();
        ob_start();
        ?>
        <input type="text" size="30" name="PROFILE[CODE]" value="<?php 
        echo $profileCode;
        ?>
"/>    
        <?php 
        $dataProfileCode = ob_get_clean();
        ob_start();
        ?>
        <input type="text" size="30" name="PROFILE[SETUP][URL_DATA_FILE]" value="/acrit.exportpro/<?php 
        echo $profileCode;
        ?>
.<?php 
        if ($PROFILE["TYPE"] == "advantshop") {
            ?>
csv<?php 
        } else {
            ?>
xml<?php 
        }
        ?>
"/>    
        <?php 
        $exportFilePath = ob_get_clean();
        ob_start();
        ?>
        <td colspan="2"></td>
        <?php 
        $advantShopCheckCompessArea = ob_get_clean();
        ob_start();
        ?>
        <td colspan="2">
            <input type="hidden" name="PROFILE[SETUP][FILE_TYPE]" value="csv" />
        </td>
        <?php 
        $advantShopFilePathArea = ob_get_clean();
        ob_start();
        ?>
        <input type="text" name="PROFILE[SETUP][EXPORT_STEP]" id="export_step_value" value="50000" disabled="disabled">
        <?php 
        $advantShopExportStepBlock = ob_get_clean();
    }
    ob_start();
    ?>
    <textarea name="PROFILE[FORMAT]" rows="5" cols="150"><?php 
    echo $types[$PROFILE['TYPE']]['FORMAT'];
    ?>
</textarea>
    <?php 
    $data1 = ob_get_clean();
    ob_start();
    ?>
    <textarea name="PROFILE[OFFER_TEMPLATE]" rows="5" cols="150"><?php 
    echo htmlspecialcharsbx($types[$PROFILE['TYPE']]['ITEMS_FORMAT']);
    ?>
</textarea>
    <?php 
    $data2 = ob_get_clean();
    ob_start();
    ?>
    <textarea name="PROFILE[CATEGORY_TEMPLATE]" rows="5" cols="150"><?php 
    echo htmlspecialcharsbx($types[$PROFILE['TYPE']]['SECTIONS']);
    ?>
</textarea>
    <?php 
    $data3 = ob_get_clean();
    ob_start();
    ?>
    <textarea name="PROFILE[CURRENCY_TEMPLATE]" rows="5" cols="150"><?php 
    echo htmlspecialcharsbx($types[$PROFILE['TYPE']]['CURRENCIES']);
    ?>
</textarea>
    <?php 
    $data4 = ob_get_clean();
    ob_start();
    $iblockList = array();
    $dbIblock = CIBlock::GetList();
    while ($arIBlock = $dbIblock->Fetch()) {
        $iblockList[] = $arIBlock['ID'];
    }
    $options = $profile->createFieldset2($PROFILE['IBLOCK_ID'], true);
    $fieldType = array('none' => GetMessage('ACRIT_EXPORTPRO_NE_VYBRANO'), 'field' => GetMessage('ACRIT_EXPORTPRO_FIELDSET_FIELD'), 'const' => GetMessage('ACRIT_EXPORTPRO_FIELDSET_CONST'));
    ?>
      
    
    <tbody>                                                                           
        <?php 
    $idCnt = 0;
    ?>
        <?php 
    foreach ($types[$PROFILE['TYPE']]['FIELDS'] as $id => $field) {
        ?>
            <?php 
        $useCondition = $field['USE_CONDITION'] == 'Y' ? 'checked="checked"' : '';
        $hideCondition = $useCondition ? '' : 'hide';
        $hideConstBlock = $field['TYPE'] == 'const' ? '' : 'hide';
        $hideFieldBlock = $field['TYPE'] != 'field' && !$hideConstBlock || $field['TYPE'] == 'none' || !$field['TYPE'] ? 'hide' : '';
        $required = $field['REQUIRED'] == 'Y' ? 'checked="checked"' : '';
        $deleteOnEmpty = $field['DELETE_ONEMPTY'] == 'N' ? '' : 'checked="checked"';
        $htmlEncode = $field['HTML_ENCODE'] == 'N' ? '' : 'checked="checked"';
        $htmlToTxt = $field['HTML_TO_TXT'] == 'N' ? '' : 'checked="checked"';
        $skipUntermElement = $field['SKIP_UNTERM_ELEMENT'] == 'N' ? '' : 'checked="checked"';
        $urlEncode = $field['URL_ENCODE'] == 'Y' ? 'checked="checked"' : '';
        $convertCase = $field['CONVERT_CASE'] == 'Y' ? 'checked="checked"' : '';
        ?>
      
            <tr class="fieldset-item" data-id="<?php 
        echo $idCnt++;
        ?>
">
                <td >
                    <label for="PROFILE[XMLDATA][<?php 
        echo $id;
        ?>
]"><?php 
        echo $field['NAME'];
        ?>
</label>
                    <input type="hidden" name="PROFILE[XMLDATA][<?php 
        echo $id;
        ?>
][NAME]" value="<?php 
        echo $field['NAME'];
        ?>
" />
                </td>
                <td colspan="2">
                    <input type="text" name="PROFILE[XMLDATA][<?php 
        echo $id;
        ?>
][CODE]" value="<?php 
        echo $field['CODE'];
        ?>
" />
                    <select name="PROFILE[XMLDATA][<?php 
        echo $id;
        ?>
][TYPE]" onchange="ShowConvalueBlock(this)" data-id="<?php 
        echo $id;
        ?>
">
                        <?php 
        foreach ($fieldType as $typeId => $typeName) {
            ?>
                            <?php 
            $selected = $typeId == $field['TYPE'] ? 'selected="selected"' : '';
            ?>
                            <option value="<?php 
            echo $typeId;
            ?>
" <?php 
            echo $selected;
            ?>
><?php 
            echo $typeName;
            ?>
</option>
                            <?php 
        }
        ?>
                    </select>
                    <select id="field-block" name="PROFILE[XMLDATA][<?php 
        echo $id;
        ?>
][VALUE]" class="<?php 
        echo $hideFieldBlock;
        ?>
">
                        <option value="">--<?php 
        echo GetMessage("ACRIT_EXPORTPRO_NE_VYBRANO");
        ?>
--</option>
                        <?php 
        if ($field['TYPE'] == 'field') {
            $opt = $profile->selectFieldset2($options, $field['VALUE']);
            echo implode("\n", $opt);
            unset($opt);
        }
        ?>
                    </select>
                    <div id="const-block" class="<?php 
        echo $hideConstBlock;
        ?>
" >
                        <?php 
        $hideContvalueFalse = !$useCondition ? 'hide' : '';
        ?>
                        <?php 
        $showPlaceholder = !$hideContvalueFalse ? 'placeholder' : 'data-placeholder';
        ?>
                        <textarea name="PROFILE[XMLDATA][<?php 
        echo $id;
        ?>
][CONTVALUE_TRUE]" <?php 
        echo $showPlaceholder;
        ?>
="<?php 
        echo GetMessage('ACRIT_EXPORTPRO_FIELDSET_CONDITION_TRUE');
        ?>
"><?php 
        echo $field['CONTVALUE_TRUE'];
        ?>
</textarea>
                        <textarea name="PROFILE[XMLDATA][<?php 
        echo $id;
        ?>
][CONTVALUE_FALSE]" placeholder="<?php 
        echo GetMessage('ACRIT_EXPORTPRO_FIELDSET_CONDITION_FALSE');
        ?>
" class="<?php 
        echo $hideContvalueFalse;
        ?>
"><?php 
        echo $field['CONTVALUE_FALSE'];
        ?>
</textarea>
                    </div>
                    <span class="fieldset-item-delete">&times</span>
                    <div style="margin: 10px 0px 10px 15px;">
                        <span id="hint_EXPORTPRO_FIELDSET_REQUIRED"></span><script type="text/javascript">BX.hint_replace( BX( 'hint_EXPORTPRO_FIELDSET_REQUIRED' ), '<?php 
        echo GetMessage("ACRIT_EXPORTPRO_FIELDSET_REQUIRED_HELP");
        ?>
' );</script>
                        <input type="checkbox" name="PROFILE[XMLDATA][<?php 
        echo $id;
        ?>
][REQUIRED]" value="Y" <?php 
        echo $required;
        ?>
 />
                        <label for="PROFILE[XMLDATA][<?php 
        echo $id;
        ?>
][REQUIRED]"><?php 
        echo GetMessage('ACRIT_EXPORTPRO_FIELDSET_REQUIRED');
        ?>
</label>
                        
                        <div style="height: 5px;">&nbsp;</div>
                        
                        <span id="hint_EXPORTPRO_FIELDSET_CONDITION"></span><script type="text/javascript">BX.hint_replace( BX( 'hint_EXPORTPRO_FIELDSET_CONDITION' ), '<?php 
        echo GetMessage("ACRIT_EXPORTPRO_FIELDSET_CONDITION_HELP");
        ?>
' );</script>
                        <input type="checkbox" name="PROFILE[XMLDATA][<?php 
        echo $id;
        ?>
][USE_CONDITION]" <?php 
        echo $useCondition;
        ?>
 value="Y" data-id="<?php 
        echo $id;
        ?>
" onclick="ShowConditionBlock(this, <?php 
        echo $idCnt;
        ?>
)"/>
                        <label for="PROFILE[XMLDATA][<?php 
        echo $id;
        ?>
][USE_CONDITION]"><?php 
        echo GetMessage('ACRIT_EXPORTPRO_FIELDSET_CONDITION');
        ?>
</label>
                        
                        <div style="height: 5px;">&nbsp;</div>
                        
                        <span id="hint_EXPORTPRO_FIELDSET_DELETE_ONEMPTY"></span><script type="text/javascript">BX.hint_replace( BX( 'hint_EXPORTPRO_FIELDSET_DELETE_ONEMPTY' ), '<?php 
        echo GetMessage("ACRIT_EXPORTPRO_FIELDSET_DELETE_ONEMPTY_HELP");
        ?>
' );</script>
                        <input type="checkbox" name="PROFILE[XMLDATA][<?php 
        echo $id;
        ?>
][DELETE_ONEMPTY]" <?php 
        echo $deleteOnEmpty;
        ?>
 value="Y">
                        <label for="PROFILE[XMLDATA][<?php 
        echo $id;
        ?>
][DELETE_ONEMPTY]"><?php 
        echo GetMessage('ACRIT_EXPORTPRO_FIELDSET_DELETE_ONEMPTY');
        ?>
</label>
                        
                        <div style="height: 5px;">&nbsp;</div>
                        
                        <span id="hint_EXPORTPRO_FIELDSET_URL_ENCODE"></span><script type="text/javascript">BX.hint_replace( BX( 'hint_EXPORTPRO_FIELDSET_URL_ENCODE' ), '<?php 
        echo GetMessage("ACRIT_EXPORTPRO_FIELDSET_URL_ENCODE_HELP");
        ?>
' );</script>
                        <input type="checkbox" name="PROFILE[XMLDATA][<?php 
        echo $id;
        ?>
][URL_ENCODE]" <?php 
        echo $urlEncode;
        ?>
 value="Y">
                        <label for="PROFILE[XMLDATA][<?php 
        echo $id;
        ?>
][URL_ENCODE]"><?php 
        echo GetMessage('ACRIT_EXPORTPRO_FIELDSET_URL_ENCODE');
        ?>
</label>
                        
                        <div style="height: 5px;">&nbsp;</div>
                        
                        <span id="hint_EXPORTPRO_FIELDSET_CONVERT_CASE"></span><script type="text/javascript">BX.hint_replace( BX( 'hint_EXPORTPRO_FIELDSET_CONVERT_CASE' ), '<?php 
        echo GetMessage("ACRIT_EXPORTPRO_FIELDSET_CONVERT_CASE_HELP");
        ?>
' );</script>                    
                        <input type="checkbox" name="PROFILE[XMLDATA][<?php 
        echo $id;
        ?>
][CONVERT_CASE]" <?php 
        echo $convertCase;
        ?>
 value="Y">
                        <label for="PROFILE[XMLDATA][<?php 
        echo $id;
        ?>
][CONVERT_CASE]"><?php 
        echo GetMessage('ACRIT_EXPORTPRO_FIELDSET_CONVERT_CASE');
        ?>
</label>
                        
                        <div style="height: 5px;">&nbsp;</div>
                        
                        <span id="hint_EXPORTPRO_FIELDSET_HTML_ENCODE"></span><script type="text/javascript">BX.hint_replace( BX( 'hint_EXPORTPRO_FIELDSET_HTML_ENCODE' ), '<?php 
        echo GetMessage("ACRIT_EXPORTPRO_FIELDSET_HTML_ENCODE_HELP");
        ?>
' );</script>
                        <input type="checkbox" name="PROFILE[XMLDATA][<?php 
        echo $id;
        ?>
][HTML_ENCODE]" <?php 
        echo $htmlEncode;
        ?>
 value="Y">
                        <label for="PROFILE[XMLDATA][<?php 
        echo $id;
        ?>
][HTML_ENCODE]"><?php 
        echo GetMessage('ACRIT_EXPORTPRO_FIELDSET_HTML_ENCODE');
        ?>
</label>
                        
                        <div style="height: 5px;">&nbsp;</div>
                        
                        <span id="hint_EXPORTPRO_FIELDSET_HTML_TO_TXT"></span><script type="text/javascript">BX.hint_replace( BX( 'hint_EXPORTPRO_FIELDSET_HTML_TO_TXT' ), '<?php 
        echo GetMessage("ACRIT_EXPORTPRO_FIELDSET_HTML_TO_TXT_HELP");
        ?>
' );</script>
                        <input type="checkbox" name="PROFILE[XMLDATA][<?php 
        echo $id;
        ?>
][HTML_TO_TXT]" <?php 
        echo $htmlToTxt;
        ?>
 value="Y">
                        <label for="PROFILE[XMLDATA][<?php 
        echo $id;
        ?>
][HTML_TO_TXT]"><?php 
        echo GetMessage('ACRIT_EXPORTPRO_FIELDSET_HTML_TO_TXT');
        ?>
</label>
                        
                        <div style="height: 5px;">&nbsp;</div>
                        
                        <span id="hint_EXPORTPRO_FIELDSET_SKIP_UNTERM_ELEMENT"></span><script type="text/javascript">BX.hint_replace( BX( 'hint_EXPORTPRO_FIELDSET_SKIP_UNTERM_ELEMENT' ), '<?php 
        echo GetMessage("ACRIT_EXPORTPRO_FIELDSET_SKIP_UNTERM_ELEMENT_HELP");
        ?>
' );</script>
                        <input type="checkbox" name="PROFILE[XMLDATA][<?php 
        echo $id;
        ?>
][SKIP_UNTERM_ELEMENT]" <?php 
        echo $skipUntermElement;
        ?>
 value="Y">
                        <label for="PROFILE[XMLDATA][<?php 
        echo $id;
        ?>
][SKIP_UNTERM_ELEMENT]"><?php 
        echo GetMessage('ACRIT_EXPORTPRO_FIELDSET_SKIP_UNTERM_ELEMENT');
        ?>
</label>
                    </div>
                    <div id="PROFILE_XMLDATA_<?php 
        echo $id;
        ?>
_CONDITION" class="condition-block <?php 
        echo $hideCondition;
        ?>
">
                        <?php 
        if ($field['USE_CONDITION'] == 'Y') {
            $obCond = new CAcritExportproCatalogCond();
            CAcritExportproProps::$arIBlockFilter = $profile->PrepareIBlock($PROFILE['IBLOCK_ID'], $PROFILE['USE_SKU']);
            $boolCond = $obCond->Init(0, 0, array('FORM_NAME' => 'exportpro_form', 'CONT_ID' => 'PROFILE_XMLDATA_' . $id . '_CONDITION', 'JS_NAME' => 'JSCatCond_field_' . $idCnt, 'PREFIX' => 'PROFILE[XMLDATA][' . $id . '][CONDITION]'));
            if (!$boolCond) {
                if ($ex = $APPLICATION->GetException()) {
                    echo $ex->GetString() . "<br>";
                }
            }
            $obCond->Show($field['CONDITION']);
        }
        ?>
                    </div>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <hr style="opacity: 0.2;">
                </td>
            </tr>
            <?php 
    }
    ?>
  
    </tbody>                
    <?php 
    $data5 = ob_get_clean();
    ob_start();
    ?>
    <a href="<?php 
    echo $types[$PROFILE["TYPE"]]["PORTAL_REQUIREMENTS"];
    ?>
" target="_blank"><?php 
    echo $types[$PROFILE["TYPE"]]["PORTAL_REQUIREMENTS"];
    ?>
</a>
    <?php 
    $dataPortalRequirements = ob_get_clean();
    ob_start();
    $encoding = $siteEncoding[SITE_CHARSET] == 'utf8' ? 'utf-8' : $siteEncoding[SITE_CHARSET];
    echo '<pre>', htmlspecialchars($types[$PROFILE['TYPE']]['EXAMPLE'], ENT_COMPAT | ENT_HTML401, $encoding), '</pre>';
    $data6 = ob_get_clean();
    ob_start();
    echo $types[$PROFILE['TYPE']]['SCHEME_DESCRIPTION'];
    $data7 = ob_get_clean();
    ob_start();
    echo $types[$PROFILE['TYPE']]['SCHEME_OFFER_DESCRIPTION'];
    $data8 = ob_get_clean();
    $APPLICATION->RestartBuffer();
    $upFieldList = array(array('id' => '#scheme_format', 'html' => $data1), array('id' => '#scheme_offer', 'html' => $data2), array('id' => '#scheme_category', 'html' => $data3), array('id' => '#scheme_currency', 'html' => $data4), array('id' => '#fieldset-container', 'html' => $data5), array('id' => '#step3 #portal_requirements', 'html' => $dataPortalRequirements), array('id' => '#step3 #description', 'html' => $data6), array('id' => '#scheme_main_add_descr', 'html' => $data7), array('id' => '#scheme_main_add_offer_descr', 'html' => $data8));
    if (strlen($profileCode) > 0) {
        $upFieldList[] = array('id' => '#profile_name', 'html' => $dataProfileName);
        $upFieldList[] = array('id' => '#profile_code', 'html' => $dataProfileCode);
        $upFieldList[] = array("id" => "#export_file_path", "html" => $exportFilePath);
    }
    if ($profileCode == "advantshop") {
        $upFieldList[] = array("id" => "#tr_type_file", "html" => $advantShopFilePathArea);
        $upFieldList[] = array("id" => "#export_step_block", "html" => $advantShopExportStepBlock);
        $upFieldList[] = array("id" => "#check_compress_block", "html" => $advantShopCheckCompessArea);
    }
    echo Bitrix\Main\Web\Json::encode(array('result' => 'ok', 'blocks' => $upFieldList));
    die;
}
Example #3
0
    ?>
][SKIP_UNTERM_ELEMENT]"><?php 
    echo GetMessage('ACRIT_EXPORTPRO_FIELDSET_SKIP_UNTERM_ELEMENT');
    ?>
</label>
                </div>
                <div id="PROFILE_XMLDATA_<?php 
    echo $id;
    ?>
_CONDITION" class="condition-block <?php 
    echo $hideCondition;
    ?>
">
                <?php 
    if ($field["USE_CONDITION"] == "Y" && CModule::IncludeModule("catalog")) {
        $obCond = new CAcritExportproCatalogCond();
        CAcritExportproProps::$arIBlockFilter = $profileUtils->PrepareIBlock($arProfile['IBLOCK_ID'], $arProfile['USE_SKU']);
        $boolCond = $obCond->Init(0, 0, array('FORM_NAME' => 'exportpro_form', 'CONT_ID' => 'PROFILE_XMLDATA_' . $id . '_CONDITION', 'JS_NAME' => 'JSCatCond_field_' . $idCnt, 'PREFIX' => 'PROFILE[XMLDATA][' . $id . '][CONDITION]'));
        if (!$boolCond) {
            if ($ex = $APPLICATION->GetException()) {
                echo $ex->GetString() . "<br>";
            }
        }
        $obCond->Show($field['CONDITION']);
    }
    ?>
                </div>
            </td>
        </tr>
        <tr>
            <td colspan="2">