Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 1 addition & 73 deletions src/Modules/Review/Http/ReviewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* HTTP controller for word review interface.
*
* PHP version 8.1
* PHP version 8.2
*
* @category Lwt
* @package Lwt\Modules\Review\Http
Expand All @@ -20,7 +20,6 @@
namespace Lwt\Modules\Review\Http;

use Lwt\Shared\Http\BaseController;
use Lwt\Shared\Infrastructure\Exception\ValidationException;
use Lwt\Modules\Review\Application\ReviewFacade;
use Lwt\Modules\Review\Infrastructure\SessionStateManager;
use Lwt\Modules\Language\Application\LanguageFacade;
Expand Down Expand Up @@ -89,77 +88,6 @@ public function index(array $params): ?\Lwt\Shared\Infrastructure\Http\RedirectR
return null;
}

/**
* Render review header frame.
*
* @param array $params Route parameters
*
* @return void
*
* @psalm-suppress UnusedVariable Variables are used in included view files
*/
public function header(array $params): void
{
$langId = $this->param('lang') !== '' ? (int) $this->param('lang') : null;
$textId = $this->param('text') !== '' ? (int) $this->param('text') : null;
$selection = $this->param('selection') !== '' ? (int) $this->param('selection') : null;

// Get selection data from session criteria
$sessReviewSql = null;
if ($selection !== null && $this->sessionManager->hasCriteria()) {
$sessReviewSql = $this->sessionManager->getSelectionString();
}

$testData = $this->reviewFacade->getReviewDataFromParams(
$selection,
$sessReviewSql,
$langId,
$textId
);

if ($testData === null) {
throw ValidationException::forField(
'parameters',
'Review header requires valid lang, text, or selection parameter'
)->setHttpStatusCode(400);
}

$languageName = $this->reviewFacade->getL2LanguageName(
$langId,
$textId,
$selection,
$sessReviewSql
);

// Initialize session
$dueCount = (int) ($testData['counts']['due'] ?? 0);
$this->reviewFacade->initializeReviewSession($dueCount);

// Pre-compute service output for view
$navLinksHtml = ($textId !== null)
? (new \Lwt\Modules\Text\Application\Services\TextNavigationService())
->getPreviousAndNextTextLinks($textId, '/review?text=', false, '')
: '';
$annotationLinkHtml = ($textId !== null)
? (new \Lwt\Modules\Text\Application\Services\AnnotationService())->getAnnotationLink($textId)
: '';

// Render header views
include __DIR__ . '/../Views/header.php';

// Prepare variables for header content
/** @var mixed $titleRaw */
$titleRaw = $testData['title'] ?? '';
$title = is_string($titleRaw) ? $titleRaw : '';
/** @var mixed $propertyRaw */
$propertyRaw = $testData['property'] ?? '';
$property = is_string($propertyRaw) ? $propertyRaw : '';
$totalDue = $dueCount;
$totalCount = (int) ($testData['counts']['total'] ?? 0);

include __DIR__ . '/../Views/header_content.php';
}

/**
* Get review property from request parameters.
*
Expand Down
80 changes: 0 additions & 80 deletions src/Modules/Review/Views/footer.php

This file was deleted.

65 changes: 0 additions & 65 deletions src/Modules/Review/Views/header.php

This file was deleted.

90 changes: 0 additions & 90 deletions src/Modules/Review/Views/header_content.php

This file was deleted.

Loading