POT
POT
POT
Main menu

Download

Forum

SVN

Class: OTS_Group

Source Location: /classes/OTS_Group.php

Class OTS_Group

Class Overview

Implements interfaces:

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

OTServ user group abstraction.

OTServ user group abstraction.

Located in /classes/OTS_Group.php [line 29]

OTS_Base_DAO
   |
   --OTS_Row_DAO
      |
      --OTS_Group
Author(s):
API Tags:
Property:  string $name: Group name.
Property:  int $flags: Access flags.
Property:  int $access: Access level.
Property:  int $maxDepotItems: Maximum count of items in depot.
Property:  int $maxVIPList: Maximum count of entries in VIP list.
Property-read:  bool $loaded: Loaded state check.
Property-read:  int $id: Row ID.
Property-read:  OTS_Players_List $playersList: List of members of this group.

Information Tags:
Version:  0.0.1
Version:  0.1.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 group.
void   find()   Loads group by it's name.
int   getAccess()   Access level.
string   getCustomField()   Reads custom field.
int   getFlags()   Rights flags.
int   getId()   Group ID.
Iterator   getIterator()   Returns players iterator.
int   getMaxDepotItems()   Maximum count of items in depot.
int   getMaxVIPList()   Maximum count of players in VIP list.
string   getName()   Group name.
array   getPlayers()  
OTS_Players_List   getPlayersList()   List of characters in group.
bool   isLoaded()   Checks if object is loaded.
void   load()   Loads group with given id.
void   save()   Saves group in database.
void   setAccess()   Sets access level.
void   setCustomField()   Writes custom field.
void   setFlags()   Sets rights flags.
void   setMaxDepotItems()   Sets maximum count of items in depot.
void   setMaxVIPList()   Sets maximum count of players in VIP list.
void   setName()   Sets group's name.
mixed   __get()   Magic PHP5 method.
void   __set()   Magic PHP5 method.
string   __toString()   Returns string representation of object.

[ Top ]
Methods
count  [line 481]

  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.1
Throws:  E_OTS_NotLoaded If group is not loaded.
Since:  0.0.5
Throws:  PDOException On PDO operation error.

Implementation of:
Countable::count

[ Top ]
delete  [line 440]

  void delete( )

Deletes group.

Deletes group.


API Tags:
Access:  public

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

[ Top ]
find  [line 59]

  void find( string $name  )

Loads group by it's name.

Loads group by it's name.

Parameters:
string   $name:  Group name.

API Tags:
Access:  public

Information Tags:
Version:  0.1.1
Version:  0.0.1
Throws:  PDOException On PDO operation error.
Since:  0.1.1

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

[ Top ]
getAccess  [line 211]

  int getAccess( )

Access level.

Access level. Note: Since 0.0.3 version this method throws E_OTS_NotLoaded exception instead of triggering E_USER_WARNING.


API Tags:
Return:  Access level.
Access:  public

Information Tags:
Version:  0.0.3
Version:  0.0.1
Throws:  E_OTS_NotLoaded If group is not loaded.

[ Top ]
getCustomField  [line 323]

  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.1
Throws:  E_OTS_NotLoaded If group is not loaded.
Since:  0.0.3
Throws:  PDOException On PDO operation error.

[ Top ]
getFlags  [line 176]

  int getFlags( )

Rights flags.

Rights flags. Note: Since 0.0.3 version this method throws E_OTS_NotLoaded exception instead of triggering E_USER_WARNING.


API Tags:
Return:  Flags.
Access:  public

Information Tags:
Version:  0.0.3
Version:  0.0.1
Throws:  E_OTS_NotLoaded If group is not loaded.

[ Top ]
getId  [line 120]

  int getId( )

Group ID.

Group ID. Note: Since 0.0.3 version this method throws E_OTS_NotLoaded exception instead of triggering E_USER_WARNING.


API Tags:
Return:  Group ID.
Access:  public

Information Tags:
Version:  0.0.3
Version:  0.0.1
Throws:  E_OTS_NotLoaded If group is not loaded.

[ Top ]
getIterator  [line 467]

  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.1
Throws:  E_OTS_NotLoaded If group is not loaded.
Since:  0.0.5
Throws:  PDOException On PDO operation error.

Implementation of:
IteratorAggregate::getIterator

[ Top ]
getMaxDepotItems  [line 246]

  int getMaxDepotItems( )

Maximum count of items in depot.

Maximum count of items in depot. Note: Since 0.0.3 version this method throws E_OTS_NotLoaded exception instead of triggering E_USER_WARNING.


