protected static function _move_tour(tour $tour, $direction) {
        $currentsortorder   = $tour->get_sortorder();
        $targetsortorder    = $currentsortorder + $direction;

        $swapwith = helper::get_tour_from_sortorder($targetsortorder);

        // Set the sort order to something out of the way.
        $tour->set_sortorder(-1);
        $tour->persist();

        // Swap the two sort orders.
        $swapwith->set_sortorder($currentsortorder);
        $swapwith->persist();

        $tour->set_sortorder($targetsortorder);
        $tour->persist();
    }
protected static function _move_tour(tour $tour, $direction) {
        $currentsortorder   = $tour->get_sortorder();
        $targetsortorder    = $currentsortorder + $direction;

        $swapwith = helper::get_tour_from_sortorder($targetsortorder);

        // Set the sort order to something out of the way.
        $tour->set_sortorder(-1);
        $tour->persist();

        // Swap the two sort orders.
        $swapwith->set_sortorder($currentsortorder);
        $swapwith->persist();

        $tour->set_sortorder($targetsortorder);
        $tour->persist();
    }
protected static function _move_tour ( tour $ tour , $ direction ) { $ currentsortorder = $ tour -> get_sortorder ( ) ; $ targetsortorder = $ currentsortorder + $ direction ; $ swapwith = helper :: get_tour_from_sortorder ( $ targetsortorder ) ; // Set the sort order to something out of the way. $ tour -> set_sortorder ( - 1 ) ; $ tour -> persist ( ) ; // Swap the two sort orders. $ swapwith -> set_sortorder ( $ currentsortorder ) ; $ swapwith -> persist ( ) ; $ tour -> set_sortorder ( $ targetsortorder ) ; $ tour -> persist ( ) ; }
Move a tour up or down.

@param   tour    $tour   The tour to move.

@param   int     $direction
Move a tour up or down .