\hhu\z\modelsAchievementsModel

Model to interact with Achievements-tables.

Summary

Methods
Properties
Constants
__construct()
load()
factory()
getAchievementByUrl()
getAchievementById()
getUnachievedOnlyOnceAchievementsForSeminary()
getDeadlineAchievements()
getSeldomAchievements()
getAchievedAchievementsForCharacter()
getUnachhievedAchievementsForCharacter()
getAchievementsCountForSeminary()
getAchievementsForSeminary()
getCountRank()
getAchievementConditionsDate()
checkAchievementConditionDate()
addAchievementConditionDate()
editAchievementConditionDate()
deleteAchievementConditionDate()
getAchievementConditionsCharacter()
checkAchievementConditionCharacter()
getAchievementConditionCharacterProgress()
addAchievementConditionCharacter()
editAchievementConditionCharacter()
deleteAchievementConditionCharacter()
getAchievementConditionsQuest()
checkAchievementConditionQuest()
getAchievementConditionQuestProgress()
addAchievementConditionQuest()
editAchievementConditionQuest()
deleteAchievementConditionQuest()
getAchievementConditionsAchievement()
checkAchievementConditionAchievement()
getAchievementConditionAchievementProgress()
addAchievementConditionAchievement()
editAchievementConditionAchievement()
deleteAchievementConditionAchievement()
setAchievementAchieved()
hasCharacterAchievedAchievement()
getAchievementsConditions()
achievementTitleExists()
createAchievement()
moveAchievement()
editAchievement()
setUnachievedMediaForAchievement()
setAchievedMediaForAchievement()
deleteAchievement()
No public properties found
No constants found
No protected methods found
$db
N/A
loadDriver()
connect()
getClassName()
loadModels()
No private properties found
N/A

Properties

$db

$db : \nre\models\DatabaseDriver

Database connection

Type

\nre\models\DatabaseDriver

Methods

__construct()

__construct() 

Construct a new AchievementsModel.

TODO Catch exception

load()

load(string  $modelName) 

Load the class of a Model.

Parameters

string $modelName

Name of the Model to load

Throws

\nre\exceptions\ModelNotFoundException
\nre\exceptions\ModelNotValidException

factory()

factory(string  $modelName) 

Instantiate a Model (Factory Pattern).

Parameters

string $modelName

Name of the Model to instantiate

getAchievementByUrl()

getAchievementByUrl(integer  $seminaryId, string  $achievementUrl) : array

Get an Achievement by its URL.

Parameters

integer $seminaryId

ID of Seminary

string $achievementUrl

URL-title of Achievement

Returns

array —

Achievement data

getAchievementById()

getAchievementById(integer  $achievementId) : array

Get an Achievement by its ID.

Parameters

integer $achievementId

ID of Achievement

Returns

array —

Achievement data

getUnachievedOnlyOnceAchievementsForSeminary()

getUnachievedOnlyOnceAchievementsForSeminary(integer  $seminaryId) : array

Get all not yet achieved Achievements for a Seminary that can only be achieved once (only by one Character).

Parameters

integer $seminaryId

ID of Seminary

Returns

array —

Achievements data

getDeadlineAchievements()

getDeadlineAchievements(integer  $seminaryId) : array

Get all Achievements that have a deadline.

Parameters

integer $seminaryId

ID of Seminary

Returns

array —

Achievements data

getSeldomAchievements()

getSeldomAchievements(integer  $seminaryId, integer  $count, boolean  $alsoWithDeadline = true) : array

Get seldom Achievements.

Parameters

integer $seminaryId

ID of Seminary

integer $count

Number of Achievements to retrieve

boolean $alsoWithDeadline

Include Achievements with deadline (optional)

Returns

array —

List of seldom Achievements

getAchievedAchievementsForCharacter()

getAchievedAchievementsForCharacter(integer  $characterId, boolean  $alsoWithDeadline = true) : array

Get all achieved Achievements for a Character.

Parameters

integer $characterId

ID of Character

boolean $alsoWithDeadline

Include Achievements with deadline (optional)

Returns

array —

Achievements data

getUnachhievedAchievementsForCharacter()

getUnachhievedAchievementsForCharacter(integer  $seminaryId, integer  $characterId, boolean  $includeOnlyOnce = false, boolean  $alsoWithDeadline = true) : array

