本文整理汇总了PHP中Component::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Component::add方法的具体用法?PHP Component::add怎么用?PHP Component::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Component
的用法示例。
在下文中一共展示了Component::add方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
public function add(&$object)
{
if ($object instanceof Component) {
$this->addComponent($object);
return;
}
parent::add($object);
}
示例2: getRelatedTagsResult
/**
* Answer tag cloud of related tags
*
* @param Component $mainScreen
* @return void
* @access public
* @since 4/8/08
*/
public function getRelatedTagsResult(Component $mainScreen)
{
ob_start();
print "<h3 style='margin-top: 0px; margin-bottom: 0px;'>" . _("Related Tags:") . "</h3>";
$tag = $this->getTag();
print TagAction::getTagCloudDiv($tag->getRelatedTags(TAG_SORT_FREQ), 'view', 100);
$mainScreen->add(new Block(ob_get_clean(), STANDARD_BLOCK), "100%", null, LEFT, TOP);
}
示例3: save
public function save()
{
if (!isset($_SESSION['logged'])) {
return call('pages', 'home');
} else {
$post_data = $_POST;
Component::add($post_data);
return call('components', 'index');
}
}
示例4: addTo
/**
* Adds component to given parent component
*
* @param Component $parent
*
* @return $this
*/
public function addTo(Component $parent)
{
$parent->add($this);
$this->parent = $parent;
return $this;
}
示例5: getResult
/**
* Parses the input data and returns a correct VFREEBUSY object, wrapped in
* a VCALENDAR.
*
* @return Component
*/
public function getResult()
{
$busyTimes = array();
foreach ($this->objects as $object) {
foreach ($object->getBaseComponents() as $component) {
switch ($component->name) {
case 'VEVENT':
$FBTYPE = 'BUSY';
if (isset($component->TRANSP) && strtoupper($component->TRANSP) === 'TRANSPARENT') {
break;
}
if (isset($component->STATUS)) {
$status = strtoupper($component->STATUS);
if ($status === 'CANCELLED') {
break;
}
if ($status === 'TENTATIVE') {
$FBTYPE = 'BUSY-TENTATIVE';
}
}
$times = array();
if ($component->RRULE) {
$iterator = new RecurrenceIterator($object, (string) $component->uid);
if ($this->start) {
$iterator->fastForward($this->start);
}
$maxRecurrences = 200;
while ($iterator->valid() && --$maxRecurrences) {
$startTime = $iterator->getDTStart();
if ($this->end && $startTime > $this->end) {
break;
}
$times[] = array($iterator->getDTStart(), $iterator->getDTEnd());
$iterator->next();
}
} else {
$startTime = $component->DTSTART->getDateTime();
if ($this->end && $startTime > $this->end) {
break;
}
$endTime = null;
if (isset($component->DTEND)) {
$endTime = $component->DTEND->getDateTime();
} elseif (isset($component->DURATION)) {
$duration = DateTimeParser::parseDuration((string) $component->DURATION);
$endTime = clone $startTime;
$endTime->add($duration);
} elseif ($component->DTSTART->getDateType() === Property\DateTime::DATE) {
$endTime = clone $startTime;
$endTime->modify('+1 day');
} else {
// The event had no duration (0 seconds)
break;
}
$times[] = array($startTime, $endTime);
}
foreach ($times as $time) {
if ($this->end && $time[0] > $this->end) {
break;
}
if ($this->start && $time[1] < $this->start) {
break;
}
$busyTimes[] = array($time[0], $time[1], $FBTYPE);
}
break;
case 'VFREEBUSY':
foreach ($component->FREEBUSY as $freebusy) {
$fbType = isset($freebusy['FBTYPE']) ? strtoupper($freebusy['FBTYPE']) : 'BUSY';
// Skipping intervals marked as 'free'
if ($fbType === 'FREE') {
continue;
}
$values = explode(',', $freebusy);
foreach ($values as $value) {
list($startTime, $endTime) = explode('/', $value);
$startTime = DateTimeParser::parseDateTime($startTime);
if (substr($endTime, 0, 1) === 'P' || substr($endTime, 0, 2) === '-P') {
$duration = DateTimeParser::parseDuration($endTime);
$endTime = clone $startTime;
$endTime->add($duration);
} else {
$endTime = DateTimeParser::parseDateTime($endTime);
}
if ($this->start && $this->start > $endTime) {
continue;
}
if ($this->end && $this->end < $startTime) {
continue;
}
$busyTimes[] = array($startTime, $endTime, $fbType);
}
}
break;
//.........这里部分代码省略.........
示例6: addSiteContent
/**
* Add the site content gui components
*
* @param Component $mainScreen
* @return void
* @access public
*/
public function addSiteContent(Component $mainScreen)
{
$harmoni = Harmoni::instance();
if ($this->isAuthorizedToExecute()) {
// :: Site ::
$rootSiteComponent = SiteDispatcher::getCurrentRootNode();
$this->siteGuiComponent = $rootSiteComponent->acceptVisitor($this->getSiteVisitor());
$mainScreen->add($this->siteGuiComponent);
} else {
// Replace the title
$outputHandler = $harmoni->getOutputHandler();
$title = "\n\t\t<title>" . _("Unauthorized") . "</title>";
$outputHandler->setHead(preg_replace("/<title>[^<]*<\\/title>/", $title, $outputHandler->getHead()));
$mainScreen->add(new Block($this->getUnauthorizedMessage(), ALERT_BLOCK), "100%", null, CENTER, TOP);
}
}
示例7: testAnotherSerializeOrderProp
function testAnotherSerializeOrderProp()
{
$prop4s = array('1', '2', '3', '4', '5', '6', '7', '8', '9', '10');
$comp = new Component('VCARD');
$comp->__set('SOMEPROP', 'FOO');
$comp->__set('ANOTHERPROP', 'FOO');
$comp->__set('THIRDPROP', 'FOO');
foreach ($prop4s as $prop4) {
$comp->add('PROP4', 'FOO ' . $prop4);
}
$comp->__set('PROPNUMBERFIVE', 'FOO');
$comp->__set('PROPNUMBERSIX', 'FOO');
$comp->__set('PROPNUMBERSEVEN', 'FOO');
$comp->__set('PROPNUMBEREIGHT', 'FOO');
$comp->__set('PROPNUMBERNINE', 'FOO');
$comp->__set('PROPNUMBERTEN', 'FOO');
$comp->__set('VERSION', '2.0');
$comp->__set('UID', 'FOO');
$str = $comp->serialize();
$this->assertEquals("BEGIN:VCARD\r\nVERSION:2.0\r\nSOMEPROP:FOO\r\nANOTHERPROP:FOO\r\nTHIRDPROP:FOO\r\nPROP4:FOO 1\r\nPROP4:FOO 2\r\nPROP4:FOO 3\r\nPROP4:FOO 4\r\nPROP4:FOO 5\r\nPROP4:FOO 6\r\nPROP4:FOO 7\r\nPROP4:FOO 8\r\nPROP4:FOO 9\r\nPROP4:FOO 10\r\nPROPNUMBERFIVE:FOO\r\nPROPNUMBERSIX:FOO\r\nPROPNUMBERSEVEN:FOO\r\nPROPNUMBEREIGHT:FOO\r\nPROPNUMBERNINE:FOO\r\nPROPNUMBERTEN:FOO\r\nUID:FOO\r\nEND:VCARD\r\n", $str);
}
示例8: addFooterControls
/**
* Add the footer controls to the main screen gui component
*
* @param object Component $mainScreen
* @return void
* @access public
* @since 4/7/08
*/
public function addFooterControls(Component $mainScreen)
{
// :: Footer ::
$harmoni = Harmoni::instance();
$rootSiteComponent = SiteDispatcher::getCurrentRootNode();
$footer = $mainScreen->add(new Container(new XLayout(), BLANK, 1), $rootSiteComponent->getWidth(), null, CENTER, BOTTOM);
ob_start();
print "<div class='seguefooter_left'>";
// Home
print "<a href='" . $harmoni->request->quickURL('portal', 'list') . "' title='" . _("List of Segue sites") . "'>";
print _("home") . "</a> | ";
// Help LInk
print Help::link();
// Site Map
$siteMapUrl = $harmoni->request->quickURL("view", "map", array('node' => SiteDispatcher::getCurrentNodeId()));
print " | <a target='_blank' href='" . $siteMapUrl . "'";
print ' onclick="';
print "var url = '" . $siteMapUrl . "'; ";
print "window.open(url, 'site_map', 'width=500,height=600,resizable=yes,scrollbars=yes'); ";
print "return false;";
print '"';
print ">" . _("map") . "</a>";
// Tracking
$trackingUrl = $harmoni->request->quickURL("participation", "actions", array('node' => SiteDispatcher::getCurrentNodeId()));
print " | <a target='_blank' href='" . $trackingUrl . "'";
print ' onclick="';
print "var url = '" . $trackingUrl . "'; ";
print "window.open(url, 'site_map', 'width=500,height=600,resizable=yes,scrollbars=yes'); ";
print "return false;";
print '"';
print ">" . _("track") . "</a>";
print "</div>";
$footer->add(new UnstyledBlock(ob_get_clean()), "50%", null, LEFT, BOTTOM);
$footer->add(new UnstyledBlock(displayAction::getVersionText()), "50%", null, RIGHT, BOTTOM);
}