本文整理汇总了PHP中Container::getComponent方法的典型用法代码示例。如果您正苦于以下问题:PHP Container::getComponent方法的具体用法?PHP Container::getComponent怎么用?PHP Container::getComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Container
的用法示例。
在下文中一共展示了Container::getComponent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: visitFixedOrganizer
/**
* Visit a fixed organizer and return the GUI component [a container]
* that corresponds to it. Traverse-to/add child components.
*
* @param object FixedOrganizerSiteComponent $organizer
* @return object Component
* @access public
* @since 4/3/06
*/
public function visitFixedOrganizer(FixedOrganizerSiteComponent $organizer)
{
$authZ = Services::getService("AuthZ");
$idManager = Services::getService("Id");
if ($authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.modify"), $organizer->getQualifierId())) {
$tdStyles = 'border: 1px solid #F00; padding: 6px;';
} else {
$tdStyles = '';
}
$guiContainer = new Container(new TableLayout($organizer->getNumColumns(), $tdStyles), BLANK, 1);
// Add controls bar and border
$authZ = Services::getService("AuthZ");
$idManager = Services::getService("Id");
if ($authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.add_children"), $organizer->getQualifierId())) {
$canAdd = true;
} else {
$canAdd = false;
}
$numCells = $organizer->getTotalNumberOfCells();
for ($i = 0; $i < $numCells; $i++) {
$child = $organizer->getSubcomponentForCell($i);
if (is_object($child)) {
$childComponent = $child->acceptVisitor($this);
if ($childComponent) {
$guiContainer->add($childComponent, $child->getWidth(), null, null, TOP);
} else {
$childComponent = $guiContainer->add(new Blank(), $child->getWidth(), null, null, TOP);
}
} else {
$this->_emptyCellContainers[$organizer->getId() . '_cell:' . $i] = $guiContainer;
$this->_emptyCellPlaceholders[$organizer->getId() . '_cell:' . $i] = $guiContainer->addPlaceholder();
$childComponent = $guiContainer->getComponent($this->_emptyCellPlaceholders[$organizer->getId() . '_cell:' . $i]);
}
if ($canAdd) {
$this->wrapAsDroppable($childComponent, $organizer->getId() . "_cell:" . $i, array_keys($organizer->getVisibleComponentsForPossibleAdditionToCell($i)));
}
}
if ($authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.modify"), $organizer->getQualifierId())) {
$controlsHTML = $this->getBarPreHTML('#F00', $organizer, '1px') . $this->getControlsHTML($organizer, $organizer->getDisplayName(), $organizer->acceptVisitor($this->_controlsVisitor), '#F00', '#F99', '#F66', 0, '1px');
$guiContainer->setPreHTML($controlsHTML . "\n<div style='z-index: 0;'>" . $guiContainer->getPreHTML($null = null));
$guiContainer->setPostHTML($guiContainer->getPostHTML($null = null) . "</div>" . $this->getBarPostHTML());
if (count($organizer->getVisibleDestinationsForPossibleAddition())) {
$this->wrapAsDraggable($guiContainer, $organizer->getId(), 'FixedOrganizer');
}
}
return $guiContainer;
}
示例2: Container
function test_generic_container()
{
$comp = new Container(new FlowLayout(), MENU, 5);
$c = new Component("Hello!", FOOTER, 4);
$c1 = $comp->add($c, "12px", "2em", LEFT, BOTTOM);
$this->assertReference($c1, $c);
$this->assertReference($comp->getComponent(1), $c);
$this->assertIdentical($comp->getComponentWidth(1), "12px");
$this->assertIdentical($comp->getComponentHeight(1), "2em");
$this->assertIdentical($comp->getComponentAlignmentX(1), LEFT);
$this->assertIdentical($comp->getComponentAlignmentY(1), BOTTOM);
$this->assertIdentical($comp->getComponentsCount(), 1);
$c = new Component("Hello!", MENU_ITEM_LINK_SELECTED, 2);
$c2 = $comp->add($c, "16px", "6em", RIGHT, CENTER);
$this->assertReference($c2, $c);
$this->assertReference($comp->getComponent(2), $c);
$this->assertIdentical($comp->getComponentsCount(), 2);
$c = new Component("Hello!", MENU_ITEM_LINK_UNSELECTED, 5);
$c3 = $comp->add($c, "6px", "2em", CENTER, TOP);
$this->assertReference($c3, $c);
$this->assertReference($comp->getComponent(3), $c);
$this->assertIdentical($comp->getComponentsCount(), 3);
$c = $comp->remove(2);
$this->assertReference($c, $c2);
$this->assertNull($comp->getComponent(2));
$this->assertIdentical($comp->getComponentsCount(), 2);
$comp->removeAll();
$this->assertIdentical($comp->_components, array());
$this->assertIdentical($comp->getComponentsCount(), 0);
}