本文整理汇总了PHP中Component类的典型用法代码示例。如果您正苦于以下问题:PHP Component类的具体用法?PHP Component怎么用?PHP Component使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Component类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onInherit
public function onInherit(Component &$component)
{
if (!PropertyResolver::hasProperty($this->getModelObject(), $component->getId())) {
return null;
}
return new WrappedCompoundModel($this);
}
示例2: test_generic_component
function test_generic_component()
{
$bodyStyle = new StyleCollection("body", "hey", "Body Style", "Global style settings.");
$bodyStyle->addSP(new BackgroundColorSP("#FFFCF0"));
$bodyStyle->addSP(new ColorSP("#2E2B33"));
$bodyStyle->addSP(new FontSP("Verdana", "10pt"));
$mainBoxStyle = new StyleCollection("*.mainBoxStyle", "mainBoxStyle", "Main Box Style", "Style for the main box.");
$mainBoxStyle->addSP(new BackgroundColorSP("#FFF3C2"));
$mainBoxStyle->addSP(new BorderSP("1px", "solid", "#2E2B33"));
$mainBoxStyle->addSP(new WidthSP("750px"));
$mainBoxStyle->addSP(new MarginSP("5px"));
$mainBoxStyle->addSP(new PaddingSP("5px"));
$comp1 = new Component(null, BLANK, 3);
$style = $comp1->addStyle($bodyStyle);
$this->assertReference($style, $bodyStyle);
$comp1->addStyle($mainBoxStyle);
$this->assertReference($comp1->_styleCollections["body"], $bodyStyle);
$this->assertReference($comp1->_styleCollections["*.mainBoxStyle"], $mainBoxStyle);
$this->assertIdentical($comp1->getType(), BLANK);
$this->assertReference($comp1->getStyle("body"), $bodyStyle);
$comp2 = new Component(null, BLANK, 3, $bodyStyle, $mainBoxStyle);
$this->assertIdentical($comp2->_styleCollections["body"], $bodyStyle);
$this->assertIdentical($comp2->_styleCollections["*.mainBoxStyle"], $mainBoxStyle);
$this->assertIdentical($comp1->getType(), BLANK);
$this->assertIdentical($comp2->getIndex(), 3);
$this->assertIdentical($comp1, $comp2);
$style = $comp1->removeStyle("body");
$this->assertReference($style, $bodyStyle);
$this->assertTrue(!isset($comp1->_styleCollections["body"]));
}
示例3: isComponentInstantiationAuthorised
public function isComponentInstantiationAuthorised(Component $component)
{
if ($component instanceof WebPage && $component->getIdentifier()->of($this->pageAuthIdentifier)) {
return $this->isAuthorised();
}
return true;
}
示例4: attach
/**
* Attaches the behavior object to the component.
* The default implementation will set the [[owner]] property
* and attach event handlers as declared in [[events]].
* Make sure you call the parent implementation if you override this method.
* @param Component $owner the component that this behavior is to be attached to.
*/
public function attach($owner)
{
$this->owner = $owner;
foreach ($this->events() as $event => $handler) {
$owner->on($event, is_string($handler) ? [$this, $handler] : $handler);
}
}
示例5: get
public static function get(Component $component)
{
if ($component->getParent() == null && !$component instanceof WebPage) {
trigger_error('It is not safe to rely on the localizer until the component hierarchy is complete', E_USER_WARNING);
}
return new self($component);
}
示例6: addComponent
public function addComponent(Component $c)
{
if ($this->ultimo) {
$c->setInput($this->ultimo->getElemento()->getOutput());
}
parent::append($c);
}
示例7: getTimeZone
/**
* This method will try to find out the correct timezone for an iCalendar
* date-time value.
*
* You must pass the contents of the TZID parameter, as well as the full
* calendar.
*
* If the lookup fails, this method will return UTC.
*
* @param string $tzid
* @param Sabre\VObject\Component $vcalendar
* @return DateTimeZone
*/
public static function getTimeZone($tzid, Component $vcalendar = null)
{
// First we will just see if the tzid is a support timezone identifier.
try {
return new \DateTimeZone($tzid);
} catch (\Exception $e) {
}
// Next, we check if the tzid is somewhere in our tzid map.
if (isset(self::$map[$tzid])) {
return new \DateTimeZone(self::$map[$tzid]);
}
if ($vcalendar) {
// If that didn't work, we will scan VTIMEZONE objects
foreach ($vcalendar->select('VTIMEZONE') as $vtimezone) {
if ((string) $vtimezone->TZID === $tzid) {
// Some clients add 'X-LIC-LOCATION' with the olson name.
if (isset($vtimezone->{'X-LIC-LOCATION'})) {
try {
return new \DateTimeZone($vtimezone->{'X-LIC-LOCATION'});
} catch (\Exception $e) {
}
}
// Microsoft may add a magic number, which we also have an
// answer for.
if (isset($vtimezone->{'X-MICROSOFT-CDO-TZID'})) {
if (isset(self::$microsoftExchangeMap[(int) $vtimezone->{'X-MICROSOFT-CDO-TZID'}->value])) {
return new \DateTimeZone(self::$microsoftExchangeMap[(int) $vtimezone->{'X-MICROSOFT-CDO-TZID'}->value]);
}
}
}
}
}
// If we got all the way here, we default to UTC.
return new \DateTimeZone(date_default_timezone_get());
}
示例8: deleteComponent
public function deleteComponent ($component_id, $reload) {
$component = new Component($component_id);
$component->deleteSelf();
if ($reload) {
$this->componentList = Search::unitComponents($unit_id);
$this->makeCount();
}
}
示例9: 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);
}
示例10: setUp
function setUp()
{
$view = new Component();
$this->form_component = new MockFormComponent($this);
$view->addChild($this->form_component, $this->form_id);
$toolkit =& Limb :: saveToolkit();
$toolkit->setView($view);
}
示例11: onComponentTagBody
public function onComponentTagBody(Component $component, ComponentTag &$tag)
{
$panelMarkup = $component->loadAssociatedMarkup();
$panel = MarkupUtils::findPiconTag('panel', $panelMarkup, $component);
if ($panel == null) {
throw new \MarkupNotFoundException(sprintf("Found markup for panel %s however there is no picon:panel tag.", $component->getId(0)));
}
$tag->setChildren(array($panel));
}
示例12: renderHead
public function renderHead(Component $component, HeaderContainer $headerContainer, HeaderResponse $headerResponse)
{
$markup = $component->loadAssociatedMarkup();
$heads = $this->findHead(array($markup));
foreach ($heads as $index => $head) {
$id = $component->getId() . '_head_' . $index;
$headerPart = new HeaderPartContainer($id, $head);
$headerPart->render();
}
}
示例13: list_drop
function list_drop()
{
$component = new Component();
$component->get();
foreach ($component as $row) {
$data[''] = '[ Components ]';
$data[$row->comp_id] = $row->comp_name . ' - ' . $row->comp_type;
}
return $data;
}
示例14: getTimeZone
/**
* This method will try to find out the correct timezone for an iCalendar
* date-time value.
*
* You must pass the contents of the TZID parameter, as well as the full
* calendar.
*
* If the lookup fails, this method will return the default PHP timezone
* (as configured using date_default_timezone_set, or the date.timezone ini
* setting).
*
* Alternatively, if $failIfUncertain is set to true, it will throw an
* exception if we cannot accurately determine the timezone.
*
* @param string $tzid
* @param SabreForRainLoop\VObject\Component $vcalendar
* @return DateTimeZone
*/
public static function getTimeZone($tzid, Component $vcalendar = null, $failIfUncertain = false)
{
// First we will just see if the tzid is a support timezone identifier.
try {
return new \DateTimeZone($tzid);
} catch (\Exception $e) {
}
// Next, we check if the tzid is somewhere in our tzid map.
if (isset(self::$map[$tzid])) {
return new \DateTimeZone(self::$map[$tzid]);
}
// Maybe the author was hyper-lazy and just included an offset. We
// support it, but we aren't happy about it.
if (preg_match('/^GMT(\\+|-)([0-9]{4})$/', $tzid, $matches)) {
return new \DateTimeZone('Etc/GMT' . $matches[1] . ltrim(substr($matches[2], 0, 2), '0'));
}
if ($vcalendar) {
// If that didn't work, we will scan VTIMEZONE objects
foreach ($vcalendar->select('VTIMEZONE') as $vtimezone) {
if ((string) $vtimezone->TZID === $tzid) {
// Some clients add 'X-LIC-LOCATION' with the olson name.
if (isset($vtimezone->{'X-LIC-LOCATION'})) {
$lic = (string) $vtimezone->{'X-LIC-LOCATION'};
// Libical generators may specify strings like
// "SystemV/EST5EDT". For those we must remove the
// SystemV part.
if (substr($lic, 0, 8) === 'SystemV/') {
$lic = substr($lic, 8);
}
try {
return new \DateTimeZone($lic);
} catch (\Exception $e) {
}
}
// Microsoft may add a magic number, which we also have an
// answer for.
if (isset($vtimezone->{'X-MICROSOFT-CDO-TZID'})) {
$cdoId = (int) $vtimezone->{'X-MICROSOFT-CDO-TZID'}->getValue();
// 2 can mean both Europe/Lisbon and Europe/Sarajevo.
if ($cdoId === 2 && strpos((string) $vtimezone->TZID, 'Sarajevo') !== false) {
return new \DateTimeZone('Europe/Sarajevo');
}
if (isset(self::$microsoftExchangeMap[$cdoId])) {
return new \DateTimeZone(self::$microsoftExchangeMap[$cdoId]);
}
}
}
}
}
if ($failIfUncertain) {
throw new \InvalidArgumentException('We were unable to determine the correct PHP timezone for tzid: ' . $tzid);
}
// If we got all the way here, we default to UTC.
return new \DateTimeZone(date_default_timezone_get());
}
示例15: renderComponent
private function renderComponent(Component $viewComp)
{
if (isset($_GET["ajax"])) {
return StringUtil::getJson("body", $viewComp->renderBodyChildren());
}
$view = $viewComp->render();
if (isset($_GET["file"])) {
$view .= $this->jsRewriteParent();
}
return $view;
}