Check-in; adding features like mixshow and google analytics.

This commit is contained in:
Cody Cook 2024-05-02 19:21:24 -07:00
commit 8288ebc67a
50 changed files with 1492 additions and 483 deletions

View file

@ -17,6 +17,7 @@ class DJ
private string $updated = "";
private string $claimed_by = "";
private mysqli $db;
private array $mixes = [];
public function __construct($value, $db)
@ -118,8 +119,6 @@ class DJ
if (isset($dj['claimed_by']) && $dj['claimed_by'] != null) {
// TODO: pull some quick data on the user who claimed this DJ
$this->claimed = true;
}
if (isset($dj['created'])) {
@ -129,6 +128,8 @@ class DJ
$this->updated = $dj['lastupdated'];
}
$this->load_dj_mixes();
return true;
} else {
return false;
@ -208,5 +209,24 @@ class DJ
return $this->claimed;
}
private function load_dj_mixes(): void
{
$stmt = $this->db->prepare("SELECT * FROM mix WHERE dj1 = ? OR dj2 = ? OR dj3 = ?");
$stmt->bind_param("iii", $this->id, $this->id, $this->id);
$stmt->execute();
$result = $stmt->get_result();
$mixes = [];
while ($mix = $result->fetch_assoc()) {
$mixes[] = $mix;
}
$stmt->close();
$this->mixes = $mixes;
}
public function get_dj_mixes()
{
return $this->mixes;
}
}