Calendar added
This commit is contained in:
@@ -10,13 +10,26 @@ class CalendarEvent extends Model {
|
||||
public $starts;
|
||||
public $ends;
|
||||
public $images;
|
||||
public $podcast;
|
||||
public $keywords;
|
||||
public $url;
|
||||
|
||||
public function __construct($data, $images = null) {
|
||||
parent::__construct($data);
|
||||
parent::ConvertToDateTime($this->starts);
|
||||
parent::ConvertToDateTime($this->ends);
|
||||
|
||||
|
||||
$this->keywords = null;
|
||||
if(isset($data->keywords)) {
|
||||
if(is_array($data->keywords)) {
|
||||
$this->keywords = $data->keywords;
|
||||
} else if(trim($data->keywords)) {
|
||||
$this->keywords = explode(' ', $data->keywords);
|
||||
}
|
||||
}
|
||||
|
||||
$this->podcast = isset($data->podcast) && $data->podcast ? $data->podcast : null;
|
||||
|
||||
$images = ($images != null) ? $images
|
||||
: (isset($data->images) ? $data->images : null);
|
||||
if($images) {
|
||||
|
||||
@@ -16,7 +16,7 @@ class Model {
|
||||
$field = new \DateTime($field);
|
||||
}
|
||||
|
||||
if($field === false || $field->getTimestamp() == 0) {
|
||||
if($field === false || $field->getTimestamp() <= 0) {
|
||||
// If field had data but is invalid DateTime or is 0000-00-00 00:00, set it to null.
|
||||
$field = null;
|
||||
} else {
|
||||
|
||||
@@ -63,10 +63,6 @@ class NewsItem extends Model {
|
||||
$this->url = "/nieuws/{$this->id}/" . parent::url_slug($this->title);
|
||||
}
|
||||
|
||||
public function detailsUrl() {
|
||||
return "/{$this->id}/" . urlencode($this->title);
|
||||
}
|
||||
|
||||
public function excerpt() {
|
||||
$hasImages = count($this->images) > 0;
|
||||
$maxLength = $hasImages ? 200 : 500;
|
||||
|
||||
Reference in New Issue
Block a user