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"])); }
$mainContentStyle->addSP(new TextAlignSP("justify")); // ============================================================================= // Create some containers & components. This stuff would normally go in an action. // ============================================================================= $xLayout = new XLayout(); $yLayout = new YLayout(); $mainBox = new Container($yLayout, BLANK, 1, $mainBoxStyle); $h1 = new Component("Home", MENU_ITEM_LINK_SELECTED, 1, $menuItemsStyle); $h2 = new Component("Pictures", MENU_ITEM_LINK_SELECTED, 1, $menuItemsStyle); $h3 = new Component("Guestbook", MENU_ITEM_LINK_SELECTED, 1, $menuItemsStyle); $h4 = new Component("Links", MENU_ITEM_LINK_SELECTED, 1, $menuItemsStyle); $menuBox = new Container($xLayout, BLANK, 1, $menuBoxStyle); $menuBox->add($h1, null, null, CENTER, CENTER); $menuBox->add($h2, null, null, CENTER, CENTER); $menuBox->add($h3, null, null, CENTER, CENTER); $menuBox->add($h4, null, null, CENTER, CENTER); $temp = new Container($yLayout, BLANK, 3); $temp->add($menuBox, null, null, RIGHT); $menuBox1 = $menuBox; $menuBox1->setLayout($yLayout); $mainContent = new Container($xLayout, BLANK, 1); $mainText = new Component("<p>Angelo de la Cruz, 46, was released Tuesday -- one day after the Philippine government completed the withdrawal of its 51-member humanitarian contingent from Iraq in compliance with kidnappers' demands.</p><p>De la Cruz was turned over to officials at the United Arab Emirates Embassy in Baghdad before he was transferred to the Philippine Embassy. He will be flown to Abu Dhabi for a medical evaluation, a UAE government statement said. </p><p>"I am very, very happy. His health is okay ... His family is waiting for him," a tearful Arsenia de la Cruz told reporters at her country's embassy in Amman, minutes after talking by telephone to her husband in Baghdad. </p><p>Mrs. de la Cruz had been staying in the Jordanian capital, awaiting word on her husband.</p><p>"I would not let him go back to the Middle East another time," The Associated Press quoted her as saying.</p><p>Earlier Tuesday, the Philippine President Gloria Macapagal Arroyo said on national television she had also spoken to the former hostage. </p><p>"I'm happy to announce that our long national vigil involving Angelo [de] la Cruz is over. I thank the Lord Almighty for his blessings," Arroyo said.</p><p>"His health is good, his spirits high and he sends best wishes to every Filipino for their thoughts and prayers." </p><p>Initial reports on de la Cruz's condition appeared promising. "He's here. He's with us. He's fine," a UAE Embassy official said before the transfer.</p><p>Kidnappers had threatened to behead the father of eight children, who was taken hostage on July 7, if the Philippines did not withdraw its forces from Iraq. </p><p>The Arabic-language news network Al-Jazeera read a statement from the kidnappers last week, saying they would free de la Cruz when "the last Filipino leaves Iraq on a date that doesn't go beyond the end of this month."</p>", BLANK, 1); $mainText->addStyle($mainContentStyle); $mainContent->add($menuBox1, null, null, null, TOP); $mainContent->add($mainText, "100%", null, null, TOP); $mainBox->add($temp, "100%", null, RIGHT, CENTER); $mainBox->add($mainContent, "100%", null, null, null); $theme = new Theme("Sample Page Theme", "This is the theme from examples/sample_page.php"); $theme->addGlobalStyle($bodyStyle); $theme->setComponent($mainBox); $theme->printPage();