Backend\Core\Engine\DataGridFunctions::getUser PHP Method

getUser() public static method

Get the HTML for a user to use in a datagrid
public static getUser ( integer $id ) : string
$id integer The Id of the user.
return string
    public static function getUser($id)
    {
        $id = (int) $id;
        // nothing in cache
        if (!isset(self::$dataGridUsers[$id])) {
            // create user instance
            $user = new User($id);
            // get settings
            $avatar = $user->getSetting('avatar', 'no-avatar.gif');
            $nickname = $user->getSetting('nickname');
            $allowed = Authentication::isAllowedAction('Edit', 'Users');
            // build html
            $html = '<div class="fork-data-grid-avatar">' . "\n";
            if ($allowed) {
                $html .= '     <a href="' . BackendModel::createURLForAction('Edit', 'Users') . '&amp;id=' . $id . '">' . "\n";
            }
            $html .= '          <img class="img-circle" src="' . FRONTEND_FILES_URL . '/backend_users/avatars/32x32/' . $avatar . '" width="24" height="24" alt="' . $nickname . '" />' . "\n";
            $html .= '<span>' . $nickname . '</span>';
            if ($allowed) {
                $html .= '</a>' . "\n";
            }
            $html .= '  </div>';
            self::$dataGridUsers[$id] = $html;
        }
        return self::$dataGridUsers[$id];
    }