original_string: public static function transform_standard_log_record_for_userid($record, $userid) {
  
          // Restore the event to try to get the name, description and other field.
          $restoredevent = static::restore_event_from_standard_record($record);
          if ($restoredevent) {
              $name = $restoredevent->get_name();
              $description = $restoredevent->get_description();
              $other = $restoredevent->other;
  
          } else {
              $name = $record->eventname;
              $description = "Unknown event ({$name})";
              $other = \tool_log\helper\reader::decode_other($record->other);
          }
  
          $realuserid = $record->realuserid;
          $isauthor = $record->userid == $userid;
          $isrelated = $record->relateduserid == $userid;
          $isrealuser = $realuserid == $userid;
          $ismasqueraded = $realuserid !== null && $record->userid != $realuserid;
          $ismasquerading = $isrealuser && !$isauthor;
          $isanonymous = $record->anonymous;
  
          $data = [
              'name' => $name,
              'description' => $description,
              'timecreated' => transform::datetime($record->timecreated),
              'origin' => static::transform_origin($record->origin),
              'ip' => $isauthor ? $record->ip : '',
              'other' => $other ? $other : []
          ];
  
          if ($isanonymous) {
              $data['action_was_done_anonymously'] = transform::yesno($isanonymous);
          }
          if ($isauthor || !$isanonymous) {
              $data['authorid'] = transform::user($record->userid);
              $data['author_of_the_action_was_you'] = transform::yesno($isauthor);
          }
  
          if ($record->relateduserid) {
              $data['relateduserid'] = transform::user($record->relateduserid);
              $data['related_user_was_you'] = transform::yesno($isrelated);
          }
  
          if ($ismasqueraded) {
              $data['author_of_the_action_was_masqueraded'] = transform::yesno(true);
              if ($ismasquerading || !$isanonymous) {
                  $data['masqueradinguserid'] = transform::user($realuserid);
                  $data['masquerading_user_was_you'] = transform::yesno($ismasquerading);
              }
          }
  
          return $data;
      }
code: public static function transform_standard_log_record_for_userid($record, $userid) {
  
          // Restore the event to try to get the name, description and other field.
          $restoredevent = static::restore_event_from_standard_record($record);
          if ($restoredevent) {
              $name = $restoredevent->get_name();
              $description = $restoredevent->get_description();
              $other = $restoredevent->other;
  
          } else {
              $name = $record->eventname;
              $description = "Unknown event ({$name})";
              $other = \tool_log\helper\reader::decode_other($record->other);
          }
  
          $realuserid = $record->realuserid;
          $isauthor = $record->userid == $userid;
          $isrelated = $record->relateduserid == $userid;
          $isrealuser = $realuserid == $userid;
          $ismasqueraded = $realuserid !== null && $record->userid != $realuserid;
          $ismasquerading = $isrealuser && !$isauthor;
          $isanonymous = $record->anonymous;
  
          $data = [
              'name' => $name,
              'description' => $description,
              'timecreated' => transform::datetime($record->timecreated),
              'origin' => static::transform_origin($record->origin),
              'ip' => $isauthor ? $record->ip : '',
              'other' => $other ? $other : []
          ];
  
          if ($isanonymous) {
              $data['action_was_done_anonymously'] = transform::yesno($isanonymous);
          }
          if ($isauthor || !$isanonymous) {
              $data['authorid'] = transform::user($record->userid);
              $data['author_of_the_action_was_you'] = transform::yesno($isauthor);
          }
  
          if ($record->relateduserid) {
              $data['relateduserid'] = transform::user($record->relateduserid);
              $data['related_user_was_you'] = transform::yesno($isrelated);
          }
  
          if ($ismasqueraded) {
              $data['author_of_the_action_was_masqueraded'] = transform::yesno(true);
              if ($ismasquerading || !$isanonymous) {
                  $data['masqueradinguserid'] = transform::user($realuserid);
                  $data['masquerading_user_was_you'] = transform::yesno($ismasquerading);
              }
          }
  
          return $data;
      }
code_tokens: public static function transform_standard_log_record_for_userid ( $ record , $ userid ) { // Restore the event to try to get the name, description and other field. $ restoredevent = static :: restore_event_from_standard_record ( $ record ) ; if ( $ restoredevent ) { $ name = $ restoredevent -> get_name ( ) ; $ description = $ restoredevent -> get_description ( ) ; $ other = $ restoredevent -> other ; } else { $ name = $ record -> eventname ; $ description = "Unknown event ({$name})" ; $ other = \ tool_log \ helper \ reader :: decode_other ( $ record -> other ) ; } $ realuserid = $ record -> realuserid ; $ isauthor = $ record -> userid == $ userid ; $ isrelated = $ record -> relateduserid == $ userid ; $ isrealuser = $ realuserid == $ userid ; $ ismasqueraded = $ realuserid !== null && $ record -> userid != $ realuserid ; $ ismasquerading = $ isrealuser && ! $ isauthor ; $ isanonymous = $ record -> anonymous ; $ data = [ 'name' => $ name , 'description' => $ description , 'timecreated' => transform :: datetime ( $ record -> timecreated ) , 'origin' => static :: transform_origin ( $ record -> origin ) , 'ip' => $ isauthor ? $ record -> ip : '' , 'other' => $ other ? $ other : [ ] ] ; if ( $ isanonymous ) { $ data [ 'action_was_done_anonymously' ] = transform :: yesno ( $ isanonymous ) ; } if ( $ isauthor || ! $ isanonymous ) { $ data [ 'authorid' ] = transform :: user ( $ record -> userid ) ; $ data [ 'author_of_the_action_was_you' ] = transform :: yesno ( $ isauthor ) ; } if ( $ record -> relateduserid ) { $ data [ 'relateduserid' ] = transform :: user ( $ record -> relateduserid ) ; $ data [ 'related_user_was_you' ] = transform :: yesno ( $ isrelated ) ; } if ( $ ismasqueraded ) { $ data [ 'author_of_the_action_was_masqueraded' ] = transform :: yesno ( true ) ; if ( $ ismasquerading || ! $ isanonymous ) { $ data [ 'masqueradinguserid' ] = transform :: user ( $ realuserid ) ; $ data [ 'masquerading_user_was_you' ] = transform :: yesno ( $ ismasquerading ) ; } } return $ data ; }
docstring: Transform a standard log record for a user.
  
  @param object $record The record.
  @param int $userid The user ID.
  @return array
docstring_tokens: Transform a standard log record for a user .