Hi, I’m trying to add events to a google calendar and am running the code in model methods. I keep getting fatal errors like this:
Fatal error: Call to a member function newEventEntry() on a non-object in C:\wamp\www\delay-ad\system\application\models\scheduler_model.php
I assume I just have object syntax incorrect. please help!
<?php
class Scheduler_model extends Model{
function Scheduler_model(){
parent::Model();
require_once 'c:\wamp\www\delay-ad\Zend\Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');
$user = 'em@ail.com';
$pass = 'p@ssw0rD';
$service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
$client = Zend_Gdata_ClientLogin::getHttpClient($user,$pass,$service);
}
function addSubjectVisits($subID,$initials,$trial,$baselineDate){
foreach($visitTemplate as $v){
$targetStamp = $blStamp + $v['relativeToBL'];
$windowSeconds = $v['windowdays']*24*60*60;
$earlyStamp = $targetStamp - $windowSeconds;
$lateStamp = $targetStamp + $windowSeconds;
$this->createGoogleCalendarVisit($trial,$v['visitName'],$targetStamp, $earlyStamp,$lateStamp);
}
}
function createGoogleCalendarVisit($trial, $visitName, $targetStamp, $earlyStamp, $lateStamp){
$event = $this->service->newEventEntry();
$event->content= $this->service->newContent($title . "on August 12, 2008");
$event->quickAdd = $this->service->newQuickAdd("true");
$this->service->insertEvent($event);
}
}
I got the Gdata code from here: Zend Manual
