Korusol
9/20/2016 - 1:53 PM

Шаблон веб форм для битрикс

Шаблон веб форм для битрикс

<?php

if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) die();

$this->setFrameMode(true);

if ($arResult['isFormErrors'] == 'Y') {
    echo html_entity_decode($arResult['FORM_ERRORS_TEXT']);
}

echo $arResult['FORM_NOTE'];

if (isset($_GET['formresult']) && $_GET['formresult'] == 'addok') {
    echo sprintf('<div class="form-success form-succes-offers-landlord">%s</div>', GetMessage('FORM_DATA_SEND'));
}

if ($arResult['isFormNote'] != 'Y') {

    echo $arResult['FORM_HEADER'];

    ?>
    <table class="form-table form-offers-landlord-table data-table">
        <tbody>
        <?php

        foreach ($arResult['QUESTIONS'] as $FIELD_SID => $arQuestion) {

            if ($arQuestion['STRUCTURE'][0]['FIELD_TYPE'] == 'hidden') {
                echo $arQuestion['HTML_CODE'];
            } else {
                ?>
                <tr>
                    <td class="label">
                        <?php if (is_array($arResult['FORM_ERRORS']) && array_key_exists($FIELD_SID, $arResult['FORM_ERRORS'])) {
                            ?><span class="error-fld"
                                    title="<?php echo $arResult['FORM_ERRORS'][$FIELD_SID] ?>"></span><?php
                        }

                        echo $arQuestion['CAPTION'] . ': ';

                        if ($arQuestion['REQUIRED'] == 'Y') {
                            echo '<span class="mark_required_field">*</span>';
                        }

                        echo $arQuestion['IS_INPUT_CAPTION_IMAGE'] == 'Y' ? '<br />' . $arQuestion['IMAGE']['HTML_CODE'] : '' ?>
                    </td>
                    <td class="input"><?php echo $arQuestion['HTML_CODE'] ?></td>
                </tr>
                <?php
            }
        }

        if ($arResult['isUseCaptcha'] == 'Y') {
            ?>
            <tr>
                <td>&nbsp;</td>
                <td><input type="hidden" name="captcha_sid"
                           value="<?php echo htmlspecialcharsbx($arResult['CAPTCHACode']); ?>"/><img
                        src="/bitrix/tools/captcha.php?captcha_sid=<?php echo htmlspecialcharsbx($arResult['CAPTCHACode']); ?>"
                        width="180" height="40"/></td>
            </tr>
            <tr>
                <td><?php echo GetMessage('FORM_CAPTCHA_FIELD_TITLE') ?>: <span class="mark_required_field">*</span></td>
                <td><input type="text" name="captcha_word" size="30" maxlength="50" value="" class="inputtext"/></td>
            </tr>
            <?php
        } // isUseCaptcha
        ?>
        </tbody>
        <tfoot>
        <tr>
            <th></th>
            <th style="text-align: left">
                <button
                    <?php echo(intval($arResult['F_RIGHT']) < 10 ? 'disabled="disabled"' : ''); ?>
                    type="submit"
                    name="web_form_submit"
                    class="content_button content_button_big send-button"
                    onclick="window.app && app.publish('preloader:start', $(this));"
                    value="<?php
                    echo htmlspecialcharsbx(strlen(trim($arResult['arForm']['BUTTON'])) <= 0
                        ? GetMessage('FORM_ADD')
                        : $arResult['arForm']['BUTTON']);
                    ?>">
                    <span><?php
                        echo htmlspecialcharsbx(strlen(trim($arResult['arForm']['BUTTON'])) <= 0
                            ? GetMessage('FORM_ADD')
                            : $arResult['arForm']['BUTTON']);
                        ?></span></button>
            </th>
        </tr>
        </tfoot>
    </table>
    <p style="margin-top: 35px">
        <span class="mark_required_field">*</span> &mdash; <?php echo GetMessage('FORM_REQUIRED_FIELDS') ?>
    </p>
    <?php
    echo $arResult['FORM_FOOTER'];
}