original_string: public static function move_up_issuer($id) {
          require_capability('moodle/site:config', context_system::instance());
          $current = new issuer($id);
  
          $sortorder = $current->get('sortorder');
          if ($sortorder == 0) {
              return false;
          }
  
          $sortorder = $sortorder - 1;
          $current->set('sortorder', $sortorder);
  
          $filters = array('sortorder' => $sortorder);
          $children = issuer::get_records($filters, 'id');
          foreach ($children as $needtoswap) {
              $needtoswap->set('sortorder', $sortorder + 1);
              $needtoswap->update();
          }
  
          // OK - all set.
          $result = $current->update();
  
          return $result;
      }
code: public static function move_up_issuer($id) {
          require_capability('moodle/site:config', context_system::instance());
          $current = new issuer($id);
  
          $sortorder = $current->get('sortorder');
          if ($sortorder == 0) {
              return false;
          }
  
          $sortorder = $sortorder - 1;
          $current->set('sortorder', $sortorder);
  
          $filters = array('sortorder' => $sortorder);
          $children = issuer::get_records($filters, 'id');
          foreach ($children as $needtoswap) {
              $needtoswap->set('sortorder', $sortorder + 1);
              $needtoswap->update();
          }
  
          // OK - all set.
          $result = $current->update();
  
          return $result;
      }
code_tokens: public static function move_up_issuer ( $ id ) { require_capability ( 'moodle/site:config' , context_system :: instance ( ) ) ; $ current = new issuer ( $ id ) ; $ sortorder = $ current -> get ( 'sortorder' ) ; if ( $ sortorder == 0 ) { return false ; } $ sortorder = $ sortorder - 1 ; $ current -> set ( 'sortorder' , $ sortorder ) ; $ filters = array ( 'sortorder' => $ sortorder ) ; $ children = issuer :: get_records ( $ filters , 'id' ) ; foreach ( $ children as $ needtoswap ) { $ needtoswap -> set ( 'sortorder' , $ sortorder + 1 ) ; $ needtoswap -> update ( ) ; } // OK - all set. $ result = $ current -> update ( ) ; return $ result ; }
docstring: Reorder this identity issuer.
  
  Requires moodle/site:config capability at the system context.
  
  @param int $id The id of the identity issuer to move.
  @return boolean
docstring_tokens: Reorder this identity issuer .