Exemplo n.º 1
0
 public function __construct()
 {
     self::$n = new HtmlNode();
     self::$n0 = new HtmlNode(['attr' => ['class' => 'main']]);
     self::$n1 = new HtmlNode(['attr' => ['class' => 'main bold']]);
     self::$n->append([self::$n0, self::$n1]);
 }
Exemplo n.º 2
0
 public function testGetCheckBoxes()
 {
     $div = new HtmlNode();
     $checkBoxes = HtmlCheckBox::getCheckBoxes(['name1' => 'value1', 'name2' => 'value2']);
     $div->append($checkBoxes);
     $this->assertEquals('<div><span><input name="name1" value="value1" type="checkbox"/></span><br/><span><input name="name2" value="value2" type="checkbox"/></span></div>', "{$div}");
 }
Exemplo n.º 3
0
 /**
  * Initialises HtmlNavigator object.
  * @method  initNavigator
  * @return  void
  */
 private static function initNavigator()
 {
     // Templates
     $L = new HtmlLeaf(['kind' => 'a']);
     $B = new HtmlNode(['kind' => 'li', 'child' => [$L]]);
     // Home
     $B_home = clone $B;
     $B_home[0]->setAttr(['href' => '/'])->setCont('HOME');
     // Services
     $B_services = clone $B;
     $B_services[0]->setAttr(['href' => '/services'])->setCont('SERVICES');
     $Menu = new HtmlNode(['kind' => 'ul', 'attr' => ['id' => 'mainMenu']]);
     $Menu->append([$B_home, $B_services]);
     return new HtmlNavigator(['kind' => 'div', 'attr' => ['id' => 'nav', 'class' => 'has-shadow'], 'child' => [$Menu]]);
 }