$transferedNodes = array(); $transferedNodesCheck = array(); if ($_GET['transfered']) { $transferedNodesCheck = unserialize($_GET['transfered']); } $copiedTests = array(); $copiedUnits = array(); $map = array(); foreach ($nodeOrders as $value) { list($id, $parentContentId) = explode("-", $value); if (!in_array($id, $transferedNodesCheck)) { if (eF_checkParameter($id, 'id') !== false && eF_checkParameter($parentContentId, 'id') !== false && in_array($id, $sourceIds) && in_array($map[$parentContentId], $currentIds)) { // echo "Copying $id to parent $map[$parentContentId] with previous $map[$previousContentId] \n"; try { $_GET['mode'] == 'link' ? $linked = true : ($linked = false); $createdUnit = $currentContent->copyUnit($id, $map[$parentContentId], $map[$previousContentId], $linked); $transferedNodes[] = intval($id); //#1383 $currentIds[] = $createdUnit['id']; $map[intval($id)] = $createdUnit['id']; } catch (Exception $e) { $errorMessages[] = $e->getMessage() . ' ' . $e->getCode(); } } else { $map[intval($id)] = $id; } $previousContentId = $id; } } Question::clearDuplicates($currentLesson); glossary::clearDuplicates($currentLesson);