Mixshows.

This commit is contained in:
Cody Cook 2024-05-14 08:42:50 -07:00
commit ef4eedcd6e
12 changed files with 493 additions and 23 deletions

View file

@ -9,9 +9,10 @@ class Mixshow
private $slug = "";
private $db = null;
private $description = "";
private $cover = "";
private $cover = "img/no-image1.png";
private $count;
private $mixes = [];
private $updated;
public function __construct($value, $db)
{
@ -29,7 +30,7 @@ class Mixshow
private function load_by_id()
{
$mixshow = $this->get_mixshow_by_id();
if ($mixshow && $mixshow['title'] != "") {
if ($mixshow && $mixshow['name'] != "") {
return $this->build_mixshow($mixshow);
} else {
return false;
@ -52,8 +53,16 @@ class Mixshow
$this->name = $mixshow['name'];
$this->slug = $mixshow['slug'];
$this->description = $mixshow['description'];
$this->cover = $mixshow['cover'];
$this->enabled = $mixshow['enabled'];
// is this legacy code?
// the code is legacy if it starts with /dj/,
// if it does, prefix with https://www.utahsdjs.com
if (substr($mixshow['cover'], 0, 5) == "/djs/") {
// remove /djs/ from the string
$mixshow['cover'] = substr($mixshow['cover'], 4);
$this->cover = "https://cdn.utahsdjs.com" . $mixshow['cover'];
}
$this->updated = $mixshow['lastupdated'];
$this->count = $mixshow['count'];
$this->load_mixes();
return true;
@ -61,7 +70,7 @@ class Mixshow
private function load_mixes()
{
$stmt = $this->db->prepare("SELECT value FROM mix_meta WHERE value = ?");
$stmt = $this->db->prepare("SELECT mix_id FROM mix_meta WHERE value = ? AND attribute = 'mixshow'");
$stmt->bind_param("i", $this->id);
$stmt->execute();
$result = $stmt->get_result();
@ -74,7 +83,7 @@ class Mixshow
private function load_by_slug()
{
$mixshow = $this->get_mixshow_by_slug();
if ($mixshow && $mixshow['title'] != "") {
if ($mixshow && $mixshow['name'] != "") {
return $this->build_mixshow($mixshow);
} else {
return false;
@ -130,5 +139,8 @@ class Mixshow
return $this->mixes;
}
public function get_updated(){
return $this->updated;
}
}