Пример #1
0
function loadBattle()
{
    $battleObj = new Battle();
    $battle = $battleObj->loadBattle();
    $leader = $battleObj->getLeaderBoard();
    $str = "\n        <div id='track-1'>\n            <object height='81' width='300'> \n                <param name='movie' value='http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F" . $battle[0]->track_id . "'></param> \n                <param name='allowscriptaccess' value='always'></param> \n                <embed allowscriptaccess='always' height='81' src='http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F" . $battle[0]->track_id . "' type='application/x-shockwave-flash' width='300'></embed> \n            </object>\n            <br /><span id='trackTitle_" . $battle[0]->track_id . "'><a href='http://soundcloud.com/" . $battle[0]->user_permalink . "/" . $battle[0]->track_permalink . "'>" . $battle[0]->track_name . "</a> by <a href='http://soundcloud.com/" . $battle[0]->user_permalink . "'>" . $battle[0]->user_name . "</a></span><br />\n            <input type='button' onclick='vote(" . $battle[0]->track_id . ", " . $battle[1]->track_id . ");' value='Vote for this pattern' />\n        </div>\n        <span id='vs'>VS</span>\n        <div id='track-2'>\n            <object height='81' width='300'>                 \n                <param name='movie' value='http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F" . $battle[1]->track_id . "'></param> \n                <param name='allowscriptaccess' value='always'></param> \n                <embed allowscriptaccess='always' height='81' src='http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F" . $battle[1]->track_id . "' type='application/x-shockwave-flash' width='300'></embed> \n            </object>\n            <br /><span id='trackTitle_" . $battle[1]->track_id . "'><a href='http://soundcloud.com/" . $battle[1]->user_permalink . "/" . $battle[1]->track_permalink . "'>" . $battle[1]->track_name . "</a> by <a href='http://soundcloud.com/" . $battle[1]->user_permalink . "'>" . $battle[1]->user_name . "</a></span><br />\n            <input type='button' onclick='vote(" . $battle[1]->track_id . ", " . $battle[0]->track_id . ");' value='Vote for this pattern' />\n        </div>\n        -----";
    foreach ($leader as $data) {
        $str .= "\n            <tr>\n                <td>" . $data->wins . "0</td>\n                <td><a href='http://soundcloud.com/" . $data->user_permalink . "/" . $data->track_permalink . "'>" . $data->track_name . "</a></td>\n                <td><a href='http://soundcloud.com/" . $data->user_permalink . "'>" . $data->user_name . "</a></td>\n            </tr>";
    }
    return $str;
}