From 6159b79715d77b2128934409fcbd81557a67ea37 Mon Sep 17 00:00:00 2001
From: Bart Visscher <bartv@thisnet.nl>
Date: Sat, 1 Oct 2011 01:14:09 +0200
Subject: [PATCH] Take setting default value out of loop

---
 apps/calendar/templates/part.eventform.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/apps/calendar/templates/part.eventform.php b/apps/calendar/templates/part.eventform.php
index 4c34b3e1fc..8588b9168f 100644
--- a/apps/calendar/templates/part.eventform.php
+++ b/apps/calendar/templates/part.eventform.php
@@ -12,8 +12,8 @@
 			<td>
 			<select id="category" name="categories[]" multiple="multiple" title="<?php echo $l->t("Select category") ?>">
 				<?php
+				if (!isset($_['categories'])) {$_['categories'] = array();}
 				foreach($_['category_options'] as $category){
-					if (!isset($_['categories'])) {$_['categories'] = array();}
 					echo '<option value="' . $category . '"' . (in_array($category, $_['categories']) ? ' selected="selected"' : '') . '>' . $category . '</option>';
 				}
 				?>
@@ -22,8 +22,8 @@
 			<td>
 			<select style="width:140px;" name="calendar">
 				<?php
+				if (!isset($_['calendar'])) {$_['calendar'] = false;}
 				foreach($_['calendar_options'] as $calendar){
-					if (!isset($_['calendar'])) {$_['calendar'] = false;}
 					echo '<option value="' . $calendar['id'] . '"' . ($_['calendar'] == $calendar['id'] ? ' selected="selected"' : '') . '>' . $calendar['displayname'] . '</option>';
 				}
 				?>
-- 
GitLab