protected function update_users_used() {
        global $DB;

        $this->userfullnames = array();
        $userids = array();

        // For each event cache full username.
        // Get list of userids which will be shown in log report.
        foreach ($this->rawdata as $event) {
            $logextra = $event->get_logextra();
            if (!empty($event->userid) && empty($userids[$event->userid])) {
                $userids[$event->userid] = $event->userid;
            }
            if (!empty($logextra['realuserid']) && empty($userids[$logextra['realuserid']])) {
                $userids[$logextra['realuserid']] = $logextra['realuserid'];
            }
            if (!empty($event->relateduserid) && empty($userids[$event->relateduserid])) {
                $userids[$event->relateduserid] = $event->relateduserid;
            }
        }
        $this->rawdata->close();

        // Get user fullname and put that in return list.
        if (!empty($userids)) {
            list($usql, $uparams) = $DB->get_in_or_equal($userids);
            $users = $DB->get_records_sql("SELECT id," . get_all_user_name_fields(true) . " FROM {user} WHERE id " . $usql,
                    $uparams);
            foreach ($users as $userid => $user) {
                $this->userfullnames[$userid] = fullname($user);
                unset($userids[$userid]);
            }

            // We fill the array with false values for the users that don't exist anymore
            // in the database so we don't need to query the db again later.
            foreach ($userids as $userid) {
                $this->userfullnames[$userid] = false;
            }
        }
    }
protected function update_users_used() {
        global $DB;

        $this->userfullnames = array();
        $userids = array();

        // For each event cache full username.
        // Get list of userids which will be shown in log report.
        foreach ($this->rawdata as $event) {
            $logextra = $event->get_logextra();
            if (!empty($event->userid) && empty($userids[$event->userid])) {
                $userids[$event->userid] = $event->userid;
            }
            if (!empty($logextra['realuserid']) && empty($userids[$logextra['realuserid']])) {
                $userids[$logextra['realuserid']] = $logextra['realuserid'];
            }
            if (!empty($event->relateduserid) && empty($userids[$event->relateduserid])) {
                $userids[$event->relateduserid] = $event->relateduserid;
            }
        }
        $this->rawdata->close();

        // Get user fullname and put that in return list.
        if (!empty($userids)) {
            list($usql, $uparams) = $DB->get_in_or_equal($userids);
            $users = $DB->get_records_sql("SELECT id," . get_all_user_name_fields(true) . " FROM {user} WHERE id " . $usql,
                    $uparams);
            foreach ($users as $userid => $user) {
                $this->userfullnames[$userid] = fullname($user);
                unset($userids[$userid]);
            }

            // We fill the array with false values for the users that don't exist anymore
            // in the database so we don't need to query the db again later.
            foreach ($userids as $userid) {
                $this->userfullnames[$userid] = false;
            }
        }
    }
protected function update_users_used ( ) { global $ DB ; $ this -> userfullnames = array ( ) ; $ userids = array ( ) ; // For each event cache full username. // Get list of userids which will be shown in log report. foreach ( $ this -> rawdata as $ event ) { $ logextra = $ event -> get_logextra ( ) ; if ( ! empty ( $ event -> userid ) && empty ( $ userids [ $ event -> userid ] ) ) { $ userids [ $ event -> userid ] = $ event -> userid ; } if ( ! empty ( $ logextra [ 'realuserid' ] ) && empty ( $ userids [ $ logextra [ 'realuserid' ] ] ) ) { $ userids [ $ logextra [ 'realuserid' ] ] = $ logextra [ 'realuserid' ] ; } if ( ! empty ( $ event -> relateduserid ) && empty ( $ userids [ $ event -> relateduserid ] ) ) { $ userids [ $ event -> relateduserid ] = $ event -> relateduserid ; } } $ this -> rawdata -> close ( ) ; // Get user fullname and put that in return list. if ( ! empty ( $ userids ) ) { list ( $ usql , $ uparams ) = $ DB -> get_in_or_equal ( $ userids ) ; $ users = $ DB -> get_records_sql ( "SELECT id," . get_all_user_name_fields ( true ) . " FROM {user} WHERE id " . $ usql , $ uparams ) ; foreach ( $ users as $ userid => $ user ) { $ this -> userfullnames [ $ userid ] = fullname ( $ user ) ; unset ( $ userids [ $ userid ] ) ; } // We fill the array with false values for the users that don't exist anymore // in the database so we don't need to query the db again later. foreach ( $ userids as $ userid ) { $ this -> userfullnames [ $ userid ] = false ; } } }
Helper function to create list of user fullnames shown in log report.

This will update $this->userfullnames array with userfullname,
which will be used to render logs in table.

@since   Moodle 2.9
@return  void
Helper function to create list of user fullnames shown in log report .