Get all not yet achieved Achievements for a Character.

Parameters

integer $seminaryId

ID of Seminary

integer $characterId

ID of Character

boolean $includeOnlyOnce

Include Achievements that can only be achieved by one Character

boolean $alsoWithDeadline

Include milestone Achievements

Returns

array —

Achievements data

getAchievementsCountForSeminary()

getAchievementsCountForSeminary(integer  $seminaryId, boolean  $includeOnlyOnce = false, boolean  $alsoWithDeadline = true) : integer

Get the amount of Achievement for a Seminary.

Parameters

integer $seminaryId

ID of Seminary

boolean $includeOnlyOnce

Include Achievements that can only be achieved by one Character

boolean $alsoWithDeadline

Include milestone Achievements

Returns

integer —

Count of Achievements

getAchievementsForSeminary()

getAchievementsForSeminary(integer  $seminaryId) : array

Get all Achievements for a Seminary.

Parameters

integer $seminaryId

ID of Seminary

Returns

array —

List of Achievements

getCountRank()

getCountRank(integer  $seminaryId,   $count) : integer

Get the rank for the number of achieved Achievements.

Parameters

integer $seminaryId

ID of Seminary

$count

Returns

integer —

Rank of Achievements count

getAchievementConditionsDate()

getAchievementConditionsDate(integer  $achievementId) : array

Get all date conditions for an Achievement.

Parameters

integer $achievementId

ID of Achievement

Returns

array —

Date conditions

checkAchievementConditionDate()

checkAchievementConditionDate(string  $select) : boolean

Check a date condition.

Parameters

string $select

SELECT-string with date-functions

Returns

boolean —

Result

addAchievementConditionDate()

addAchievementConditionDate(integer  $userId, integer  $achievementId, string  $select) 

Add a new date condition.

Parameters

integer $userId

ID of creating user

integer $achievementId

ID of Achievement to add condition to

string $select

SELECT-string for condition

editAchievementConditionDate()

editAchievementConditionDate(integer  $conditionId, string  $select) 

Edit a date condition.

Parameters

integer $conditionId

ID of condition to edit

string $select

New SELECT-string for condition

deleteAchievementConditionDate()

deleteAchievementConditionDate(integer  $conditionId) 

Delete a date condition.

Parameters

integer $conditionId

ID of condition to delete

getAchievementConditionsCharacter()

getAchievementConditionsCharacter(integer  $achievementId) : array

Get all Character conditions for an Achievement.

Parameters

integer $achievementId

ID of Achievement

Returns

array —

Character conditions

checkAchievementConditionCharacter()

checkAchievementConditionCharacter(string  $field, integer  $value, integer  $characterId) : boolean

Check a Character condition.

Parameters

string $field

Field to check

integer $value

The value the field has to match

integer $characterId

ID of Character

Returns

boolean —

Result

getAchievementConditionCharacterProgress()

getAchievementConditionCharacterProgress(string  $field, integer  $value, integer  $characterId) : float

Get the progress for a Character condition.

Parameters

string $field

Field to check

integer $value

The value the field has to match

integer $characterId

ID of Character

Returns

float —

Percentage progress

addAchievementConditionCharacter()

addAchievementConditionCharacter(integer  $userId, integer  $achievementId, string  $field, string  $value) 

Add a new Character condition.

Parameters

integer $userId

ID of creating user

integer $achievementId

ID of Achievement to add condition to

string $field

Field to match

string $value

Value to match

editAchievementConditionCharacter()

editAchievementConditionCharacter(integer  $conditionId, string  $field, string  $value) 

Edit a Character condition.

Parameters

integer $conditionId

ID of condition to edit

string $field

Field to match

string $value

Value to match

deleteAchievementConditionCharacter()

deleteAchievementConditionCharacter(integer  $conditionId) 

Delete a Character condition.

Parameters

integer $conditionId

ID of condition to delete

getAchievementConditionsQuest()

getAchievementConditionsQuest(integer  $achievementId) : array

Get all Quest conditions for an Achievement.

Parameters

integer $achievementId

ID of Achievement

Returns

array —

Quest conditions

checkAchievementConditionQuest()

checkAchievementConditionQuest(string  $field, boolean  $count, integer  $value, integer  $status, string  $groupby, integer  $questId, integer  $characterId) : boolean

Check a Quest condition.

Parameters

string $field

Field to check

