本文整理汇总了PHP中Zend_Gdata_Calendar::newLink方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Gdata_Calendar::newLink方法的具体用法?PHP Zend_Gdata_Calendar::newLink怎么用?PHP Zend_Gdata_Calendar::newLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Gdata_Calendar
的用法示例。
在下文中一共展示了Zend_Gdata_Calendar::newLink方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testNormalLinkShouldHaveNoExtensionElements
public function testNormalLinkShouldHaveNoExtensionElements()
{
$this->link->rel = "http://nowhere.invalid/";
$this->link->title = "Somewhere";
$this->link->href = "http://somewhere.invalid/";
$this->link->type = "text/plain";
$this->link->webContent = new Zend_Gdata_Calendar_Extension_WebContent("a", "1", "2");
$this->assertEquals($this->link->rel, "http://nowhere.invalid/");
$this->assertEquals($this->link->title, "Somewhere");
$this->assertEquals($this->link->href, "http://somewhere.invalid/");
$this->assertEquals($this->link->type, "text/plain");
$this->assertEquals($this->link->webcontent->url, "a");
$this->assertEquals($this->link->webcontent->height, "1");
$this->assertEquals($this->link->webcontent->width, "2");
$this->assertEquals(count($this->link->extensionElements), 0);
$newLink = new Zend_Gdata_Calendar_Extension_Link();
$newLink->transferFromXML($this->link->saveXML());
$this->assertEquals(count($newLink->extensionElements), 0);
$newLink->extensionElements = array(new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar'));
$this->assertEquals(count($newLink->extensionElements), 1);
$this->assertEquals($this->link->rel, "http://nowhere.invalid/");
$this->assertEquals($this->link->title, "Somewhere");
$this->assertEquals($this->link->href, "http://somewhere.invalid/");
$this->assertEquals($this->link->type, "text/plain");
$this->assertEquals($this->link->webcontent->url, "a");
$this->assertEquals($this->link->webcontent->height, "1");
$this->assertEquals($this->link->webcontent->width, "2");
/* try constructing using magic factory */
$cal = new Zend_Gdata_Calendar();
$newLink2 = $cal->newLink();
$newLink2->transferFromXML($newLink->saveXML());
$this->assertEquals(count($newLink2->extensionElements), 1);
$this->assertEquals($this->link->rel, "http://nowhere.invalid/");
$this->assertEquals($this->link->title, "Somewhere");
$this->assertEquals($this->link->href, "http://somewhere.invalid/");
$this->assertEquals($this->link->type, "text/plain");
$this->assertEquals($this->link->webcontent->url, "a");
$this->assertEquals($this->link->webcontent->height, "1");
$this->assertEquals($this->link->webcontent->width, "2");
}
示例2: createWebContentEvent
/**
* Creates a new web content event on the authenticated user's default
* calendar with the specified event details. For simplicity, the event
* is created as an all day event and does not include a description.
*
* @param Zend_Http_Client $client The authenticated client object
* @param string $title The event title
* @param string $startDate The start date of the event in YYYY-MM-DD format
* @param string $endDate The end time of the event in HH:MM 24hr format
* @param string $icon URL pointing to a 16x16 px icon representing the event.
* @param string $url The URL containing the web content for the event.
* @param string $height The desired height of the web content pane.
* @param string $width The desired width of the web content pane.
* @param string $type The MIME type of the web content.
* @return string The ID URL for the event.
*/
function createWebContentEvent($client, $title = 'World Cup 2006', $startDate = '2006-06-09', $endDate = '2006-06-09', $icon = 'http://www.google.com/calendar/images/google-holiday.gif', $url = 'http://www.google.com/logos/worldcup06.gif', $height = '120', $width = '276', $type = 'image/gif')
{
$gc = new Zend_Gdata_Calendar($client);
$newEntry = $gc->newEventEntry();
$newEntry->title = $gc->newTitle(trim($title));
$when = $gc->newWhen();
$when->startTime = $startDate;
$when->endTime = $endDate;
$newEntry->when = array($when);
$wc = $gc->newWebContent();
$wc->url = $url;
$wc->height = $height;
$wc->width = $width;
$wcLink = $gc->newLink();
$wcLink->rel = "http://schemas.google.com/gCal/2005/webContent";
$wcLink->title = $title;
$wcLink->type = $type;
$wcLink->href = $icon;
$wcLink->webContent = $wc;
$newEntry->link = array($wcLink);
$createdEntry = $gc->insertEvent($newEntry);
return $createdEntry->id->text;
}