2014-02-23 13:15:28 +01:00
|
|
|
<?php
|
2014-04-13 12:00:08 +02:00
|
|
|
namespace Dedimania;
|
|
|
|
|
2014-02-23 13:15:28 +01:00
|
|
|
/**
|
2014-04-13 12:00:08 +02:00
|
|
|
* ManiaControl Dedimania-Plugin Record DataStructure
|
2014-02-25 18:34:35 +01:00
|
|
|
*
|
|
|
|
* @author kremsy and steeffeen
|
2014-04-13 12:00:08 +02:00
|
|
|
* @copyright ManiaControl Copyright © 2014 ManiaControl Team
|
|
|
|
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
2014-02-23 13:15:28 +01:00
|
|
|
*/
|
|
|
|
use ManiaControl\Formatter;
|
|
|
|
|
|
|
|
class RecordData {
|
|
|
|
public $nullRecord = false;
|
|
|
|
public $login = '';
|
|
|
|
public $nickName = '';
|
|
|
|
public $best = -1;
|
|
|
|
public $rank = -1;
|
|
|
|
public $maxRank = -1;
|
|
|
|
public $checkpoints = '';
|
|
|
|
public $newRecord = false;
|
|
|
|
public $vReplay = '';
|
|
|
|
public $top1GReplay = '';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct a Record by a given Record Array
|
2014-02-25 18:34:35 +01:00
|
|
|
*
|
2014-02-23 13:15:28 +01:00
|
|
|
* @param $record
|
|
|
|
*/
|
|
|
|
public function __construct($record) {
|
2014-03-31 21:54:51 +02:00
|
|
|
if (!$record) {
|
2014-02-23 13:15:28 +01:00
|
|
|
$this->nullRecord = true;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->login = $record['Login'];
|
|
|
|
$this->nickName = Formatter::stripDirtyCodes($record['NickName']);
|
|
|
|
$this->best = $record['Best'];
|
|
|
|
$this->rank = $record['Rank'];
|
|
|
|
$this->maxRank = $record['MaxRank'];
|
|
|
|
$this->checkpoints = $record['Checks'];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructs a new Record via it's properties
|
2014-02-25 18:34:35 +01:00
|
|
|
*
|
2014-02-23 13:15:28 +01:00
|
|
|
* @param $login
|
|
|
|
* @param $nickName
|
|
|
|
* @param $best
|
|
|
|
* @param $checkpoints
|
|
|
|
* @param bool $newRecord
|
|
|
|
*/
|
|
|
|
public function constructNewRecord($login, $nickName, $best, $checkpoints, $newRecord = false) {
|
2014-02-25 18:34:35 +01:00
|
|
|
$this->nullRecord = false;
|
2014-02-23 13:15:28 +01:00
|
|
|
$this->login = $login;
|
|
|
|
$this->nickName = $nickName;
|
|
|
|
$this->best = $best;
|
|
|
|
$this->checkpoints = $checkpoints;
|
|
|
|
$this->newRecord = $newRecord;
|
|
|
|
}
|
|
|
|
}
|