original_string: protected function status($versionid, $row) {
          $onbehalf = false;
          $versions = $versionid ? [$versionid => $this->versionids[$versionid]] : $this->versionids; // List of versions.
          $accepted = []; // List of versionids that user has accepted.
          $declined = [];
  
          foreach ($versions as $v => $name) {
              if ($row->{'status' . $v} !== null) {
                  if (empty($row->{'status' . $v})) {
                      $declined[] = $v;
                  } else {
                      $accepted[] = $v;
                  }
                  $agreedby = $row->{'usermodified' . $v};
                  if ($agreedby && $agreedby != $row->id) {
                      $onbehalf = true;
                  }
              }
          }
  
          $ua = new user_agreement($row->id, $accepted, $declined, $this->get_return_url(), $versions, $onbehalf, $row->canaccept);
  
          if ($this->is_downloading()) {
              return $ua->export_for_download();
  
          } else {
              return $this->output->render($ua);
          }
      }
code: protected function status($versionid, $row) {
          $onbehalf = false;
          $versions = $versionid ? [$versionid => $this->versionids[$versionid]] : $this->versionids; // List of versions.
          $accepted = []; // List of versionids that user has accepted.
          $declined = [];
  
          foreach ($versions as $v => $name) {
              if ($row->{'status' . $v} !== null) {
                  if (empty($row->{'status' . $v})) {
                      $declined[] = $v;
                  } else {
                      $accepted[] = $v;
                  }
                  $agreedby = $row->{'usermodified' . $v};
                  if ($agreedby && $agreedby != $row->id) {
                      $onbehalf = true;
                  }
              }
          }
  
          $ua = new user_agreement($row->id, $accepted, $declined, $this->get_return_url(), $versions, $onbehalf, $row->canaccept);
  
          if ($this->is_downloading()) {
              return $ua->export_for_download();
  
          } else {
              return $this->output->render($ua);
          }
      }
code_tokens: protected function status ( $ versionid , $ row ) { $ onbehalf = false ; $ versions = $ versionid ? [ $ versionid => $ this -> versionids [ $ versionid ] ] : $ this -> versionids ; // List of versions. $ accepted = [ ] ; // List of versionids that user has accepted. $ declined = [ ] ; foreach ( $ versions as $ v => $ name ) { if ( $ row -> { 'status' . $ v } !== null ) { if ( empty ( $ row -> { 'status' . $ v } ) ) { $ declined [ ] = $ v ; } else { $ accepted [ ] = $ v ; } $ agreedby = $ row -> { 'usermodified' . $ v } ; if ( $ agreedby && $ agreedby != $ row -> id ) { $ onbehalf = true ; } } } $ ua = new user_agreement ( $ row -> id , $ accepted , $ declined , $ this -> get_return_url ( ) , $ versions , $ onbehalf , $ row -> canaccept ) ; if ( $ this -> is_downloading ( ) ) { return $ ua -> export_for_download ( ) ; } else { return $ this -> output -> render ( $ ua ) ; } }
docstring: Return agreement status
  
  @param int $versionid either id of an individual version or empty for overall status
  @param stdClass $row
  @return string
docstring_tokens: Return agreement status