Exemplo n.º 1
0
    $options['eventsR'] = $_REQUEST["Event"];
}
$rank = Obj_RankFactory::create('FinalInd', $options);
$rank->read();
$rankData = $rank->getData();
// se ho degli eventi
if (count($rankData['sections'])) {
    foreach ($rankData['sections'] as $section) {
        $ElimCols = 0;
        if ($section['meta']['elim1']) {
            $ElimCols++;
        }
        if ($section['meta']['elim2']) {
            $ElimCols++;
        }
        $NumPhases = numPhases($section['meta']['firstPhase']);
        //Se Esistono righe caricate....
        if (count($section['items'])) {
            $ListHeader = $XmlDoc->createElement('List');
            $ListHeader->setAttribute('Title', get_text($section['meta']['descr'], '', '', true));
            $ListHeader->setAttribute('Columns', 4 + $ElimCols + $NumPhases);
            $XmlRoot->appendChild($ListHeader);
            $TitElem = array();
            $TitElem['Rank'] = $section['meta']['fields']['rank'];
            $TitElem['Athlete'] = $section['meta']['fields']['athlete'];
            $TitElem['Country'] = $section['meta']['fields']['countryName'];
            $TitElem['Rank Score'] = $section['meta']['fields']['qualRank'];
            for ($i = 1; $i <= $ElimCols; $i++) {
                $TitElem['Elim' . $i] = $section['meta']['fields']['elims']['e' . $i];
            }
            foreach ($section['meta']['fields']['finals'] as $k => $v) {
Exemplo n.º 2
0
function ExportLSTFinTeam($Event = null)
{
    $rank = Obj_RankFactory::create('FinalTeam', array());
    $rank->read();
    $rankData = $rank->getData();
    /*echo "<pre>";
    		print_r($rankData);
    		echo "</pre>";exit;*/
    $StrData = "";
    if (count($rankData['sections'])) {
        foreach ($rankData['sections'] as $section) {
            $NumPhases = numPhases($section['meta']['firstPhase']);
            $NumComponenti = $section['meta']['maxTeamPerson'] ? $section['meta']['maxTeamPerson'] : 3;
            if (count($section['items'])) {
                $StrData .= "\n" . get_text($section['meta']['descr'], '', '', true) . "\n";
                // Header vero e proprio
                $StrData .= str_pad(substr($section['meta']['fields']['rank'], 0, 5), 5, ' ', STR_PAD_RIGHT) . " ";
                $StrData .= str_pad(substr($section['meta']['fields']['countryName'], 0, 40), 40, ' ', STR_PAD_RIGHT) . "  ";
                $StrData .= str_pad(substr($section['meta']['fields']['qualRank'], 0, 10), 10, ' ', STR_PAD_LEFT) . " ";
                foreach ($section['meta']['fields']['finals'] as $k => $v) {
                    if (is_numeric($k) && $k != 1) {
                        $StrData .= str_pad(substr($v, 0, 8), 8, ' ', STR_PAD_LEFT) . " ";
                    }
                }
                $StrData .= "\n";
                foreach ($section['items'] as $item) {
                    $StrData .= str_pad($item['rank'] ? $item['rank'] : ' ', 5, ' ', STR_PAD_RIGHT) . " ";
                    $StrData .= str_pad(substr($item['countryCode'], 0, 10), 10, ' ', STR_PAD_RIGHT) . " ";
                    $StrData .= str_pad(substr($item['countryName'] . ($item['subteam'] <= 1 ? '' : ' (' . $item['subteam'] . ')'), 0, 30), 30, ' ', STR_PAD_RIGHT) . " ";
                    $StrData .= str_pad(substr(number_format($item['qualScore'], 0, get_text('NumberDecimalSeparator'), get_text('NumberThousandsSeparator')) . '-' . substr('00' . $item['qualRank'], -2, 2), 0, 10), 10, ' ', STR_PAD_LEFT) . " ";
                    //Risultati  delle varie fasi
                    foreach ($item['finals'] as $k => $v) {
                        $tmp = '';
                        if ($v['tie'] == 2) {
                            $tmp = get_text('Bye');
                        } else {
                            if ($k == 4 && $section['meta']['matchMode'] != 0 && $item['rank'] >= 5) {
                                $tmp = $v['setScore'] . " (" . $v['score'] . ")";
                            } else {
                                $tmp = $section['meta']['matchMode'] == 0 ? $v['score'] : $v['setScore'];
                                if (strlen($v['tiebreak']) > 0 && $k <= 1) {
                                    $tmpTxt = "";
                                    $tmpArr = explode("|", $v['tiebreak']);
                                    for ($countArr = 0; $countArr < count($tmpArr); $countArr += $NumComponenti) {
                                        $tmpTxt .= array_sum(array_slice($tmpArr, $countArr, $NumComponenti)) . ",";
                                    }
                                    $tmp .= " T." . substr($tmpTxt, 0, -1);
                                } elseif ($k <= 1 && $v['tie'] == 1) {
                                    $tmp .= "*";
                                }
                            }
                        }
                        $StrData .= str_pad(substr($tmp, 0, 8), 8, ' ', STR_PAD_LEFT) . " ";
                    }
                    $StrData .= "\n";
                }
            }
        }
    }
    return $StrData;
}