API Tags:
Return:  Maximum value.
Access:  public

Information Tags:
Version:  0.0.3
Version:  0.0.1
Throws:  E_OTS_NotLoaded If group is not loaded.

[ Top ]
getMaxVIPList  [line 281]

  int getMaxVIPList( )

Maximum count of players in VIP list.

Maximum count of players in VIP list. Note: Since 0.0.3 version this method throws E_OTS_NotLoaded exception instead of triggering E_USER_WARNING.


API Tags:
Return:  Maximum value.
Access:  public

Information Tags:
Version:  0.0.3
Version:  0.0.1
Throws:  E_OTS_NotLoaded If group is not loaded.

[ Top ]
getName  [line 141]

  string getName( )

Group name.

Group name. Note: Since 0.0.3 version this method throws E_OTS_NotLoaded exception instead of triggering E_USER_WARNING.


API Tags:
Return:  Name.
Access:  public

Information Tags:
Version:  0.0.3
Version:  0.0.1
Throws:  E_OTS_NotLoaded If group is not loaded.

[ Top ]
getPlayers  [line 378]

  array getPlayers( )


API Tags:
Return:  Array of OTS_Player objects from given group.
Deprecated:  0.0.5 Use getPlayersList().
Access:  public

Information Tags:
Version:  0.1.0
Version:  0.0.1
Throws:  E_OTS_NotLoaded If group is not loaded.

[ Top ]
getPlayersList  [line 414]

  OTS_Players_List getPlayersList( )

List of characters in group.

List of characters in group. 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 from current group.
Access:  public

Information Tags:
Version:  0.1.4
Version:  0.0.1
Throws:  E_OTS_NotLoaded If group is not loaded.
Since:  0.0.5

[ Top ]
isLoaded  [line 76]

  bool isLoaded( )

Checks if object is loaded.

Checks if object is loaded.


API Tags:
Return:  Load state.
Access:  public

Information Tags:
Version:  0.0.1

[ Top ]
load  [line 45]

  void load( int $id  )

Loads group with given id.

Loads group with given id.

Parameters:
int   $id:  Group number.

API Tags:
Access:  public

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

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

[ Top ]
save  [line 91]

  void save( )

Saves group in database.

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


API Tags:
Access:  public

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

[ Top ]
setAccess  [line 230]

  void setAccess( int $access  )

Sets access level.

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

Parameters:
int   $access:  Access level.

API Tags:
Access:  public

Information Tags:
Version:  0.0.1

[ Top ]
setCustomField  [line 356]

  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 name. 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.1
Throws:  E_OTS_NotLoaded If group is not loaded.
Since:  0.0.3
Throws:  PDOException On PDO operation error.

[ Top ]
setFlags  [line 195]

  void setFlags( int $flags  )

Sets rights flags.

Sets rights flags. This method only updates object state. To save changes in database you need to use save() method to flush changed to database.

Parameters:
int   $flags:  Flags.

API Tags:
Access:  public

Information Tags:
Version:  0.0.1

[ Top ]
setMaxDepotItems  [line 265]

  void setMaxDepotItems( int $maxdepotitems  )

Sets maximum count of items in depot.

Sets maximum count of items in depot. This method only updates object state. To save changes in database you need to use save() method to flush changed to database.

Parameters:
int   $maxdepotitems:  Maximum value.

API Tags:
Access:  public

Information Tags:
Version:  0.0.1

[ Top ]
setMaxVIPList  [line 300]

  void setMaxVIPList( int $maxviplist  )

Sets maximum count of players in VIP list.

Sets maximum count of players in VIP list. This method only updates object state. To save changes in database you need to use save() method to flush changed to database.

Parameters:
int   $maxviplist:  Maximum value.

API Tags:
Access:  public

Information Tags:
Version:  0.0.1

[ Top ]
setName  [line 160]

  void setName( string $name  )

Sets group's name.

Sets group'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.1

[ Top ]
__get  [line 497]

  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.1
Throws:  OutOfBoundsException For non-supported properties.
Throws:  E_OTS_NotLoaded If group is not loaded.
Throws:  PDOException On PDO operation error.
Since:  0.1.0

[ Top ]
__set  [line 540]

  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.1
Throws:  OutOfBoundsException For non-supported properties.
Since:  0.1.0
Throws:  PDOException On PDO operation error.

[ Top ]
__toString  [line 580]

  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 group name.


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

Information Tags:
Version:  0.1.3
Version:  0.0.1
Since:  0.1.0

[ Top ]