UsersLibrary
extends Model
in package
UsersLibrary Class
Table of Contents
- $db : Database
- Contains the Database instance
- __construct() : mixed
- Constructor
- __destruct() : mixed
- Destructor
- changeUserPlanetByUserId() : void
- Change the user current planet
- createNewUser() : int
- Insert a new user and return their ID
- createPremium() : void
- Create premium record
- createResearch() : void
- Create research record
- createSettings() : void
- Create settings record
- createUserStatistics() : void
- Create statistics record
- deleteAllianceById() : void
- Delete alliance
- deleteBuddysByUserId() : void
- Delete the planet and its related data like buildings, defenses and ships.
- deleteMessagesByUserId() : void
- Delete the planet and its related data like buildings, defenses and ships.
- deletePlanetsAndRelatedDataByUserId() : void
- Delete the planet and its related data like buildings, defenses and ships.
- deleteUserDataById() : void
- Delete the planet and its related data like buildings, defenses and ships.
- getAllianceDataByAllianceId() : array<string|int, mixed>
- Get alliance data
- getAllyIdByUserId() : array<string|int, mixed>
- Get alliance ID
- getUserPlanetByIdAndUserId() : array<string|int, mixed>
- Validate if the requested planet belongs to the current user
- setPlanetData() : type
- Set the user current planet data
- setUserDataByUserId() : array<string|int, mixed>
- Get the user data by user name
- updateAllianceOwner() : type
- Update the alliance owner
- updateUserActivityData() : void
- Update some data
- setNewDb() : void
- Creates a new Database object
Properties
$db
Contains the Database instance
protected
Database
$db
Methods
__construct()
Constructor
public
__construct() : mixed
Return values
mixed —__destruct()
Destructor
public
__destruct() : mixed
Return values
mixed —changeUserPlanetByUserId()
Change the user current planet
public
changeUserPlanetByUserId(int $planet_id, int $user_id) : void
Parameters
- $planet_id : int
-
Planet ID
- $user_id : int
-
User ID
Return values
void —createNewUser()
Insert a new user and return their ID
public
createNewUser(string $insert_query) : int
Parameters
- $insert_query : string
-
Insert Query
Return values
int —createPremium()
Create premium record
public
createPremium(type $user_id) : void
Parameters
- $user_id : type
-
The user id
Return values
void —createResearch()
Create research record
public
createResearch(type $user_id) : void
Parameters
- $user_id : type
-
The user id
Return values
void —createSettings()
Create settings record
public
createSettings(type $user_id) : void
Parameters
- $user_id : type
-
The user id
Return values
void —createUserStatistics()
Create statistics record
public
createUserStatistics(type $user_id) : void
Parameters
- $user_id : type
-
The user id
Return values
void —deleteAllianceById()
Delete alliance
public
deleteAllianceById(int $alliance_id) : void
Parameters
- $alliance_id : int
-
Alliance ID
Return values
void —deleteBuddysByUserId()
Delete the planet and its related data like buildings, defenses and ships.
public
deleteBuddysByUserId(int $user_id) : void
Parameters
- $user_id : int
-
User ID
Return values
void —deleteMessagesByUserId()
Delete the planet and its related data like buildings, defenses and ships.
public
deleteMessagesByUserId(int $user_id) : void
Parameters
- $user_id : int
-
User ID
Return values
void —deletePlanetsAndRelatedDataByUserId()
Delete the planet and its related data like buildings, defenses and ships.
public
deletePlanetsAndRelatedDataByUserId(int $user_id) : void
Parameters
- $user_id : int
-
User ID
Return values
void —deleteUserDataById()
Delete the planet and its related data like buildings, defenses and ships.
public
deleteUserDataById(int $user_id) : void
Parameters
- $user_id : int
-
User ID
Return values
void —getAllianceDataByAllianceId()
Get alliance data
public
getAllianceDataByAllianceId(array<string|int, mixed> $alliance_id) : array<string|int, mixed>
Parameters
- $alliance_id : array<string|int, mixed>
-
Alliance ID
Return values
array<string|int, mixed> —getAllyIdByUserId()
Get alliance ID
public
getAllyIdByUserId(int $user_id) : array<string|int, mixed>
Parameters
- $user_id : int
-
User ID
Return values
array<string|int, mixed> —getUserPlanetByIdAndUserId()
Validate if the requested planet belongs to the current user
public
getUserPlanetByIdAndUserId(int $planet_id, int $user_id) : array<string|int, mixed>
Parameters
- $planet_id : int
-
Planet ID
- $user_id : int
-
User ID
Return values
array<string|int, mixed> —setPlanetData()
Set the user current planet data
public
setPlanetData(int $planet_id, int $admin_level) : type
Parameters
- $planet_id : int
-
Planet ID
- $admin_level : int
-
Admin Level
Return values
type —setUserDataByUserId()
Get the user data by user name
public
setUserDataByUserId(mixed $user_id) : array<string|int, mixed>
Parameters
- $user_id : mixed
Return values
array<string|int, mixed> —updateAllianceOwner()
Update the alliance owner
public
updateAllianceOwner(array<string|int, mixed> $alliance_id, int $user_rank) : type
Parameters
- $alliance_id : array<string|int, mixed>
-
Alliance ID
- $user_rank : int
-
Rank ID
Return values
type —updateUserActivityData()
Update some data
public
updateUserActivityData(string $request_uri, string $remote_addr, string $user_agent, int $user_id) : void
Parameters
- $request_uri : string
-
Requested URL
- $remote_addr : string
-
Remote IP Address
- $user_agent : string
-
User agent/browser
- $user_id : int
-
User ID
Return values
void —setNewDb()
Creates a new Database object
private
setNewDb() : void