<?php
    $linkPlaceholder = '[survey_link]';
    $agencyPlaceholder = '[agency_name]';

    if($this->survey instanceof \Website\Model\Agency){
        $a = $this->survey;
        $name = $a->getName();
        $customUrl = $a->getSeerus_custom_url();
    }

    $link = 'http://satisfaction.realadvice.be/' . $customUrl . '/';

?>

<div id="survey_info">
    <div id="inner_survey_info" class="container">
        <h1><?= $this->input('h1') ?></h1>
        <div class="text"><?= $this->wysiwyg('text')?></div>


        <?php if ($this->editmode) {
            echo 'Lien de l\'enquête : <input type="text" value="' . $linkPlaceholder . '" readonly>';
            echo 'Nom de l\'agence   : <input type="text" value="' . $agencyPlaceholder . '" readonly>';

            echo 'template FR :';

            echo $this->input('sujet-fr');
            echo $this->wysiwyg('template-fr');

            echo 'template NL :';

            echo $this->input('sujet-nl');
            echo $this->wysiwyg('template-nl');

            echo 'template EN :';

            echo $this->input('sujet-en');
            echo $this->wysiwyg('template-en');
        } else {?>

            <fieldset>
                <legend>Français</legend>
                <input class="sujet" type="text" readonly value="<?= $this->input('sujet-fr') ?>">
                <div class="template">
                    <?= str_replace($agencyPlaceholder, $name, str_replace($linkPlaceholder, $link, $this->wysiwyg('template-fr')->text ))?>

                </div>
            </fieldset>

            <fieldset>
                <legend>Néerlandais</legend>
                <input class="sujet" type="text" readonly value="<?= $this->input('sujet-nl') ?>">
                <div class="template">
                    <?= str_replace($agencyPlaceholder, $name, str_replace($linkPlaceholder, $link, $this->wysiwyg('template-nl')->text ))?>

                </div>
            </fieldset>

            <fieldset>
                <legend>Anglais</legend>
                <input class="sujet" type="text" readonly value="<?= $this->input('sujet-en') ?>">
                <div class="template">
                    <?= str_replace($agencyPlaceholder, $name, str_replace($linkPlaceholder, $link, $this->wysiwyg('template-en')->text ))?>
                </div>
            </fieldset>


        <?php }?>

    </div>
</div>