function displayObjectPart($row, $emphasis) { echo "<div class=\"result\">"; echo "<a class=\"restitle\" href=objectInfo.php?objectID=" . urlencode($row['OLocalID']) . ">" . addEmphasis($row[ObjectName], $emphasis) . "</a> "; /* sale types * Not = 0, Original = 1, Copy = 2, Contents = 3, */ echo "<span class=\"saleInfo\">"; if ($row['SaleType'] == 1) { echo "Origonal For Sale: \${$row['SalePrice']}L"; } else { if ($row['SaleType'] == 2) { echo "Copy For Sale: \${$row['SalePrice']}L"; } else { if ($row['SaleType'] == 3) { echo "Contents For Sale: \${$row['SalePrice']}L"; } else { echo "Not for Sale"; } } } if ($row['SaleType'] != 0) { echo " : Perms: " . parsePerms($row["Perms"]); } echo "</span><br>"; echo "<span class=\"description\">" . addEmphasis($row['Description'], $emphasis) . "</span><br>"; echo "<b>Owner</b> " . $row['OwnerName'] . "<br>"; echo "<b>Creator</b> " . $row['CreatorName'] . "<br>"; echo getLocationURL($row['GridLoginURI'], $row['RegionName'], $row['Location']) . "<br>"; echo "</div><p>"; }
function parsePerms(SimpleXMLElement $element, array $parents) { // var_dump($element); $prefix = ""; foreach ($parents as $parent) { $prefix .= $parent . "."; } $description = (string) $element->attributes()->description; $default = (string) $element->attributes()->default; $children = []; foreach ($element->children() as $childName => $child) { $copy = $parents; $copy[] = $childName; $children[$prefix . $childName] = parsePerms($child, $copy); } return ["description" => $description, "default" => $default, "children" => $children]; }