function parent_category_form_rec($categories, $key, $level) { foreach ($categories as $category) { if ($category->parent == $key) { echo "<option VALUE=\"" . $category->id . "\" />"; for ($i = 0; $i < $level; ++$i) { echo "-"; } echo " " . $category->name; HTML_priceguard::parent_category_form_rec($categories, $category->id, $level + 1); } } }
function createCategory() { global $mainframe, $_POST, $my, $database; $success = false; if (isset($_POST[category_name])) { $query = "INSERT INTO priceguard_categories (mos_user_id, parent, name) VALUES (" . $my->id . ", "; if ($_POST["parent"] != -1) { $query .= $_POST["parent"] . ", \""; } else { $query .= "NULL, \""; } $query .= $_POST["category_name"] . "\")"; $database->setQuery($query); $success = $database->query(); } $mainframe->setPageTitle(preg_replace("/([ÂÃ])([€-¿])/e", "chr(ord('\\1')<<6&0xC0|ord('\\2')&0x3F)", "Kategorie erstellen")); HTML_priceguard::createCategory($success); }