boolean $count

Conut field-value

integer $value

The value the field has to match

integer $status

Status of Quest or NULL

string $groupby

Field to group or NULL

integer $questId

ID of related Quest or NULL

integer $characterId

ID of Character

Returns

boolean —

Result

getAchievementConditionQuestProgress()

getAchievementConditionQuestProgress(string  $field, boolean  $count, integer  $value, integer  $status, string  $groupby, integer  $questId, integer  $characterId) : float

Get the progress for a Quest condition.

Parameters

string $field

Field to check

boolean $count

Conut field-value

integer $value

The value the field has to match

integer $status

Status of Quest or NULL

string $groupby

Field to group or NULL

integer $questId

ID of related Quest or NULL

integer $characterId

ID of Character

Returns

float —

Percentage progress

addAchievementConditionQuest()

addAchievementConditionQuest(integer  $userId, integer  $achievementId, string  $field, boolean  $count, string  $value, integer  $questId = null, integer  $status = null, string  $groupby = null) 

Add a new Quest condition.

Parameters

integer $userId

ID of creating user

integer $achievementId

ID of Achievement to add condition to

string $field

Field to match

boolean $count

Count the value

string $value

Value to match

integer $questId

ID of Quest (optional)

integer $status

Quest status (optional)

string $groupby

Field to group by (optional)

editAchievementConditionQuest()

editAchievementConditionQuest(integer  $conditionId, string  $field, boolean  $count, string  $value, integer  $questId = null, integer  $status = null, string  $groupby = null) 

Edit a Quest condition.

Parameters

integer $conditionId

ID of condition to edit

string $field

Field to match

boolean $count

Count the value

string $value

Value to match

integer $questId

ID of Quest (optional)

integer $status

Quest status (optional)

string $groupby

Field to group by (optional)

deleteAchievementConditionQuest()

deleteAchievementConditionQuest(integer  $conditionId) 

Delete a Quest condition.

Parameters

integer $conditionId

ID of condition to delete

getAchievementConditionsAchievement()

getAchievementConditionsAchievement(integer  $achievementId) : array

Get all Metaachievement conditions for an Achievement.

Parameters

integer $achievementId

ID of Achievement

Returns

array —

Metaachievement conditions

checkAchievementConditionAchievement()

checkAchievementConditionAchievement(string  $field, boolean  $count, integer  $value, string  $groupby, integer  $metaAchievementId, integer  $characterId) : boolean

Check a Metaachievement condition.

Parameters

string $field

Field to check

boolean $count

Conut field-value

integer $value

The value the field has to match

string $groupby

Field to group or NULL

integer $metaAchievementId

ID of related Achievement or NULL

integer $characterId

ID of Character

Returns

boolean —

Result

getAchievementConditionAchievementProgress()

getAchievementConditionAchievementProgress(string  $field, boolean  $count, integer  $value, string  $groupby, integer  $metaAchievementId, integer  $characterId) : float

Get the progress for a Metaachievement condition.

Parameters

string $field

Field to check

boolean $count

Conut field-value

integer $value

The value the field has to match

string $groupby

Field to group or NULL

integer $metaAchievementId

ID of related Achievement or NULL

integer $characterId

ID of Character

Returns

float —

Percentage progress

addAchievementConditionAchievement()

addAchievementConditionAchievement(integer  $userId, integer  $achievementId, string  $field, boolean  $count, string  $value, integer  $metaAchievementId = null, string  $groupby = null) 

Add a new Achievement condition.

Parameters

integer $userId

ID of creating user

integer $achievementId

ID of Achievement to add condition to

string $field

Field to match

boolean $count

Count the value

string $value

Value to match

integer $metaAchievementId

ID of Meta-Achievement (optional)

string $groupby

Field to group by (optional)

editAchievementConditionAchievement()

editAchievementConditionAchievement(integer  $conditionId, string  $field, boolean  $count, string  $value, integer  $metaAchievementId = null, string  $groupby = null) 

Edit a Achievement condition.

Parameters

integer $conditionId

ID of condition to edit

string $field

Field to match

boolean $count

Count the value

string $value

Value to match

integer $metaAchievementId

ID of Achievement (optional)

string $groupby

Field to group by (optional)

deleteAchievementConditionAchievement()

deleteAchievementConditionAchievement(integer  $conditionId) 

Delete a Achievement condition.

