- Introduced Domain\Article\ArticleRepository for better data access. - Migrated article_edit functionality to admin\Controllers\ArticlesController. - Updated admin\factory\Articles::article_details() to use the new repository. - Marked legacy methods in admin\controls as @deprecated for clarity. - Updated changelog and versioning to reflect changes in version 0.242.
47 lines
1.1 KiB
PHP
47 lines
1.1 KiB
PHP
<?php
|
|
namespace admin\Controllers;
|
|
|
|
use Domain\Article\ArticleRepository;
|
|
|
|
class ArticlesController
|
|
{
|
|
private ArticleRepository $repository;
|
|
|
|
public function __construct(ArticleRepository $repository)
|
|
{
|
|
$this->repository = $repository;
|
|
}
|
|
|
|
/**
|
|
* Lista artykulow
|
|
*/
|
|
public function list(): string
|
|
{
|
|
return \admin\view\Articles::articles_list();
|
|
}
|
|
|
|
/**
|
|
* Edycja artykulu
|
|
*/
|
|
public function edit(): string
|
|
{
|
|
global $user;
|
|
|
|
if (!$user) {
|
|
header('Location: /admin/');
|
|
exit;
|
|
}
|
|
|
|
\admin\factory\Articles::delete_nonassigned_images();
|
|
\admin\factory\Articles::delete_nonassigned_files();
|
|
|
|
return \Tpl::view('articles/article-edit', [
|
|
'article' => $this->repository->find((int)\S::get('id')),
|
|
'menus' => \admin\factory\Pages::menus_list(),
|
|
'languages' => \admin\factory\Languages::languages_list(),
|
|
'layouts' => \admin\factory\Layouts::layouts_list(),
|
|
'user' => $user
|
|
]);
|
|
}
|
|
}
|