Elitist Jerks
Register
Blogs
Forums


Go Back   Elitist Jerks » Blogs » Fiesty and Short

Once upon a time, a casual tank formed a raid coalition for BC. Stuff happened.
Rate this Entry

More stasiscl Tricks (Raid Listing Page)

Posted 07/07/08 at 7:10 PM by Abbi
Updated 07/07/08 at 10:06 PM by Abbi
Enough people have complained that they don't have old WWS parses to provide the necessary .js and .css files for the stasiscl history option that I decided to write something. Have some bad PHP. Drop this sucker in your top level raid directory (call it index.php). It should sit right next to all the directories named "sws-blahblah-1234567".

Code:
<html>
<head>
<title>Raid History</title>
<link rel="stylesheet" type="text/css" href="extras/sws2.css" />
</head>
<body>
<div class="swsmaster">
<div class="top">
<h2>Raid History</h2>
</div>

<table cellspacing="0" class="chart">
<tr>
    <th>WWS report</th>
    <th>Comment</th>
    <th>Start time</th>
    <th style='text-align: right;'>DPS</th>
    <th style='text-align: right;'>DPS time</th>
    <th style='text-align: right;'>Duration</th>
    <th style='text-align: right;'>Players</th>
</tr>

<?
    if ($dir = opendir(".")) {
        while (($file = readdir($dir)) !== false) {
            if (preg_match("/^sws/", $file)) {
                $parser = xml_parser_create();
                xml_set_element_handler($parser, "start_tag", "end_tag");

                if (!($fp = fopen($file . "/data.xml", "r"))) { echo("cannot open".$filename); }

                while ($data = fread($fp, 4096)){
                    if (!xml_parse($parser, $data, feof($fp))) {
                        $reason = xml_error_string(xml_get_error_code($parser));
                        $reason .= xml_get_current_line_number($parser);
                        die($reason);
                    }
                }
            }
        }
    }

    ksort($raids);
    foreach ($raids as $value) {
        echo $value;
    }

    function start_tag($parser, $name, $attribs) {
        global $players;
        global $raids;
        global $start;
        if ($name == "RAID") {
            $start = $attribs['START'] . " " . $attribs['COMMENT'];
            $players = 0;
            $raids[$start] =  "<tr>";
            $raids[$start] .= "<td><a href='" . $attribs['DIR'] . "/index.html'>" . $attribs['DIR'] . "</a></td>";
            $raids[$start] .= "<td>" . $attribs['COMMENT'] . "</td>";
            $raids[$start] .= "<td>" . date("D F j, H:i", $attribs['START'] / 1000) . "</td>";
            $raids[$start] .= "<td style='text-align: right;'>" . $attribs['DPS'] . "</td>";
            $raids[$start] .= "<td style='text-align: right;'>" . $attribs['DPSTIME'] . "%</td>";
            $lghour = sprintf("%02u", $attribs['LG'] / 1000 / 60 / 60);
            $lgmin  = sprintf("%02u", ($attribs['LG'] / 1000 / 60) % 60);
            $raids[$start] .= "<td style='text-align: right;'>" . $lghour . ":" . $lgmin . "</td>";
        }
        if ($name == "PLAYER") {
            $players++;
        }
    }

    function end_tag($parser, $name) {
        global $players;
        global $raids;
        global $start;
        if ($name == "RAID") {
            $raids[$start] .= "<td style='text-align: right;'>" . $players . "</td>";
            $raids[$start] .= "</tr>";
        }
    }

?>
</table>
</div>
</body>
</html>
Posted in Code
Comments 4 Email Blog Entry
Total Comments 4

Comments

Old
rawrz's Avatar
Works great, thanks! I am using it for my alt raid parses - if someone wants to see what it looks like: http://1tb.lightbringer-pve.com/stats/
Posted 07/07/08 at 7:37 PM by rawrz rawrz is offline
Old
Abbi's Avatar
Always good when it works for someone who's not me.

Players page incoming in a bit. (Maybe tonight.)
Posted 07/07/08 at 8:32 PM by Abbi Abbi is offline
Old
Malan's Avatar
Because I am stupid - what file name is this supposed to be given?
Posted 07/07/08 at 8:38 PM by Malan Malan is offline
Old
Abbi's Avatar
index.php should work.

<link rel="stylesheet" type="text/css" href="/logs/raids/sws2.css" />

is the line you'll need to change -- actually, hm, make it:

<link rel="stylesheet" type="text/css" href="extras/sws2.css" />

And that'll work. I'm gonna change the original post.
Posted 07/07/08 at 10:05 PM by Abbi Abbi is offline