Skip to content

Commit

Permalink
Fix error when box with specific locale is missing (#892)
Browse files Browse the repository at this point in the history
  • Loading branch information
blackcoder87 authored Dec 30, 2023
1 parent 2505ba8 commit 461cdff
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 47 deletions.
5 changes: 4 additions & 1 deletion application/modules/admin/translations/de.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
'off' => 'Aus',
'yes' => 'Ja',
'no' => 'Nein',
'httpOrMedia' => 'http:// oder Medien',
'httpOrMedia' => 'https:// oder Medien',
'favicon' => 'Favicon',
'appleIcon' => 'Apple Touch Icon',
'backendFunctions' => 'Backend - Funktionen',
Expand Down Expand Up @@ -181,6 +181,9 @@
'addButtonBox' => 'Box anlegen',
'updateButtonBox' => 'Box aktualisieren',
'noBoxes' => 'Keine Boxen vorhanden',
'multilingualContent' => 'Mehrsprachiger Inhalt',
'addContentLanguage' => 'Sprache hinzufügen',
'editContentLanguage' => 'Sprache bearbeiten',
'notVisible' => 'Nicht sichtbar für',
'selectAssignedGroups' => 'Ausgewählte Gruppen',
'askIfDeleteBox' => 'Sind Sie sicher, dass die Box "%s" entfernt werden soll?',
Expand Down
5 changes: 4 additions & 1 deletion application/modules/admin/translations/en.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
'off' => 'Off',
'yes' => 'Yes',
'no' => 'No',
'httpOrMedia' => 'http:// or Media',
'httpOrMedia' => 'https:// or Media',
'favicon' => 'Favicon',
'appleIcon' => 'Apple Touch Icon',
'backendFunctions' => 'Backend - Functions',
Expand Down Expand Up @@ -181,6 +181,9 @@
'addButtonBox' => 'Add box',
'updateButtonBox' => 'Update box',
'noBoxes' => 'No Boxes',
'multilingualContent' => 'Multilingual content',
'addContentLanguage' => 'Add a language',
'editContentLanguage' => 'Edit the language',
'notVisible' => 'Not visible for',
'selectAssignedGroups' => 'Selected groups',
'askIfDeleteBox' => 'Are you sure you want delete the box "%s"?',
Expand Down
28 changes: 14 additions & 14 deletions application/modules/admin/views/admin/boxes/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<col class="icon_width">
<col class="icon_width">
<col>
<?php if ($this->get('multilingual')): ?>
<?php if ($this->get('multilingual')) : ?>
<col class="col-lg-1">
<?php endif; ?>
</colgroup>
Expand All @@ -24,44 +24,44 @@
<th>
<a href="<?=$this->getUrl($this->get('sorter')->getUrlArray('title')) ?>" title="<?=$this->getTrans('boxTitle') ?>"><?=$this->get('sorter')->getArrowHtml('title') ?> <?=$this->getTrans('boxTitle') ?></a>&nbsp;
</th>
<?php if ($this->get('multilingual')): ?>
<?php if ($this->get('multilingual')) : ?>
<th class="text-right">
<?php foreach ($this->getTranslator()->getLocaleList() as $key => $value): ?>
<?php if ($key == $this->get('contentLanguage')): ?>
<?php foreach ($this->getTranslator()->getLocaleList() as $key => $value) : ?>
<?php if ($key == $this->get('contentLanguage')) : ?>
<?php continue; ?>
<?php endif; ?>

<img src="<?=$this->getStaticUrl('img/lang/'.$key.'.png') ?>">
<img src="<?=$this->getStaticUrl('img/lang/' . $key . '.png') ?>" alt="<?=$this->getTrans('multilingualContent') ?>" title="<?=$this->getTrans('multilingualContent') ?>">
<?php endforeach; ?>
</th>
<?php endif; ?>
</tr>
</thead>
<tbody>
<?php if (!empty($this->get('boxes'))): ?>
<?php foreach ($this->get('boxes') as $box): ?>
<?php if (!empty($this->get('boxes'))) : ?>
<?php foreach ($this->get('boxes') as $box) : ?>
<tr>
<td><?=$this->getDeleteCheckbox('check_boxes', $box->getId()) ?></td>
<td><?=$this->getEditIcon(['action' => 'treat', 'id' => $box->getId()]) ?></td>
<td><?=$this->getDeleteIcon(['action' => 'delete', 'id' => $box->getId()]) ?> </td>
<td>
<?php if ($box->getTitle() !== ''): ?>
<?php if ($box->getTitle() !== '') : ?>
<?=$this->escape($box->getTitle()) ?>
<?php else: ?>
<?=$this->getTrans('noTitleBox') ?>
<?php endif; ?>
</td>
<?php if ($this->get('multilingual')): ?>
<?php if ($this->get('multilingual')) : ?>
<td class="text-right">
<?php foreach ($this->getTranslator()->getLocaleList() as $key => $value): ?>
<?php if ($key == $this->get('contentLanguage')): ?>
<?php foreach ($this->getTranslator()->getLocaleList() as $key => $value) : ?>
<?php if ($key == $this->get('contentLanguage')) : ?>
<?php continue; ?>
<?php endif; ?>

<?php if ($this->get('boxMapper')->getSelfBoxByIdLocale($box->getId(), $key) != null): ?>
<a href="<?=$this->getUrl(['action' => 'treat', 'id' => $box->getId(), 'locale' => $key]) ?>"><i class="fa-regular fa-pen-to-square"></i></a>
<?php if ($this->get('boxMapper')->getSelfBoxByIdLocale($box->getId(), $key) != null) : ?>
<a href="<?=$this->getUrl(['action' => 'treat', 'id' => $box->getId(), 'locale' => $key]) ?>" title="<?=$this->getTrans('editContentLanguage') ?>"><i class="fa-regular fa-pen-to-square"></i></a>
<?php else: ?>
<a href="<?=$this->getUrl(['action' => 'treat', 'id' => $box->getId(), 'locale' => $key]) ?>"><i class="fa-solid fa-circle-plus"></i></a>
<a href="<?=$this->getUrl(['action' => 'treat', 'id' => $box->getId(), 'locale' => $key]) ?>" title="<?=$this->getTrans('addContentLanguage') ?>"><i class="fa-solid fa-circle-plus"></i></a>
<?php endif; ?>
<?php endforeach; ?>
</td>
Expand Down
58 changes: 27 additions & 31 deletions application/modules/admin/views/admin/page/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<col class="icon_width">
<col class="icon_width">
<col>
<?php if ($this->get('multilingual')): ?>
<?php if ($this->get('multilingual')) : ?>
<col class="col-lg-1">
<?php endif; ?>
</colgroup>
Expand All @@ -22,48 +22,44 @@
<th>
<a href="<?=$this->getUrl($this->get('sorter')->getUrlArray('title')) ?>" title="<?=$this->getTrans('pageTitle') ?>"><?=$this->get('sorter')->getArrowHtml('title') ?> <?=$this->getTrans('pageTitle') ?></a>&nbsp;
</th>
<?php
if ($this->get('multilingual')) {
echo '<th class="text-right">';
<?php if ($this->get('multilingual')) : ?>
<th class="text-right">
<?php foreach ($this->getTranslator()->getLocaleList() as $key => $value) : ?>
<?php if ($key == $this->get('contentLanguage')) : ?>
<?php continue; ?>
<?php endif; ?>

foreach ($this->getTranslator()->getLocaleList() as $key => $value) {
if ($key == $this->get('contentLanguage')) {
continue;
}
echo '<img src="'.$this->getStaticUrl('img/lang/'.$key.'.png').'"> ';
}
echo '</th>';
}
?>
<img src="<?=$this->getStaticUrl('img/lang/' . $key . '.png') ?>" alt="<?=$this->getTrans('multilingualContent') ?>" title="<?=$this->getTrans('multilingualContent') ?>">
<?php endforeach; ?>
</th>
<?php endif; ?>
</tr>
</thead>
<tbody>
<?php if (!empty($this->get('pages'))): ?>
<?php foreach ($this->get('pages') as $page): ?>
<?php if (!empty($this->get('pages'))) : ?>
<?php foreach ($this->get('pages') as $page) : ?>
<tr>
<td><?=$this->getDeleteCheckbox('check_pages', $page->getId()) ?></td>
<td><?=$this->getEditIcon(['action' => 'treat', 'id' => $page->getId()]) ?></td>
<td><?=$this->getDeleteIcon(['action' => 'delete', 'id' => $page->getId()]) ?></td>
<td>
<a target="_blank" href="<?=$this->getUrl().'index.php/'.$this->escape($page->getPerma()) ?>"><?=$this->escape($page->getTitle()) ?></a>
</td>
<?php
if ($this->get('multilingual')) {
echo '<td class="text-right">';
foreach ($this->getTranslator()->getLocaleList() as $key => $value) {
if ($key == $this->get('contentLanguage')) {
continue;
}
<?php if ($this->get('multilingual')) : ?>
<td class="text-right">
<?php foreach ($this->getTranslator()->getLocaleList() as $key => $value) : ?>
<?php if ($key == $this->get('contentLanguage')) : ?>
<?php continue; ?>
<?php endif; ?>

if ($this->get('pageMapper')->getPageByIdLocale($page->getId(), $key) != null) {
echo '<a href="'.$this->getUrl(['action' => 'treat', 'id' => $page->getId(), 'locale' => $key]).'"><i class="fa-regular fa-pen-to-square"></i></a>';
} else {
echo '<a href="'.$this->getUrl(['action' => 'treat', 'id' => $page->getId(), 'locale' => $key]).'"><i class="fa-solid fa-circle-plus"></i></a>';
}
}
echo '</td>';
}
?>
<?php if ($this->get('pageMapper')->getPageByIdLocale($page->getId(), $key) != null) : ?>
<a href="<?=$this->getUrl(['action' => 'treat', 'id' => $page->getId(), 'locale' => $key]) ?>" title="<?=$this->getTrans('editContentLanguage') ?>"><i class="fa-regular fa-pen-to-square"></i></a>
<?php else: ?>
<a href="<?=$this->getUrl(['action' => 'treat', 'id' => $page->getId(), 'locale' => $key]) ?>" title="<?=$this->getTrans('addContentLanguage') ?>"><i class="fa-solid fa-circle-plus"></i></a>
<?php endif; ?>
<?php endforeach; ?>
</td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
<?php else: ?>
Expand Down

0 comments on commit 461cdff

Please sign in to comment.