- Add 8 frontend methods to ArticleRepository (with Redis cache) - Create front\Views\Articles (rendering + utility methods) - Rewire front\view\Site::show() and front\controls\Site::route() to repo + Views - Update 5 article templates to use \front\Views\Articles:: - Convert front\factory\Articles and front\view\Articles to facades - Remove class.Article (entity + static methods migrated to repo + Views) - Remove front\factory\Settings facade (already migrated) - Fix: eliminate global $lang from articleNoindex(), inline page sort query - Tests: 450 OK, 1431 assertions (+13 new) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
58 lines
2.1 KiB
PHP
58 lines
2.1 KiB
PHP
<?php
|
|
namespace front\view;
|
|
|
|
/**
|
|
* FASADA — deleguje do \Domain\Article\ArticleRepository i \front\Views\Articles
|
|
* Zachowana dla wstecznej kompatybilności. Nowy kod powinien używać bezpośrednio repo + Views.
|
|
*/
|
|
class Articles
|
|
{
|
|
public static function news( $page_id, $articles )
|
|
{
|
|
return \front\Views\Articles::news( $page_id, $articles );
|
|
}
|
|
|
|
public static function full_article( $article_id, $lang_id )
|
|
{
|
|
$repo = new \Domain\Article\ArticleRepository( $GLOBALS['mdb'] );
|
|
$article = $repo->articleDetailsFrontend( (int)$article_id, $lang_id );
|
|
return \front\Views\Articles::fullArticle( $article );
|
|
}
|
|
|
|
public static function miniature_articles_list( $page, $lang_id, $bs = 1 )
|
|
{
|
|
$repo = new \Domain\Article\ArticleRepository( $GLOBALS['mdb'] );
|
|
$results = $repo->pageArticles( $page, $lang_id, (int)$bs );
|
|
|
|
$articles = [];
|
|
if ( is_array( $results['articles'] ) ) foreach ( $results['articles'] as $article_id )
|
|
$articles[] = $repo->articleDetailsFrontend( (int)$article_id, $lang_id );
|
|
|
|
return \front\Views\Articles::miniatureArticlesList( $articles, $results['ls'], $bs ?: 1, $page );
|
|
}
|
|
|
|
public static function entry_articles_list( $page, $lang_id, $bs = 1 )
|
|
{
|
|
$repo = new \Domain\Article\ArticleRepository( $GLOBALS['mdb'] );
|
|
$results = $repo->pageArticles( $page, $lang_id, (int)$bs );
|
|
|
|
$articles = [];
|
|
if ( is_array( $results['articles'] ) ) foreach ( $results['articles'] as $article_id )
|
|
$articles[] = $repo->articleDetailsFrontend( (int)$article_id, $lang_id );
|
|
|
|
return \front\Views\Articles::entryArticlesList( $articles, $results['ls'], $bs ?: 1, $page );
|
|
}
|
|
|
|
public static function full_articles_list( $page, $lang_id, $bs = 1 )
|
|
{
|
|
$repo = new \Domain\Article\ArticleRepository( $GLOBALS['mdb'] );
|
|
$results = $repo->pageArticles( $page, $lang_id, (int)$bs );
|
|
|
|
$articles = [];
|
|
if ( is_array( $results['articles'] ) ) foreach ( $results['articles'] as $article_id )
|
|
$articles[] = $repo->articleDetailsFrontend( (int)$article_id, $lang_id );
|
|
|
|
return \front\Views\Articles::fullArticlesList( $articles, $results['ls'], $bs ?: 1, $page );
|
|
}
|
|
}
|