function renderElement($data, $prefix) { global $pageData; if ($data["type"] > 1) { return; } $address = $pageData->getAddress(); $prefix .= "— "; ?> <option value="<?php echo $data["id"]; ?> "> <?php echo $prefix . $data["title"]; ?> </option> <?php echo $data["children"][0]["children"] ? "" : "(" . count($data["children"]) . ")"; ?> <?php foreach ($data["children"] as $child) { renderElement($child, $prefix); } return; }
function renderElement($data, $separator) { if ($data["type"] > 1) { return; } $len = count($data["children"]) | 0; // title echo "<option value='{$data['label']}'>{$separator}{$data['title']}</option>'n"; if ($len) { $separator .= " - "; foreach ($data["children"] as $child) { renderElement($child, $separator); } } }
function renderElement($data) { if ($data["type"] == TYPE_CATEGORY) { $len = count($data["children"]) | 0; $arrow = " ➤ "; // title echo $data["title"] . "<sup>[" . $len . "]</sup> " . "<span class='small-text'>" . "[<a href=\"javascript:popupWindow('editAdminCategory', '{$data['id']}')\">edit</a>] " . "[<a href='delete-category#{$data['label']}'>delete</a>]" . "</span>"; // children echo "<div class='spoilers-tree' spoiler='true' title='{$arrow}'>"; if ($len) { foreach ($data["children"] as $child) { renderElement($child); } } else { echo "<span class='grey-text'>empty</span>"; } echo "</div>"; } else { echo "<span class='grey-text'>{$data['title']}</span>"; } echo "<br />\n"; return; }