예제 #1
0
파일: TextArea.php 프로젝트: ntentan/honam
 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));
 }
예제 #2
0
 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));
 }
예제 #3
0
 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'));
 }
예제 #4
0
파일: Form.php 프로젝트: ntentan/wyf
 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());
 }
예제 #5
0
 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 = "&lt;div&gt;Number one&lt;/div&gt; <div>Number one</div> first \n&lt;b&gt;Number two&lt;/b&gt; <b>Number two</b> second \n&lt;span&gt;Number three&lt;/span&gt; <span>Number three</span> third \n&lt;div&gt;Number one&lt;/div&gt; <div>Number one</div> \nsecond found\n&lt;p&gt;A new paragraph&lt;/p&gt; <p>A new paragraph</p> \n&lt;p&gt;A zero paragraph&lt;/p&gt; <p>A zero paragraph</p> \n\n";
     $this->assertEquals($expected, $output);
 }
예제 #6
0
파일: Element.php 프로젝트: ntentan/honam
 public function __toString()
 {
     return TemplateEngine::render(FormHelper::getLayout() . "_layout_element.tpl.php", array('element' => $this));
 }
예제 #7
0
파일: Field.php 프로젝트: ntentan/honam
 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));
 }
예제 #8
0
 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]);
 }
예제 #9
0
파일: Fieldset.php 프로젝트: ntentan/honam
 public function renderFoot()
 {
     return \ntentan\honam\TemplateEngine::render('fieldset_foot.tpl.php', array('element' => $this));
 }
예제 #10
0
 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));
 }
예제 #11
0
파일: Container.php 프로젝트: ntentan/honam
 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();
     }
 }
예제 #12
0
파일: Element.php 프로젝트: ntentan/wyf
 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());
 }
예제 #13
0
파일: functions.php 프로젝트: ntentan/honam
function t($template, $templateData = array())
{
    return TemplateEngine::render($template, $templateData);
}
예제 #14
0
 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);
 }
예제 #15
0
파일: Form.php 프로젝트: ntentan/honam
 public function renderFoot()
 {
     return TemplateEngine::render('form_foot.tpl.php', array('show_submit' => $this->showSubmit, 'submit_values' => $this->submitValues));
 }
예제 #16
0
 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));
 }
예제 #17
0
 public function testLoading()
 {
     TemplateEngine::appendPath("tests/files/views/no_engine");
     TemplateEngine::render("no_engine", array());
 }
예제 #18
0
 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')));
 }