Files
Leantime/app/Domain/Tickets/Hxcontrollers/TimerButton.php
wangruiguo d647428529
Some checks failed
Security Audit / Composer Security Audit (push) Has been cancelled
Security Audit / NPM Security Audit (push) Has been cancelled
Security Audit / CodeQL Analysis (push) Has been cancelled
OneBot: Leantime 改造版源码(BOM/Univer 表格/AI 接管/品牌替换等)
2026-09-03 18:49:20 +08:00

38 lines
1006 B
PHP

<?php
namespace Leantime\Domain\Tickets\Hxcontrollers;
use Leantime\Core\Controller\HtmxController;
use Leantime\Domain\Timesheets\Services\Timesheets;
class TimerButton extends HtmxController
{
protected static string $view = 'tickets::partials.timerButton';
private Timesheets $timesheetService;
/**
* Controller constructor
*/
public function init(Timesheets $timesheetService): void
{
$this->timesheetService = $timesheetService;
}
public function getStatus(): void
{
$params = $this->incomingRequest->query->all();
$onTheClock = session()->exists('userdata') ? $this->timesheetService->isClocked(session('userdata.id')) : false;
$this->tpl->assign('onTheClock', $onTheClock);
$this->tpl->assign('parentTicketId', $params['request_parts'] ?? false);
}
public function getStatusButton(): void
{
$this->getStatus();
$this->tpl->displayPartial('tickets::partials.timerButton');
}
}