POT
POT
POT
Main menu

Download

Forum

SVN

Class: OTS_GuildRank

Source Location: /classes/OTS_GuildRank.php

Class OTS_GuildRank

Class Overview

Implements interfaces:

  • IteratorAggregate (internal interface)
  • Countable (internal interface)

OTServ guild rank abstraction.

OTServ guild rank abstraction.

Located in /classes/OTS_GuildRank.php [line 28]

OTS_Base_DAO
   |
   --OTS_Row_DAO
      |
      --OTS_GuildRank
Author(s):
API Tags:
Property:  string $name: Rank title.
Property:  OTS_Guild $guild: Guild in which rank exists.
Property:  int $level: Guild access level.
Property-read:  bool $loaded: Loaded state check.
Property-read:  int $id: Row ID.
Property-read:  OTS_Players_List $playersList: List of members with this rank.

Information Tags:
Version:  0.1.4
Version:  0.0.4
Since:  0.0.4

Methods

[ Top ]
Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From OTS_Base_DAO

OTS_Base_DAO::$db

Inherited From OTS_Row_DAO

OTS_Row_DAO::__construct()
Handles automatic loading for record.
OTS_Row_DAO::find()
Loads row by it's name.
OTS_Row_DAO::load()
Loads row by it's ID.

Inherited From OTS_Base_DAO

OTS_Base_DAO::__construct()
Sets database connection handler.
OTS_Base_DAO::__clone()
Creates clone of object.
OTS_Base_DAO::__set_state()
Magic PHP5 method.
OTS_Base_DAO::__sleep()
Magic PHP5 method.
OTS_Base_DAO::__wakeup()
Magic PHP5 method.

[ Top ]
Method Summary
int   count()   Returns number of player within.
void   delete()   Deletes guild rank.
void   find()   Loads rank by it's name.
string   getCustomField()   Reads custom field.
OTS_Guild   getGuild()   Returns guild of this rank.
int   getId()   Rank ID.
Iterator   getIterator()   Returns players iterator.
int   getLevel()   Rank's access level.
string   getName()   Rank name.
array   getPlayers()  
OTS_Players_List   getPlayersList()   List of characters with current rank.
bool   isLoaded()   Checks if object is loaded.
void   load()   Loads rank with given id.
void   save()   Saves rank in database.
void   setCustomField()   Writes custom field.
void   setGuild()   Assigns rank to guild.
void   setLevel()   Sets rank's access level within guild.
void   setName()   Sets rank's name.
mixed   __get()   Magic PHP5 method.
void   __set()   Magic PHP5 method.
string   __toString()   Returns string representation of object.

[ Top ]
Methods
count  [line 406]

  int count( )

Returns number of player within.

Returns number of player within.


API Tags:
Return:  Count of players.
Access:  public

Information Tags:
Version:  0.0.5
Version:  0.0.4
Throws:  PDOException On PDO operation error.
Throws:  E_OTS_NotLoaded If rank is not loaded.
Since:  0.0.4
Since:  0.0.5

Implementation of:
Countable::count

[ Top ]
delete  [line 365]

  void delete( )

Deletes guild rank.

Deletes guild rank.


API Tags:
Access:  public

Information Tags:
Version:  0.0.5
Version:  0.0.4
Throws:  PDOException On PDO operation error.
Throws:  E_OTS_NotLoaded If guild rank is not loaded.
Since:  0.0.4
Since:  0.0.5

[ Top ]
find  [line 63]

  void find( string $name, [OTS_Guild $guild = null]  )

Loads rank by it's name.

Loads rank by it's name. As there can be several ranks with same name in different guilds you can pass optional second parameter to specify in which guild script should look for rank.

Parameters:
string   $name:  Rank's name.
OTS_Guild   $guild:  Guild in which rank should be found.

API Tags:
Access:  public

Information Tags:
Version:  0.0.5
Version:  0.0.4
Throws:  PDOException On PDO operation error.
Since:  0.0.4
Throws:  E_OTS_NotLoaded If given $guild object is not loaded.

