42 lines
1008 B
PHP
42 lines
1008 B
PHP
<?php
|
|
|
|
require_once "class/Task.php";
|
|
|
|
class PicturedTask extends Task
|
|
{
|
|
private string $image_data; // image data or the URL
|
|
private string $image_type; // the type of the image
|
|
|
|
function __construct(string $type, array &$a = null)
|
|
{
|
|
parent::__construct($type, $a);
|
|
$this->image_data = $a["image_data"] ?? ($a["image_url"] ?? "");
|
|
$this->image_type = $a["image_type"] ?? "none";
|
|
}
|
|
|
|
function setImageData(string $image_data): void
|
|
{
|
|
$this->image_data = $image_data;
|
|
}
|
|
|
|
function getImageData(): string
|
|
{
|
|
return $this->image_data;
|
|
}
|
|
|
|
function setImageType(string $image_type): void {
|
|
$this->image_type = $image_type;
|
|
}
|
|
|
|
function getImageType(): string {
|
|
return $this->image_type;
|
|
}
|
|
|
|
function toArray(string $mode = "all"): array
|
|
{
|
|
$a = parent::toArray($mode);
|
|
$a["image_data"] = $this->image_data;
|
|
$a["image_type"] = $this->image_type;
|
|
return $a;
|
|
}
|
|
} |