Пример #1
0
 public function testTag()
 {
     $this->assertEquals(std::tag("ul"), "<ul>");
     $this->assertEquals(std::tag("LI"), "<LI>");
     $this->assertEquals(std::tag("/ul"), "</ul>");
     $this->assertEquals(std::tag("br/"), "<br />");
     $this->assertEquals(std::tag("img", ["src" => "hello.png"]), '<img src="hello.png">');
 }
Пример #2
0
 /**
  * 
  * @param unknown_type $data an array containing
  * 		the expected data to be displayed (in the HTML
  * 		format). If this variable is not an array, the row
  * 		is simply ignored.
  *
  * @return the row.
  */
 public function getRow($data)
 {
     $ret = '';
     if (is_array($data)) {
         $options = array();
         $rowstyle = '';
         if (isset($data['tr-style'])) {
             $rowstyle = $data["tr-style"];
             if (strlen($rowstyle) > 0) {
                 $options["style"] = $rowstyle;
             }
         }
         if (strlen($rowstyle) > 0) {
             $options["style"] = $rowstyle;
         }
         if (isset($data['tr-class'])) {
             $options['class'] = $data["tr-class"];
         }
         $ret .= std::tagln("tr", $options);
         foreach ($this->headers as $key => $value) {
             $opt = array();
             $val = @$data[$key];
             $style = '';
             if (isset($data["{$key}-style"])) {
                 $style = $data["{$key}-style"];
             }
             if (isset($data["{$key}-order"])) {
                 $opt['data-order'] = $data["{$key}-order"];
             }
             if ($style || $rowstyle) {
                 $opt["style"] = $style . $rowstyle;
             }
             if ($this->columns[$key]['plain']) {
                 $val = std::html($val);
             }
             $ret .= "  " . std::tag("td", $opt) . $val . std::tagln("/td");
         }
         $ret .= std::tagln("/tr");
     }
     return $ret;
 }
Пример #3
0
 /**
  * Formatte the text into a paragraph.
  * 
  * @param string $html the text of the paragraph
  * 		previously formatted in HTML.
  * @return string the HTML embedded with &lt;P&gt; and &lt;/P&gt;.
  */
 public function p($html, $attr = array())
 {
     if (!is_array($attr)) {
         // If the attr is not an array, we consider as a class.
         $cls = $attr;
         $attr = array("class" => $cls);
     }
     $ret = std::tag("p", $attr) . $html . "</p>\n";
     return $this->getTabulation() . $ret;
 }