$level = $subarray['level']; } elseif ($subarray['level'] == $level) { // We are on the same level, going to the next id //array_pop($stock); //array_push($stock, $new_id); } else { // Getting back from one level deeper array_pop($stock); $parent_id = array_pop($stock); array_push($stock, $parent_id); $level = $subarray['level']; } if (!empty($ordered_list[$index + 1]['identifier']) && !empty($lp_item_refs[$in_id][$ordered_list[$index + 1]['identifier']])){ $next = $lp_item_refs[$in_id][$ordered_list[$index + 1]['identifier']]; } $path = $oScorm->get_res_path($subarray['identifierref']); $update_path = ''; if (!empty($path)) { // If new path is not empty, update $update_path = "path = '$path', "; } $type = $oScorm->get_res_type($subarray['identifierref']); $update_type = ''; if (!empty($type)) { // If type is defined, update $update_type = "item_type = '$type', "; } if (empty($path)) { // If path is empty, it is a dir anyway $update_type = "item_type = 'dir', "; }