Player
class Player extends AvatarModel implements NamedModel, DuplexUrlInterface
A league player
Constants
DEVELOPER |
These are built-in roles that cannot be deleted via the web interface so we will be storing these values as constant variables. Hopefully, a user won't be silly enough to delete them manually from the database. |
ADMIN |
|
COP |
|
REFEREE |
|
S_ADMIN |
|
PLAYER |
|
PLAYER_NO_PM |
|
TABLE |
The name of the database table used for queries |
AVATAR_LOCATION |
The location where avatars will be stored |
EDIT_PERMISSION |
|
SOFT_DELETE_PERMISSION |
|
HARD_DELETE_PERMISSION |
|
Methods
Get the notes admins have left about a player
Get the player's BZID
Get the country a player belongs to
Get the e-mail address of the player
Returns whether the player has verified their e-mail address
Returns the confirmation code for the player's e-mail address verification
Returns what kind of events the player should be e-mailed about
Finds out whether the specified player wants and can receive an e-mail message
Find out whether the specified confirmation code is correct
Get the player's sanitized description
Get the joined date of the player
Get all of the known IPs used by the player
Get the last login for a player
Get the last match
Get all of the callsigns a player has used to log in to the website
Get the player's timezone PHP identifier (example: "Europe/Paris")
Check if a player has a specific permission
Check whether or not a player been in a match or has logged on in the specified amount of time to be considered active
Check whether the callsign of the player is outdated
Check if a player's account has been disabled
Check if everyone can log in as this user on a test environment
Check if a player is teamless
Mark a player's account as banned
Mark a player's account as unbanned
Find out if a player is banned
Remove a player from a role
Set the player's email address and reset their verification status
Set whether the player has verified their e-mail address
Generate a new random confirmation token for e-mail address verification
Set what kind of events the player should be e-mailed about
Set whether the callsign of the player is outdated
Set the player's description
Set the player's timezone
Set the player's team
Set the match the player last participated in
Set the player's status
Set the player's admin notes
Set the player's country
Updates this player's last login
Get the player's username
Get the player's username, safe for use in your HTML
Alias for Player::setUsername()
Mark all the unread messages of a player as read
Given a player's BZID, get a player object
Get a single player by their username
Get all the players in the database that have an active status
Show the number of notifications the user hasn't read yet
Count the number of matches a player has participated in
Get the (victory/total matches) ratio of the player
Get the (total caps made by team/total matches) ratio of the player
Get the match activity in matches per day for a player
Show the number of messages the user hasn't read yet
Get all of the members belonging to a team
Get the possible statuses representing an active model (visible to everyone)
Get the MySQL columns that will be loaded as soon as the model is created
{@inheritdoc}
Get a query builder for players
Enter a new player to the database
Determine if a player exists in the database
Change a player's callsign and add it to the database if it does not exist as a past callsign
Alphabetical order function for use in usort (case-insensitive)
Permanently delete the object from the database
Find whether the player can delete a model
Find whether the player can create a model
Details
at line line 203
bool
addRole(Role|int $role_id)
Add a player a new role
at line line 228
string
getAdminNotes()
Get the notes admins have left about a player
at line line 239
int
getBZID()
Get the player's BZID
at line line 249
Country
getCountry()
Get the country a player belongs to
at line line 259
string
getEmailAddress()
Get the e-mail address of the player
at line line 271
bool
isVerified()
Returns whether the player has verified their e-mail address
at line line 283
string
getConfirmCode()
Returns the confirmation code for the player's e-mail address verification
at line line 295
string
getReceives()
Returns what kind of events the player should be e-mailed about
at line line 309
bool
canReceive(string $type)
Finds out whether the specified player wants and can receive an e-mail message
at line line 333
bool
isCorrectConfirmCode(string $code)
Find out whether the specified confirmation code is correct
This method protects against timing attacks
at line line 348
string
getDescription()
Get the player's sanitized description
at line line 359
TimeDate
getJoinedDate()
Get the joined date of the player
at line line 371
string[][]
getKnownIPs()
Get all of the known IPs used by the player
at line line 380
TimeDate
getLastLogin()
Get the last login for a player
at line line 391
Match
getLastMatch()
Get the last match
at line line 402
string[]
getPastCallsigns()
Get all of the callsigns a player has used to log in to the website
at line line 411
Team
getTeam()
Get the player's team
at line line 420
string
getTimezone()
Get the player's timezone PHP identifier (example: "Europe/Paris")
at line line 431
Role[]
getRoles()
Get the roles of the player
at line line 458
bool
hasPermission(string|null $permission)
Check if a player has a specific permission
at line line 475
bool
hasBeenActive()
Check whether or not a player been in a match or has logged on in the specified amount of time to be considered active
at line line 500
bool
isOutdated()
Check whether the callsign of the player is outdated
Returns true if this player has probably changed their callsign, making the current username stored in the database obsolete
at line line 512
bool
isDisabled()
Check if a player's account has been disabled
at line line 522
bool
isTestUser()
Check if everyone can log in as this user on a test environment
at line line 532
bool
isTeamless()
Check if a player is teamless
at line line 540
markAsBanned()
Mark a player's account as banned
at line line 552
markAsUnbanned()
Mark a player's account as unbanned
at line line 566
bool
isBanned()
Find out if a player is banned
at line line 579
Ban|null
getBan()
Get the ban of the player
This method performs a load of all the lazy parameters of the Player
at line line 593
bool
removeRole(int $role_id)
Remove a player from a role
at line line 605
setEmailAddress(string $email)
Set the player's email address and reset their verification status
at line line 626
Player
setVerified(bool $verified)
Set whether the player has verified their e-mail address
at line line 642
Player
generateNewConfirmCode()
Generate a new random confirmation token for e-mail address verification
at line line 669
Player
setReceives(string $receives)
Set what kind of events the player should be e-mailed about
at line line 682
Player
setOutdated(bool $outdated)
Set whether the callsign of the player is outdated
at line line 693
setDescription(string $description)
Set the player's description
at line line 702
setTimezone(string $timezone)
Set the player's timezone
at line line 711
setTeam(int $team)
Set the player's team
at line line 721
setLastMatch(int $match)
Set the match the player last participated in
at line line 730
setStatus(string $status)
Set the player's status
at line line 740
Player
setAdminNotes(string $admin_notes)
Set the player's admin notes
at line line 750
Player
setCountry(int $country)
Set the player's country
at line line 758
updateLastLogin()
Updates this player's last login
at line line 767
string
getUsername()
Get the player's username
at line line 776
string
getEscapedUsername()
Get the player's username, safe for use in your HTML
at line line 787
AliasModel
setName(string $username)
Alias for Player::setUsername()
at line line 797
void
markMessagesAsRead()
Mark all the unread messages of a player as read
at line line 869
static Player
getFromBZID(int $bzid)
Given a player's BZID, get a player object
at line line 880
static Player
getFromUsername(string $username)
Get a single player by their username
at line line 891
static Player[]
getPlayers()
Get all the players in the database that have an active status
at line line 902
int
countUnreadNotifications()
Show the number of notifications the user hasn't read yet
at line line 911
int
getMatchCount()
Count the number of matches a player has participated in
at line line 927
float
getMatchWinRatio()
Get the (victory/total matches) ratio of the player
at line line 947
float
getMatchAverageCaps()
Get the (total caps made by team/total matches) ratio of the player
at line line 977
float
getMatchActivity()
Get the match activity in matches per day for a player
at line line 998
int
countUnreadMessages()
Show the number of messages the user hasn't read yet
at line line 1010
static Player[]
getTeamMembers(int $teamID)
Get all of the members belonging to a team
at line line 1020
static string[]
getActiveStatuses()
Get the possible statuses representing an active model (visible to everyone)
at line line 1028
static string
getEagerColumns()
Get the MySQL columns that will be loaded as soon as the model is created
at line line 1036
static
getLazyColumns()
{@inheritdoc}
at line line 1045
static QueryBuilder
getQueryBuilder()
Get a query builder for players
at line line 1073
static Player
newPlayer(int $bzid, string $username, int $team = null, string $status = 'active', int $role_id = self::PLAYER, string $avatar = '', string $description = '', int $country = 1, string $timezone = null, string|TimeDate $joined = 'now', string|TimeDate $last_login = 'now')
Enter a new player to the database
at line line 1105
static bool
playerBZIDExists(int $bzid)
Determine if a player exists in the database
at line line 1117
Player
setUsername(string $username)
Change a player's callsign and add it to the database if it does not exist as a past callsign
at line line 1153
static Closure
getAlphabeticalSort()
Alphabetical order function for use in usort (case-insensitive)
at line line 1164
void
wipe()
Permanently delete the object from the database
at line line 1178
bool
canSee(PermissionModel $model, bool $showDeleted = false)
Find whether the player can delete a model
at line line 1191
bool
canDelete(PermissionModel $model, bool $hard = false)
Find whether the player can delete a model
at line line 1206
bool
canCreate(string $modelName)
Find whether the player can create a model
at line line 1217
bool
canEdit(PermissionModel $model)
Find whether the player can edit a model