$resultAll = $modelGeneral->fetchAll($queryAll, array($_SESSION['user']['id'], $_GET['id']), $t); if (!empty($resultAll)) { foreach ($resultAll as $k => $v) { $mid = $v['move_id']; $cat_parent_id = $v['parent_id']; $arrayCategories[$mid] = array("parent_id" => $cat_parent_id, "name" => $v['move'], "details" => $v); $cat_tree = chess_tree_add($cat_tree, $cat_parent_id, $v, $mid); } if (!empty($move_id)) { list($arrSelectedBox, $arrSelectedDetails) = display_parent_nodes($move_id, $arrayCategories); } } if (!empty($_GET['del'])) { $queryDel = "DELETE FROM chess_repertorie_moves WHERE move_id = ? AND repertory_id = ? AND uid = ?"; $modelGeneral->deleteDetails($queryDel, array($_GET['del'], $_GET['id'], $_SESSION['user']['id'])); delete_child_nodes($_GET['del'], $arrayCategories, $modelGeneral, $_GET['id'], $_SESSION['user']['id']); $modelGeneral->clearCache($query, array($_SESSION['user']['id'], $_GET['id'])); $modelGeneral->clearCache($queryChessMoves, array($_SESSION['user']['id'], $_GET['id'], $parent_id)); $modelGeneral->clearCache($queryChessCurrentMove, array($_SESSION['user']['id'], $_GET['id'], $move_id)); $modelGeneral->clearCache($queryAll, array($_SESSION['user']['id'], $_GET['id'])); header("Location: " . HTTPPATH . "/chess/repertorie/{$pageUrl}?id=" . $_GET['id'] . "&move_id=" . $move_id . "&parent_id=" . $move_id); exit; } ?> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo HTTPPATH; ?> /samples/chessstockfish/css/chess.css"></link>
function delete_child_nodes($parent_id, $index, $modelGeneral, $repertory_id, $uid) { if (isset($index[$parent_id])) { foreach ($index as $id => $details) { if ($details['details']['parent_id'] == $parent_id) { $queryDel = "DELETE FROM chess_repertorie_moves WHERE move_id = ? AND repertory_id = ? AND uid = ?"; $modelGeneral->deleteDetails($queryDel, array($id, $repertory_id, $uid)); delete_child_nodes($id, $index, $modelGeneral, $repertory_id, $uid); } } } }