예제 #1
0
/*
COMMON SETUP FOR TARGET
*/
require_once dirname(__FILE__) . '/lib.php';
require_once dirname(dirname(__FILE__)) . '/lib.php';
// default Divisions
CreateStandardDivisions($TourId, $TourType, $SubRule);
// default Classes
CreateStandardClasses($TourId, $SubRule, $TourType);
// default Subclasses
CreateStandardSubClasses($TourId);
if ($SubRule == 9) {
    // Champs
    CreateStandardFieldEvents($TourId, $SubRule);
    InsertStandardFieldEvents($TourId, $SubRule);
}
// default Distances
// default targets
if ($tourDetNumDist == 2) {
    CreateDistance($TourId, $TourType, '%', 'Bane 1', 'Bane 2');
    CreateTargetFace($TourId, 1, '~Default', '%', '1', 6, 0, 6, 0);
} else {
    CreateDistance($TourId, $TourType, '%', 'Bane');
    CreateTargetFace($TourId, 1, '~Default', '%', '1', 6, 0);
}
// create a first distance prototype
CreateDistanceInformation($TourId, $DistanceInfoArray, $tourDetNumEnds, 4);
// Update Tour details
$tourDetails = array('ToCollation' => $tourCollation, 'ToTypeName' => $tourDetTypeName, 'ToNumDist' => $tourDetNumDist, 'ToNumEnds' => $tourDetNumEnds, 'ToMaxDistScore' => $tourDetMaxDistScore, 'ToMaxFinIndScore' => $tourDetMaxFinIndScore, 'ToMaxFinTeamScore' => $tourDetMaxFinTeamScore, 'ToCategory' => $tourDetCategory, 'ToElabTeam' => $tourDetElabTeam, 'ToElimination' => $tourDetElimination, 'ToGolds' => $tourDetGolds, 'ToXNine' => $tourDetXNine, 'ToGoldsChars' => $tourDetGoldsChars, 'ToXNineChars' => $tourDetXNineChars, 'ToDouble' => $tourDetDouble, 'ToIocCode' => $tourDetIocCode);
UpdateTourDetails($TourId, $tourDetails);
예제 #2
0
        break;
    case 6:
        CreateTargetFace($TourId, $i++, '~Default', '%', '1', 1, 40, 1, 40);
        CreateTargetFace($TourId, $i++, '~DefaultCO', 'REG-^CO[^G]', '1', 4, 40, 4, 40);
        CreateTargetFace($TourId, $i++, '~Default G/VI', 'REG-^OLG|^ANG|^VI', '1', 1, 60, 1, 60);
        CreateTargetFace($TourId, $i++, '~Default COG', 'REG-^COG', '1', 4, 60, 4, 60);
        // optional target faces
        CreateTargetFace($TourId, $i++, '~6-10', 'REG-^OL[AJMRS]', '', 2, 40, 2, 40);
        break;
    case 7:
        CreateTargetFace($TourId, $i++, '~Default', '%', '1', 1, 60, 1, 60);
        CreateTargetFace($TourId, $i++, '~DefaultCO', 'REG-^CO[^G]', '1', 4, 60, 4, 60);
        CreateTargetFace($TourId, $i++, '~Default G/VI', 'REG-^OLG|^VI', '1', 1, 80, 1, 80);
        CreateTargetFace($TourId, $i++, '~Default COG', 'REG-^COG', '1', 4, 80, 4, 80);
        // optional target faces
        CreateTargetFace($TourId, $i++, '~6-10', 'REG-^OL[AJMRS]', '', 2, 60, 2, 60);
        break;
    case 8:
        CreateTargetFace($TourId, $i++, '~Default', '%', '1', 1, 60, 1, 60, 1, 40, 1, 40);
        CreateTargetFace($TourId, $i++, '~DefaultCO', 'REG-^CO[^G]', '1', 4, 60, 4, 60, 4, 40, 4, 40);
        CreateTargetFace($TourId, $i++, '~Default G/VI', 'REG-^OLG|^VI', '1', 1, 80, 1, 80, 1, 60, 1, 60);
        CreateTargetFace($TourId, $i++, '~Default COG', 'REG-^COG', '1', 4, 80, 4, 80, 4, 60, 4, 60);
        // optional target faces
        CreateTargetFace($TourId, $i++, '~6-10', 'REG-^OL[AJMRS]', '', 2, 60, 2, 60, 2, 40, 2, 40);
        break;
}
// create a first distance prototype
CreateDistanceInformation($TourId, $DistanceInfoArray, 16, 4);
// Update Tour details
$tourDetails = array('ToCollation' => $tourCollation, 'ToTypeName' => $tourDetTypeName, 'ToNumDist' => $tourDetNumDist, 'ToNumEnds' => $tourDetNumEnds, 'ToMaxDistScore' => $tourDetMaxDistScore, 'ToMaxFinIndScore' => $tourDetMaxFinIndScore, 'ToMaxFinTeamScore' => $tourDetMaxFinTeamScore, 'ToCategory' => $tourDetCategory, 'ToElabTeam' => $tourDetElabTeam, 'ToElimination' => $tourDetElimination, 'ToGolds' => $tourDetGolds, 'ToXNine' => $tourDetXNine, 'ToGoldsChars' => $tourDetGoldsChars, 'ToXNineChars' => $tourDetXNineChars, 'ToDouble' => $tourDetDouble, 'ToIocCode' => $tourDetIocCode);
UpdateTourDetails($TourId, $tourDetails);
예제 #3
0
function UpdatePreOpen($TournamentID)
{
    // checks if the structure of the database is consistent
    //	CheckDbStructure();
    $DbVersion = GetParameter('DBUpdate');
    $rs = safe_r_SQL("SELECT ToDbVersion, ToType, ToNumSession FROM Tournament WHERE ToId='{$TournamentID}'");
    $row = safe_fetch($rs);
    $version = $row->ToDbVersion;
    if ($version < '2010-11-26 15:50:00') {
        updateEnTimeStamp_20101126($TournamentID);
        to_save_version($TournamentID, '2010-11-26 15:50:00');
    }
    if ($version < '2010-12-11 20:30:00') {
        recalculateIndividuals_20101211($TournamentID);
        to_save_version($TournamentID, '2010-12-11 20:30:00');
    }
    if ($version < '2011-02-16 15:42:00') {
        // metto a posto il numero max di persone nei team
        calcMaxTeamPerson_20110216($TournamentID);
        // ricalcolo le rank a squadra
        recalculateTeamRanking_20110216($TournamentID);
        to_save_version($TournamentID, '2011-02-16 15:42:00');
    }
    if ($version < '2011-03-09 14:38:00') {
        initTourGoldsXNineChars_20110309($TournamentID);
        to_save_version($TournamentID, '2011-03-09 14:38:00');
    }
    if ($version < '2011-04-15 15:55:00') {
        RecalcFinRank_20110415($TournamentID);
        to_save_version($TournamentID, '2011-04-15 15:55:00');
    }
    if ($version < '2012-01-11 10:20:00') {
        Update3DIta_20120111($TournamentID);
        to_save_version($TournamentID, '2012-01-11 10:20:00');
    }
    if ($version < '2012-01-24 15:16:00') {
        $q = insertIntoGridForF2F_21($TournamentID);
        $rs2 = safe_w_sql($q, false, array(1062));
        to_save_version($TournamentID, '2012-01-24 15:16:00');
    }
    if ($version < '2012-05-18 07:10:00') {
        safe_w_sql("update Divisions set DivWaDivision=DivId, DivRecDivision=DivId where DivWaDivision='' or DivRecDivision=''");
        safe_w_sql("update Classes set ClWaClass=ClId, ClRecClass=ClId where ClWaClass='' or ClRecClass=''");
        safe_w_sql("update Events set EvWaCategory=EvCode, EvRecCategory=EvCode where EvWaCategory='' or EvRecCategory=''");
        to_save_version($TournamentID, '2012-05-18 07:10:00');
    }
    if ($version < '2013-12-19 12:30:00') {
        // Updating DistanceInformation
        require_once 'Modules/Sets/lib.php';
        require_once 'Tournament/Fun_ManSessions.inc.php';
        $Distances = getDistanceArrays($row->ToType);
        $q = safe_r_sql("select SesAth4Target, SesOrder from Session where SesTournament={$TournamentID}");
        while ($r = safe_fetch($q)) {
            CreateDistanceInformation($TournamentID, $Distances, 0, $r->SesAth4Target, $r->SesOrder);
        }
        to_save_version($TournamentID, '2013-12-19 12:30:00');
    }
    if ($version < '2014-03-22 14:00:00') {
        UpdateWinLose_20140322($TournamentID);
        to_save_version($TournamentID, '2014-03-22 14:00:00');
    }
    if ($version < '2014-04-01 00:00:00') {
        UpdateItaRules_20140401($TournamentID);
        to_save_version($TournamentID, '2014-04-01 00:00:00');
    }
    if ($version < '2014-05-23 16:00:00') {
        safe_w_sql("update Scheduler\n\t\t\tleft join Session on SchTournament=SesTournament and SchSesOrder=SesOrder and SchSesType=SesType\n\t\t\tset SchDay=date(SchDateStart), SchStart=time(SchDateStart), SchDuration=TIMESTAMPDIFF(MINUTE, SchDateStart, SchDateEnd), SchText=SchDescr, SchTitle=SesName\n\t\t\twhere SchTournament={$TournamentID}");
        $q = safe_r_sql("select * from Scheduler where SchTournament={$TournamentID} and SchDay>0 and SchStart>0 order by SchDay, SchStart, SchOrder desc");
        $oldKeys = array();
        while ($r = safe_fetch($q)) {
            $good = true;
            $key = $r->SchDay . '|' . $r->SchStart;
            while (in_array($key, $oldKeys)) {
                $key++;
                $good = false;
            }
            $oldKeys[] = $key;
            if (!$good) {
                $SQL = "update Scheduler set SchStart='" . substr($key, -8) . "' where SchDay='{$r->SchDay}' and SchStart='{$r->SchStart}' and SchDuration='{$r->SchDuration}' and SchSesOrder={$r->SchSesOrder} and SchOrder={$r->SchOrder} and SchSesType='{$r->SchSesType}' limit 1";
                safe_w_sql($SQL);
            }
        }
        to_save_version($TournamentID, '2014-04-01 00:00:00');
    }
    to_save_version($TournamentID, $DbVersion);
}
예제 #4
0
// Default Target
$i = 1;
switch ($TourType) {
    case 10:
    case 12:
        CreateTargetFace($TourId, $i++, 'Red Peg', 'REG-^[CR]{1,1}[J]{0,1}[HD]{1,1}', '1', 6, 0, 6, 0);
        CreateTargetFace($TourId, $i++, 'White Peg', 'REG-^[RCBL]{1,1}[K]{1,1}[HD]{1,1}', '1', 6, 0, 6, 0);
        CreateTargetFace($TourId, $i++, 'Blue Peg', 'REG-^[B]{1,1}[J]{0,1}[HD]{1,1}', '1', 6, 0, 6, 0);
        CreateTargetFace($TourId, $i++, 'Blue Peg', 'REG-^[CR]{1,1}[SMV]{1,1}[HD]{1,1}', '1', 6, 0, 6, 0);
        CreateTargetFace($TourId, $i++, 'Black Peg', 'REG-^[L]{1,1}[CJSMV]{0,1}[HD]{1,1}', '1', 6, 0, 6, 0);
        CreateTargetFace($TourId, $i++, 'Black Peg', 'REG-^[RCB]{1,1}[C]{1,1}[HD]{1,1}', '1', 6, 0, 6, 0);
        CreateTargetFace($TourId, $i++, 'Black Peg', 'REG-^[B]{1,1}[SMV]{1,1}[HD]{1,1}', '1', 6, 0, 6, 0);
        /*
        CreateTargetFace($TourId, $i++, 'Blue Peg', 'REG-^[B]{1,1}[HD]{1,1}', '1',  6, 0, 6, 0);
        		CreateTargetFace($TourId, $i++, 'Black Peg', 'REG-^[L]{1,1}[HD]{1,1}', '1',  6, 0, 6, 0);
        		CreateTargetFace($TourId, $i++, 'Red Peg', 'REG-^[CB]{1,1}[V]{1,1}[HD]{1,1}', '1',  6, 0, 6, 0);
        		CreateTargetFace($TourId, $i++, 'Blue Peg', 'REG-^[RL]{1,1}[S]{1,1}[HD]{1,1}', '1',  6, 0, 6, 0);
        		CreateTargetFace($TourId, $i++, 'Black Peg', 'REG-^[CB]{1,1}[S]{1,1}[HD]{1,1}', '1',  6, 0, 6, 0);
        		CreateTargetFace($TourId, $i++, 'Blue Peg', 'REG-^[RC]{1,1}[M]{1,1}[HD]{1,1}', '1',  6, 0, 6, 0);
        		CreateTargetFace($TourId, $i++, 'Black Peg', 'REG-^[BL]{1,1}[M]{1,1}[HD]{1,1}', '1',  6, 0, 6, 0);
        		CreateTargetFace($TourId, $i++, 'Blue Peg', 'REG-^[L]{1,1}[V]{1,1}[HD]{1,1}', '1',  6, 0, 6, 0);
        		CreateTargetFace($TourId, $i++, 'Black Peg', 'REG-^[R]{1,1}[V]{1,1}[HD]{1,1}', '1',  6, 0, 6, 0);
        		CreateTargetFace($TourId, $i++, 'Black Peg', 'REG-^[RCBL]{1,1}[J]{1,1}[HD]{1,1}', '1',  6, 0, 6, 0);
        */
        break;
}
// create a first distance prototype
CreateDistanceInformation($TourId, $DistanceInfoArray, $TourType == 10 ? 24 : 12);
// Update Tour details
$tourDetails = array('ToCollation' => $tourCollation, 'ToTypeName' => $tourDetTypeName, 'ToNumDist' => $tourDetNumDist, 'ToNumEnds' => $tourDetNumEnds, 'ToMaxDistScore' => $tourDetMaxDistScore, 'ToMaxFinIndScore' => $tourDetMaxFinIndScore, 'ToMaxFinTeamScore' => $tourDetMaxFinTeamScore, 'ToCategory' => $tourDetCategory, 'ToElabTeam' => $tourDetElabTeam, 'ToElimination' => $tourDetElimination, 'ToGolds' => $tourDetGolds, 'ToXNine' => $tourDetXNine, 'ToGoldsChars' => $tourDetGoldsChars, 'ToXNineChars' => $tourDetXNineChars, 'ToDouble' => $tourDetDouble, 'ToIocCode' => $tourDetIocCode);
UpdateTourDetails($TourId, $tourDetails);
예제 #5
0
        break;
    case 6:
        CreateTargetFace($TourId, 1, '~Default', '%', '1', 2, 40, 2, 40);
        CreateTargetFace($TourId, 2, '~DefaultCO', 'C%', '1', 4, 40, 4, 40);
        CreateTargetFace($TourId, 3, '~DefaultCO', 'W1%', '1', 4, 40, 4, 40);
        CreateTargetFace($TourId, 4, '~DefaultVI', 'VI%', '1', 1, 60, 1, 60);
        // optional target faces
        CreateTargetFace($TourId, 5, '~Option1', 'R%', '', 1, 40, 1, 40);
        break;
    case 7:
        CreateTargetFace($TourId, 1, '~Default', 'R%', '1', 2, 60, 2, 60);
        CreateTargetFace($TourId, 2, '~DefaultCO', 'C%', '1', 4, 60, 4, 60);
        CreateTargetFace($TourId, 3, '~DefaultCO', 'W1%', '1', 4, 60, 4, 60);
        CreateTargetFace($TourId, 4, '~DefaultVI', 'VI%', '1', 1, 80, 1, 80);
        // optional target faces
        CreateTargetFace($TourId, 5, '~Option1', 'R%', '', 1, 60, 1, 60);
        break;
    case 8:
        CreateTargetFace($TourId, 1, '~Default', 'R%', '1', 2, 60, 2, 60, 2, 40, 2, 40);
        CreateTargetFace($TourId, 2, '~DefaultCO', 'C%', '1', 4, 60, 4, 60, 4, 40, 4, 40);
        CreateTargetFace($TourId, 3, '~DefaultCO', 'W1%', '1', 4, 60, 4, 60, 4, 40, 4, 40);
        CreateTargetFace($TourId, 4, '~DefaultVI', 'VI%', '1', 1, 80, 1, 80, 1, 60, 1, 60);
        // optional target faces
        CreateTargetFace($TourId, 5, '~Option1', 'R%', '', 1, 60, 1, 60, 1, 40, 1, 40);
        break;
}
// create a first distance prototype
CreateDistanceInformation($TourId, $DistanceInfoArray, 32, 2);
// Update Tour details
$tourDetails = array('ToCollation' => $tourCollation, 'ToTypeName' => $tourDetTypeName, 'ToNumDist' => $tourDetNumDist, 'ToNumEnds' => $tourDetNumEnds, 'ToMaxDistScore' => $tourDetMaxDistScore, 'ToMaxFinIndScore' => $tourDetMaxFinIndScore, 'ToMaxFinTeamScore' => $tourDetMaxFinTeamScore, 'ToCategory' => $tourDetCategory, 'ToElabTeam' => $tourDetElabTeam, 'ToElimination' => $tourDetElimination, 'ToGolds' => $tourDetGolds, 'ToXNine' => $tourDetXNine, 'ToGoldsChars' => $tourDetGoldsChars, 'ToXNineChars' => $tourDetXNineChars, 'ToDouble' => $tourDetDouble);
UpdateTourDetails($TourId, $tourDetails);