コード例 #1
0
 /**
  * @covers HtmlElement::getBody
  */
 public function testGetBody()
 {
     $body = "html body";
     $elt = $this->element->setBody($body);
     $actual = $elt->getBody();
     $this->assertInstanceOf("HtmlElement", $elt);
     $this->assertEquals($body, $actual);
 }
コード例 #2
0
ファイル: Section.php プロジェクト: fruition-sciences/phpfw
 public function begin()
 {
     echo $this->getElementOpenTag() . "\n";
     $legend = new HtmlElement("legend");
     $legend->setBody($this->title);
     echo $legend;
     $this->started = true;
 }
コード例 #3
0
ファイル: Form.php プロジェクト: fruition-sciences/phpfw
 /**
  * Dispaly a label for a field.
  * If the field is required, the css class 'required' will be added to
  * the label's element.
  * 
  * @param $name string the field name
  * @param $title string the title to display.
  * @return HtmlElement
  */
 public function label($name, $title)
 {
     $cssClasses = array();
     $this->labels[$name] = $this->removeEndColon($title);
     $span = new HtmlElement("label");
     $span->setBody($title);
     if ($this->findConstraint($name, ConstraintFactory::REQUIRED)) {
         $cssClasses[] = 'required';
     }
     if (isset($this->field_errors[$name])) {
         $styleClass = Config::getInstance()->getString("webapp/ui/errorCssClass", "error");
         $cssClasses[] = $styleClass;
     }
     if (count($cssClasses) > 0) {
         $span->set("class", implode(' ', $cssClasses));
     }
     return $span;
 }