12 const TABLE_NAME =
"LeaderBoard_User";
15 public $IdLeaderboard = 0;
16 public $IdAccount = 0;
17 public $Username =
"";
19 public $ValueFloat = 0;
20 public $ValueString =
"";
21 public $LastUpdated =
"";
26 public function __construct($src = null, $stripSlashes =
false) {
31 $this->_loadByRow($src, $stripSlashes);
32 }
else if (is_numeric($src) && intval($src) > 0) {
34 $this->_loadFilter(self::GetTableName(__CLASS__),
"Id = " . intval($src));
46 public static function LoadAccount ($idAccount, $idLeaderboard = 0, $returnArray =
false) {
47 $where = sprintf(
"IdAccount = %d", $idAccount);
48 if ($idLeaderboard > 0)
49 $where .= sprintf(
" AND IdLeaderboard = %d", $idLeaderboard);
50 return self::_load(self::GetTableName(__CLASS__), ($returnArray ?
"" : __CLASS__), $where);
64 public static function Load ($idLeaderboard, $order, $limit = null, $offset = null, &$count = null, $returnArray =
false) {
65 $where = sprintf(
"al.IdLeaderboard = %d", $idLeaderboard);
66 return self::_loadEx(
"al.*", self::GetTableName(__CLASS__) .
" al INNER JOIN " . self::GetTableName(Account::class) .
" u ON u.Id = al.IdAccount", ($returnArray ?
"" : __CLASS__), $where, $order, $limit, $offset, $count);
77 $query = sprintf(
"INSERT INTO %s (IdLeaderboard, IdAccount, Username, ValueInt, ValueFloat, LastUpdated) VALUES (%d, %d, '%s', %d, %f, '%s')",
78 self::GetTableName(__CLASS__),
81 $Database->Escape($this->Username),
86 $query = sprintf(
"UPDATE %s SET Username = '%s', ValueInt = %d, ValueFloat = %f, LastUpdated = '%s' WHERE Id = %d",
87 self::GetTableName(__CLASS__),
88 $Database->Escape($this->Username),
94 $saved = $Database->Query($query);
97 $this->Id = $Database->InsertedId();
111 return $this->_Delete(self::GetTableName(__CLASS__),
"Id = " . $this->Id);
119 self::TruncateClass(__CLASS__);
static LoadAccount($idAccount, $idLeaderboard=0, $returnArray=false)
static Load($idLeaderboard, $order, $limit=null, $offset=null, &$count=null, $returnArray=false)
__construct($src=null, $stripSlashes=false)