Example #1
0
 public function __construct($row = null)
 {
     parent::__construct($row);
     if (is_object($row)) {
         $this->admin = !!ord($row->user_admin);
     }
 }
Example #2
0
 public function __construct($row = null)
 {
     parent::__construct($row);
     if (is_object($row)) {
         $this->admin = (int) $row->user_admin === 1;
     }
 }
Example #3
0
 /**
  * Override for image
  */
 public function copyFromDbRow($row)
 {
     parent::copyFromDbRow($row);
     $this->id = (int) $this->id;
     $this->bracketId = (int) $this->bracketId;
     $this->seed = (int) $this->seed;
     $this->image = IMAGE_URL . '/' . base_convert($this->id, 10, 36) . '.jpg';
 }
Example #4
0
 /**
  * Constructor
  */
 public function __construct($round = null)
 {
     if (is_object($round)) {
         parent::copyFromDbRow($round);
         $this->final = (bool) ord($this->final);
         // Because PHP is retarded about return BIT types from MySQL
         if (isset($round->user_vote)) {
             $this->voted = $round->user_vote > 0;
             $this->votedCharacterId = (int) $round->user_vote;
         }
     }
 }
Example #5
0
 /**
  * Override for image
  */
 public function copyFromDbRow($row)
 {
     parent::copyFromDbRow($row);
     $this->image = IMAGE_URL . '/' . base_convert($this->id, 10, 36) . '.jpg';
 }
Example #6
0
 /**
  * Override for getAll to include the winner character object
  */
 public static function getAll($force = false)
 {
     $cacheKey = 'Api:Bracket:getAll_' . BRACKET_SOURCE;
     $retVal = Lib\Cache::Get($cacheKey);
     if (false === $retVal || $force) {
         $brackets = parent::queryReturnAll(['source' => BRACKET_SOURCE, 'state' => ['ne' => BS_HIDDEN]], ['score' => 'desc', 'state' => 'desc', 'start' => 'desc']);
         $retVal = [];
         foreach ($brackets as $bracket) {
             if ($bracket->winnerCharacterId) {
                 $bracket->winner = Character::getById($bracket->winnerCharacterId);
             }
             if ($bracket->start <= time() || $force) {
                 $retVal[] = $bracket;
             }
         }
         Lib\Cache::Set($cacheKey, $retVal, 3600);
     }
     return $retVal;
 }
Example #7
0
 /**
  * Constructor
  */
 public function __construct($item = null)
 {
     parent::__construct($item);
     $this->id = (int) $this->id;
 }