up templates wiki
This commit is contained in:
parent
bd3d14e9f8
commit
e61d932565
1 changed files with 28 additions and 5 deletions
|
@ -686,8 +686,22 @@ class WikiController extends AbstractController
|
||||||
return $this->redirectToRoute('app_admin_wiki');
|
return $this->redirectToRoute('app_admin_wiki');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Select a random page from the outdated pages
|
// Combine regular_pages and specific_pages into a single array
|
||||||
$randomPage = $jsonData[array_rand($jsonData)];
|
$allPages = [];
|
||||||
|
if (isset($jsonData['regular_pages']) && is_array($jsonData['regular_pages'])) {
|
||||||
|
$allPages = array_merge($allPages, $jsonData['regular_pages']);
|
||||||
|
}
|
||||||
|
if (isset($jsonData['specific_pages']) && is_array($jsonData['specific_pages'])) {
|
||||||
|
$allPages = array_merge($allPages, $jsonData['specific_pages']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($allPages)) {
|
||||||
|
$this->addFlash('error', 'Aucune page à améliorer n\'a été trouvée.');
|
||||||
|
return $this->redirectToRoute('app_admin_wiki');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Select a random page from the combined pages
|
||||||
|
$randomPage = $allPages[array_rand($allPages)];
|
||||||
|
|
||||||
return $this->render('admin/wiki_random_suggestion.html.twig', [
|
return $this->render('admin/wiki_random_suggestion.html.twig', [
|
||||||
'page' => $randomPage
|
'page' => $randomPage
|
||||||
|
@ -939,7 +953,7 @@ class WikiController extends AbstractController
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route('/wiki/compare/{key}', name: 'app_admin_wiki_compare')]
|
#[Route('/wiki/compare/{key}', name: 'app_admin_wiki_compare', requirements: ['key' => '.+'])]
|
||||||
public function compare(string $key): Response
|
public function compare(string $key): Response
|
||||||
{
|
{
|
||||||
$csvFile = $this->getParameter('kernel.project_dir') . '/wiki_compare/wiki_pages.csv';
|
$csvFile = $this->getParameter('kernel.project_dir') . '/wiki_compare/wiki_pages.csv';
|
||||||
|
@ -980,9 +994,18 @@ class WikiController extends AbstractController
|
||||||
|
|
||||||
if (file_exists($jsonFile)) {
|
if (file_exists($jsonFile)) {
|
||||||
$jsonData = json_decode(file_get_contents($jsonFile), true);
|
$jsonData = json_decode(file_get_contents($jsonFile), true);
|
||||||
|
|
||||||
|
// Check both regular_pages and specific_pages sections
|
||||||
|
$allPages = [];
|
||||||
|
if (isset($jsonData['regular_pages']) && is_array($jsonData['regular_pages'])) {
|
||||||
|
$allPages = array_merge($allPages, $jsonData['regular_pages']);
|
||||||
|
}
|
||||||
|
if (isset($jsonData['specific_pages']) && is_array($jsonData['specific_pages'])) {
|
||||||
|
$allPages = array_merge($allPages, $jsonData['specific_pages']);
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($jsonData as $page) {
|
foreach ($allPages as $page) {
|
||||||
if ($page['key'] === $key) {
|
if (isset($page['key']) && $page['key'] === $key) {
|
||||||
$mediaComparison = $page['media_comparison'] ?? null;
|
$mediaComparison = $page['media_comparison'] ?? null;
|
||||||
|
|
||||||
// Deduplicate images by URL in the controller and filter out images that appear in both languages
|
// Deduplicate images by URL in the controller and filter out images that appear in both languages
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue