phpzend-frameworkframeworksgoogle-calendar-api

How to update date and time with Google Calendar API


How could I update date and time.. Everything is fine, except date and time. After every update they are same and never changed. Where do you think is my mistake?

Here is the function that I use to update events.

    function updateEvent ($client, $eventId, $newTitle, 
        $newDesc, $newWhere, $newStartDate, 
        $newStartTime, $newEndDate, $newEndTime, 
        $tzOffset)
            {   
                $gdataCal = new Zend_Gdata_Calendar($client);
                if ($eventOld = getEvent($client, $eventId)) {
                $eventOld->title = $gdataCal->newTitle($newTitle);
                $eventOld->where = array($gdataCal->newWhere($newWhere));
                $eventOld->content = $gdataCal->newContent("$newDesc");

                $when = $gdataCal->newWhen();

                if ($newStartTime!='' && $newEndTime!=''){
                  $when->startTime = "{$newStartDate}T{$newStartTime}:00.000{$tzOffset}:00";
                  $when->endTime = "{$newEndDate}T{$newEndTime}:00.000{$tzOffset}:00";
                }else {
                  $when->startTime = $newStartDate;
                  $when->endTime = $newEndDate;
                }

                try {
                  $eventOld->save();
                } catch (Zend_Gdata_App_Exception $e) {
                  var_dump($e);
                  return null;
                }
                  return 1;
              } else {
                return 0;
              }
            }

            if($_POST) {

              updateEvent($client, $id, $_POST['nameBg'], $_POST['descrBg'], $_POST['place'],
               $_POST['dateStart'],
               $_POST['dateEnd'],
               $_POST['timeStart'],
               $_POST['timeEnd'],
               '+02');



        $this->_helper->FlashMessenger->addMessage(array('success' => $this->_translate->_('Everything is OK.')));

        return $this->_helper->redirector->gotoRoute(array_merge($this->_urlCommon, array('action' => 'list')), 'lang-admin', true);


            } 

Solution

  • I find where was my problem.. Actually when i call updateEvent() i have changed the places of timeStart and dateEnd..