public function main() { $root = RootNode::getInstance(); if (!empty($_REQUEST)) { if (isset($_REQUEST['command']) && $_REQUEST['command'] == 'add') { $root->addNode(); } elseif (isset($_REQUEST['command']) && $_REQUEST['command'] == 'delete' && isset($_REQUEST['node']) && null !== $_REQUEST['node']) { $root->deleteNode((int) $_REQUEST['node']); } $root = RootNode::getInstance(); } $root::output($root); }
public function deleteNode($i) { $root = RootNode::getInstance(); $root->child = null; $_SESSION['instance'] = serialize($this->rebuild($i, $root)); }