Files
api/common/classes/Program.php
2017-07-31 01:16:46 +02:00

35 lines
824 B
PHP

<?php
namespace Model;
class Program extends Model {
public $id;
public $name;
public $description;
public $email;
public $priority;
// TODO: Implementeren
public $hosts;
public $schedule;
public function __construct($data) {
parent::__construct($data);
if($this->schedule && $this->schedule->next && $this->schedule->next->time) {
parent::ConvertToDateTime($this->schedule->next->time);
}
if($this->schedule && $this->schedule->recent) {
foreach($this->schedule->recent as &$recent) {
parent::ConvertToDateTime($recent->time);
}
}
if(isset($data->email) && ($mailComma = strpos($data->email, ',')) !== false) {
$this->email = substr($data->email, 0, $mailComma);
}
$this->url = "/{$this->id}/" . parent::url_slug($this->name);
}
}