/**
 * Display all data of a form without the use of other plugins.
 *
 * @param jTpl $tpl template engine
 * @param jFormsBase $form  the form to display
 */
function jtpl_function_html_formdatafull($tpl, $form)
{
    echo '<table class="jforms-table" border="0">';
    foreach ($form->getControls() as $ctrlref => $ctrl) {
        if ($ctrl->type == 'submit' || $ctrl->type == 'reset' || $ctrl->type == 'hidden' || $ctrl->type == 'captcha') {
            continue;
        }
        if (!$form->isActivated($ctrlref)) {
            continue;
        }
        echo '<tr><th scope="row">';
        echo htmlspecialchars($ctrl->label);
        echo '</th><td>';
        $value = $ctrl->getDisplayValue($form->getData($ctrlref));
        if (is_array($value)) {
            $s = '';
            foreach ($value as $v) {
                $s .= ',' . htmlspecialchars($v);
            }
            echo substr($s, 1);
        } elseif ($ctrl->datatype instanceof jDatatypeHtml) {
            echo $value;
        } else {
            if ($ctrl->type == 'textarea') {
                echo nl2br(htmlspecialchars($value));
            } else {
                echo htmlspecialchars($value);
            }
        }
        echo '</td></tr>';
    }
    echo '</table>';
}
/**
 * Display all data of a form without the use of other plugins.
 *
 * @param jTpl $tpl template engine
 * @param jFormsBase $form  the form to display
 */
function jtpl_function_html_formdatasfull($tpl, $form)
{
    //$formBuilder = $form->getBuilder('html', $action, $params);
    echo '<table class="jforms-table" border="0">';
    foreach ($form->getControls() as $ctrlref => $ctrl) {
        if ($ctrl->type == 'submit' || $ctrl->type == 'reset') {
            continue;
        }
        echo '<tr><th scope="row">';
        echo htmlspecialchars($ctrl->label);
        echo '</th><td>';
        $value = $ctrl->getDisplayValue($form->getData($ctrlref));
        if (is_array($value)) {
            $s = '';
            foreach ($value as $v) {
                $s .= ',' . htmlspecialchars($v);
            }
            echo substr($s, 1);
        } else {
            echo htmlspecialchars($value);
        }
        echo '</td></tr>';
    }
    echo '</table>';
}
/**
 * Display all data of a form without the use of other plugins.
 *
 * @param jTpl $tpl template engine
 * @param jFormsBase $form  the form to display
 */
function jtpl_function_html_formdatafull($tpl, $form)
{
    echo '<table class="jforms-table" border="0">';
    foreach ($form->getControls() as $ctrlref => $ctrl) {
        if ($ctrl->type == 'submit' || $ctrl->type == 'reset' || $ctrl->type == 'hidden' || $ctrl->type == 'captcha' || $ctrl->type == 'secretconfirm') {
            continue;
        }
        if (!$form->isActivated($ctrlref)) {
            continue;
        }
        echo '<tr><th scope="row"' . ($ctrl->type == 'group' ? ' colspan="2" class="jforms-group"' : '') . '>';
        echo htmlspecialchars($ctrl->label);
        echo '</th>';
        if ($ctrl->type != 'group') {
            echo '<td>';
            $value = $ctrl->getDisplayValue($form->getData($ctrlref));
            if (is_array($value) && !empty($value)) {
                echo '<ul>';
                foreach ($value as $v) {
                    echo '<li>', nl2br(htmlspecialchars($v)), '</li>';
                }
                echo '</ul>';
            } else {
                if ($ctrl->isHtmlContent()) {
                    echo $value;
                } else {
                    if ($ctrl->type == 'textarea') {
                        echo nl2br(htmlspecialchars($value));
                    } else {
                        echo htmlspecialchars($value);
                    }
                }
            }
            echo '</td>';
        }
        echo '</tr>';
    }
    echo '</table>';
}
/**
 * Display all data of a form without the use of other plugins.
 *
 * @param jTpl $tpl template engine
 * @param jFormsBase $form the form to display
 */
function jtpl_function_text_formdatafull($tpl, $form)
{
    foreach ($form->getControls() as $ctrlref => $ctrl) {
        if ($ctrl->type == 'submit' || $ctrl->type == 'reset' || $ctrl->type == 'hidden' || $ctrl->type == 'captcha') {
            continue;
        }
        if (!$form->isActivated($ctrlref)) {
            continue;
        }
        echo $ctrl->label, ' : ';
        $value = $ctrl->getDisplayValue($form->getData($ctrlref));
        if (is_array($value)) {
            echo join(',', $value);
        } else {
            if ($ctrl->datatype instanceof jDatatypeHtml) {
                echo strip_tags($value);
            } else {
                echo $value;
            }
        }
        echo "\n\n";
    }
}