From: Hendrik B. <nh...@us...> - 2010-08-20 20:00:00
|
Update of /cvsroot/arianne/stendhal_website/content/admin In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv12802/content/admin Modified Files: inspect.php Log Message: render keyed slots as tables Index: inspect.php =================================================================== RCS file: /cvsroot/arianne/stendhal_website/content/admin/inspect.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** inspect.php 20 Aug 2010 19:33:52 -0000 1.1 --- inspect.php 20 Aug 2010 19:59:52 -0000 1.2 *************** *** 2,6 **** class InspectPage extends Page { ! private $data = ' --- 2,7 ---- class InspectPage extends Page { ! private static $KEYED_SLOTS = array("!quests", "!features", "!tutorial", "skills", "!kills", "!visited"); ! private $data = ' *************** *** 142,145 **** --- 143,172 ---- die("Ooops!"); } + + $parsedData = $this->parse($this->data); + foreach ($parsedData as $inspectData) { + $this->renderInspectResult($inspectData); + } + } + + private function parse($data) { + $res = array(); + $res[] = array(); + $res[0]['!quests']['mykey'] = 'myvalue'; + return $res; + } + + private function renderInspectResult($inspectData) { + foreach (InspectPage::$KEYED_SLOTS as $keyedSlot) { + if (!isset($inspectData[$keyedSlot])) { + continue; + } + echo '<h2>'.htmlspecialchars($keyedSlot).'</h2>'; + echo '<table class="prettytable"><tr><th>key</th><th>value</th></tr>'; + foreach ($inspectData[$keyedSlot] as $key => $value) { + echo '<tr><td>'.htmlspecialchars($key).'</td><td>'.htmlspecialchars($value).'</td></tr>'; + } + echo '</table>'; + } } } |