2025-01-31 18:20:13 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
2020-06-07 19:04:43 +03:00
|
|
|
namespace openvk\Web\Models\Entities;
|
2025-01-31 18:20:13 +03:00
|
|
|
|
2020-06-07 19:04:43 +03:00
|
|
|
use openvk\Web\Util\DateTime;
|
|
|
|
use openvk\Web\Models\RowModel;
|
|
|
|
use openvk\Web\Models\Repositories\Users;
|
|
|
|
|
|
|
|
class Ticket extends RowModel
|
|
|
|
{
|
2025-01-31 18:20:13 +03:00
|
|
|
use Traits\TRichText;
|
2020-06-07 19:04:43 +03:00
|
|
|
protected $tableName = "tickets";
|
2025-01-31 18:20:13 +03:00
|
|
|
|
2021-11-17 22:39:22 +03:00
|
|
|
private $overrideContentColumn = "text";
|
2020-06-07 19:04:43 +03:00
|
|
|
|
2025-01-31 18:20:13 +03:00
|
|
|
public function getId(): int
|
2020-06-07 19:04:43 +03:00
|
|
|
{
|
|
|
|
return $this->getRecord()->id;
|
|
|
|
}
|
2025-01-31 18:20:13 +03:00
|
|
|
|
|
|
|
public function getStatus(): string
|
2020-06-07 19:04:43 +03:00
|
|
|
{
|
2021-12-10 19:36:50 +03:00
|
|
|
return tr("support_status_" . $this->getRecord()->type);
|
2020-06-07 19:04:43 +03:00
|
|
|
}
|
2025-01-31 18:20:13 +03:00
|
|
|
|
|
|
|
public function getType(): int
|
2020-06-07 19:04:43 +03:00
|
|
|
{
|
|
|
|
return $this->getRecord()->type;
|
|
|
|
}
|
2025-01-31 18:20:13 +03:00
|
|
|
|
|
|
|
public function getName(): string
|
2020-06-07 19:04:43 +03:00
|
|
|
{
|
|
|
|
return ovk_proc_strtr($this->getRecord()->name, 100);
|
|
|
|
}
|
2025-01-31 18:20:13 +03:00
|
|
|
|
|
|
|
public function getContext(): string
|
2020-06-07 19:04:43 +03:00
|
|
|
{
|
2021-10-09 13:46:41 +03:00
|
|
|
$text = $this->getRecord()->text;
|
|
|
|
$text = $this->formatLinks($text);
|
|
|
|
$text = $this->removeZalgo($text);
|
|
|
|
$text = nl2br($text);
|
|
|
|
return $text;
|
2020-06-07 19:04:43 +03:00
|
|
|
}
|
2025-01-31 18:20:13 +03:00
|
|
|
|
|
|
|
public function getTime(): DateTime
|
2020-06-07 19:04:43 +03:00
|
|
|
{
|
|
|
|
return new DateTime($this->getRecord()->created);
|
|
|
|
}
|
2025-01-31 18:20:13 +03:00
|
|
|
|
|
|
|
public function isDeleted(): bool
|
2020-06-07 19:04:43 +03:00
|
|
|
{
|
2021-12-10 19:36:50 +03:00
|
|
|
return (bool) $this->getRecord()->deleted;
|
2020-06-07 19:04:43 +03:00
|
|
|
}
|
2025-01-31 18:20:13 +03:00
|
|
|
|
|
|
|
public function getUser(): user
|
2020-06-07 19:04:43 +03:00
|
|
|
{
|
2025-01-31 18:20:13 +03:00
|
|
|
return (new Users())->get($this->getRecord()->user_id);
|
2020-06-07 19:04:43 +03:00
|
|
|
}
|
2021-10-09 13:46:41 +03:00
|
|
|
|
2025-01-31 18:20:13 +03:00
|
|
|
public function getUserId(): int
|
2021-12-10 19:36:50 +03:00
|
|
|
{
|
|
|
|
return $this->getRecord()->user_id;
|
|
|
|
}
|
|
|
|
|
2025-01-31 18:20:13 +03:00
|
|
|
public function isAd(): bool /* Эх, костыли... */
|
2021-10-09 13:55:25 +03:00
|
|
|
{
|
2025-01-31 18:20:13 +03:00
|
|
|
return false;
|
2021-10-09 13:55:25 +03:00
|
|
|
}
|
2020-06-07 19:04:43 +03:00
|
|
|
}
|