protected function takeChildFromDOM($child)
 {
     $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
     switch ($absoluteNodeName) {
         case $this->lookupNamespace('gCal') . ':' . 'sendEventNotifications':
             $sendEventNotifications = new Zend_Gdata_Calendar_Extension_SendEventNotifications();
             $sendEventNotifications->transferFromDOM($child);
             $this->_sendEventNotifications = $sendEventNotifications;
             break;
         case $this->lookupNamespace('gCal') . ':' . 'timezone':
             $timezone = new Zend_Gdata_Calendar_Extension_Timezone();
             $timezone->transferFromDOM($child);
             $this->_timezone = $timezone;
             break;
         case $this->lookupNamespace('atom') . ':' . 'link':
             $link = new Zend_Gdata_Calendar_Extension_Link();
             $link->transferFromDOM($child);
             $this->_link[] = $link;
             break;
         case $this->lookupNamespace('gCal') . ':' . 'quickadd':
             $quickadd = new Zend_Gdata_Calendar_Extension_QuickAdd();
             $quickadd->transferFromDOM($child);
             $this->_quickadd = $quickadd;
             break;
         default:
             parent::takeChildFromDOM($child);
             break;
     }
 }
Beispiel #2
0
 public function addEvent($recordid, $Data, $tzOffset)
 {
     set_include_path($this->root_directory . "modules/Calendar4You/");
     $startDate = $Data["date_start"];
     $endDate = $Data["due_date"];
     $startTime = $Data["time_start"];
     $endTime = $Data["time_end"];
     $GCalClass = new Zend_Gdata_Calendar($this->gClient);
     $newEntry = $GCalClass->newEventEntry();
     $newEntry->title = $GCalClass->newTitle(trim($Data["subject"]));
     $newEntry->where = array($GCalClass->newWhere(trim($Data["location"])));
     $newEntry->content = $GCalClass->newContent($Data["description"]);
     $newEntry->content->type = 'text';
     $when = $GCalClass->newWhen();
     $when->startTime = $startDate . 'T' . $this->removeLastColon($startTime) . ':00.000' . $tzOffset;
     $when->endTime = $endDate . 'T' . $this->removeLastColon($endTime) . ':00.000' . $tzOffset;
     $newEntry->when = array($when);
     $SendEventNotifications = new Zend_Gdata_Calendar_Extension_SendEventNotifications();
     $SendEventNotifications->setValue(true);
     $newEntry->SendEventNotifications = $SendEventNotifications;
     $whos = $this->getInvitedUsersEmails($GCalClass, $recordid);
     if (count($whos) > 0) {
         $newEntry->setWho($whos);
     }
     $appCallUri = "";
     foreach ($this->gListFeed as $calendar) {
         if ($calendar->id == $this->selected_calendar) {
             $appCallUri = $calendar->content->src;
         }
     }
     $createdEntry = $GCalClass->insertEvent($newEntry, $appCallUri);
     set_include_path($this->root_directory);
     $eventid = urldecode($createdEntry->id->text);
     return $eventid;
 }
 public function testExtensionAttributes()
 {
     $extensionAttributes = $this->sendEventNotifications->extensionAttributes;
     $extensionAttributes['foo1'] = array('name' => 'foo1', 'value' => 'bar');
     $extensionAttributes['foo2'] = array('name' => 'foo2', 'value' => 'rab');
     $this->sendEventNotifications->extensionAttributes = $extensionAttributes;
     $this->assertEquals('bar', $this->sendEventNotifications->extensionAttributes['foo1']['value']);
     $this->assertEquals('rab', $this->sendEventNotifications->extensionAttributes['foo2']['value']);
     $sendEventNotificationsXml = $this->sendEventNotifications->saveXML();
     $newSendEventNotifications = new Zend_Gdata_Calendar_Extension_SendEventNotifications();
     $newSendEventNotifications->transferFromXML($sendEventNotificationsXml);
     $this->assertEquals('bar', $newSendEventNotifications->extensionAttributes['foo1']['value']);
     $this->assertEquals('rab', $newSendEventNotifications->extensionAttributes['foo2']['value']);
 }