Skip to content

Commit

Permalink
Fix Event, Shoutbox Module
Browse files Browse the repository at this point in the history
  • Loading branch information
kveldscholten committed Oct 22, 2015
1 parent 86c7914 commit 81889cc
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 8 deletions.
11 changes: 9 additions & 2 deletions application/modules/events/controllers/Index.php
Expand Up @@ -76,10 +76,10 @@ public function treatAction()
$height = $size[1];

if ($file_size <= $imageSize AND $width == $imageWidth AND $height == $imageHeight) {
$image = $path.$title.'-'.time().'.'.$endung;
$image = $path.time().'.'.$endung;

if ($this->getRequest()->getParam('id') AND $event->getImage() != '') {
$eventMapper->delImageById($this->getUser()->getId());
$eventMapper->delImageById($this->getRequest()->getParam('id'));
}

$eventModel->setImage($image);
Expand Down Expand Up @@ -117,6 +117,13 @@ public function treatAction()

$this->addMessage('saveSuccess');


if ($this->getRequest()->getPost('image_delete') != '') {
$eventMapper->delImageById($this->getRequest()->getParam('id'));

$this->redirect(array('action' => 'treat', 'id' => $this->getRequest()->getParam('id')));
}

if ($this->getRequest()->getParam('id')) {
$eventId = $this->getRequest()->getParam('id');
$this->redirect(array('controller' => 'show', 'action' => 'event', 'id' => $eventId));
Expand Down
6 changes: 6 additions & 0 deletions application/modules/events/controllers/admin/Index.php
Expand Up @@ -91,6 +91,7 @@ public function treatAction()
$dateCreated = new \Ilch\Date(trim($this->getRequest()->getPost('dateCreated')));
$place = trim($this->getRequest()->getPost('place'));
$text = trim($this->getRequest()->getPost('text'));
$show = trim($this->getRequest()->getPost('calendarShow'));

if (empty($dateCreated)) {
$this->addMessage('missingDate', 'danger');
Expand All @@ -106,13 +107,18 @@ public function treatAction()
$eventModel->setDateCreated($dateCreated);
$eventModel->setPlace($place);
$eventModel->setText($text);
$eventModel->setShow($show);
$eventMapper->save($eventModel);

$this->addMessage('saveSuccess');

$this->redirect(array('action' => 'index'));
}
}

if ($eventMapper->existsTable('calendar') == true) {
$this->getView()->set('calendarShow', 1);
}
}

public function showAction()
Expand Down
1 change: 1 addition & 0 deletions application/modules/events/translations/de.php
Expand Up @@ -58,6 +58,7 @@
'imageSizeBytes' => 'Bild max Größe in Bytes',
'height' => 'hoch',
'width' => 'breit',
'imageDelete' => 'Bild löschen?',
'imageSize' => 'Bildgröße',
'maxFilesize' => 'Maximale Dateigröße',
'imageAllowedFileExtensions' => 'Erlaubte Dateiendungen',
Expand Down
1 change: 1 addition & 0 deletions application/modules/events/translations/en.php
Expand Up @@ -58,6 +58,7 @@
'imageSizeBytes' => 'Image max Size in Bytes',
'height' => 'height',
'width' => 'width',
'imageDelete' => 'Image delete?',
'avatarSize' => 'image Size',
'maxFilesize' => 'Maximum file size',
'avatarAllowedFileExtensions' => 'Allowed file extensions',
Expand Down
10 changes: 10 additions & 0 deletions application/modules/events/views/admin/index/treat.php
Expand Up @@ -61,6 +61,16 @@
rows="5"><?php if ($this->get('event') != '') { echo $this->escape($this->get('event')->getText()); } ?></textarea>
</div>
</div>
<?php if ($this->get('calendarShow') == 1): ?>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<input value="1" type="checkbox" name="calendarShow" id="calendarShow" <?php if ($this->get('event') != '' AND $this->get('event')->getShow() == 1) { echo 'checked'; } ?> />
<label for="calendarShow">
<?=$this->getTrans('calendarShow') ?>
</label>
</div>
</div>
<?php endif; ?>
<?php if ($this->get('event') != ''): ?>
<?=$this->getSaveBar('updateButton') ?>
<?php else: ?>
Expand Down
6 changes: 6 additions & 0 deletions application/modules/events/views/index/treat.php
Expand Up @@ -27,6 +27,12 @@
</div>
<?php endif; ?>
<div class="col-lg-7">
<?php if ($this->get('event') != '' AND $this->get('event')->getImage() != ''): ?>
<label for="image_delete" style="margin-left: 10px; margin-top: 10px;">
<input type="checkbox" name="image_delete" id="image_delete"> <?=$this->getTrans('imageDelete') ?>
</label>
<?php endif; ?>

<p><?=$this->getTrans('imageSize') ?>: <?=$this->get('image_width') ?> Pixel <?=$this->getTrans('width') ?>, <?=$this->get('image_height') ?> Pixel <?=$this->getTrans('height') ?>.</p>
<p><?=$this->getTrans('maxFilesize') ?>: <?=$settingMapper->getNicebytes($this->get('image_size')) ?>.</p>
<p><?=$this->getTrans('imageAllowedFileExtensions') ?>: <?=str_replace(' ', ', ', $this->get('image_filetypes')) ?></p>
Expand Down
8 changes: 2 additions & 6 deletions application/modules/shoutbox/boxes/views/shoutbox.php
Expand Up @@ -63,9 +63,7 @@
</div>
<?php if (count($this->get('shoutbox')) == $config->get('shoutbox_limit')): ?>
<div class="pull-right">
<button class="btn">
<a href="<?=$this->getUrl('shoutbox/index/index/') ?>"><?=$this->getTrans('archive') ?></a>
</button>
<a href="<?=$this->getUrl('shoutbox/index/index/') ?>" class="btn btn-default"><?=$this->getTrans('archive') ?></a>
</div>
<?php endif; ?>
</div>
Expand Down Expand Up @@ -117,9 +115,7 @@ class="form-control"
</div>
<?php if (count($this->get('shoutbox')) == $config->get('shoutbox_limit')): ?>
<div class="pull-right">
<button class="btn">
<a href="<?=$this->getUrl('shoutbox/index/index/') ?>"><?=$this->getTrans('archive') ?></a>
</button>
<a href="<?=$this->getUrl('shoutbox/index/index/') ?>" class="btn btn-default"><?=$this->getTrans('archive') ?></a>
</div>
<?php endif; ?>
</div>
Expand Down

0 comments on commit 81889cc

Please sign in to comment.