26            return $this->
renderMonth($component, $default_renderer);
 
   28            return $this->
renderButton($component, $default_renderer);
 
   42            $tpl_name = 
"tpl.primary.html";
 
   45            $tpl_name = 
"tpl.standard.html";
 
   48            $tpl_name = 
"tpl.shy.html";
 
   51            $tpl_name = 
"tpl.tag.html";
 
   54            $tpl_name = 
"tpl.bulky.html";
 
   59        $action = $component->getAction();
 
   63            $tpl->setCurrentBlock(
"with_data_action");
 
   65            $tpl->parseCurrentBlock();
 
   68        $label = $component->getLabel();
 
   69        if ($label !== 
null) {
 
   70            $tpl->setVariable(
"LABEL", $component->getLabel());
 
   72        if ($component->isActive()) {
 
   76                $component = $component->withAdditionalOnLoadCode(
function (
$id) use (
$action) {
 
   79                    return "$('#$id').on('click', function(event) { 
   80                                                        window.location = '{$action}'; 
   87                $component = $component->withAdditionalOnLoadCode(
function (
$id) {
 
   88                    return "$('#$id').click(function(e) { $('#$id').addClass('il-btn-with-loading-animation'); $('#$id').addClass('disabled');});";
 
   92            $tpl->touchBlock(
"disabled");
 
   94        $aria_label = $component->getAriaLabel();
 
   95        if ($aria_label != 
null) {
 
   96            $tpl->setCurrentBlock(
"with_aria_label");
 
   97            $tpl->setVariable(
"ARIA_LABEL", $aria_label);
 
   98            $tpl->parseCurrentBlock();
 
  100        if ($component->isAriaChecked()) {
 
  101            $tpl->setCurrentBlock(
"with_aria_checked");
 
  102            $tpl->setVariable(
"ARIA_CHECKED", 
"true");
 
  103            $tpl->parseCurrentBlock();
 
  124        parent::registerResources($registry);
 
  125        $registry->register(
'./src/UI/templates/js/Button/button.js');
 
  126        $registry->register(
"./libs/bower/bower_components/moment/min/moment-with-locales.min.js");
 
  127        $registry->register(
"./libs/bower/bower_components/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js");
 
  135        $tpl->setVariable(
"FORCE_RENDERING", 
"");
 
  144        $on_action = $component->getActionOn();
 
  145        $off_action = $component->getActionOff();
 
  147        $on_url = (is_string($on_action))
 
  151        $off_url = (is_string($off_action))
 
  157        foreach ($component->getTriggeredSignals() as 
$s) {
 
  159                "signal_id" => 
$s->getSignal()->getId(),
 
  160                "event" => 
$s->getEvent(),
 
  161                "options" => 
$s->getSignal()->getOptions()
 
  165        $signals = json_encode($signals);
 
  167        if ($component->isActive()) {
 
  168            $component = $component->withAdditionalOnLoadCode(
function (
$id) use ($on_url, $off_url, $signals) {
 
  169                $code = 
"$('#$id').on('click', function(event) { 
  170                                                il.UI.button.handleToggleClick(event, '$id', '$on_url', '$off_url', $signals); 
  171                                                return false; // stop event propagation 
  177            $tpl->touchBlock(
"disabled");
 
  180        $is_on = $component->isOn();
 
  182            $tpl->touchBlock(
"on");
 
  184        $label = $component->getLabel();
 
  185        if (!empty($label)) {
 
  186            $tpl->setCurrentBlock(
"with_label");
 
  187            $tpl->setVariable(
"LABEL", $label);
 
  188            $tpl->parseCurrentBlock();
 
  190        $aria_label = $component->getAriaLabel();
 
  191        if ($aria_label != 
null) {
 
  192            $tpl->setCurrentBlock(
"with_aria_label");
 
  193            $tpl->setVariable(
"ARIA_LABEL", $aria_label);
 
  194            $tpl->parseCurrentBlock();
 
  204            $tpl->setCurrentBlock(
"with_id");
 
  206            $tpl->parseCurrentBlock();
 
  212        $def = $component->getDefault();
 
  214        for (
$i = 1; 
$i <= 12; 
$i++) {
 
  215            $this->
toJS(array(
"month_" . str_pad(
$i, 2, 
"0", STR_PAD_LEFT) . 
"_short"));
 
  220        $month = explode(
"-", 
$def);
 
  221        $tpl->setVariable(
"DEFAULT_LABEL", $this->
txt(
"month_" . str_pad($month[0], 2, 
"0", STR_PAD_LEFT) . 
"_short") . 
" " . $month[1]);
 
  222        $tpl->setVariable(
"DEF_DATE", $month[0] . 
"/1/" . $month[1]);
 
  224        $lang_key = in_array($this->
getLangKey(), array(
"ar", 
"bg", 
"cs", 
"da", 
"de", 
"el", 
"en", 
"es", 
"et", 
"fa", 
"fr", 
"hu", 
"it",
 
  225            "ja", 
"ka", 
"lt", 
"nl", 
"pl", 
"pt", 
"ro", 
"ru", 
"sk", 
"sq", 
"sr", 
"tr", 
"uk", 
"vi", 
"zh"))
 
  228        if ($lang_key == 
"zh") {
 
  231        $tpl->setVariable(
"LANG", $lang_key);
 
  236            $tpl->setCurrentBlock(
"with_id");
 
  238            $tpl->parseCurrentBlock();
 
  239            $tpl->setVariable(
"JSID", 
$id);
 
  247        $tpl->touchBlock(
'rel_' . $component->getRelevance());
 
  249        $classes = trim(join(
' ', $component->getClasses()));
 
  250        if ($classes !== 
'') {
 
  251            $tpl->setVariable(
"CLASSES", $classes);
 
  254        $bgcol = $component->getBackgroundColor();
 
  256            $tpl->setVariable(
"BGCOL", $bgcol->asHex());
 
  258        $forecol = $component->getForegroundColor();
 
  260            $tpl->setVariable(
"FORECOL", $forecol->asHex());
 
  266        $renderer = $default_renderer->withAdditionalContext($component);
 
  267        $tpl->setVariable(
"ICON_OR_GLYPH", $renderer->render($component->getIconOrGlyph()));
 
  268        $label = $component->getLabel();
 
  269        if ($label !== 
null) {
 
  270            $tpl->setVariable(
"LABEL", $label);
 
  272        if ($component->isEngaged()) {
 
  273            $tpl->touchBlock(
"engaged");
 
  274            $tpl->setVariable(
"ARIA_PRESSED", 
'true');
 
  276            if (is_string($component->getAction())) {
 
  277                $tpl->setVariable(
"ARIA_PRESSED", 
'undefined');
 
  279                $tpl->setVariable(
"ARIA_PRESSED", 
'false');
 
An exception for terminatinating execution or to throw for unit testing.
Base class for all component renderers.
txt($id)
Get a text from the language file.
getTemplate($name, $purge_unfilled_vars, $purge_unused_blocks)
Get template of component this renderer is made for.
bindJavaScript(JavaScriptBindable $component)
Bind the component to JavaScript.
checkComponent(Component $component)
Check if a given component fits this renderer and throw \LogicError if that is not the case.
getLangKey()
Get current language key.
toJS($key)
Add language var to client side (il.Language)
if(!array_key_exists('StateId', $_REQUEST)) $id
A component is the most general form of an entity in the UI.
An entity that renders components to a string output.
trait LoadingAnimationOnClick
Implements LoadingAnimationOnClick interface.