[kronolith] Re: free/busy, almost there but...

Ken Weaverling weave at dtcc.edu
Tue Apr 5 11:56:11 PDT 2005


I'm still trying to figure out why my free/busy display doesn't show, and
am having a hard time groking what's going on in the code that adds the
busy times...

I've verified that parsevCalendar() is getting the busy periods, but
addBusyPeriod() is being passed null values... The function

function parsevCalendar($data)
{

 parent::parsevCalendar($data, 'VFREEBUSY');

 // Do something with all the busy periods.
 foreach ($this->_attributes as $key => $attribute) {
   if ($attribute['name'] == 'FREEBUSY') {
     foreach ($attribute['value'] as $fooo => $value) {
       if (array_key_exists('duration', $attribute['value'])) {
         $this->addBusyPeriod('BUSY', $value['start'], null, $value['duration']);
       } else {
         $this->addBusyPeriod('BUSY', $value['start'], $value['end']);
       }
     }
     unset($this->_attributes[$key]);
   }
 }
}

$attribute['value'] is a pair of times, actual example...

Array ( [start] => 1112702400 [end] => 1112709600 )

But .. the foreach line 'foreach ($attribute['value'] as $value)' just
assigns a scalar (integer) to $value and that is one of the values of the
pairs up there, not one of the array themselves. I verified this with
gettype($value) and it returned integer. So when addBusyPeriod is passed
something like $value['start'] since $value is not an array, it's passing
a null, and hence what appears to be my problem.

So either the code is wrong (which I have a hard time believing since it
works for others), or the data that is being parsed by parsevCalendar is
not what it expects... It doesnt' help that this is my first experience
with php either :(

Example FREEBUSY lines that fp.php returns

FREEBUSY:20050405T130000Z/20050405T150000Z
FREEBUSY:20050407T140000Z/20050407T150000Z
FREEBUSY:20050413T150000Z/20050413T170000Z

Any ideas greatly appreciated!



More information about the kronolith mailing list