Check-in; adding features like mixshow and google analytics.
This commit is contained in:
parent
36e6e23a68
commit
8288ebc67a
50 changed files with 1492 additions and 483 deletions
|
@ -3,12 +3,13 @@
|
|||
class Genre
|
||||
{
|
||||
|
||||
private $id = -1 ;
|
||||
private $id = -1;
|
||||
private $enabled = "";
|
||||
private $count = 0;
|
||||
private $name = "";
|
||||
private $slug = "";
|
||||
private $db = "";
|
||||
private $mixes = [];
|
||||
|
||||
public function __construct($value, $db)
|
||||
{
|
||||
|
@ -22,6 +23,7 @@ class Genre
|
|||
return $this->load_by_slug();
|
||||
}
|
||||
}
|
||||
|
||||
private function load_by_id(): bool
|
||||
{
|
||||
$genre = $this->get_genre_by_id();
|
||||
|
@ -30,6 +32,7 @@ class Genre
|
|||
$this->count = $genre['count'];
|
||||
$this->name = $genre['name'];
|
||||
$this->slug = $genre['slug'];
|
||||
$this->mixes = $this->load_mixes();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -56,6 +59,7 @@ class Genre
|
|||
$this->enabled = $genre['enabled'];
|
||||
$this->count = $genre['count'];
|
||||
$this->name = $genre['name'];
|
||||
$this->mixes = $this->load_mixes();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -98,4 +102,23 @@ class Genre
|
|||
return $this->count;
|
||||
}
|
||||
|
||||
public function get_mixes(): array
|
||||
{
|
||||
return $this->mixes;
|
||||
}
|
||||
|
||||
private function load_mixes(): array
|
||||
{
|
||||
$stmt = $this->db->prepare("SELECT mix_id FROM mix_meta WHERE attribute = 'genre' AND value = ?");
|
||||
$stmt->bind_param("i", $this->id);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
$mixes = [];
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$mixes[] = $row['mix_id'];
|
||||
}
|
||||
$stmt->close();
|
||||
return $mixes;
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue