示例#1
0
        //Save stat data
        file_put_contents("{$statDataDir}/" . $id, serialize($stat['ranking']));
    }
}
//Save player stats
foreach ($playerStats as $id => $pstat) {
    echo "Saving data for {$id} ...\n";
    file_put_contents("{$playerDataDir}/" . $id, serialize($pstat));
}
//Save awards
echo "Saving awards ...\n";
file_put_contents($awardsFile, serialize($awards));
//Create award output
if ($awardOutputFile) {
    echo "Generating award output ...\n";
    $f = fopen($awardOutputFile, 'w');
    foreach ($stats as $id => $stat) {
        if (array_key_exists($id, $awards)) {
            $award = $awards[$id];
            fwrite($f, str_replace('%A%', $stat['award'], str_replace('%D%', $stat['desc'], str_replace('%W%', getPlayerName($award['id']), str_replace('%S%', getStatDisplayValue($stat, $award['score']), $awardOutputFormat)))));
        }
    }
    fclose($f);
}
//Sort and save Hall of Fame
echo "Saving hall of fame\n";
uasort($hof, 'compareRankingEntries');
file_put_contents($hofFile, serialize($hof));
//Save last update
echo "Saving last update time ...\n";
file_put_contents($lastUpdateFile, serialize(time()));
"/>
                    </div>
                    <div class="award-title">
                        <a href="?stat=<?php 
    echo $id;
    ?>
"><?php 
    echo $stat['award'];
    ?>
</a>
                    </div>
                    
                    <?php 
    if (array_key_exists($id, $awards)) {
        $awardWinner = createPlayerWidget($awards[$id]['id'], 24);
        $awardText = $stat['desc'] . ': <span class="award-score">' . getStatDisplayValue($stat, $awards[$id]['score']) . '</span>';
    } else {
        $awardWinner = createPlayerWidget(FALSE, 24);
        $awardText = '(' . $stat['desc'] . ')';
    }
    ?>
                    
                    <div class="award-winner-box">
                        <div class="award-winner">
                            <?php 
    echo $awardWinner;
    ?>
                        </div>
                        <div class="award-text">
                            <?php 
    echo $awardText;
                <col style="width:15%;"/>
                <col style="width:35%;"/>
                <col style="width:10%;"/>
            </colgroup>
            <tbody>
                <tr>
                    <th>Stat</th>
                    <th>Score</th>
                    <th>Award</th>
                    <th>Rank</th>
                </tr>
                <?php 
sortStatsByAwardName();
foreach ($stats as $id => $stat) {
    if (array_key_exists($id, $pstats)) {
        $score = getStatDisplayValue($stat, $pstats[$id]['score']);
        if (isset($pstats[$id]['rank'])) {
            $rank = $pstats[$id]['rank'];
        } else {
            unset($rank);
        }
    } else {
        unset($score);
        unset($rank);
    }
    ?>
                        <tr>
                            <td class="stat">
                                <?php 
    echo $stat['desc'];
    ?>