Redefinition of:
OTS_Row_DAO::find()
Loads row by it's name.

[ Top ]
getCustomField  [line 249]

  string getCustomField( string $field  )

Reads custom field.

Reads custom field. Reads field by it's name. Can read any field of given record that exists in database.

Note: You should use this method only for fields that are not provided in standard setters/getters (SVN fields). This method runs SQL query each time you call it so it highly overloads used resources.

Parameters:
string   $field:  Field name.

API Tags:
Return:  Field value.
Access:  public

Information Tags:
Version:  0.0.5
Version:  0.0.4
Throws:  E_OTS_NotLoaded If rank is not loaded.
Since:  0.0.4
Throws:  PDOException On PDO operation error.

[ Top ]
getGuild  [line 175]

  OTS_Guild getGuild( )

Returns guild of this rank.

Returns guild of this rank.


API Tags:
Return:  Guild of this rank.
Access:  public

Information Tags:
Version:  0.1.0
Version:  0.0.4
Throws:  E_OTS_NotLoaded If rank is not loaded.
Since:  0.0.4
Throws:  PDOException On PDO operation error.

[ Top ]
getId  [line 127]

  int getId( )

Rank ID.

Rank ID.


API Tags:
Return:  Rank ID.
Access:  public

Information Tags:
Version:  0.0.4
Throws:  E_OTS_NotLoaded If rank is not loaded.
Since:  0.0.4

[ Top ]
getIterator  [line 392]

  Iterator getIterator( )

Returns players iterator.

Returns players iterator. There is no need to implement entire Iterator interface since we have players list class for it.


API Tags:
Return:  List of players.
Access:  public

Information Tags:
Version:  0.0.5
Version:  0.0.4
Throws:  PDOException On PDO operation error.
Throws:  E_OTS_NotLoaded If rank is not loaded.
Since:  0.0.4
Since:  0.0.5

Implementation of:
IteratorAggregate::getIterator

[ Top ]
getLevel  [line 208]

  int getLevel( )

Rank's access level.

Rank's access level.


API Tags:
Return:  Rank access level within guild.
Access:  public

Information Tags:
Version:  0.0.4
Throws:  E_OTS_NotLoaded If rank is not loaded.
Since:  0.0.4

[ Top ]
getName  [line 143]

  string getName( )

Rank name.

Rank name.


API Tags:
Return:  Rank's name.
Access:  public

Information Tags:
Version:  0.0.4
Throws:  E_OTS_NotLoaded If rank is not loaded.
Since:  0.0.4

[ Top ]
getPlayers  [line 303]

  array getPlayers( )


API Tags:
Return:  List of members.
Deprecated:  0.0.5 Use getPlayersList().
Access:  public

Information Tags:
Version:  0.1.0
Version:  0.0.4
Since:  0.0.4
Throws:  E_OTS_NotLoaded If rank is not loaded.

[ Top ]
getPlayersList  [line 339]

  OTS_Players_List getPlayersList( )

List of characters with current rank.

List of characters with current rank. In difference to getPlayers() method this method returns filtered OTS_Players_List object instead of array of OTS_Player objects. It is more effective since OTS_Player_List doesn't perform all rows loading at once.

Note: Returned object is only prepared, but not initialised. When using as parameter in foreach loop it doesn't matter since it will return it's iterator, but if you will wan't to execute direct operation on that object you will need to call rewind() method first.


API Tags:
Return:  List of players with current rank.
Access:  public

Information Tags:
Version:  0.1.4
Version:  0.0.4
Throws:  E_OTS_NotLoaded If rank is not loaded.
Since:  0.0.5
Since:  0.0.4

[ Top ]
isLoaded  [line 88]

  bool isLoaded( )

Checks if object is loaded.

Checks if object is loaded.


API Tags:
Return:  Load state.
Access:  public

Information Tags:
Version:  0.0.4
Since:  0.0.4

[ Top ]
load  [line 44]

  void load( int $id  )

Loads rank with given id.

Loads rank with given id.

