public function render() { $this->setAttribute('rows', 10); $this->setAttribute('cols', 80); $this->setAttribute('class', "textarea {$this->getCSSClasses()}"); $this->setAttribute('name', $this->getName()); return \ntentan\honam\TemplateEngine::render("textarea_element.tpl.php", array('element' => $this)); }
public function render() { if ($this->getCheckedValue() == (string) $this->getValue()) { $this->setAttribute('checked', 'checked'); } $this->setAttribute("name", $this->getName()); $this->setAttribute("class", "{$this->getAttribute('type')} {$this->getCSSClasses()}"); $this->setValue($this->getCheckedValue()); return TemplateEngine::render('input_checkable_element.tpl.php', array('element' => $this)); }
public function testAssetLoading() { vfsStream::setup('public'); AssetsLoader::appendSourceDir('tests/files/assets'); AssetsLoader::setDestinationDir(vfsStream::url('public')); touch(vfsStream::url('public/existing.css')); $output = TemplateEngine::render('assets.tpl.php', array()); $this->assertEquals("vfs://public/some.css\nvfs://public/another.css\nvfs://public/existing.css", $output); $this->assertFileExists(vfsStream::url('public/some.css')); $this->assertFileExists(vfsStream::url('public/another.css')); }
public function __toString() { foreach ($this->elements as $element) { if (is_a($element, "\\ntentan\\plugins\\wyf\\helpers\\inputs\\forms\\Container")) { $element->setData($this->data); $element->setErrors($this->errors); } else { $name = $element->getName(); $element->setData($this->data[$name]); $element->setErrors($this->errors[$name]); } } return TemplateEngine::render('wyf_forms_form', $this->getTemplateVariables()); }
public function testArrayVariable() { $output = TemplateEngine::render('phptest_array.tpl.php', array('array' => array('first' => '<div>Number one</div>', 'second' => '<b>Number two</b>', 'third' => '<span>Number three</span>'))); $expected = "<div>Number one</div> <div>Number one</div> first \n<b>Number two</b> <b>Number two</b> second \n<span>Number three</span> <span>Number three</span> third \n<div>Number one</div> <div>Number one</div> \nsecond found\n<p>A new paragraph</p> <p>A new paragraph</p> \n<p>A zero paragraph</p> <p>A zero paragraph</p> \n\n"; $this->assertEquals($expected, $output); }
public function __toString() { return TemplateEngine::render(FormHelper::getLayout() . "_layout_element.tpl.php", array('element' => $this)); }
public function render() { $this->setAttribute("class", "{$this->getAttribute('type')} {$this->getCSSClasses()}"); $this->setAttribute("name", $this->getName()); return TemplateEngine::render("input_element.tpl.php", array('element' => $this)); }
public function __toString() { $menuItems = array(); foreach ($this->items as $index => $item) { if (is_string($item) || is_numeric($item)) { $item = array('label' => $item, 'url' => $this->makeFullUrl(strtolower(str_replace(' ', '_', $item))), 'default' => null); } $item['selected'] = $item['url'] == substr($this->currentUrl, 0, strlen($item['url'])); $item['fully_matched'] = $item['url'] == $this->currentUrl; $menuItems[$index] = $item; } return \ntentan\honam\TemplateEngine::render("{$this->alias}_menu.tpl.php", ['items' => $menuItems, 'css_classes' => $this->cssClasses, 'has_links' => $this->hasLinks, 'alias' => $this->alias]); }
public function renderFoot() { return \ntentan\honam\TemplateEngine::render('fieldset_foot.tpl.php', array('element' => $this)); }
public function __toString() { $pagingLinks = array(); if ($this->parameters['page_number'] > 1) { $pagingLinks[] = array("link" => $this->getLink($this->parameters['page_number'] - 1), "label" => "< Prev", "selected" => false); } if ($this->parameters['number_of_pages'] <= $this->parameters['number_of_links'] || $this->parameters['page_number'] < $this->halfNumberOfLinks) { for ($i = 1; $i <= ($this->parameters['number_of_pages'] > $this->parameters['number_of_links'] ? $this->parameters['number_of_links'] : $this->parameters['number_of_pages']); $i++) { $pagingLinks[] = array("link" => $this->getLink($i), "label" => "{$i}", "selected" => $this->parameters['page_number'] == $i); } } else { if ($this->parameters['number_of_pages'] - $this->parameters['page_number'] < $this->halfNumberOfLinks) { $startOffset = $this->parameters['page_number'] - ($this->parameters['number_of_links'] - 1 - ($this->parameters['number_of_pages'] - $this->parameters['page_number'])); $endOffset = $this->parameters['page_number'] + ($this->parameters['number_of_pages'] - $this->parameters['page_number']); } else { $startOffset = $this->parameters['page_number'] - ($this->halfNumberOfLinks - 1); $endOffset = $this->parameters['page_number'] + ($this->halfNumberOfLinks - 1); } for ($i = $startOffset; $i <= $endOffset; $i++) { $pagingLinks[] = array("link" => $this->getLink($i), "label" => "{$i}", "selected" => $this->parameters['page_number'] == $i); } } if ($this->parameters['page_number'] < $this->parameters['number_of_pages']) { $pagingLinks[] = array("link" => $this->getLink($this->parameters['page_number'] + 1), "label" => "Next >", "selected" => false); } return TemplateEngine::render("links.tpl.php", array('links' => $pagingLinks)); }
public function render() { switch ($this->rendererMode) { case 'head': return $this->renderHead(); case 'foot': return $this->renderFoot(); default: return $this->renderHead() . TemplateEngine::render('elements.tpl.php', array('elements' => $this->getElements())) . $this->renderFoot(); } }
public function __toString() { $type = $this->renderWithType == '' ? \ntentan\utils\Text::deCamelize($this->getType()) : $this->renderWithType; return TemplateEngine::render("wyf_inputs_forms_{$type}.tpl.php", $this->getTemplateVariables()); }
function t($template, $templateData = array()) { return TemplateEngine::render($template, $templateData); }
public function __toString() { $this->parameters['row_template'] = $this->parameters['row_template'] == null ? 'row.tpl.php' : $this->parameters['row_template']; $this->parameters['default_cell_template'] = $this->parameters['default_cell_template'] == null ? 'default_cell.tpl.php' : $this->parameters['default_cell_template']; return TemplateEngine::render('list.tpl.php', $this->parameters); }
public function renderFoot() { return TemplateEngine::render('form_foot.tpl.php', array('show_submit' => $this->showSubmit, 'submit_values' => $this->submitValues)); }
public function render() { $keys = array_keys($this->options); array_unshift($keys, ''); array_unshift($this->options, $this->default); $this->options = array_combine($keys, $this->options); $this->setAttribute('name', $this->name); if ($this->multiple) { $this->setAttribute('multiple', 'multiple'); } $this->setAttribute('class', "select {$this->getCSSClasses()}"); return \ntentan\honam\TemplateEngine::render('select_element.tpl.php', array('element' => $this)); }
public function testLoading() { TemplateEngine::appendPath("tests/files/views/no_engine"); TemplateEngine::render("no_engine", array()); }
public function testInvocation() { $this->assertEquals('Hello James Ainooson<form method="POST" class="fapi-form"><div class="form-submit-area"><input class="form-submit" type="submit" value="Submit" /></div></form>', TemplateEngine::render("test.smarty", array('firstname' => 'James', 'lastname' => 'Ainooson'))); }