/**
 * Display all data of a form without the use of other plugins.
 *
 * @param jTpl $tpl template engine
 * @param jFormsBase $form  the form to display
 * @param string $builder the builder type to use
 * @param array $options options for the builder
 */
function jtpl_function_html_formdatafull($tpl, $form, $builder = 'html', $options = array())
{
    echo '<table class="jforms-table" border="0">';
    $formfullBuilder = $form->getBuilder($builder);
    if (count($options)) {
        $formfullBuilder->setOptions($options);
    }
    foreach ($form->getRootControls() 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;
        }
        if ($ctrl->type == 'group') {
            echo '<tr><td scope="row"' . ($ctrl->type == 'group' ? ' colspan="2" class="jforms-group"' : '') . '>';
            $formfullBuilder->outputControlValue($ctrl);
            echo '</td>';
            echo "</tr>\n";
        } else {
            echo '<tr><th scope="row" valign="top">';
            $formfullBuilder->outputControlLabel($ctrl, '', false);
            echo '</th>';
            echo '<td>';
            $formfullBuilder->outputControlValue($ctrl);
            echo '</td>';
            echo "</tr>\n";
        }
    }
    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') {
            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_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";
    }
}