示例#1
0
 public function addItem($content)
 {
     $child = new HTMLElement('li');
     $child->appendChild($content);
     parent::appendChild($child);
     return $child;
 }
示例#2
0
 /**
  * @return HTMLElement
  */
 public function parseDropDownList()
 {
     $dropDownListContainer = new HTMLElement(HTMLElement::SELECT);
     $options = $this->getOptions();
     foreach ($options as $option) {
         $optionContainer = new HTMLElement(HTMLElement::OPTION);
         $optionText = (string) $option[0]['wdisplayText'];
         $optionValue = (string) $option[0]['wvalue'];
         $optionContainer->setInnerText($optionText);
         $optionContainer->setAttribute('value', $optionValue);
         $dropDownListContainer->addInnerElement($optionContainer);
     }
     return $dropDownListContainer;
 }
示例#3
0
 public function testGetInnerElementsByTag()
 {
     $divContainer = new HTMLElement(HTMLElement::DIV);
     $pContainer1 = new HTMLElement(HTMLElement::P);
     $spanContainer1 = new HTMLElement(HTMLElement::SPAN);
     $tableContainer1 = new HTMLElement(HTMLElement::TABLE);
     $pContainer1->addInnerElement($spanContainer1);
     $divContainer->addInnerElement($pContainer1);
     $divContainer->addInnerElement($tableContainer1);
     $elements = $divContainer->getInnerElementsByTagName("table");
     $this->assertInternalType('array', $elements);
     foreach ($elements as $element) {
         $this->assertEquals("table", $element->getTagName());
     }
 }
示例#4
0
 /**
  * Método Construtor
  * @param string $name nome para o atribute name
  * da tag META
  */
 function __construct($name = null)
 {
     parent::__construct("meta");
     if ($name) {
         $this->setAttribute("name", $name);
     }
 }
示例#5
0
 public function __construct($text = NULL)
 {
     parent::__construct('legend');
     if (!is_null($text)) {
         parent::appendChild($text);
     }
 }
示例#6
0
 public function getOutput()
 {
     if (!is_null($this->_legend)) {
         $this->prependChild($this->_legend);
     }
     return parent::getOutput();
 }
示例#7
0
 /**
  * Cria uma Tag HTML h1 a h6 de acordo com o parâmetro passado
  * @param int $num 
  */
 public function __construct($num = 1)
 {
     if ($num > 0 || $num < 7) {
         parent::__construct('h' . $num);
     } else {
         trigger_error('Parâmetro inválido em: ' . __CLASS__ . 'em seu construtor.', E_USER_ERROR);
     }
 }
示例#8
0
 public function __construct($nameId = null)
 {
     parent::__construct('div');
     if (!is_null($nameId)) {
         $this->id = $nameId;
         $this->name = $nameId;
     }
 }
示例#9
0
 /**
  *
  * @param script $src
  */
 public function __construct($src = null)
 {
     parent::__construct("script");
     $this->type = "text/javascript";
     //$this->language="javascript";
     $this->appendChild(" ");
     if (!is_null($src)) {
         $this->src = $src;
     }
 }
示例#10
0
 /**
  * Cria um IFrame
  * @param string $text
  */
 public function __construct($src = NULL)
 {
     parent::__construct("iframe");
     $this->setAttribute("width", "99%");
     //$this->setAttribute("height", "0");
     $this->setAttribute("frameborder", "0");
     $this->setAttribute("marginwidth", "0");
     $this->setAttribute("marginheight", "0");
     if (!is_null($src)) {
         $this->setAttribute("src", "{$src}");
     }
 }
示例#11
0
 /**
  * instancia o objet HTMLImage;
  *
  * @param string $src = localizacao da imagem a partir da raiz do site.;
  */
 public function __construct($src)
 {
     parent::__construct("img");
     $file = PUBLIC_PATH . $src;
     if (file_exists($file)) {
         $this->info = getimagesize($file);
         $this->height = $this->info[1];
         $this->width = $this->info[0];
     }
     $this->src = $src;
     $this->border = '0';
 }
