コード例 #1
0
 /**
  * @covers HtmlElement::set
  */
 public function testSetCss()
 {
     $elt = $this->element->set("class", "col-lg-12");
     $actual = $elt->getCssClasses();
     $excepted = "col-lg-12";
     $this->assertInstanceOf("HtmlElement", $elt);
     $this->assertContains($excepted, $actual);
 }
コード例 #2
0
ファイル: HX.php プロジェクト: xavocvijay/atkschool
 function set($text)
 {
     $this->text = $text;
     return parent::set($text);
 }
コード例 #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;
 }