From bba37b84a1214985cca1d0fbbac661fe27b58021 Mon Sep 17 00:00:00 2001
From: Patrick Seeger <pseeger@ccwn.org>
Date: Fri, 20 Jun 2014 12:44:01 +0200
Subject: =?UTF-8?q?Hintergrundbilder=20auch=20f=C3=BCr=20Vereine.=20Anzeig?=
 =?UTF-8?q?e=20verbessert?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 protected/controllers/MyVereinController.php | 9 +++++++++
 protected/views/verein/_form.php             | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/protected/controllers/MyVereinController.php b/protected/controllers/MyVereinController.php
index c019f73..2f606a6 100644
--- a/protected/controllers/MyVereinController.php
+++ b/protected/controllers/MyVereinController.php
@@ -68,6 +68,7 @@ class MyVereinController extends Controller
 		{
 			$model->attributes = $_POST['Verein'];
 			$model->uploadedImage = CUploadedFile::getInstance($model, 'uploadedImage');
+			$model->uploadedHintergrund = CUploadedFile::getInstance($model, 'uploadedHintergrund');
 			Yii::trace("Bild: ".$model->uploadedImage, "admin.astaf.verein");
 			if($model->save()) {
 				Yii::trace("Verein gespeichert", "admin.astaf.verein");
@@ -91,6 +92,14 @@ class MyVereinController extends Controller
 	        }
 	        $model->bild = "/".$filename;
 	        $model->save();
+	    }
+	    if (null !== $model->uploadedHintergrund)  {
+	    	$filename = VereinImageFunctions::resizeAndSaveBG($model->uploadedHintergrund, $model->slug);
+	    	if (null === $filename) {
+	    		throw new CHttpException(500, 'Error while saving image.');
+	    	}
+	    	$model->hintergrund = "/".$filename;
+	    	$model->save();
 	    }
 	}
 
diff --git a/protected/views/verein/_form.php b/protected/views/verein/_form.php
index c51b922..dbdcd7b 100644
--- a/protected/views/verein/_form.php
+++ b/protected/views/verein/_form.php
@@ -110,7 +110,9 @@
 		Das Bild wird von oben her genutzt und mit einem halbtransparenten Weißton überlagert.
 		</p>
 		<?php echo $form->labelEx($model,'hintergrund'); ?>
+		<?php if ($model->hintergrund) {?>
 		<?php echo CHtml::image($model->hintergrund,'height="80"'); ?><br/>
+		<?php }?>
 		<?php echo $form->fileField($model,'uploadedHintergrund', array('size'=>60)); ?>
 		<?php echo $form->error($model,'hintergrund'); ?>
 	</div>
-- 
cgit v1.0-28-g1787

