|
|
|
|
|
|
|
|
$favoritePointSale = User::getCurrent()->getFavoritePointSale() ; |
|
|
$favoritePointSale = User::getCurrent()->getFavoritePointSale() ; |
|
|
|
|
|
|
|
|
if($favoritePointSale) { |
|
|
if($favoritePointSale) { |
|
|
foreach($pointsSaleArray as $key => $pointSale) { |
|
|
|
|
|
if($pointSale['id'] == $favoritePointSale->id) { |
|
|
|
|
|
unset($pointsSaleArray[$key]) ; |
|
|
|
|
|
array_unshift($pointsSaleArray, $pointSale) ; |
|
|
|
|
|
|
|
|
for( $i = 0; $i < count($pointsSaleArray) ; $i++) { |
|
|
|
|
|
if($pointsSaleArray[$i]['id'] == $favoritePointSale->id) { |
|
|
|
|
|
$theFavoritePointSale = $pointsSaleArray[$i] ; |
|
|
|
|
|
unset($pointsSaleArray[$i]) ; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(isset($theFavoritePointSale)) { |
|
|
|
|
|
$pointsSaleArray = array_reverse($pointsSaleArray, false) ; |
|
|
|
|
|
$pointsSaleArray[] = $theFavoritePointSale ; |
|
|
|
|
|
$pointsSaleArray = array_reverse($pointsSaleArray, false) ; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$json['points_sale'] = $pointsSaleArray ; |
|
|
$json['points_sale'] = $pointsSaleArray ; |