/**
 * Print SOUR structure
 *
 *  This function prints the input array of SOUR sub-records built by the
 *  getSourceStructure() function.
 */
function printSourceStructure($textSOUR)
{
    global $WT_TREE;
    $html = '';
    if ($textSOUR['PAGE']) {
        $html .= WT_Gedcom_Tag::getLabelValue('PAGE', WT_Filter::expandUrls($textSOUR['PAGE']));
    }
    if ($textSOUR['EVEN']) {
        $html .= WT_Gedcom_Tag::getLabelValue('EVEN', WT_Filter::escapeHtml($textSOUR['EVEN']));
        if ($textSOUR['ROLE']) {
            $html .= WT_Gedcom_Tag::getLabelValue('ROLE', WT_Filter::escapeHtml($textSOUR['ROLE']));
        }
    }
    if ($textSOUR['DATE'] || count($textSOUR['TEXT'])) {
        if ($textSOUR['DATE']) {
            $date = new WT_Date($textSOUR['DATE']);
            $html .= WT_Gedcom_Tag::getLabelValue('DATA:DATE', $date->Display(false));
        }
        foreach ($textSOUR['TEXT'] as $text) {
            $html .= WT_Gedcom_Tag::getLabelValue('TEXT', WT_Filter::formatText($text, $WT_TREE));
        }
    }
    if ($textSOUR['QUAY'] != '') {
        $html .= WT_Gedcom_Tag::getLabelValue('QUAY', WT_Gedcom_Code_Quay::getValue($textSOUR['QUAY']));
    }
    return '<div class="indent">' . $html . '</div>';
}