aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/admin/banner.php24
-rw-r--r--app/views/admin/banner/edit.php18
-rw-r--r--app/views/admin/banner/info.php17
3 files changed, 49 insertions, 10 deletions
diff --git a/app/controllers/admin/banner.php b/app/controllers/admin/banner.php
index 5199bbc..ee11787 100644
--- a/app/controllers/admin/banner.php
+++ b/app/controllers/admin/banner.php
@@ -102,6 +102,7 @@ class Admin_BannerController extends AuthenticatedController
// edit banner input
if (Request::submitted('speichern')) {
$banner_path = Request::get('banner_path');
+ $banner_mobile_path = Request::get('banner_mobile_path');
$description = Request::get('description');
$alttext = Request::get('alttext');
$target_type = Request::get('target_type');
@@ -132,6 +133,12 @@ class Admin_BannerController extends AuthenticatedController
$errors[] = _('Es wurde kein Bild ausgewählt.');
}
+ // upload mobile banner file
+ $upload = $_FILES['imgfile_mobile'];
+ if (!empty($upload['name'])) {
+ $banner_mobile_path = $this->bannerupload($upload['tmp_name'], $upload['size'], $upload['name'], $errors);
+ }
+
$startdate = strtotime(Request::get('start_date', 0));
$enddate = strtotime(Request::get('end_date', 0));
@@ -173,14 +180,15 @@ class Admin_BannerController extends AuthenticatedController
PageLayout::postError(_('Es sind folgende Fehler aufgetreten:'), $errors);
$this->redirect('admin/banner');
} else {
- $banner->banner_path = $banner_path;
- $banner->description = $description;
- $banner->alttext = $alttext;
- $banner->target_type = $target_type;
- $banner->target = $target;
- $banner->startdate = $startdate;
- $banner->enddate = $enddate;
- $banner->priority = $priority;
+ $banner->banner_path = $banner_path;
+ $banner->banner_mobile_path = $banner_mobile_path;
+ $banner->description = $description;
+ $banner->alttext = $alttext;
+ $banner->target_type = $target_type;
+ $banner->target = $target;
+ $banner->startdate = $startdate;
+ $banner->enddate = $enddate;
+ $banner->priority = $priority;
$banner->store();
$assignedroles = Request::intArray('assignedroles');
diff --git a/app/views/admin/banner/edit.php b/app/views/admin/banner/edit.php
index 9bf48f5..b99e108 100644
--- a/app/views/admin/banner/edit.php
+++ b/app/views/admin/banner/edit.php
@@ -18,6 +18,8 @@
<fieldset>
<label>
+ <?= _('Banner:') ?><br>
+
<? if ($banner['banner_path']) : ?>
<?= $banner->toImg(['style' => 'max-width:500px']) ?>
<? else : ?>
@@ -32,6 +34,22 @@
</label>
<label>
+ <?= _('Mobiles Banner (optional):') ?><br>
+
+ <? if ($banner['banner_mobile_path']) : ?>
+ <?= $banner->toImg(['style' => 'max-width:500px'], true) ?>
+ <? else : ?>
+ <?= _('Noch kein Bild hochgeladen') ?>
+ <? endif; ?><br>
+
+ <label class="file-upload">
+ <?= _('Bilddatei auswählen') ?>
+ <input id="imgfile_mobile" name="imgfile_mobile" type="file" accept="image/*">
+ <input type="hidden" name="banner_mobile_path" value="<?= $banner['banner_mobile_path'] ?>">
+ </label>
+ </label>
+
+ <label>
<?= _('Beschreibung:') ?>
<input type="text" id="description" name="description" value="<?= htmlReady($banner['description']) ?>" size="40" maxlength="254">
</label>
diff --git a/app/views/admin/banner/info.php b/app/views/admin/banner/info.php
index be5df97..8fa4cbe 100644
--- a/app/views/admin/banner/info.php
+++ b/app/views/admin/banner/info.php
@@ -10,14 +10,27 @@
<table class="default">
<tbody>
<tr>
- <td rowspan="9" colspan="2" style="text-align: center;">
+ <td><?= _("Banner:") ?></td>
+ <td style="text-align: left;">
<? if ($banner['banner_path']): ?>
- <?= $banner->toImg() ?>
+ <?= $banner->toImg(['style' => 'max-width:100%']) ?>
<? else: ?>
<?= _('noch kein Bild hochgeladen') ?>
<? endif; ?>
</td>
</tr>
+ <? if ($banner['banner_mobile_path']) : ?>
+ <tr>
+ <td><?= _("Mobiles Banner:") ?></td>
+ <td style="text-align: left;">
+ <? if ($banner['banner_mobile_path']): ?>
+ <?= $banner->toImg(['style' => 'max-width:100%'], true) ?>
+ <? else: ?>
+ <?= _('noch kein Bild hochgeladen') ?>
+ <? endif; ?>
+ </td>
+ </tr>
+ <? endif; ?>
<tr>
<td><?= _("Beschreibung:") ?></td>
<td>