Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error when box with specific locale is missing #892

Merged
merged 1 commit into from
Dec 30, 2023
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
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