public static function render($name, $chosenSelector, $poolSelector, TemplateEngine $tplEngine)
    {
        $chosenEntries = $tplEngine->getDataFromSelector($chosenSelector);
        $poolEntries = array();
        if ($poolSelector !== null) {
            $poolEntries = $tplEngine->getDataFromSelector($poolSelector);
        }
        $html = '<div class="add-remove" name="' . $name . '">';
        // Choosen
        $html .= '<ul class="option-list chosen">';
        foreach ($chosenEntries as $id => $title) {
            $html .= '<li id=\\"" . $name . "-' . $id . '\\">' . $title . '</li>';
        }
        $html .= '</ul>';
        if (count($poolEntries) > 0) {
            // left or right
            $html .= '<div class="between">
				<a href="#" class="entries-add" title="add selected entries">&larr;</a>
				<br>
				<a href="#" class="entries-remove" title="remove selected entries">&rarr;</a>
			</div>';
            // Pool
            $html .= '<ul class="option-list pool">';
            foreach ($poolEntries as $id => $title) {
                $html .= '<li id=\\"" . $name . "-' . $id . '\\">' . $title . '</li>';
            }
            $html .= '</ul>';
        }
        $html .= '</div>';
        return $html;
    }
 public static function render(TemplateEngine $tplEngine, $optionsSelector, $selectedSelector)
 {
     $options = $tplEngine->getDataFromSelector($optionsSelector);
     $selection = array();
     if ($selectedSelector !== null) {
         $selection = (array) $tplEngine->getDataFromSelector($selectedSelector);
     }
     return self::renderOptions($options, $selection);
 }
 public static function render(TemplateEngine $tplEngine, $fldName, $optionsSelector, $checkedSelector)
 {
     $options = $tplEngine->getDataFromSelector($optionsSelector);
     $selection = (array) $tplEngine->getDataFromSelector($checkedSelector);
     $html = '<ul>';
     foreach ($options as $key => $val) {
         $checked = in_array($key, $selection) ? ' checked' : null;
         $html .= '<li><label><input type="radio" value="' . $key . '" name="' . $fldName . '"' . $checked . '> ' . $val . '</label></li>' . "\n";
     }
     $html .= '</ul>';
     return $html;
 }
 public static function generateOutput(TemplateEngine $templateEngine, $selector)
 {
     $data = $templateEngine->getDataFromSelector($selector);
     if ($data instanceof \DateTime) {
         return $data->format('Y-m-d H:i:s');
     } elseif (is_scalar($data) === false) {
         return print_r($data, true);
     }
     return $data;
 }
 public static function render($formSelector, $componentName, TemplateEngine $tplEngine)
 {
     $callback = array($tplEngine->getDataFromSelector($formSelector), 'getComponent');
     $component = call_user_func($callback, $componentName);
     return call_user_func(array($component, 'render'));
 }