original_string: 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);
      }
code: 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);
      }
code_tokens: 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 ) ; }
docstring: Move a record up or down
  
  @param string $direction up / down
  @param integer $id
docstring_tokens: Move a record up or down