//Needed in order to delete branches as well $_POST['delete_nodes'] = array_reverse($_POST['delete_nodes']); foreach ($_POST['delete_nodes'] as $value) { try { if (in_array($value, $legalValues) && eF_checkParameter($value, 'id')) { // Delete also linked units $linked_units = eF_getTableData('content', 'id', 'linked_to=' . $value); foreach ($linked_units as $unit) { $lessons_IDs = eF_getTableData('content', 'lessons_ID', 'id=' . $unit['id']); foreach ($lessons_IDs as $lessons_ID) { $lessonsContent = new EfrontContentTree($lessons_ID['lessons_ID']); $lessonsContent->removeNode($unit['id']); } } //exit; $currentContent->removeNode($value); if (($pos = array_search($value, $legalValues)) !== false) { unset($legalValues[$pos]); } } } catch (Exception $e) { $errorMessages[] = $e->getMessage() . ' ' . $e->getCode(); } } } if (isset($_POST['activate_nodes']) && $_POST['activate_nodes']) { foreach ($_POST['activate_nodes'] as $value) { if (in_array($value, $legalValues) && eF_checkParameter($value, 'id')) { try { // Activate also linked units $linked_units = eF_getTableData('content', 'id', 'linked_to=' . $value);