示例#12
0
 /**
  * Constructor
  * Create the special hidden and button fields
  */
 public function __construct()
 {
     parent::__construct();
     $this->setAcceptCharset('UTF-8');
     $this->setMethod('post');
     $this->fields = array();
     $this->attributes['action'] = 'action';
     $this->attributes['enctype'] = 'enctype';
     $this->attributes['method'] = 'method';
     $this->attributes['acceptCharset'] = 'accept-charset';
     $this->attributes['name'] = 'name';
     $this->hidden = new Form\Field($this);
     $this->hidden->addClass('hidden');
     $this->buttons = new Form\Field($this);
     $this->buttons->addClass('buttons');
     $this->errorMessages = array();
 }
示例#13
0
 public function getOutput()
 {
     $this->setAttribute('data', $this->filename);
     $url = new HTMLElement('param');
     $url->setAttribute('name', 'src');
     $url->setAttribute('value', $this->filename);
     $this->appendChild($url);
     $url = new HTMLElement('param');
     $url->setAttribute('name', 'url');
     $url->setAttribute('value', $this->filename);
     $this->appendChild($url);
     $url = new HTMLElement('param');
     $url->setAttribute('name', 'autoplay');
     $url->setAttribute('value', $this->autostart);
     $this->appendChild($url);
     $color = new HTMLElement('param');
     $color->setAttribute('name', 'color');
     $color->setAttribute('value', '#FFFFFF');
     $this->appendChild($color);
     return parent::getOutput();
 }
 public function testItCanSetAttributesByName()
 {
     $expected = "<nav class='classOne'></nav>";
     $el = new HTMLElement('nav');
     $el->class = 'classOne';
     $this->assertEquals($expected, $el->getNode(), $el->getErrors());
 }
示例#15
0
 /**
  * Stvara novi element zadanog naziva uz posvecivanje
  * paznje na otvarajuce i zatvarajuce tagove.
  */
 public function __construct()
 {
     parent::__construct('label');
 }
示例#16
0
 /**
  * Stvara novi element zadanog naziva uz posvecivanje
  * paznje na otvarajuce i zatvarajuce tagove.
  */
 public function __construct()
 {
     parent::__construct('image', false);
 }
示例#17
0
 public function __construct()
 {
     parent::__construct("body");
 }
示例#18
0
 /**
  * Add inner text
  * @param   string  Text
  */
 public function addInnerText($text)
 {
     // Create new text element
     $textElement = new HTMLElement(self::TEXT);
     // Assign text to text element
     if ($this->innerElements != null && isset($this->innerElements[0])) {
         $text = $this->innerElements[0]->getHTML() . $text;
         $text = str_replace("\n", "", $text);
     }
     // Set inner text element
     $textElement->setInnerElement($text);
     $this->setInnerElement($textElement);
 }
示例#19
0
 /**
  * @abstract Uses a variable function list and a selected value to build a list of <option>'s.
  * Pipes, "|", are used to seperate parameters within individual option arguments, and an argument 
  * with no pipes will set the value and title to the whole argument.
  *
  * Example:
  *   echo generateSelectOptions('1', 'One|1', 'Two|2', '3');
  *
  * Would produce:
  *   <option value="1" title="One" selected>One</option>
  *   <option value="2" title="Two" >Two</option>
  *   <option value="3" title="3" >3</option>
  * 
  * @param string $selected The value to flag as selected in the generated <option>'s.
  * 
  * @return string Returns the generated <option> list markup.
  */
 public static function generateSelectOptions($selected = '')
 {
     $args = func_get_args();
     $numArgs = func_num_args();
     $response = $title = $value = $class = '';
     $parts = array();
     for ($i = 1; $i < $numArgs; ++$i) {
         $parts = explode('|', $args[$i], 4);
         $title = isset($parts[0]) ? $parts[0] : '';
         $value = isset($parts[1]) ? $parts[1] : $title;
         $class = isset($parts[2]) ? $parts[2] : '';
         $response .= HTMLElement::build('option', $title, array('value' => $value, 'title' => $title, 'class' => $class), array('selected' => $selected == $value)) . "\n";
     }
     return $response;
 }
