Remaining PHP5 code changes, Horde 4 style for kronolith
authorMichael J. Rubinsky <mrubinsk@horde.org>
Wed, 26 Jan 2011 18:57:50 +0000 (13:57 -0500)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Wed, 26 Jan 2011 18:58:35 +0000 (13:58 -0500)
17 files changed:
kronolith/lib/Day.php
kronolith/lib/Driver.php
kronolith/lib/Storage/Kolab.php
kronolith/lib/Storage/Sql.php
kronolith/lib/View/Day.php
kronolith/lib/View/DeleteEvent.php
kronolith/lib/View/EditEvent.php
kronolith/lib/View/Event.php
kronolith/lib/View/ExportEvent.php
kronolith/lib/View/Month.php
kronolith/lib/View/Week.php
kronolith/lib/View/WorkWeek.php
kronolith/lib/View/Year.php
kronolith/templates/day/all_day.inc
kronolith/templates/day/head_side_by_side.inc
kronolith/templates/week/head.inc
kronolith/templates/week/head_side_by_side.inc

index c9ddda2..a918272 100644 (file)
@@ -5,15 +5,15 @@
  * @author  Chuck Hagenbuch <chuck@horde.org>
  * @package Kronolith
  */
-class Kronolith_Day extends Horde_Date {
-
+class Kronolith_Day extends Horde_Date
+{
     /**
      * How many time slots are we dividing each hour into? Set from user
      * preferences.
      *
      * @var integer
      */
-    var $_slotsPerHour;
+    public $slotsPerHour;
 
     /**
      * How many slots do we have per day? Calculated from $_slotsPerHour.
@@ -21,7 +21,7 @@ class Kronolith_Day extends Horde_Date {
      * @see $_slotsPerHour
      * @var integer
      */
-    var $_slotsPerDay;
+    public $slotsPerDay;
 
     /**
      * How many minutes are in each slot? Calculated from $_slotsPerHour.
@@ -29,14 +29,14 @@ class Kronolith_Day extends Horde_Date {
      * @see $_slotsPerHour
      * @var integer
      */
-    var $_slotLength;
+    public $slotLength;
 
     /**
      * Array of slots holding hours and minutes for each piece of this day.
      *
      * @var array
      */
-    var $slots = array();
+    public $slots = array();
 
     /**
      * Constructor.
@@ -45,7 +45,7 @@ class Kronolith_Day extends Horde_Date {
      * @param integer $day
      * @param integer $year
      */
-    function Kronolith_Day($month = null, $day = null, $year = null)
+    public function __construct($month = null, $day = null, $year = null)
     {
         if (is_null($month)) {
             $month = date('n');
@@ -58,21 +58,21 @@ class Kronolith_Day extends Horde_Date {
         }
         parent::__construct(array('year' => $year, 'month' => $month, 'mday' => $day));
 
-        $this->_slotsPerHour = $GLOBALS['prefs']->getValue('slots_per_hour');
-        if (!$this->_slotsPerHour) {
-            $this->_slotsPerHour = 1;
+        $this->slotsPerHour = $GLOBALS['prefs']->getValue('slots_per_hour');
+        if (!$this->slotsPerHour) {
+            $this->slotsPerHour = 1;
         }
-        $this->_slotsPerDay = $this->_slotsPerHour * 24;
-        $this->_slotLength = 60 / $this->_slotsPerHour;
+        $this->slotsPerDay = $this->slotsPerHour * 24;
+        $this->slotLength = 60 / $this->slotsPerHour;
 
-        for ($i = 0; $i < $this->_slotsPerDay; $i++) {
-            $minutes = $i * $this->_slotLength;
+        for ($i = 0; $i < $this->slotsPerDay; $i++) {
+            $minutes = $i * $this->slotLength;
             $this->slots[$i]['hour'] = (int)($minutes / 60);
             $this->slots[$i]['min'] = $minutes % 60;
         }
     }
 
-    function getTime($format, $offset = 0)
+    public function getTime($format, $offset = 0)
     {
         $date = new Horde_Date(array('month' => $this->month,
                                      'mday' => $this->mday + $offset,
@@ -80,7 +80,7 @@ class Kronolith_Day extends Horde_Date {
         return $date->strftime($format);
     }
 
-    function getTomorrow()
+    public function getTomorrow()
     {
         $date = new Horde_Date(array('month' => $this->month,
                                      'mday' => $this->mday + 1,
@@ -88,7 +88,7 @@ class Kronolith_Day extends Horde_Date {
         return $date;
     }
 
-    function getYesterday()
+    public function getYesterday()
     {
         $date = new Horde_Date(array('month' => $this->month,
                                      'mday' => $this->mday - 1,
@@ -96,12 +96,12 @@ class Kronolith_Day extends Horde_Date {
         return $date;
     }
 
-    function isToday()
+    public function isToday()
     {
         return $this->compareDate(new Horde_Date(mktime(0, 0, 0))) == 0;
     }
 
-    function isTomorrow()
+    public function isTomorrow()
     {
         $date = new Horde_Date(array('month' => $this->month,
                                      'mday' => $this->mday - 1,
@@ -109,7 +109,7 @@ class Kronolith_Day extends Horde_Date {
         return $date->compareDate(new Horde_Date(mktime(0, 0, 0))) == 0;
     }
 
-    function diff()
+    public function diff()
     {
         $day2 = new Kronolith_Day();
         return Date_Calc::dateDiff($this->mday, $this->month, $this->year,
index 3773e59..18cc744 100644 (file)
@@ -55,9 +55,10 @@ class Kronolith_Driver
      * Just stores the $params in our newly-created object. All other work is
      * done by {@link initialize()}.
      *
-     * @param array $params  Any parameters needed for this driver.
+     * @param array $params     Any parameters needed for this driver.
+     * @param string $errormsg  A custom error message to use.
      */
-    public function __construct($params = array(), $errormsg = null)
+    public function __construct(array $params = array(), $errormsg = null)
     {
         $this->_params = $params;
         if ($errormsg === null) {
index bba2be4..fa8b9cb 100644 (file)
@@ -13,7 +13,7 @@ class Kronolith_Storage_Kolab extends Kronolith_Storage
 {
     protected $_params = array();
 
-    function __construct($user, $params = array())
+    public function __construct($user, array $params = array())
     {
         $this->_user = $user;
         $this->_params = $params;
index 48e4340..2989c21 100644 (file)
@@ -25,9 +25,12 @@ class Kronolith_Storage_Sql extends Kronolith_Storage
     /**
      * Constructs a new Kronolith_Storage SQL instance.
      *
+     * @param string $user   The user the fb info belongs to.
      * @param array $params  A hash containing connection parameters.
+     *
+     * @return Kronolith_Storage_Sql
      */
-    public function __construct($user, $params = array())
+    public function __construct($user, array $params = array())
     {
         $this->_user = $user;
         if (empty($params['db'])) {
index 6794904..aa67591 100644 (file)
@@ -6,31 +6,38 @@
  * @author  Jan Schneider <jan@horde.org>
  * @package Kronolith
  */
-class Kronolith_View_Day extends Kronolith_Day {
-
-    var $_events = array();
-    var $_all_day_events = array();
-    var $_all_day_rowspan = array();
-    var $_all_day_maxrowspan = 0;
-    var $_event_matrix = array();
-    var $_parsed = false;
-    var $_span = array();
-    var $_totalspan = 0;
-    var $_sidebyside = false;
-    var $_currentCalendars = array();
-    var $_first;
-    var $_last;
-
-    function Kronolith_View_Day($date, $events = null)
+class Kronolith_View_Day extends Kronolith_Day
+{
+    public $all_day_events = array();
+    public $all_day_rowspan = array();
+    public $all_day_maxrowspan = 0;
+    public $span = array();
+    public $totalspan = 0;
+    public $sidebyside = false;
+    protected $_events = array();
+    protected $_event_matrix = array();
+    protected $_parsed = false;
+    protected $_currentCalendars = array();
+    protected $_first;
+    protected $_last;
+
+    /**
+     *
+     * @param Horde_Date $date  The day for this view
+     * @param array $events     An array of Kronolith_Event objects
+     *
+     * @return Kronolith_View_Day
+     */
+    public function __construct(Horde_Date $date, array $events = null)
     {
-        parent::Kronolith_Day($date->month, $date->mday, $date->year);
+        parent::__construct($date->month, $date->mday, $date->year);
 
-        $this->_sidebyside = $GLOBALS['prefs']->getValue('show_shared_side_by_side');
-        if ($this->_sidebyside) {
+        $this->sidebyside = $GLOBALS['prefs']->getValue('show_shared_side_by_side');
+        if ($this->sidebyside) {
             $allCalendars = Kronolith::listInternalCalendars();
             foreach ($GLOBALS['display_calendars'] as $cid) {
                  $this->_currentCalendars[$cid] = $allCalendars[$cid];
-                 $this->_all_day_events[$cid] = array();
+                 $this->all_day_events[$cid] = array();
             }
         } else {
             $this->_currentCalendars = array(0);
@@ -57,12 +64,17 @@ class Kronolith_View_Day extends Kronolith_Day {
         }
     }
 
-    function setEvents($events)
+    /**
+     * Setter for events array
+     *
+     * @param array $events
+     */
+    public function setEvents(array $events)
     {
         $this->_events = $events;
     }
 
-    function html()
+    public function html()
     {
         global $prefs;
 
@@ -79,7 +91,7 @@ class Kronolith_View_Day extends Kronolith_Day {
         $showTime = Kronolith::viewShowTime();
 
         require KRONOLITH_TEMPLATES . '/day/head.inc';
-        if ($this->_sidebyside) {
+        if ($this->sidebyside) {
             require KRONOLITH_TEMPLATES . '/day/head_side_by_side.inc';
         }
         echo '<tbody>';
@@ -107,22 +119,22 @@ class Kronolith_View_Day extends Kronolith_Day {
          * with no rowspan.  We put in a rowspan in the row after the last
          * event to fill all remaining rows. */
         $row = '';
-        $rowspan = ($this->_all_day_maxrowspan) ? ' rowspan="' . $this->_all_day_maxrowspan . '"' : '';
-        for ($k = 0; $k < $this->_all_day_maxrowspan; ++$k) {
+        $rowspan = ($this->all_day_maxrowspan) ? ' rowspan="' . $this->all_day_maxrowspan . '"' : '';
+        for ($k = 0; $k < $this->all_day_maxrowspan; ++$k) {
             $row = '';
             foreach (array_keys($this->_currentCalendars) as $cid) {
-                if (count($this->_all_day_events[$cid]) === $k) {
+                if (count($this->all_day_events[$cid]) === $k) {
                     // There are no events or all events for this calendar
                     // have already been printed.
-                    $row .= '<td class="allday" width="1%" rowspan="' . ($this->_all_day_maxrowspan - $k) . '" colspan="'.  $this->_span[$cid] . '">&nbsp;</td>';
-                } elseif (count($this->_all_day_events[$cid]) > $k) {
+                    $row .= '<td class="allday" width="1%" rowspan="' . ($this->all_day_maxrowspan - $k) . '" colspan="'.  $this->span[$cid] . '">&nbsp;</td>';
+                } elseif (count($this->all_day_events[$cid]) > $k) {
                     // We have not printed every all day event yet. Put one
                     // into this row.
-                    $event = $this->_all_day_events[$cid][$k];
+                    $event = $this->all_day_events[$cid][$k];
                     $row .= '<td class="day-eventbox"'
                         . $event->getCSSColors()
                         . 'width="' . round(90 / count($this->_currentCalendars))  . '%" '
-                        . 'valign="top" colspan="' . $this->_span[$cid] . '">'
+                        . 'valign="top" colspan="' . $this->span[$cid] . '">'
                         . $event->getLink($this, true, $this->link(0, true));
                     if ($showLocation) {
                         $row .= '<div class="event-location">' . htmlspecialchars($event->location) . '</div>';
@@ -135,17 +147,17 @@ class Kronolith_View_Day extends Kronolith_Day {
         }
 
         if ($first_row) {
-            $row .= '<td colspan="' . $this->_totalspan . '" width="100%">&nbsp;</td>';
+            $row .= '<td colspan="' . $this->totalspan . '" width="100%">&nbsp;</td>';
             require KRONOLITH_TEMPLATES . '/day/all_day.inc';
         }
 
         $day_hour_force = $prefs->getValue('day_hour_force');
-        $day_hour_start = $prefs->getValue('day_hour_start') / 2 * $this->_slotsPerHour;
-        $day_hour_end = $prefs->getValue('day_hour_end') / 2 * $this->_slotsPerHour;
+        $day_hour_start = $prefs->getValue('day_hour_start') / 2 * $this->slotsPerHour;
+        $day_hour_end = $prefs->getValue('day_hour_end') / 2 * $this->slotsPerHour;
         $rows = array();
         $covered = array();
 
-        for ($i = 0; $i < $this->_slotsPerDay; ++$i) {
+        for ($i = 0; $i < $this->slotsPerDay; ++$i) {
             if ($i >= $day_hour_end && $i > $this->_last) {
                 break;
             }
@@ -154,8 +166,8 @@ class Kronolith_View_Day extends Kronolith_Day {
             }
 
             $row = '';
-            if (($m = $i % $this->_slotsPerHour) != 0) {
-                $time = ':' . $m * $this->_slotLength;
+            if (($m = $i % $this->slotsPerHour) != 0) {
+                $time = ':' . $m * $this->slotLength;
                 $hourclass = 'halfhour';
             } else {
                 $time = Kronolith_View_Day::prefHourFormat($this->slots[$i]['hour']);
@@ -175,7 +187,7 @@ class Kronolith_View_Day extends Kronolith_Day {
                     // factor of the total span, we get this event's
                     // individual span by dividing the total span by this
                     // event's overlap.
-                    $span = $this->_span[$cid] / $event->overlap;
+                    $span = $this->span[$cid] / $event->overlap;
 
                     // Store the indent we're starting this event at
                     // for future use.
@@ -208,13 +220,13 @@ class Kronolith_View_Day extends Kronolith_Day {
                     $hspan += $span;
 
                     $start = new Horde_Date(array(
-                        'hour'  => floor($i / $this->_slotsPerHour),
-                        'min'   => ($i % $this->_slotsPerHour) * $this->_slotLength,
+                        'hour'  => floor($i / $this->slotsPerHour),
+                        'min'   => ($i % $this->slotsPerHour) * $this->slotLength,
                         'month' => $this->month,
                         'mday'  => $this->mday,
                         'year'  => $this->year));
                     $end_slot = new Horde_Date($start);
-                    $end_slot->min += $this->_slotLength;
+                    $end_slot->min += $this->slotLength;
                     if (((!$day_hour_force || $i >= $day_hour_start) &&
                          $event->start->compareDateTime($start) >= 0 &&
                          $event->start->compareDateTime($end_slot) < 0 ||
@@ -233,7 +245,7 @@ class Kronolith_View_Day extends Kronolith_Day {
 
                         $row .= '<td class="day-eventbox"'
                             . $event->getCSSColors()
-                            . 'width="' . round((90 / count($this->_currentCalendars)) * ($span / $this->_span[$cid]))  . '%" '
+                            . 'width="' . round((90 / count($this->_currentCalendars)) * ($span / $this->span[$cid]))  . '%" '
                             . 'valign="top" colspan="' . $span . '" rowspan="' . $event->rowspan . '">'
                             . $event->getLink($this, true, $this->link(0, true));
                         if ($showTime) {
@@ -246,7 +258,7 @@ class Kronolith_View_Day extends Kronolith_Day {
                     }
                 }
 
-                $diff = $this->_span[$cid] - $hspan;
+                $diff = $this->span[$cid] - $hspan;
                 if ($diff > 0) {
                     $row .= str_repeat('<td>&nbsp;</td>', $diff);
                 }
@@ -269,7 +281,7 @@ class Kronolith_View_Day extends Kronolith_Day {
         }
 
         $template = $GLOBALS['injector']->createInstance('Horde_Template');
-        $template->set('row_height', round(20 / $this->_slotsPerHour));
+        $template->set('row_height', round(20 / $this->slotsPerHour));
         $template->set('rows', $rows);
         $template->set('show_slots', true, true);
         echo $template->fetch(KRONOLITH_TEMPLATES . '/day/rows.html')
@@ -281,27 +293,27 @@ class Kronolith_View_Day extends Kronolith_Day {
      * what should be on each line of the output table. This is a
      * little tricky.
      */
-    function parse()
+    public function parse()
     {
         global $prefs;
 
         $tmp = array();
-        $this->_all_day_maxrowspan = 0;
+        $this->all_day_maxrowspan = 0;
         $day_hour_force = $prefs->getValue('day_hour_force');
-        $day_hour_start = $prefs->getValue('day_hour_start') / 2 * $this->_slotsPerHour;
-        $day_hour_end = $prefs->getValue('day_hour_end') / 2 * $this->_slotsPerHour;
+        $day_hour_start = $prefs->getValue('day_hour_start') / 2 * $this->slotsPerHour;
+        $day_hour_end = $prefs->getValue('day_hour_end') / 2 * $this->slotsPerHour;
 
         // Separate out all day events and do some initialization/prep
         // for parsing.
         foreach (array_keys($this->_currentCalendars) as $cid) {
-            $this->_all_day_events[$cid] = array();
-            $this->_all_day_rowspan[$cid] = 0;
+            $this->all_day_events[$cid] = array();
+            $this->all_day_rowspan[$cid] = 0;
         }
 
         foreach ($this->_events as $key => $event) {
             // If we have side_by_side we only want to include the
             // event in the proper calendar.
-            if ($this->_sidebyside) {
+            if ($this->sidebyside) {
                 $cid = $event->calendar;
             } else {
                 $cid = 0;
@@ -309,9 +321,9 @@ class Kronolith_View_Day extends Kronolith_Day {
 
             // All day events are easy; store them seperately.
             if ($event->isAllDay()) {
-                $this->_all_day_events[$cid][] = clone $event;
-                ++$this->_all_day_rowspan[$cid];
-                $this->_all_day_maxrowspan = max($this->_all_day_maxrowspan, $this->_all_day_rowspan[$cid]);
+                $this->all_day_events[$cid][] = clone $event;
+                ++$this->all_day_rowspan[$cid];
+                $this->all_day_maxrowspan = max($this->all_day_maxrowspan, $this->all_day_rowspan[$cid]);
             } else {
                 // Initialize the number of events that this event
                 // overlaps with.
@@ -331,12 +343,12 @@ class Kronolith_View_Day extends Kronolith_Day {
         // Track the first and last slots in which we have an event
         // (they each start at the other end of the day and move
         // towards/past each other as we find events).
-        $this->_first = $this->_slotsPerDay;
+        $this->_first = $this->slotsPerDay;
         $this->_last = 0;
 
         // Run through every slot, adding in entries for every event
         // that we have here.
-        for ($i = 0; $i < $this->_slotsPerDay; ++$i) {
+        for ($i = 0; $i < $this->slotsPerDay; ++$i) {
             // Initialize this slot in the event matrix.
             foreach (array_keys($this->_currentCalendars) as $cid) {
                 $this->_event_matrix[$cid][$i] = array();
@@ -344,19 +356,19 @@ class Kronolith_View_Day extends Kronolith_Day {
 
             // Calculate the start and end times for this slot.
             $start = new Horde_Date(array(
-                'hour'  => floor($i / $this->_slotsPerHour),
-                'min'   => ($i % $this->_slotsPerHour) * $this->_slotLength,
+                'hour'  => floor($i / $this->slotsPerHour),
+                'min'   => ($i % $this->slotsPerHour) * $this->slotLength,
                 'month' => $this->month,
                 'mday'  => $this->mday,
                 'year'  => $this->year));
             $end = clone $start;
-            $end->min += $this->_slotLength;
+            $end->min += $this->slotLength;
 
             // Search through our events.
             foreach ($this->_events as $key => $event) {
                 // If we have side_by_side we only want to include the
                 // event in the proper calendar.
-                if ($this->_sidebyside) {
+                if ($this->sidebyside) {
                     $cid = $event->calendar;
                 } else {
                     $cid = 0;
@@ -438,31 +450,31 @@ class Kronolith_View_Day extends Kronolith_Day {
                     $span[$cid] *= $s;
                 }
             }
-            $this->_totalspan += $span[$cid];
+            $this->totalspan += $span[$cid];
         }
         // Set the final span.
         if (isset($span)) {
-            $this->_span = $span;
+            $this->span = $span;
         } else {
-            $this->_totalspan = 1;
+            $this->totalspan = 1;
         }
 
         // We're now parsed and ready to go.
         $this->_parsed = true;
     }
 
-    function link($offset = 0, $full = false)
+    public function link($offset = 0, $full = false)
     {
         return Horde::url('day.php', $full)
             ->add('date', $this->getTime('%Y%m%d', $offset));
     }
 
-    function getName()
+    public function getName()
     {
         return 'Day';
     }
 
-    function prefHourFormat($hour)
+    public function prefHourFormat($hour)
     {
         $hour = $hour % 24;
         if ($GLOBALS['prefs']->getValue('twentyFour')) {
@@ -472,7 +484,7 @@ class Kronolith_View_Day extends Kronolith_Day {
             . ($hour < 12 ? 'am' : 'pm');
     }
 
-    function _sortByStart($evA, $evB)
+    protected function _sortByStart($evA, $evB)
     {
         $sA = $this->_events[$evA]->start;
         $sB = $this->_events[$evB]->start;
index de69fa6..7740926 100644 (file)
@@ -6,42 +6,55 @@
  * @author  Chuck Hagenbuch <chuck@horde.org>
  * @package Kronolith
  */
-class Kronolith_View_DeleteEvent {
-
-    var $event;
+class Kronolith_View_DeleteEvent
+{
+    /**
+     * @var Kronolith_Event
+     */
+    protected $_event;
 
     /**
      * @param Kronolith_Event $event
      */
-    function Kronolith_View_DeleteEvent($event)
+    public function __construct(Kronolith_Event $event)
     {
-        $this->event = $event;
+        $this->_event = $event;
+    }
+
+    public function __get($property)
+    {
+        switch ($property) {
+        case 'event':
+            return $this->_event;
+        default:
+            throw new Exception(_("Property does not exist."));
+        }
     }
 
-    function getTitle()
+    public function getTitle()
     {
-        if (!$this->event) {
+        if (!$this->_event) {
             return _("Not Found");
         }
-        if (is_string($this->event)) {
-            return $this->event;
+        if (is_string($this->_event)) {
+            return $this->_event;
         }
-        return sprintf(_("Delete %s"), $this->event->getTitle());
+        return sprintf(_("Delete %s"), $this->_event->getTitle());
     }
 
-    function link()
+    public function link()
     {
-        return $this->event->getDeleteUrl();
+        return $this->_event->getDeleteUrl();
     }
 
-    function html($active = true)
+    public function html($active = true)
     {
-        if (!$this->event) {
+        if (!$this->_event) {
             echo '<h3>' . _("Event not found") . '</h3>';
             exit;
         }
-        if (is_string($this->event)) {
-            echo '<h3>' . $this->event . '</h3>';
+        if (is_string($this->_event)) {
+            echo '<h3>' . $this->_event . '</h3>';
             exit;
         }
 
@@ -59,7 +72,7 @@ class Kronolith_View_DeleteEvent {
         $url = Horde_Util::getFormData('url');
 
         echo '<div id="DeleteEvent"' . ($active ? '' : ' style="display:none"') . '>';
-        if (!$this->event->recurs()) {
+        if (!$this->_event->recurs()) {
             require KRONOLITH_TEMPLATES . '/delete/one.inc';
         } else {
             require KRONOLITH_TEMPLATES . '/delete/delete.inc';
@@ -67,18 +80,18 @@ class Kronolith_View_DeleteEvent {
         echo '</div>';
 
         if ($active && $GLOBALS['browser']->hasFeature('dom')) {
-            if ($this->event->hasPermission(Horde_Perms::READ)) {
-                $view = new Kronolith_View_Event($this->event);
+            if ($this->_event->hasPermission(Horde_Perms::READ)) {
+                $view = new Kronolith_View_Event($this->_event);
                 $view->html(false);
             }
-            if ($this->event->hasPermission(Horde_Perms::EDIT)) {
-                $edit = new Kronolith_View_EditEvent($this->event);
+            if ($this->_event->hasPermission(Horde_Perms::EDIT)) {
+                $edit = new Kronolith_View_EditEvent($this->_event);
                 $edit->html(false);
             }
         }
     }
 
-    function getName()
+    public function getName()
     {
         return 'DeleteEvent';
     }
index 11b66dd..e257955 100644 (file)
@@ -6,60 +6,74 @@
  * @author  Chuck Hagenbuch <chuck@horde.org>
  * @package Kronolith
  */
-class Kronolith_View_EditEvent {
-
-    var $event;
+class Kronolith_View_EditEvent
+{
+    /**
+     *
+     * @var Kronolith_Event
+     */
+    protected $_event;
 
     /**
      * @param Kronolith_Event $event
      */
-    function Kronolith_View_EditEvent($event)
+    public function __construct(Kronolith_Event $event)
     {
-        $this->event = $event;
+        $this->_event = $event;
+    }
+
+    public function __get($property)
+    {
+        switch ($property) {
+        case 'event':
+            return $this->_event;
+        default:
+            throw new Exception(_("Property does not exist."));
+        }
     }
 
-    function getTitle()
+    public function getTitle()
     {
-        if (!$this->event) {
+        if (!$this->_event) {
             return _("Not Found");
         }
-        if (is_string($this->event)) {
-            return $this->event;
+        if (is_string($this->_event)) {
+            return $this->_event;
         }
-        return sprintf(_("Edit %s"), $this->event->getTitle());
+        return sprintf(_("Edit %s"), $this->_event->getTitle());
     }
 
-    function link()
+    public function link()
     {
-        return $this->event->getEditUrl();
+        return $this->_event->getEditUrl();
     }
 
-    function html($active = true)
+    public function html($active = true)
     {
-        if (!$this->event) {
+        if (!$this->_event) {
             echo '<h3>' . _("Event not found") . '</h3>';
             exit;
         }
-        if (is_string($this->event)) {
-            echo '<h3>' . $this->event . '</h3>';
+        if (is_string($this->_event)) {
+            echo '<h3>' . $this->_event . '</h3>';
             exit;
         }
 
         $identity = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Identity')->create();
 
-        if ($this->event->hasPermission(Horde_Perms::EDIT)) {
-            $calendar_id = $this->event->calendarType . '_' . $this->event->calendar;
+        if ($this->_event->hasPermission(Horde_Perms::EDIT)) {
+            $calendar_id = $this->_event->calendarType . '_' . $this->_event->calendar;
         } else {
             $calendar_id = 'internal_' . Kronolith::getDefaultCalendar(Horde_Perms::EDIT);
         }
-        if (!$this->event->hasPermission(Horde_Perms::EDIT)) {
+        if (!$this->_event->hasPermission(Horde_Perms::EDIT)) {
             try {
-                $calendar_id .= ':' . $this->event->getShare()->get('owner');
+                $calendar_id .= ':' . $this->_event->getShare()->get('owner');
             } catch (Exception $e) {
             }
         }
-        $GLOBALS['session']->set('kronolith', 'attendees', $this->event->attendees);
-        $GLOBALS['session']->set('kronolith', 'resources', $this->event->getResources());
+        $GLOBALS['session']->set('kronolith', 'attendees', $this->_event->attendees);
+        $GLOBALS['session']->set('kronolith', 'resources', $this->_event->getResources());
         if ($datetime = Horde_Util::getFormData('datetime')) {
             $datetime = new Horde_Date($datetime);
             $month = $datetime->month;
@@ -71,22 +85,22 @@ class Kronolith_View_EditEvent {
 
         $url = Horde_Util::getFormData('url');
         $perms = Horde_Perms::EDIT;
-        if ($this->event->creator == $GLOBALS['registry']->getAuth()) {
+        if ($this->_event->creator == $GLOBALS['registry']->getAuth()) {
             $perms |= Kronolith::PERMS_DELEGATE;
         }
         $calendars = Kronolith::listCalendars($perms, true);
 
         $buttons = array();
-        if (!$this->event->hasPermission(Horde_Perms::EDIT) &&
+        if (!$this->_event->hasPermission(Horde_Perms::EDIT) &&
             ($GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') === true ||
              $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') > Kronolith::countEvents())) {
             $buttons[] = '<input type="submit" class="button" name="saveAsNew" value="' . _("Save As New") . '" />';
         } else {
-            if ($this->event->hasPermission(Horde_Perms::EDIT)) {
+            if ($this->_event->hasPermission(Horde_Perms::EDIT)) {
                 $buttons[] = '<input type="submit" class="button" name="save" value="' . _("Save Event") . '" />';
             }
-            if ($this->event->initialized) {
-                if (!$this->event->recurs() &&
+            if ($this->_event->initialized) {
+                if (!$this->_event->recurs() &&
                     ($GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') === true ||
                      $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') > Kronolith::countEvents())) {
                     $buttons[] = '<input type="submit" class="button" name="saveAsNew" value="' . _("Save As New") . '" />';
@@ -101,7 +115,7 @@ class Kronolith_View_EditEvent {
                 ->add(array('month' => $month, 'year' => $year));
         }
 
-        $event = &$this->event;
+        $event = &$this->_event;
         $tags = implode(',', array_values($event->tags));
 
         Horde_Core_Ui_JsCalendar::init(array(
@@ -116,18 +130,18 @@ class Kronolith_View_EditEvent {
         echo '</div>';
 
         if ($active && $GLOBALS['browser']->hasFeature('dom')) {
-            if ($this->event->hasPermission(Horde_Perms::READ)) {
-                $view = new Kronolith_View_Event($this->event);
+            if ($this->_event->hasPermission(Horde_Perms::READ)) {
+                $view = new Kronolith_View_Event($this->_event);
                 $view->html(false);
             }
-            if ($this->event->hasPermission(Horde_Perms::DELETE)) {
-                $delete = new Kronolith_View_DeleteEvent($this->event);
+            if ($this->_event->hasPermission(Horde_Perms::DELETE)) {
+                $delete = new Kronolith_View_DeleteEvent($this->_event);
                 $delete->html(false);
             }
         }
     }
 
-    function getName()
+    public function getName()
     {
         return 'EditEvent';
     }
index 2f73c17..ba29e17 100644 (file)
@@ -5,42 +5,56 @@
  * @author  Chuck Hagenbuch <chuck@horde.org>
  * @package Kronolith
  */
-class Kronolith_View_Event {
-
-    var $event;
+class Kronolith_View_Event
+{
+    /**
+     *
+     * @var Kronolith_Event
+     */
+    protected $_event;
 
     /**
      * @param Kronolith_Event $event
      */
-    function Kronolith_View_Event($event)
+    public function __construct(Kronolith_Event $event)
     {
-        $this->event = $event;
+        $this->_event = $event;
+    }
+
+    public function __get($property)
+    {
+        switch ($property) {
+        case 'event':
+            return $this->_event;
+        default:
+            throw new Exception(_("Property does not exist."));
+        }
     }
 
-    function getTitle()
+    public function getTitle()
     {
-        if (!$this->event) {
+        if (!$this->_event) {
             return _("Not Found");
         }
-        if (is_string($this->event)) {
-            return $this->event;
+        if (is_string($this->_event)) {
+            return $this->_event;
         }
-        return $this->event->getTitle();
+        return $this->_event->getTitle();
     }
 
-    function link()
+    public function link()
     {
-        return $this->event->getViewUrl();
+        return $this->_event->getViewUrl();
     }
 
-    function html($active = true)
+    public function html($active = true)
     {
-        if (!$this->event) {
+        if (!$this->_event) {
             echo '<h3>' . _("Event not found") . '</h3>';
             exit;
         }
-        if (is_string($this->event)) {
-            echo '<h3>' . $this->event . '</h3>';
+        if (is_string($this->_event)) {
+            echo '<h3>' . $this->_event . '</h3>';
             exit;
         }
 
@@ -49,11 +63,11 @@ class Kronolith_View_Event {
         $createdby = '';
         $modifiedby = '';
         $userId = $GLOBALS['registry']->getAuth();
-        if ($this->event->uid) {
+        if ($this->_event->uid) {
             /* Get the event's history. */
             try {
                 $log = $GLOBALS['injector']->getInstance('Horde_History')
-                    ->getHistory('kronolith:' . $this->event->calendar . ':' . $this->event->uid);
+                    ->getHistory('kronolith:' . $this->_event->calendar . ':' . $this->_event->uid);
                 foreach ($log as $entry) {
                     switch ($entry['action']) {
                     case 'add':
@@ -78,15 +92,15 @@ class Kronolith_View_Event {
             } catch (Exception $e) {}
         }
 
-        $creatorId = $this->event->creator;
-        $description = $this->event->description;
-        $location = $this->event->location;
-        $eventurl = $this->event->url;
-        $private = $this->event->private && $creatorId != $GLOBALS['registry']->getAuth();
+        $creatorId = $this->_event->creator;
+        $description = $this->_event->description;
+        $location = $this->_event->location;
+        $eventurl = $this->_event->url;
+        $private = $this->_event->private && $creatorId != $GLOBALS['registry']->getAuth();
         $owner = Kronolith::getUserName($creatorId);
-        $status = Kronolith::statusToString($this->event->status);
-        $attendees = $this->event->attendees;
-        $resources = $this->event->getResources();
+        $status = Kronolith::statusToString($this->_event->status);
+        $attendees = $this->_event->attendees;
+        $resources = $this->_event->getResources();
         if ($datetime = Horde_Util::getFormData('datetime')) {
             $datetime = new Horde_Date($datetime);
             $month = $datetime->month;
@@ -100,7 +114,7 @@ class Kronolith_View_Event {
         $timeFormat = $prefs->getValue('twentyFour') ? 'G:i' : 'g:ia';
 
         // Tags
-        $tags = implode(', ', $this->event->tags);
+        $tags = implode(', ', $this->_event->tags);
 
 
         echo '<div id="Event"' . ($active ? '' : ' style="display:none"') . '>';
@@ -110,18 +124,18 @@ class Kronolith_View_Event {
         if ($active && $GLOBALS['browser']->hasFeature('dom')) {
             /* We check for read permissions, because we can always save a
              * copy if we can read the event. */
-            if ($this->event->hasPermission(Horde_Perms::READ)) {
-                $edit = new Kronolith_View_EditEvent($this->event);
+            if ($this->_event->hasPermission(Horde_Perms::READ)) {
+                $edit = new Kronolith_View_EditEvent($this->_event);
                 $edit->html(false);
             }
-            if ($this->event->hasPermission(Horde_Perms::DELETE)) {
-                $delete = new Kronolith_View_DeleteEvent($this->event);
+            if ($this->_event->hasPermission(Horde_Perms::DELETE)) {
+                $delete = new Kronolith_View_DeleteEvent($this->_event);
                 $delete->html(false);
             }
         }
     }
 
-    function getName()
+    public function getName()
     {
         return 'Event';
     }
index cd64e46..b4a0cc4 100644 (file)
@@ -6,12 +6,12 @@
  * @author  Jan Schneider <chuck@horde.org>
  * @package Kronolith
  */
-class Kronolith_View_ExportEvent {
-
+class Kronolith_View_ExportEvent
+{
     /**
      * @param Kronolith_Event $event
      */
-    function Kronolith_View_ExportEvent($event)
+    public function __construct(Kronolith_Event $event)
     {
         if (!$event) {
             echo '<h3>' . _("Event not found") . '</h3>';
index 695e3e5..7aa2fb2 100644 (file)
@@ -7,49 +7,56 @@
  * @author  Jan Schneider <jan@horde.org>
  * @package Kronolith
  */
-class Kronolith_View_Month {
-
+class Kronolith_View_Month
+{
     /**
      * @var integer
      */
-    var $month;
+    public $month;
 
     /**
      * @var integer
      */
-    var $year;
+    public $year;
 
     /**
      * @var Horde_Date
      */
-    var $date;
+    public $date;
 
     /**
      * @var array
      */
-    var $_events = array();
+    protected $_events = array();
 
     /**
      * @var array
      */
-    var $_currentCalendars = array();
+    protected $_currentCalendars = array();
 
     /**
      * @var integer
      */
-    var $_daysInView;
+    protected $_daysInView;
 
     /**
      * @var integer
      */
-    var $_startOfView;
+    protected $_startOfView;
 
     /**
      * @var integer
      */
-    var $_startday;
+    protected $_startday;
 
-    function Kronolith_View_Month($date)
+    /**
+     *
+     * @global Horde_Prefs $prefs
+     * @param Horde_Date $date
+     *
+     * @return Kronolith_View_Month
+     */
+    public function __construct(Horde_Date $date)
     {
         global $prefs;
 
@@ -112,7 +119,7 @@ class Kronolith_View_Month {
         }
     }
 
-    function html()
+    public function html()
     {
         global $prefs;
 
@@ -224,21 +231,21 @@ class Kronolith_View_Month {
         echo $html . '</tbody></table>';
     }
 
-    function getMonth($offset = 0)
+    public function getMonth($offset = 0)
     {
         $month = new Horde_Date($this->date);
         $month->month += $offset;
         return $month;
     }
 
-    function link($offset = 0, $full = false)
+    public function link($offset = 0, $full = false)
     {
         $month = $this->getMonth($offset);
         return Horde::url('month.php', $full)
             ->add('date', $month->dateString());
     }
 
-    function getName()
+    public function getName()
     {
         return 'Month';
     }
index 4f5575f..cfca437 100644 (file)
@@ -6,25 +6,25 @@
  * @author  Jan Schneider <jan@horde.org>
  * @package Kronolith
  */
-class Kronolith_View_Week {
-
-    var $parsed = false;
-    var $days = array();
-    var $week = null;
-    var $year = null;
-    var $startDay = null;
-    var $endDay = null;
-    var $startDate = null;
-    var $_controller = 'week.php';
-    var $_sidebyside = false;
-    var $_currentCalendars = array();
+class Kronolith_View_Week
+{
+    public $parsed = false;
+    public $days = array();
+    public $week = null;
+    public $year = null;
+    public $startDay = null;
+    public $endDay = null;
+    public $startDate = null;
+    protected $_controller = 'week.php';
+    public $sidebyside = false;
+    public $_currentCalendars = array();
 
     /**
      * How many time slots are we dividing each hour into?
      *
      * @var integer
      */
-    var $_slotsPerHour = 2;
+    public $_slotsPerHour = 2;
 
     /**
      * How many slots do we have per day? Calculated from $_slotsPerHour.
@@ -32,9 +32,9 @@ class Kronolith_View_Week {
      * @see $_slotsPerHour
      * @var integer
      */
-    var $_slotsPerDay;
+    public $_slotsPerDay;
 
-    function Kronolith_View_Week($date)
+    public function __construct(Horde_Date $date)
     {
         $week = $date->weekOfYear();
         $year = $date->year;
@@ -81,14 +81,14 @@ class Kronolith_View_Week {
                                        ? $allevents[$date_stamp]
                                        : array());
         }
-        $this->_sidebyside = $this->days[$this->startDay]->_sidebyside;
-        $this->_currentCalendars = $this->days[$this->startDay]->_currentCalendars;
-        $this->_slotsPerHour = $this->days[$this->startDay]->_slotsPerHour;
-        $this->_slotsPerDay = $this->days[$this->startDay]->_slotsPerDay;
-        $this->_slotLength = $this->days[$this->startDay]->_slotLength;
+        $this->sidebyside = $this->days[$this->startDay]->sidebyside;
+        $this->_currentCalendars = $this->days[$this->startDay]->currentCalendars;
+        $this->slotsPerHour = $this->days[$this->startDay]->slotsPerHour;
+        $this->slotsPerDay = $this->days[$this->startDay]->slotsPerDay;
+        $this->slotLength = $this->days[$this->startDay]->slotLength;
     }
 
-    function html()
+    public function html()
     {
         global $prefs;
 
@@ -104,7 +104,7 @@ class Kronolith_View_Week {
         $slots = $this->days[$this->startDay]->slots;
         $cid = 0;
         require KRONOLITH_TEMPLATES . '/week/head.inc';
-        if ($this->_sidebyside) {
+        if ($this->sidebyside) {
             require KRONOLITH_TEMPLATES . '/week/head_side_by_side.inc';
         }
         echo '</thead><tbody>';
@@ -112,8 +112,8 @@ class Kronolith_View_Week {
         $event_count = 0;
         for ($j = $this->startDay; $j <= $this->endDay; ++$j) {
             foreach (array_keys($this->_currentCalendars) as $cid) {
-                $event_count = max($event_count, count($this->days[$j]->_all_day_events[$cid]));
-                reset($this->days[$j]->_all_day_events[$cid]);
+                $event_count = max($event_count, count($this->days[$j]->all_day_events[$cid]));
+                reset($this->days[$j]->all_day_events[$cid]);
             }
         }
 
@@ -126,18 +126,18 @@ class Kronolith_View_Week {
         $row = '';
         for ($j = $this->startDay; $j <= $this->endDay; ++$j) {
             $row .= '<td class="hour rightAlign daySpacer">' . ($more_timeslots ? _("All day") : '&nbsp;') . '</td>' .
-                '<td colspan="' . $this->days[$j]->_totalspan . '" valign="top"><table width="100%" cellspacing="0">';
-            if ($this->days[$j]->_all_day_maxrowspan > 0) {
-                for ($k = 0; $k < $this->days[$j]->_all_day_maxrowspan; ++$k) {
+                '<td colspan="' . $this->days[$j]->totalspan . '" valign="top"><table width="100%" cellspacing="0">';
+            if ($this->days[$j]->all_day_maxrowspan > 0) {
+                for ($k = 0; $k < $this->days[$j]->all_day_maxrowspan; ++$k) {
                     $row .= '<tr>';
-                    foreach (array_keys($this->days[$j]->_currentCalendars) as $cid) {
-                        if (count($this->days[$j]->_all_day_events[$cid]) === $k) {
-                            $row .= '<td rowspan="' . ($this->days[$j]->_all_day_maxrowspan - $k) . '" width="'. round(99 / count($this->days[$j]->_currentCalendars)) . '%">&nbsp;</td>';
-                        } elseif (count($this->days[$j]->_all_day_events[$cid]) > $k) {
-                            $event = $this->days[$j]->_all_day_events[$cid][$k];
+                    foreach (array_keys($this->days[$j]->currentCalendars) as $cid) {
+                        if (count($this->days[$j]->all_day_events[$cid]) === $k) {
+                            $row .= '<td rowspan="' . ($this->days[$j]->all_day_maxrowspan - $k) . '" width="'. round(99 / count($this->days[$j]->currentCalendars)) . '%">&nbsp;</td>';
+                        } elseif (count($this->days[$j]->all_day_events[$cid]) > $k) {
+                            $event = $this->days[$j]->all_day_events[$cid][$k];
                             $row .= '<td class="week-eventbox"'
                                 . $event->getCSSColors()
-                                . 'width="' . round(99 / count($this->days[$j]->_currentCalendars)) . '%" '
+                                . 'width="' . round(99 / count($this->days[$j]->currentCalendars)) . '%" '
                                 . 'valign="top">'
                                 . $event->getLink($this->days[$j], true, $this->link(0, true));
                             if ($showLocation) {
@@ -159,12 +159,12 @@ class Kronolith_View_Week {
         require KRONOLITH_TEMPLATES . '/day/all_day.inc';
 
         $day_hour_force = $prefs->getValue('day_hour_force');
-        $day_hour_start = $prefs->getValue('day_hour_start') / 2 * $this->_slotsPerHour;
-        $day_hour_end = $prefs->getValue('day_hour_end') / 2 * $this->_slotsPerHour;
+        $day_hour_start = $prefs->getValue('day_hour_start') / 2 * $this->slotsPerHour;
+        $day_hour_end = $prefs->getValue('day_hour_end') / 2 * $this->slotsPerHour;
         $rows = array();
         $covered = array();
 
-        for ($i = 0; $i < $this->_slotsPerDay; ++$i) {
+        for ($i = 0; $i < $this->slotsPerDay; ++$i) {
             if ($i >= $day_hour_end && $i > $this->last) {
                 break;
             }
@@ -172,8 +172,8 @@ class Kronolith_View_Week {
                 continue;
             }
 
-            if (($m = $i % $this->_slotsPerHour) != 0) {
-                $time = ':' . $m * $this->_slotLength;
+            if (($m = $i % $this->slotsPerHour) != 0) {
+                $time = ':' . $m * $this->slotLength;
                 $hourclass = 'halfhour';
             } else {
                 $time = Kronolith_View_Day::prefHourFormat($slots[$i]['hour']);
@@ -204,15 +204,15 @@ class Kronolith_View_Week {
                     // first available cell of the day.
                     for (; isset($covered[$j][$i][$current_indent]); ++$current_indent);
 
-                    foreach ($this->days[$j]->_event_matrix[$cid][$i] as $key) {
-                        $event = &$this->days[$j]->_events[$key];
+                    foreach ($this->days[$j]->event_matrix[$cid][$i] as $key) {
+                        $event = &$this->days[$j]->events[$key];
                         if ($include_all_events || $event->calendar == $cid) {
                             // Since we've made sure that this event's
                             // overlap is a factor of the total span,
                             // we get this event's individual span by
                             // dividing the total span by this event's
                             // overlap.
-                            $span = $this->days[$j]->_span[$cid] / $event->overlap;
+                            $span = $this->days[$j]->span[$cid] / $event->overlap;
 
                             // Store the indent we're starting this event at
                             // for future use.
@@ -259,13 +259,13 @@ class Kronolith_View_Week {
                             $current_indent += $event->span;
 
                             $start = new Horde_Date(array(
-                                'hour'  => floor($i / $this->_slotsPerHour),
-                                'min'   => ($i % $this->_slotsPerHour) * $this->_slotLength,
+                                'hour'  => floor($i / $this->slotsPerHour),
+                                'min'   => ($i % $this->slotsPerHour) * $this->slotLength,
                                 'month' => $this->days[$j]->month,
                                 'mday'  => $this->days[$j]->mday,
                                 'year'  => $this->days[$j]->year));
                             $slot_end = new Horde_Date($start);
-                            $slot_end->min += $this->_slotLength;
+                            $slot_end->min += $this->slotLength;
                             if (((!$day_hour_force || $i >= $day_hour_start) &&
                                  $event->start->compareDateTime($start) >= 0 &&
                                  $event->start->compareDateTime($slot_end) < 0 ||
@@ -284,7 +284,7 @@ class Kronolith_View_Week {
                                 $row .= '<td class="week-eventbox"'
                                     . $event->getCSSColors()
                                     . 'valign="top" '
-                                    . 'width="' . floor(((90 / count($this->days)) / count($this->_currentCalendars)) * ($span / $this->days[$j]->_span[$cid])) . '%" '
+                                    . 'width="' . floor(((90 / count($this->days)) / count($this->_currentCalendars)) * ($span / $this->days[$j]->span[$cid])) . '%" '
                                     . 'colspan="' . $event->span . '" rowspan="' . $event->rowspan . '">'
                                     . $event->getLink($this->days[$j], true, $this->link(0, true));
                                 if ($showTime) {
@@ -298,7 +298,7 @@ class Kronolith_View_Week {
                         }
                     }
 
-                    $diff = $this->days[$j]->_span[$cid] - $hspan;
+                    $diff = $this->days[$j]->span[$cid] - $hspan;
                     if ($diff > 0) {
                         $row .= str_repeat('<td>&nbsp;</td>', $diff);
                     }
@@ -309,7 +309,7 @@ class Kronolith_View_Week {
         }
 
         $template = $GLOBALS['injector']->createInstance('Horde_Template');
-        $template->set('row_height', round(20 / $this->_slotsPerHour));
+        $template->set('row_height', round(20 / $this->slotsPerHour));
         $template->set('rows', $rows);
         $template->set('show_slots', !$more_timeslots, true);
         echo $template->fetch(KRONOLITH_TEMPLATES . '/day/rows.html')
@@ -321,7 +321,7 @@ class Kronolith_View_Week {
      * run through the results to get the total horizontal span for
      * the week, and the latest event of the week.
      */
-    function parse()
+    public function parse()
     {
         for ($i = $this->startDay; $i <= $this->endDay; ++$i) {
             $this->days[$i]->parse();
@@ -330,18 +330,18 @@ class Kronolith_View_Week {
         $this->totalspan = 0;
         $this->span = array();
         for ($i = $this->startDay; $i <= $this->endDay; ++$i) {
-            $this->totalspan += $this->days[$i]->_totalspan;
+            $this->totalspan += $this->days[$i]->totalspan;
             foreach (array_keys($this->_currentCalendars) as $cid) {
                 if (isset($this->span[$cid])) {
-                    $this->span[$cid] += $this->days[$i]->_span[$cid];
+                    $this->span[$cid] += $this->days[$i]->span[$cid];
                 } else {
-                    $this->span[$cid] = $this->days[$i]->_span[$cid];
+                    $this->span[$cid] = $this->days[$i]->span[$cid];
                 }
             }
         }
 
         $this->last = 0;
-        $this->first = $this->_slotsPerDay;
+        $this->first = $this->slotsPerDay;
         for ($i = $this->startDay; $i <= $this->endDay; ++$i) {
             if ($this->days[$i]->last > $this->last) {
                 $this->last = $this->days[$i]->last;
@@ -352,21 +352,21 @@ class Kronolith_View_Week {
         }
     }
 
-    function getWeek($offset = 0)
+    public function getWeek($offset = 0)
     {
         $week = new Horde_Date($this->startDate);
         $week->mday += $offset * 7;
         return $week;
     }
 
-    function link($offset = 0, $full = false)
+    public function link($offset = 0, $full = false)
     {
         $week = $this->getWeek($offset);
         return Horde::url($this->_controller, $full)
             ->add('date', $week->dateString());
     }
 
-    function getName()
+    public function getName()
     {
         return 'Week';
     }
index 672fcca..02511d0 100644 (file)
@@ -6,13 +6,13 @@
  * @author  Chuck Hagenbuch <chuck@horde.org>
  * @package Kronolith
  */
-class Kronolith_View_WorkWeek extends Kronolith_View_Week {
+class Kronolith_View_WorkWeek extends Kronolith_View_Week
+{
+    public $startDay = Horde_Date::DATE_MONDAY;
+    public $endDay = Horde_Date::DATE_FRIDAY;
+    protected $_controller = 'workweek.php';
 
-    var $startDay = Horde_Date::DATE_MONDAY;
-    var $endDay = Horde_Date::DATE_FRIDAY;
-    var $_controller = 'workweek.php';
-
-    function getName()
+    public function getName()
     {
         return 'WorkWeek';
     }
index 6de5571..7e6e538 100644 (file)
@@ -6,12 +6,18 @@
  * @author  Jan Schneider <jan@horde.org>
  * @package Kronolith
  */
-class Kronolith_View_Year {
-
-    var $year;
-    var $_events = array();
-
-    function Kronolith_View_Year($date)
+class Kronolith_View_Year
+{
+    public $year;
+    protected $_events = array();
+
+    /**
+     *
+     * @param Horde_Date $date
+     *
+     * @return Kronolith_View_Year
+     */
+    public function __construct(Horde_Date $date)
     {
         $this->year = $date->year;
         $startDate = new Horde_Date(array('year' => $this->year,
@@ -32,7 +38,7 @@ class Kronolith_View_Year {
         }
     }
 
-    function html()
+    public function html()
     {
         global $prefs;
 
@@ -163,13 +169,13 @@ class Kronolith_View_Year {
         echo $html . '</tr></table>';
     }
 
-    function link($offset = 0, $full = false)
+    public function link($offset = 0, $full = false)
     {
         return Horde::url('year.php', $full)
             ->add('date', ($this->year + $offset) . '0101');
     }
 
-    function getName()
+    public function getName()
     {
         return 'Year';
     }
index 3d80941..95f9ce5 100644 (file)
@@ -1,7 +1,7 @@
  <tr>
 <?php if ($first_row): ?>
   <td class="nowrap rightAlignt"<?php echo $rowspan ?>><strong><?php echo $newEventUrl ?></strong></td>
-  <td<?php echo $rowspan ?> style="height:<?php echo round(20 / $this->_slotsPerHour) ?>px">&nbsp;</td>
+  <td<?php echo $rowspan ?> style="height:<?php echo round(20 / $this->slotsPerHour) ?>px">&nbsp;</td>
   <td<?php echo $rowspan ?>>&nbsp;</td>
 <?php endif; ?>
   <?php echo $row ?>
index c33c407..7594e9b 100644 (file)
@@ -5,7 +5,7 @@
   <th class="control" width="90%">&nbsp;</th>
 <?php endif; ?>
 <?php $i = 0; foreach ($this->_currentCalendars as $cid => $cal): ?>
-  <th class="control" width="<?php echo round(90 / count($this->_currentCalendars)) ?>%" colspan="<?php echo $this->_span[$cid] ?>">
+  <th class="control" width="<?php echo round(90 / count($this->_currentCalendars)) ?>%" colspan="<?php echo $this->span[$cid] ?>">
    <strong><?php echo htmlspecialchars($cal->get('name')) ?></strong>
   </th>
 <?php endforeach; ?>
index 3630a65..d07dd8b 100644 (file)
@@ -16,7 +16,7 @@ echo $this->link(1)->link(array('title' => _("Next week"), 'class' => 'iconNav',
 
 <?php $colwidth = round((100 - count($this->days) - 1) / count($this->days)); foreach ($this->days as $day): ?>
   <th class="control" width="1%">&nbsp;</th>
-  <th class="nowrap <?php echo ($day->isToday() ? 'selected-control' : 'control') ?>" width="<?php echo $colwidth ?>%" colspan="<?php echo $day->_totalspan ?>">
+  <th class="nowrap <?php echo ($day->isToday() ? 'selected-control' : 'control') ?>" width="<?php echo $colwidth ?>%" colspan="<?php echo $day->totalspan ?>">
 <?php
 if (Kronolith::getDefaultCalendar(Horde_Perms::EDIT) &&
     ($GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_events') === true ||
index 2edc6d1..41c26f8 100644 (file)
@@ -6,7 +6,7 @@
   <th width="<?php echo $colwidth ?>%" class="<?php echo ($day->isToday() ? 'selected-control' : 'control') ?>">&nbsp;</th>
 <?php endif; ?>
 <?php foreach ($this->_currentCalendars as $cid => $cal): ?>
-  <th class="<?php echo ($day->isToday() ? 'selected-control' : 'control') ?>" width="<?php echo floor((90 / count($this->days)) / count($this->_currentCalendars)) ?>%" colspan="<?php echo $day->_span[$cid] ?>">
+  <th class="<?php echo ($day->isToday() ? 'selected-control' : 'control') ?>" width="<?php echo floor((90 / count($this->days)) / count($this->_currentCalendars)) ?>%" colspan="<?php echo $day->span[$cid] ?>">
    <strong><?php echo htmlspecialchars($cal->get('name')) ?></strong>
   </th>
 <?php endforeach; endforeach; ?>