Parameters:
int   $id:  Rank's ID.

API Tags:
Access:  public

Information Tags:
Version:  0.0.5
Version:  0.0.4
Throws:  PDOException On PDO operation error.
Since:  0.0.4

Redefinition of:
OTS_Row_DAO::load()
Loads row by it's ID.

[ Top ]
save  [line 103]

  void save( )

Saves rank in database.

Saves rank in database. If rank is not loaded to represent any existing group it will create new row for it.


API Tags:
Access:  public

Information Tags:
Version:  0.0.8
Version:  0.0.4
Throws:  PDOException On PDO operation error.
Since:  0.0.4

[ Top ]
setCustomField  [line 281]

  void setCustomField( string $field, mixed $value  )

Writes custom field.

Writes custom field. Write field by it's name. Can write any field of given record that exists in database.

Note: You should use this method only for fields that are not provided in standard setters/getters (SVN fields). This method runs SQL query each time you call it so it highly overloads used resources.

Note: Make sure that you pass $value argument of correct type. This method determinates whether to quote field value. It is safe - it makes you sure that no unproper queries that could lead to SQL injection will be executed, but it can make your code working wrong way. For example: $object->setCustomField('foo', '1'); will quote 1 as as string ('1') instead of passing it as a integer.

Parameters:
string   $field:  Field name.
mixed   $value:  Field value.

API Tags:
Access:  public

Information Tags:
Version:  0.0.5
Version:  0.0.4
Throws:  E_OTS_NotLoaded If rank is not loaded.
Since:  0.0.4
Throws:  PDOException On PDO operation error.

[ Top ]
setGuild  [line 197]

  void setGuild( OTS_Guild $guild  )

Assigns rank to guild.

Assigns rank to guild. This method only updates object state. To save changes in database you need to use save() method to flush changed to database.

Parameters:
OTS_Guild   $guild:  Owning guild.

API Tags:
Access:  public

Information Tags:
Version:  0.0.4
Throws:  E_OTS_NotLoaded If given $guild object is not loaded.
Since:  0.0.4

[ Top ]
setLevel  [line 227]

  void setLevel( int $level  )

Sets rank's access level within guild.

Sets rank's access level within guild. This method only updates object state. To save changes in database you need to use save() method to flush changed to database.

Parameters:
int   $level:  access level within guild.

API Tags:
Access:  public

Information Tags:
Version:  0.0.4
Since:  0.0.4

[ Top ]
setName  [line 162]

  void setName( string $name  )

Sets rank's name.

Sets rank's name. This method only updates object state. To save changes in database you need to use save() method to flush changed to database.

Parameters:
string   $name:  Name.

API Tags:
Access:  public

Information Tags:
Version:  0.0.4
Since:  0.0.4

[ Top ]
__get  [line 421]

  mixed __get( string $name  )

Magic PHP5 method.

Magic PHP5 method.

Parameters:
string   $name:  Property name.

API Tags:
Return:  Property value.
Access:  public

Information Tags:
Version:  0.1.0
Version:  0.0.4
Throws:  PDOException On PDO operation error.
Throws:  OutOfBoundsException For non-supported properties.
Since:  0.0.4
Since:  0.1.0

[ Top ]
__set  [line 458]

  void __set( string $name, mixed $value  )

Magic PHP5 method.

Magic PHP5 method.

Parameters:
string   $name:  Property name.
mixed   $value:  Property value.

API Tags:
Access:  public

Information Tags:
Version:  0.1.0
Version:  0.0.4
Throws:  PDOException On PDO operation error.
Throws:  OutOfBoundsException For non-supported properties.
Since:  0.0.4
Since:  0.1.0

[ Top ]
__toString  [line 490]

  string __toString( )

Returns string representation of object.

Returns string representation of object. If any display driver is currently loaded then it uses it's method. Else it returns rank name.


API Tags:
Return:  String representation of object.
Access:  public

Information Tags:
Version:  0.1.3
Version:  0.0.4
Since:  0.0.4
Since:  0.1.0

[ Top ]