示例#20
0
 /**
  * @param $entry
  * @return HTMLElement
  */
 private function constructTOCEntries($entry)
 {
     $bodyRow = new HTMLElement(HTMLElement::TR);
     $numberCell = new HTMLElement(HTMLElement::TD);
     $numberCell->setInnerText($entry['number']);
     $descriptionCell = new HTMLElement(HTMLElement::TD);
     $description = $entry['description'];
     while (strlen($description) < 140) {
         $description .= ".";
     }
     $descriptionCell->setInnerText($description);
     $pageCell = new HTMLElement(HTMLElement::TD);
     $pageCell->setInnerText($entry['page']);
     $bodyRow->addInnerElement($numberCell);
     $bodyRow->addInnerElement($descriptionCell);
     $bodyRow->addInnerElement($pageCell);
     return $bodyRow;
 }
示例#21
0
 public function getRenderArray()
 {
     return array_merge(array("checked" => (bool) $this->getValue() ? "checked" : ""), parent::getRenderArray());
 }
示例#22
0
 public function collectField($field)
 {
     $this->html = $field->getCaptchaHTML();
     parent::collectField($field);
 }
示例#23
0
 private function topRightMenu()
 {
     $div = new HTMLDiv("float_right");
     $div->class = "float_right";
     $ul = new HTMLElement("ul");
     if (is_array($this->topRightMenu)) {
         foreach ($this->topRightMenu as $item) {
             $li = new HTMLElement("li");
             $li->appendChild($item);
             $ul->appendChild($li);
         }
     }
     $div->appendChild($ul);
     $this->topRightMenu = $div;
     return $this->topRightMenu;
 }
示例#24
0
 private function add_id_vars(HTMLElement $element, array &$tpl_vars)
 {
     $tpl_vars['C_ID'] = $element->has_id();
     $tpl_vars['ID'] = $element->get_id();
 }
示例#25
0
 /**
  * @abstract Creates a new HTML <a> element.
  * @param string $href The `href` attribute of the element (e.g.: href="http://asdf.com/").
  * @param mixed $innerHTML InnerHTML as described by HTMLElement.
  * @param array $attributes Attributes as described by HTMLElement.
  * @param array $flags Flags as described by HTMLElement.
  * @see HTMLElement::__construct() 
  */
 public function __construct($href, $innerHTML, $attributes = array(), $flags = array())
 {
     $attributes['href'] = $href;
     parent::__construct('a', $innerHTML, $attributes, $flags);
 }
示例#26
0
 /**
  * Stvara novi element zadanog naziva uz posvecivanje
  * paznje na otvarajuce i zatvarajuce tagove.
  */
 public function __construct()
 {
     parent::__construct('option');
 }
示例#27
0
 public function HTMLDocument()
 {
     parent::__construct("html");
 }
示例#28
0
 public function parseTableCell()
 {
     $cellContainer = new HTMLElement(HTMLElement::TD);
     $paragraphs = $this->getParagraphs();
     foreach ($paragraphs as $javaParagraph) {
         $paragraph = new XWPFParagraph($javaParagraph, $this->mainStyleSheet);
         $paragraphContainer = $paragraph->parseParagraph();
         $styleClass = $paragraph->processParagraphStyle();
         $paragraphStyle = $this->extractParagraphStyles();
         // Merge inherited styles
         if ($paragraphStyle->hasAttributes()) {
             $styleClass = $styleClass->mergeStyleClass($paragraphStyle);
         }
         $className = $this->mainStyleSheet->getClassName($styleClass);
         $paragraphContainer->setClass('textframe horizontal common_style1 ' . $className);
         // Add id attribute to container for this paragraph
         if (!empty($paragraph->getId())) {
             $paragraphContainer->setAttribute('id', 'div_' . $paragraph->getId());
         }
         $cellContainer->addInnerElement($paragraphContainer);
     }
     //Set Attributes
     $colspan = $this->getColspan();
     if (!empty($colspan)) {
         $cellContainer->setAttribute('colspan', $colspan);
     }
     //TODO Find values for rowspan
     //        $rowspan = $this->getRowspan();
     //        if($rowspan == "restart") $cellContainer->setAttribute('rowspan', 2);
     return $cellContainer;
 }
示例#29
0
 /**
  * Stvara novi element zadanog naziva uz posvecivanje
  * paznje na otvarajuce i zatvarajuce tagove.
  */
 public function __construct()
 {
     parent::__construct('br');
 }
示例#30
0
 /**
  * Stvara novi element zadanog naziva uz posvecivanje
  * paznje na otvarajuce i zatvarajuce tagove.
  */
 public function __construct()
 {
     parent::__construct('select');
 }