2025-01-03 18:07:07 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace app\modules\tgbot\controllers;
|
|
|
|
|
2025-01-20 00:12:30 +03:00
|
|
|
use app\modules\tgbot\models\Tgbot;
|
2025-01-23 20:02:06 +03:00
|
|
|
use app\modules\tgbot\services\TgBotService;
|
2025-01-19 19:21:15 +03:00
|
|
|
use Cassandra\Decimal;
|
2025-01-23 20:02:06 +03:00
|
|
|
use kernel\app_modules\card\models\Card;
|
2025-01-19 17:15:58 +03:00
|
|
|
use kernel\app_modules\tag\service\TagService;
|
2025-01-03 18:07:07 +03:00
|
|
|
use kernel\Controller;
|
2025-01-19 19:21:15 +03:00
|
|
|
use kernel\helpers\Debug;
|
2025-01-19 17:15:58 +03:00
|
|
|
use kernel\modules\post\models\Post;
|
2025-01-03 18:07:07 +03:00
|
|
|
|
|
|
|
class TgMainController extends Controller
|
|
|
|
{
|
|
|
|
|
|
|
|
protected function init(): void
|
|
|
|
{
|
|
|
|
parent::init();
|
|
|
|
$this->cgView->viewPath = APP_DIR . "/modules/tgbot/views/tgbot/main/";
|
|
|
|
$this->cgView->layout = "main.php";
|
|
|
|
$this->cgView->layoutPath = APP_DIR . "/modules/tgbot/views/tgbot/layout/";
|
|
|
|
$this->cgView->addVarToLayout("resources", "/resources/main");
|
|
|
|
}
|
|
|
|
|
|
|
|
public function actionMain(): void
|
|
|
|
{
|
|
|
|
$this->cgView->render("index.php");
|
|
|
|
}
|
|
|
|
|
2025-01-19 17:15:58 +03:00
|
|
|
public function actionNews(): void
|
|
|
|
{
|
2025-01-19 19:21:15 +03:00
|
|
|
$news = TagService::getEntityByTagSlug("novosti", Post::class);
|
2025-01-19 17:15:58 +03:00
|
|
|
|
|
|
|
$this->cgView->render("news.php", ['news' => $news]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function actionPromo(): void
|
|
|
|
{
|
2025-01-19 19:21:15 +03:00
|
|
|
$news = TagService::getEntityByTagSlug("akcii", Post::class);
|
2025-01-19 17:15:58 +03:00
|
|
|
|
|
|
|
$this->cgView->render("news.php", ['news' => $news]);
|
|
|
|
}
|
|
|
|
|
2025-01-23 20:02:06 +03:00
|
|
|
public function actionScanner(): void
|
|
|
|
{
|
|
|
|
$this->cgView->render("scanner.php");
|
|
|
|
}
|
|
|
|
|
|
|
|
public function actionCardAction(int $cardId): void
|
|
|
|
{
|
|
|
|
$card = Card::where("id", $cardId)->first();
|
|
|
|
|
|
|
|
$this->cgView->render("card_action.php", ['card' => $card]);
|
|
|
|
}
|
|
|
|
|
2025-01-03 18:07:07 +03:00
|
|
|
}
|