コード例 #1
0
ファイル: HTMLList.php プロジェクト: primephp/framework
 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
ファイル: HTMLElementTest.php プロジェクト: skypeter1/webapps
 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
ファイル: HTMLMeta.php プロジェクト: primephp/framework
 /**
  * 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
ファイル: HTMLLegend.php プロジェクト: primephp/framework
 public function __construct($text = NULL)
 {
     parent::__construct('legend');
     if (!is_null($text)) {
         parent::appendChild($text);
     }
 }
コード例 #6
0
ファイル: HTMLFieldset.php プロジェクト: primephp/framework
 public function getOutput()
 {
     if (!is_null($this->_legend)) {
         $this->prependChild($this->_legend);
     }
     return parent::getOutput();
 }
コード例 #7
0
ファイル: HTMLHeader.php プロジェクト: primephp/framework
 /**
  * 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
ファイル: HTMLDiv.php プロジェクト: primephp/framework
 public function __construct($nameId = null)
 {
     parent::__construct('div');
     if (!is_null($nameId)) {
         $this->id = $nameId;
         $this->name = $nameId;
     }
 }
コード例 #9
0
ファイル: HTMLScript.php プロジェクト: primephp/framework
 /**
  *
  * @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
ファイル: HTMLIFrame.php プロジェクト: primephp/framework
 /**
  * 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
ファイル: HTMLImage.php プロジェクト: primephp/framework
 /**
  * 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
ファイル: Form.php プロジェクト: jazzee/foundation
 /**
  * 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
ファイル: HTMLObject.php プロジェクト: primephp/framework
 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();
 }
コード例 #14
0
 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
ファイル: HTMLBody.php プロジェクト: primephp/framework
 public function __construct()
 {
     parent::__construct("body");
 }
コード例 #18
0
ファイル: HTMLElement.php プロジェクト: skypeter1/webapps
 /**
  * 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
ファイル: page.php プロジェクト: BGCX262/zwf-svn-to-git
 /**
  * @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
ファイル: TableOfContents.php プロジェクト: skypeter1/webapps
 /**
  * @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
ファイル: Checkbox.php プロジェクト: shadowprince/forman
 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
ファイル: Index.php プロジェクト: primephp/framework
 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
ファイル: html.php プロジェクト: BGCX262/zwf-svn-to-git
 /**
  * @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
ファイル: HTMLDocument.php プロジェクト: primephp/framework
 public function HTMLDocument()
 {
     parent::__construct("html");
 }
コード例 #28
0
ファイル: XWPFTableCell.php プロジェクト: skypeter1/webapps
 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
ファイル: HTMLBrElement.php プロジェクト: Cibale/sofascoreEDU
 /**
  * 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');
 }