54 lines
1.2 KiB
PHP
54 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Model;
|
|
|
|
class Program extends Model {
|
|
public $id;
|
|
public $name;
|
|
public $description;
|
|
public $email;
|
|
public $nonstop;
|
|
public $rerun;
|
|
public $priority;
|
|
|
|
public $hosts;
|
|
public $recent;
|
|
public $next;
|
|
|
|
public function __construct($data) {
|
|
parent::__construct($data);
|
|
|
|
if(isset($data->suffix) && $data->suffix) {
|
|
$this->name .= ' ' . $data->suffix;
|
|
}
|
|
|
|
if($this->recent && $this->recent) {
|
|
foreach($this->recent as &$recent) {
|
|
parent::ConvertToDateTime($recent->starts);
|
|
parent::ConvertToDateTime($recent->ends);
|
|
}
|
|
}
|
|
if($this->next && $this->next) {
|
|
foreach($this->next as &$next) {
|
|
parent::ConvertToDateTime($next->starts);
|
|
parent::ConvertToDateTime($next->ends);
|
|
}
|
|
}
|
|
|
|
if(isset($data->email) && ($mailComma = strpos($data->email, ',')) !== false) {
|
|
$this->email = substr($data->email, 0, $mailComma);
|
|
}
|
|
|
|
if(isset($data->state)) {
|
|
$this->nonstop = $data->state == 0;
|
|
$this->rerun = $data->state == 3;
|
|
}
|
|
|
|
$this->url = "/{$this->id}/" . parent::url_slug($this->name);
|
|
}
|
|
|
|
public function isSpecial() {
|
|
return ($this->priority < 2);
|
|
}
|
|
}
|