Parameters

integer $conditionId

ID of condition to delete

setAchievementAchieved()

setAchievementAchieved(integer  $achievementId, integer  $characterId) 

Set an Achievement as achieved for a Character.

Parameters

integer $achievementId

ID of Achievement

integer $characterId

ID of Character

hasCharacterAchievedAchievement()

hasCharacterAchievedAchievement(integer  $achievementId, integer  $characterId) : boolean

Check if a Character has achieved an Achievement.

Parameters

integer $achievementId

ID of Achievement

integer $characterId

ID of Character

Returns

boolean —

Whether Character has achieved the Achievement or not

getAchievementsConditions()

getAchievementsConditions() : array

Get all existing Achievements conditions.

Returns

array —

List of Achievements conditions

achievementTitleExists()

achievementTitleExists(integer  $seminaryId, string  $title,   $achievementId = null) : boolean

Check if an Achievement title already exists.

Parameters

integer $seminaryId

ID of Seminary

string $title

Achievement title to check

$achievementId

Returns

boolean —

Whether Achievement title exists or not

createAchievement()

createAchievement(integer  $userId, integer  $seminaryId, integer  $conditionId, string  $title, string  $description, boolean  $progress, boolean  $hidden, boolean  $onlyOnce, boolean  $allConditions, string  $deadline) : integer

Create a new Achievement for a Seminary.

Parameters

integer $userId

ID of creating user

integer $seminaryId

ID of Seminary

integer $conditionId

ID of Achievement condition

string $title

Title of new Achievement

string $description

Description of new Achievement

boolean $progress

Show progress

boolean $hidden

Secret Achievement

boolean $onlyOnce

Only achieveable by one user

boolean $allConditions

Achievement must match all conditions

string $deadline

Deadline for Achievement

Returns

integer —

ID of newly created Achievement

moveAchievement()

moveAchievement(array  $achievement, boolean  $up) 

Move an Achievement up (decrement position) or down (increment position).

Parameters

array $achievement

Achievement to move

boolean $up

True for moving up, false for down

editAchievement()

editAchievement(integer  $achievementId, integer  $conditionId, string  $title, string  $description, boolean  $progress, boolean  $hidden, boolean  $onlyOnce, boolean  $allConditions, string  $deadline) 

Edit an Achievement of a Seminary.

Parameters

integer $achievementId

ID of Achievement to edit

integer $conditionId

ID of Achievement condition

string $title

New title of Achievement

string $description

New description of Achievement

boolean $progress

Show progress

boolean $hidden

Secret Achievement

boolean $onlyOnce

Only achieveable by one user

boolean $allConditions

Achievement must match all conditions

string $deadline

Deadline for Achievement

setUnachievedMediaForAchievement()

setUnachievedMediaForAchievement(integer  $achievementId, integer  $achievementsmediaId) 

Set unachieved media for an Achievement.

Parameters

integer $achievementId

ID of Achievement to set media for

integer $achievementsmediaId

ID of achievementsmedia to set

setAchievedMediaForAchievement()

setAchievedMediaForAchievement(integer  $achievementId, integer  $achievementsmediaId) 

Set achieved media for an Achievement.

Parameters

integer $achievementId

ID of Achievement to set media for

integer $achievementsmediaId

ID of achievementsmedia to set

deleteAchievement()

deleteAchievement(integer  $achievement) 

Delete an Achievement.

Parameters

integer $achievement

Achievement to delete

loadDriver()

loadDriver(string  $driverName) 

Load the database driver.

Parameters

string $driverName

Name of the database driver

Throws

\nre\exceptions\DriverNotFoundException
\nre\exceptions\DriverNotValidException

connect()

connect(string  $driverName, array  $config) 

Establish a connection to the database.

Parameters

string $driverName

Name of the database driver

array $config

Connection settings

Throws

\nre\exceptions\DatamodelException

getClassName()

getClassName(string  $modelName) : string

Determine the classname for the given Model name.

Parameters

string $modelName

Model name to get classname of

Returns

string —

Classname fore the Model name

loadModels()

loadModels() 

Load the Models of this Model.

Throws

\nre\exceptions\DatamodelException
\nre\exceptions\DriverNotFoundException
\nre\exceptions\DriverNotValidException
\nre\exceptions\ModelNotValidException
\nre\exceptions\ModelNotFoundException