Skip to content

Commit

Permalink
Expermineting to drag results
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrikBuetler committed Jun 24, 2024
1 parent ab406c9 commit d312183
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions api/ui/Rearranger.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
class Rearranger {
public function seekAndSwap($array, $goal, $direction) {
if (gettype($array) == 'array') {
foreach ($array as $element) {
foreach ($array as $goalkey => $element) {
$found = $this->searchInside($$element, $goal);
if ($found) {
$temparray = $element;
$found = false;
$tempkey = $goalkey;
echo "Element found inside this array:\n";
print_r($element, false);
echo "\nInitiating swap.. \n";
echo "\nInitiating swap.. Key: " . $goalkey . "\n";
break;
}
else {
Expand All @@ -42,8 +42,8 @@ public function seekAndSwap($array, $goal, $direction) {
}
}
}
if(isset($temparray)) {
return $this->swap($temparray, $goal, $goalkey, $direction);
if(isset($temparray) && isset($tempkey)) {
return $this->swap($temparray, $goal, $tempkey, $direction);
}
}
return $array;
Expand Down

0 comments on commit d312183

Please sign in to comment.