예제 #1
0
function XmlCreateSessionsCountries()
{
    $XmlDoc = new DOMDocument('1.0', 'UTF-8');
    $TmpNode = $XmlDoc->createProcessingInstruction("xml-stylesheet", 'type="text/xsl" href="/Common/Styles/StyleStartList.xsl" ');
    $XmlDoc->appendChild($TmpNode);
    $XmlRoot = $XmlDoc->createElement('Results');
    $XmlRoot->setAttribute('IANSEO', ProgramVersion);
    $XmlRoot->setAttribute('TS', date('Y-m-d H:i:s'));
    $XmlDoc->appendChild($XmlRoot);
    $MyQuery = getStartListCountryQuery();
    $Rs = safe_r_sql($MyQuery);
    $CurTeam = -1;
    $ListHeader = $XmlDoc->createElement('List');
    $ListHeader->setAttribute('Columns', '10');
    $XmlRoot->appendChild($ListHeader);
    $TmpNode = $XmlDoc->createElement('Caption', get_text('Country'));
    $TmpNode->setAttribute('Name', 'Country');
    $TmpNode->setAttribute('Columns', '1');
    $ListHeader->appendChild($TmpNode);
    $TmpNode = $XmlDoc->createElement('Caption', get_text('Session'));
    $TmpNode->setAttribute('Name', 'Session');
    $TmpNode->setAttribute('Columns', '1');
    $ListHeader->appendChild($TmpNode);
    $TmpNode = $XmlDoc->createElement('Caption', get_text('Target'));
    $TmpNode->setAttribute('Name', 'TargetNo');
    $TmpNode->setAttribute('Columns', '1');
    $ListHeader->appendChild($TmpNode);
    $TmpNode = $XmlDoc->createElement('Caption', get_text('Code', 'Tournament'));
    $TmpNode->setAttribute('Name', 'Code');
    $TmpNode->setAttribute('Columns', '1');
    $ListHeader->appendChild($TmpNode);
    $TmpNode = $XmlDoc->createElement('Caption', get_text('Athlete'));
    $TmpNode->setAttribute('Name', 'Athlete');
    $TmpNode->setAttribute('Columns', '1');
    $ListHeader->appendChild($TmpNode);
    $TmpNode = $XmlDoc->createElement('Caption', get_text('AgeCl'));
    $TmpNode->setAttribute('Name', 'AgeClass');
    $TmpNode->setAttribute('Columns', '1');
    $ListHeader->appendChild($TmpNode);
    $TmpNode = $XmlDoc->createElement('Caption', get_text('SubCl', 'Tournament'));
    $TmpNode->setAttribute('Name', 'SubCl');
    $TmpNode->setAttribute('Columns', '1');
    $ListHeader->appendChild($TmpNode);
    $TmpNode = $XmlDoc->createElement('Caption', get_text('Div'));
    $TmpNode->setAttribute('Name', 'Div');
    $TmpNode->setAttribute('Columns', '1');
    $ListHeader->appendChild($TmpNode);
    $TmpNode = $XmlDoc->createElement('Caption', get_text('Cl'));
    $TmpNode->setAttribute('Name', 'Class');
    $TmpNode->setAttribute('Columns', '1');
    $ListHeader->appendChild($TmpNode);
    while ($MyRow = safe_fetch($Rs)) {
        $XmlAthlete = $XmlDoc->createElement('Athlete');
        $ListHeader->appendChild($XmlAthlete);
        $Team = '';
        if ($CurTeam != $MyRow->NationCode) {
            $Team = $MyRow->NationCode . ' - ' . $MyRow->Nation;
            $CurTeam = $MyRow->NationCode;
        }
        $Element = $XmlDoc->createElement('Item', $Team);
        $Element->setAttribute('Name', 'Country');
        $XmlAthlete->appendChild($Element);
        $Element = $XmlDoc->createElement('Item', $MyRow->Session);
        $Element->setAttribute('Name', 'Session');
        $XmlAthlete->appendChild($Element);
        $Element = $XmlDoc->createElement('Item', $MyRow->TargetNo);
        $Element->setAttribute('Name', 'TargetNo');
        $XmlAthlete->appendChild($Element);
        $Element = $XmlDoc->createElement('Item', $MyRow->Bib);
        $Element->setAttribute('Name', 'Bib');
        $XmlAthlete->appendChild($Element);
        $Element = $XmlDoc->createElement('Item', $MyRow->FirstName . ' ' . $MyRow->Name);
        $Element->setAttribute('Name', 'Bib');
        $XmlAthlete->appendChild($Element);
        $Element = $XmlDoc->createElement('Item', $MyRow->AgeClass);
        $Element->setAttribute('Name', 'AgeClass');
        $XmlAthlete->appendChild($Element);
        $Element = $XmlDoc->createElement('Item', $MyRow->SubClass);
        $Element->setAttribute('Name', 'SubClass');
        $XmlAthlete->appendChild($Element);
        $Element = $XmlDoc->createElement('Item', $MyRow->DivCode);
        $Element->setAttribute('Name', 'Div');
        $XmlAthlete->appendChild($Element);
        $Element = $XmlDoc->createElement('Item', $MyRow->ClassCode);
        $Element->setAttribute('Name', 'Class');
        $XmlAthlete->appendChild($Element);
    }
    return $XmlDoc;
}
예제 #2
0
function getStartListByCountries($ORIS = false, $Athletes = false, $orderByName = false)
{
    $Data = new StdClass();
    $Data->Code = 'C32E';
    $Data->Order = '2';
    $Data->Description = 'Entries by Country';
    $Data->Header = array("NOC", "Country", "Name", "Date of Birth   #", "Back No.", "Event");
    $Data->HeaderWidth = array(10, 40, 40, 35, 20, 45);
    $Data->Phase = '';
    $Data->Data = array();
    $Data->Data['Fields'] = array("Bib" => get_text('Code', 'Tournament'), "Athlete" => get_text('Athlete'), "Session" => get_text('SessionShort', 'Tournament'), "SesName" => get_text('Session'), "TargetNo" => get_text('Target'), 'Nation' => get_text('Country'), 'ClDescription' => get_text('Class'), 'DivDescription' => get_text('Division'), 'AgeClass' => get_text('AgeCl'), 'SubClass' => get_text('SubCl', 'Tournament'), 'Status' => get_text('Status', 'Tournament'), 'EventName' => get_text('Event'), 'TargetFace' => get_text('TargetType'));
    if ($ORIS) {
        $Data->Data['Fields']['TargetNo'] = 'Target';
        $Data->Data['Fields']['Athlete'] = 'Name';
        $Data->Data['Fields']['NationCode'] = 'NOC';
        $Data->Data['Fields']['Nation'] = 'Country';
        $Data->Data['Fields']['EventName'] = 'Event';
        $Data->Data['Fields']['Session'] = 'Session';
    } else {
        $Data->HideCols = GetParameter("IntEvent");
        $Data->Description = get_text('StartlistCountry', 'Tournament');
    }
    $MyQuery = getStartListCountryQuery($ORIS, $Athletes, $orderByName);
    //echo $MyQuery;exit;
    $Rs = safe_r_sql($MyQuery);
    while ($MyRow = safe_fetch($Rs)) {
        if (!empty($MyRow->EventName)) {
            $MyRow->EventName = get_text($MyRow->EventName, '', '', true);
        }
        $MyRow->DivDescription = get_text($MyRow->DivDescription, '', '', true);
        $MyRow->ClDescription = get_text($MyRow->ClDescription, '', '', true);
        $Data->Data['Items'][$MyRow->NationCode][] = $MyRow;
    }
    return $Data;
}