public function move_item_up_down($direction, $id) {
        $peers = $this->get_items_peers($id);
        $itemkey = array_search($id, $peers);
        switch ($direction) {
            case 'down' :
                if (isset($peers[$itemkey+1])) {
                    $olditem = $peers[$itemkey+1];
                    $peers[$itemkey+1] = $id;
                    $peers[$itemkey] = $olditem;
                } else {
                    print_error('listcantmoveup');
                }
                break;

            case 'up' :
                if (isset($peers[$itemkey-1])) {
                    $olditem = $peers[$itemkey-1];
                    $peers[$itemkey-1] = $id;
                    $peers[$itemkey] = $olditem;
                } else {
                    print_error('listcantmovedown');
                }
                break;
        }
        $this->reorder_peers($peers);
    }
public function move_item_up_down($direction, $id) {
        $peers = $this->get_items_peers($id);
        $itemkey = array_search($id, $peers);
        switch ($direction) {
            case 'down' :
                if (isset($peers[$itemkey+1])) {
                    $olditem = $peers[$itemkey+1];
                    $peers[$itemkey+1] = $id;
                    $peers[$itemkey] = $olditem;
                } else {
                    print_error('listcantmoveup');
                }
                break;

            case 'up' :
                if (isset($peers[$itemkey-1])) {
                    $olditem = $peers[$itemkey-1];
                    $peers[$itemkey-1] = $id;
                    $peers[$itemkey] = $olditem;
                } else {
                    print_error('listcantmovedown');
                }
                break;
        }
        $this->reorder_peers($peers);
    }
public function move_item_up_down ( $ direction , $ id ) { $ peers = $ this -> get_items_peers ( $ id ) ; $ itemkey = array_search ( $ id , $ peers ) ; switch ( $ direction ) { case 'down' : if ( isset ( $ peers [ $ itemkey + 1 ] ) ) { $ olditem = $ peers [ $ itemkey + 1 ] ; $ peers [ $ itemkey + 1 ] = $ id ; $ peers [ $ itemkey ] = $ olditem ; } else { print_error ( 'listcantmoveup' ) ; } break ; case 'up' : if ( isset ( $ peers [ $ itemkey - 1 ] ) ) { $ olditem = $ peers [ $ itemkey - 1 ] ; $ peers [ $ itemkey - 1 ] = $ id ; $ peers [ $ itemkey ] = $ olditem ; } else { print_error ( 'listcantmovedown' ) ; } break ; } $ this -> reorder_peers ( $ peers ) ; }
Move a record up or down

@param string $direction up / down
@param integer $id
Move a record up or down