Pass the complete event to the view, to allow more flexible template contents.
authorJan Schneider <jan@horde.org>
Thu, 3 Jun 2010 10:43:30 +0000 (12:43 +0200)
committerJan Schneider <jan@horde.org>
Thu, 3 Jun 2010 10:43:30 +0000 (12:43 +0200)
kronolith/lib/Kronolith.php
kronolith/templates/itip/notification.html.php
kronolith/templates/itip/notification.plain.php

index bd8260c..f9c2391 100644 (file)
@@ -2128,6 +2128,7 @@ class Kronolith
         $share = $GLOBALS['kronolith_shares']->getShare($event->calendar);
         $view = new Horde_View(array('templatePath' => KRONOLITH_TEMPLATES . '/itip'));
         new Horde_View_Helper_Text($view);
+        $view->event = $event;
 
         foreach ($event->attendees as $email => $status) {
             /* Don't bother sending an invitation/update if the recipient does
@@ -2171,16 +2172,6 @@ class Kronolith
                 break;
             }
 
-            $view->title = $event->getTitle();
-            $view->start = $event->start;
-            $view->end   = $event->end;
-            if (strlen($event->location)) {
-                $view->location = $event->location;
-            }
-            if (strlen($event->description)) {
-                $view->description = $event->description;
-            }
-
             if ($event->attendees) {
                 $attendees = array();
                 foreach ($event->attendees as $mail => $attendee) {
index 0d5b216..49f6ac8 100644 (file)
@@ -2,27 +2,30 @@
 
 <table style="border-collapse:collapse;border:1px solid #000" border="1">
   <thead><tr>
-    <th colspan="2" style="font-weight:bold;font-size:120%;background-color:#ddd"><?= $this->h($this->title) ?></th>
+    <th colspan="2" style="font-weight:bold;font-size:120%;background-color:#ddd"><?= $this->h($this->event->getTitle()) ?></th>
   </tr></thead>
   <tbody>
     <tr>
       <td style="font-weight:bold;vertical-align:top"><?= _("Start:") ?></td>
-      <td><?= $this->h($this->start->strftime('%x %X')) ?></td>
+      <td><?= $this->h($this->event->start->strftime('%x %X')) ?></td>
     </tr>
     <tr>
       <td style="font-weight:bold;vertical-align:top"><?= _("End:") ?></td>
-      <td><?= $this->h($this->end->strftime('%x %X')) ?></td>
+      <td><?= $this->h($this->event->end->strftime('%x %X')) ?></td>
     </tr>
+    <? if (strlen($this->event->location)): ?>
     <tr>
       <td style="font-weight:bold;vertical-align:top"><?= _("Location:") ?></td>
-      <td><?= $this->h($this->location) ?></td>
+      <td><?= $this->h($this->event->location) ?></td>
     </tr>
-    <? if (isset($this->description)): ?>
+    <? endif; ?>
+    <? if (strlen($this->event->description)): ?>
     <tr>
       <td style="font-weight:bold;vertical-align:top"><?= _("Description:") ?></td>
-         <td><?= Horde_Text_Filter::filter($this->description, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'callback' => null, 'class' => null, 'charset' => Horde_Nls::getCharset())) ?></td>
+         <td><?= Horde_Text_Filter::filter($this->event->description, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'callback' => null, 'class' => null, 'charset' => Horde_Nls::getCharset())) ?></td>
     </tr>
     <? endif; ?>
+    <? if ($this->attendees): ?>
     <tr>
       <td style="font-weight:bold;vertical-align:top"><?= _("Attendees:") ?></td>
       <td>
@@ -35,6 +38,7 @@
         <? endforeach; ?>
       </td>
     </tr>
+    <? endif; ?>
   </tbody>
 </table>
 
index 505e2a7..65f8bc5 100644 (file)
@@ -1,16 +1,20 @@
-<?= $this->subject ?> (<? printf(_("on %s at %s"), $this->start->strftime('%x'), $this->start->strftime('%X')) ?>)
+<?= $this->subject ?> (<? printf(_("on %s at %s"), $this->event->start->strftime('%x'), $this->event->start->strftime('%X')) ?>)
 
-<?= _("Location:") ?> <?= $this->location ?>
+<? if (strlen($this->event->location)): ?>
+<?= _("Location:") ?> <?= $this->event->location ?>
 
 
+<? endif; ?>
+<? if ($this->attendees): ?>
 <?= _("Attendees:") ?> <?= implode(', ', $this->attendees) ?>
 
 
-<? if (isset($this->description)): ?>
+<? endif; ?>
+<? if (strlen($this->event->description)): ?>
 <?= _("The following is a more detailed description of the event:") ?>
 
 
-<?= $this->description ?>
+<?= $this->event->description ?>
 
 
 <? endif; ?>