Initial Upload
This commit is contained in:
80
lib/Widget/DataType/Article.php
Normal file
80
lib/Widget/DataType/Article.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2024 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* This file is part of Xibo.
|
||||
*
|
||||
* Xibo is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Xibo is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Xibo\Widget\DataType;
|
||||
|
||||
use Xibo\Widget\Definition\DataType;
|
||||
|
||||
/**
|
||||
* An article, usually from a blog or news feed.
|
||||
*/
|
||||
class Article implements \JsonSerializable, DataTypeInterface
|
||||
{
|
||||
public static $NAME = 'article';
|
||||
public $title;
|
||||
public $summary;
|
||||
public $content;
|
||||
public $author;
|
||||
public $permalink;
|
||||
public $link;
|
||||
public $image;
|
||||
|
||||
/** @var \Carbon\Carbon */
|
||||
public $date;
|
||||
|
||||
/** @var \Carbon\Carbon */
|
||||
public $publishedDate;
|
||||
|
||||
/** @inheritDoc */
|
||||
public function jsonSerialize(): array
|
||||
{
|
||||
return [
|
||||
'title' => $this->title,
|
||||
'summary' => $this->summary,
|
||||
'content' => $this->content,
|
||||
'author' => $this->author,
|
||||
'permalink' => $this->permalink,
|
||||
'link' => $this->link,
|
||||
'date' => $this->date->format('c'),
|
||||
'publishedDate' => $this->publishedDate->format('c'),
|
||||
'image' => $this->image,
|
||||
];
|
||||
}
|
||||
|
||||
public function getDefinition(): DataType
|
||||
{
|
||||
$dataType = new DataType();
|
||||
$dataType->id = self::$NAME;
|
||||
$dataType->name = __('Article');
|
||||
$dataType
|
||||
->addField('title', __('Title'), 'text')
|
||||
->addField('summary', __('Summary'), 'text')
|
||||
->addField('content', __('Content'), 'text')
|
||||
->addField('author', __('Author'), 'text')
|
||||
->addField('permalink', __('Permalink'), 'text')
|
||||
->addField('link', __('Link'), 'text')
|
||||
->addField('date', __('Created Date'), 'datetime')
|
||||
->addField('publishedDate', __('Published Date'), 'datetime')
|
||||
->addField('image', __('Image'), 'image');
|
||||
return $dataType;
|
||||
}
|
||||
}
|
||||
37
lib/Widget/DataType/DataTypeInterface.php
Normal file
37
lib/Widget/DataType/DataTypeInterface.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - http://www.xibo.org.uk
|
||||
*
|
||||
* This file is part of Xibo.
|
||||
*
|
||||
* Xibo is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Xibo is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Xibo\Widget\DataType;
|
||||
|
||||
use Xibo\Widget\Definition\DataType;
|
||||
|
||||
/**
|
||||
* A class representation of a data type.
|
||||
*/
|
||||
interface DataTypeInterface
|
||||
{
|
||||
/**
|
||||
* Return the definition
|
||||
* @return \Xibo\Widget\Definition\DataType
|
||||
*/
|
||||
public function getDefinition(): DataType;
|
||||
}
|
||||
73
lib/Widget/DataType/Event.php
Normal file
73
lib/Widget/DataType/Event.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* This file is part of Xibo.
|
||||
*
|
||||
* Xibo is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Xibo is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Xibo\Widget\DataType;
|
||||
|
||||
use Xibo\Widget\Definition\DataType;
|
||||
|
||||
/**
|
||||
* Event data type
|
||||
*/
|
||||
class Event implements \JsonSerializable, DataTypeInterface
|
||||
{
|
||||
public static $NAME = 'event';
|
||||
public $summary;
|
||||
public $description;
|
||||
public $location;
|
||||
|
||||
/** @var \Carbon\Carbon */
|
||||
public $startDate;
|
||||
|
||||
/** @var \Carbon\Carbon */
|
||||
public $endDate;
|
||||
|
||||
/** @var bool */
|
||||
public $isAllDay = false;
|
||||
|
||||
/** @inheritDoc */
|
||||
public function jsonSerialize(): array
|
||||
{
|
||||
return [
|
||||
'summary' => $this->summary,
|
||||
'description' => $this->description,
|
||||
'location' => $this->location,
|
||||
'startDate' => $this->startDate->format('c'),
|
||||
'endDate' => $this->endDate->format('c'),
|
||||
'isAllDay' => $this->isAllDay,
|
||||
];
|
||||
}
|
||||
|
||||
public function getDefinition(): DataType
|
||||
{
|
||||
$dataType = new DataType();
|
||||
$dataType->id = self::$NAME;
|
||||
$dataType->name = __('Event');
|
||||
$dataType
|
||||
->addField('summary', __('Summary'), 'text')
|
||||
->addField('description', __('Description'), 'text')
|
||||
->addField('location', __('Location'), 'text')
|
||||
->addField('startDate', __('Start Date'), 'datetime')
|
||||
->addField('endDate', __('End Date'), 'datetime')
|
||||
->addField('isAllDay', __('All Day Event'), 'boolean');
|
||||
return $dataType;
|
||||
}
|
||||
}
|
||||
161
lib/Widget/DataType/Forecast.php
Normal file
161
lib/Widget/DataType/Forecast.php
Normal file
@@ -0,0 +1,161 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2024 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* This file is part of Xibo.
|
||||
*
|
||||
* Xibo is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Xibo is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Xibo\Widget\DataType;
|
||||
|
||||
use Xibo\Widget\Definition\DataType;
|
||||
|
||||
/**
|
||||
* Forecast DataType
|
||||
*/
|
||||
class Forecast implements \JsonSerializable, DataTypeInterface
|
||||
{
|
||||
public static $NAME = 'forecast';
|
||||
public $time;
|
||||
public $sunSet;
|
||||
public $sunRise;
|
||||
public $summary;
|
||||
public $icon;
|
||||
public $wicon;
|
||||
public $temperature;
|
||||
public $temperatureRound;
|
||||
public $temperatureNight;
|
||||
public $temperatureNightRound;
|
||||
public $temperatureMorning;
|
||||
public $temperatureMorningRound;
|
||||
public $temperatureEvening;
|
||||
public $temperatureEveningRound;
|
||||
public $temperatureHigh;
|
||||
public $temperatureMaxRound;
|
||||
public $temperatureLow;
|
||||
public $temperatureMinRound;
|
||||
public $temperatureMean;
|
||||
public $temperatureMeanRound;
|
||||
public $apparentTemperature;
|
||||
public $apparentTemperatureRound;
|
||||
public $dewPoint;
|
||||
public $humidity;
|
||||
public $humidityPercent;
|
||||
public $pressure;
|
||||
public $windSpeed;
|
||||
public $windBearing;
|
||||
public $windDirection;
|
||||
public $cloudCover;
|
||||
public $uvIndex;
|
||||
public $visibility;
|
||||
public $ozone;
|
||||
public $location;
|
||||
|
||||
public $temperatureUnit;
|
||||
public $windSpeedUnit;
|
||||
public $visibilityDistanceUnit;
|
||||
|
||||
/** @inheritDoc */
|
||||
public function jsonSerialize(): array
|
||||
{
|
||||
return [
|
||||
'time' => $this->time,
|
||||
'sunSet' => $this->sunSet,
|
||||
'sunRise' => $this->sunRise,
|
||||
'summary' => $this->summary,
|
||||
'icon' => $this->icon,
|
||||
'wicon' => $this->wicon,
|
||||
'temperature' => $this->temperature,
|
||||
'temperatureRound' => $this->temperatureRound,
|
||||
'temperatureNight' => $this->temperatureNight,
|
||||
'temperatureNightRound' => $this->temperatureNightRound,
|
||||
'temperatureMorning' => $this->temperatureMorning,
|
||||
'temperatureMorningRound' => $this->temperatureMorningRound,
|
||||
'temperatureEvening' => $this->temperatureEvening,
|
||||
'temperatureEveningRound' => $this->temperatureEveningRound,
|
||||
'temperatureHigh' => $this->temperatureHigh,
|
||||
'temperatureMaxRound' => $this->temperatureMaxRound,
|
||||
'temperatureLow' => $this->temperatureLow,
|
||||
'temperatureMinRound' => $this->temperatureMinRound,
|
||||
'temperatureMean' => $this->temperatureMean,
|
||||
'temperatureMeanRound' => $this->temperatureMeanRound,
|
||||
'apparentTemperature' => $this->apparentTemperature,
|
||||
'apparentTemperatureRound' => $this->apparentTemperatureRound,
|
||||
'dewPoint' => $this->dewPoint,
|
||||
'humidity' => $this->humidity,
|
||||
'humidityPercent' => $this->humidityPercent,
|
||||
'pressure' => $this->pressure,
|
||||
'windSpeed' => $this->windSpeed,
|
||||
'windBearing' => $this->windBearing,
|
||||
'windDirection' => $this->windDirection,
|
||||
'cloudCover' => $this->cloudCover,
|
||||
'uvIndex' => $this->uvIndex,
|
||||
'visibility' => $this->visibility,
|
||||
'ozone' => $this->ozone,
|
||||
'location' => $this->location,
|
||||
'temperatureUnit' => $this->temperatureUnit,
|
||||
'windSpeedUnit' => $this->windSpeedUnit,
|
||||
'visibilityDistanceUnit' => $this->visibilityDistanceUnit
|
||||
];
|
||||
}
|
||||
|
||||
public function getDefinition(): DataType
|
||||
{
|
||||
$dataType = new DataType();
|
||||
$dataType->id = self::$NAME;
|
||||
$dataType->name = __('Forecast');
|
||||
$dataType
|
||||
->addField('time', 'Time', 'datetime')
|
||||
->addField('sunSet', 'Sun Set', 'datetime')
|
||||
->addField('sunRise', 'Sun Rise', 'datetime')
|
||||
->addField('summary', 'Summary', 'text')
|
||||
->addField('icon', 'Icon', 'text')
|
||||
->addField('wicon', 'Weather Icon', 'text')
|
||||
->addField('temperature', 'Temperature', 'number')
|
||||
->addField('temperatureRound', 'Temperature Round', 'number')
|
||||
->addField('temperatureNight', 'Temperature Night', 'number')
|
||||
->addField('temperatureNightRound', 'Temperature Night Round', 'number')
|
||||
->addField('temperatureMorning', 'Temperature Morning', 'number')
|
||||
->addField('temperatureMorningRound', 'Temperature Morning Round', 'number')
|
||||
->addField('temperatureEvening', 'Temperature Evening', 'number')
|
||||
->addField('temperatureEveningRound', 'Temperature Evening Round', 'number')
|
||||
->addField('temperatureHigh', 'Temperature High', 'number')
|
||||
->addField('temperatureMaxRound', 'Temperature Max Round', 'number')
|
||||
->addField('temperatureLow', 'Temperature Low', 'number')
|
||||
->addField('temperatureMinRound', 'Temperature Min Round', 'number')
|
||||
->addField('temperatureMean', 'Temperature Mean', 'number')
|
||||
->addField('temperatureMeanRound', 'Temperature Mean Round', 'number')
|
||||
->addField('apparentTemperature', 'Apparent Temperature', 'number')
|
||||
->addField('apparentTemperatureRound', 'Apparent Temperature Round', 'number')
|
||||
->addField('dewPoint', 'Dew Point', 'number')
|
||||
->addField('humidity', 'Humidity', 'number')
|
||||
->addField('humidityPercent', 'Humidity Percent', 'number')
|
||||
->addField('pressure', 'Pressure', 'number')
|
||||
->addField('windSpeed', 'Wind Speed', 'number')
|
||||
->addField('windBearing', 'Wind Bearing', 'number')
|
||||
->addField('windDirection', 'Wind Direction', 'text')
|
||||
->addField('cloudCover', 'Cloud Cover', 'number')
|
||||
->addField('uvIndex', 'Uv Index', 'number')
|
||||
->addField('visibility', 'Visibility', 'number')
|
||||
->addField('ozone', 'Ozone', 'number')
|
||||
->addField('location', 'Location', 'text')
|
||||
->addField('temperatureUnit', 'Temperature Unit', 'text')
|
||||
->addField('windSpeedUnit', 'WindSpeed Unit', 'text')
|
||||
->addField('visibilityDistanceUnit', 'VisibilityDistance Unit', 'text');
|
||||
return $dataType;
|
||||
}
|
||||
}
|
||||
70
lib/Widget/DataType/Product.php
Normal file
70
lib/Widget/DataType/Product.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* This file is part of Xibo.
|
||||
*
|
||||
* Xibo is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Xibo is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Xibo\Widget\DataType;
|
||||
|
||||
use Xibo\Widget\Definition\DataType;
|
||||
|
||||
/**
|
||||
* Product DataType (primarily used for the Menu Board component)
|
||||
*/
|
||||
class Product implements \JsonSerializable, DataTypeInterface
|
||||
{
|
||||
public $name;
|
||||
public $price;
|
||||
public $description;
|
||||
public $availability;
|
||||
public $allergyInfo;
|
||||
public $calories;
|
||||
public $image;
|
||||
public $productOptions;
|
||||
|
||||
public function getDefinition(): DataType
|
||||
{
|
||||
$dataType = new DataType();
|
||||
$dataType->id = 'product';
|
||||
$dataType->name = __('Product');
|
||||
$dataType->addField('name', __('Name'), 'string');
|
||||
$dataType->addField('price', __('Price'), 'decimal');
|
||||
$dataType->addField('description', __('Description'), 'string');
|
||||
$dataType->addField('availability', __('Availability'), 'int');
|
||||
$dataType->addField('allergyInfo', __('Allergy Information'), 'string');
|
||||
$dataType->addField('calories', __('Calories'), 'string');
|
||||
$dataType->addField('image', __('Image'), 'int');
|
||||
$dataType->addField('productOptions', __('Product Options'), 'array');
|
||||
return $dataType;
|
||||
}
|
||||
|
||||
public function jsonSerialize(): array
|
||||
{
|
||||
return [
|
||||
'name' => $this->name,
|
||||
'price' => $this->price,
|
||||
'description' => $this->description,
|
||||
'availability' => $this->availability,
|
||||
'calories' => $this->calories,
|
||||
'allergyInfo' => $this->allergyInfo,
|
||||
'image' => $this->image,
|
||||
'productOptions' => $this->productOptions,
|
||||
];
|
||||
}
|
||||
}
|
||||
55
lib/Widget/DataType/ProductCategory.php
Normal file
55
lib/Widget/DataType/ProductCategory.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* This file is part of Xibo.
|
||||
*
|
||||
* Xibo is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Xibo is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Xibo\Widget\DataType;
|
||||
|
||||
use Xibo\Widget\Definition\DataType;
|
||||
|
||||
/**
|
||||
* Product Category (primarily used for the Menu Board component)
|
||||
*/
|
||||
class ProductCategory implements \JsonSerializable, DataTypeInterface
|
||||
{
|
||||
public $name;
|
||||
public $description;
|
||||
public $image;
|
||||
|
||||
public function getDefinition(): DataType
|
||||
{
|
||||
$dataType = new DataType();
|
||||
$dataType->id = 'product-category';
|
||||
$dataType->name = __('Product Category');
|
||||
$dataType->addField('name', __('Name'), 'string');
|
||||
$dataType->addField('description', __('Description'), 'string');
|
||||
$dataType->addField('image', __('Image'), 'int');
|
||||
return $dataType;
|
||||
}
|
||||
|
||||
public function jsonSerialize(): array
|
||||
{
|
||||
return [
|
||||
'name' => $this->name,
|
||||
'description' => $this->description,
|
||||
'image' => $this->image,
|
||||
];
|
||||
}
|
||||
}
|
||||
76
lib/Widget/DataType/SocialMedia.php
Normal file
76
lib/Widget/DataType/SocialMedia.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* This file is part of Xibo.
|
||||
*
|
||||
* Xibo is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Xibo is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Xibo\Widget\DataType;
|
||||
|
||||
use Xibo\Widget\Definition\DataType;
|
||||
|
||||
/**
|
||||
* Social Media DataType
|
||||
*/
|
||||
class SocialMedia implements \JsonSerializable, DataTypeInterface
|
||||
{
|
||||
public static $NAME = 'social-media';
|
||||
public $text;
|
||||
public $user;
|
||||
public $userProfileImage;
|
||||
public $userProfileImageMini;
|
||||
public $userProfileImageBigger;
|
||||
public $location;
|
||||
public $screenName;
|
||||
public $date;
|
||||
public $photo;
|
||||
|
||||
/** @inheritDoc */
|
||||
public function jsonSerialize(): array
|
||||
{
|
||||
return [
|
||||
'text' => $this->text,
|
||||
'user' => $this->user,
|
||||
'userProfileImage' => $this->userProfileImage,
|
||||
'userProfileImageMini' => $this->userProfileImageMini,
|
||||
'userProfileImageBigger' => $this->userProfileImageBigger,
|
||||
'location' => $this->location,
|
||||
'screenName' => $this->screenName,
|
||||
'date' => $this->date,
|
||||
'photo' => $this->photo,
|
||||
];
|
||||
}
|
||||
|
||||
public function getDefinition(): DataType
|
||||
{
|
||||
$dataType = new DataType();
|
||||
$dataType->id = self::$NAME;
|
||||
$dataType->name = __('Social Media');
|
||||
$dataType
|
||||
->addField('text', __('Text'), 'text', true)
|
||||
->addField('user', __('User'), 'text')
|
||||
->addField('userProfileImage', __('Profile Image'), 'image')
|
||||
->addField('userProfileImageMini', __('Mini Profile Image'), 'image')
|
||||
->addField('userProfileImageBigger', __('Bigger Profile Image'), 'image')
|
||||
->addField('location', __('Location'), 'text')
|
||||
->addField('screenName', __('Screen Name'), 'text')
|
||||
->addField('date', __('Date'), 'datetime')
|
||||
->addField('photo', __('Photo'), 'image');
|
||||
return $dataType;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user