Ejemplo n.º 1
0
$tribes_created = array();
while ($row = $missing_tribes->nextRow()) {
    if (!tribe_createTribe($row['tribe'], $row['tribe'], 0, $db)) {
        echo "There are players with the tag {$row['tribe']}, " . "but I couldn't create this new tribe!\n";
        continue;
    }
    array_push($tribes_created, $row['tribe']);
}
echo "The following tribes have been created:\n";
for ($i = 0; $i < sizeof($tribes_created); ++$i) {
    echo $tribes_created[$i] . "<br>\n";
}
// ----------------------------------------------------------------------------
// Step 3: Recalculate the leaders
echo "-- Checking Tribe Leaders --\n";
$tribes = tribe_getAllTribes($db);
if ($tribes < 0) {
    echo "Error retrieving all tribes.\n";
    return -1;
}
foreach ($tribes as $tag => $data) {
    if (($r = tribe_recalcLeader($tag, $data['leaderID'], $data['juniorLeaderID'], $db)) < 0) {
        echo "Error recalcing leader for Tribe {$tag}\n";
        return -1;
    }
    if (is_array($r)) {
        echo "Tribe {$tag} has a new leader: " . $r[0] . " with juniorLeader: " . $r[1] . "\n";
    }
}
// ----------------------------------------------------------------------------
// Step 4 Check Relations
Ejemplo n.º 2
0
$tribes_created = array();
while ($row = $sql->fetch()) {
    if (!tribe_createTribe($row['tribe'], $row['tribe'], 0)) {
        echo "There are players with the tag {$row['tribe']}, " . "but I couldn't create this new tribe!\n";
        continue;
    }
    array_push($tribes_created, $row['tribe']);
}
echo "The following tribes have been created:\n";
for ($i = 0; $i < sizeof($tribes_created); ++$i) {
    echo $tribes_created[$i] . "<br>\n";
}
// ----------------------------------------------------------------------------
// Step 3: Recalculate the leaders
echo "-- Checking Tribe Leaders --\n";
$tribes = tribe_getAllTribes();
if ($tribes < 0) {
    echo "Error retrieving all tribes.\n";
    return -1;
}
foreach ($tribes as $tag => $data) {
    if (($r = tribe_recalcLeader($tag, $data['leaderID'], $data['juniorLeaderID'])) < 0) {
        echo "Error recalcing leader for Tribe {$tag}\n";
        return -1;
    }
    if (is_array($r)) {
        echo "Tribe {$tag} has a new leader: " . $r[0] . " with juniorLeader: " . $r[1] . "\n";
    }
}
// ----------------------------------------------------------------------------
// Step 4 Check Relations