26 return $this->
renderMonth($component, $default_renderer);
31 return $this->
renderButton($component, $default_renderer);
46 $tpl_name =
"tpl.primary.html";
49 $tpl_name =
"tpl.standard.html";
52 $tpl_name =
"tpl.shy.html";
55 $tpl_name =
"tpl.tag.html";
58 $tpl_name =
"tpl.bulky.html";
63 $action = $component->getAction();
66 if (is_string($action)) {
67 $tpl->setCurrentBlock(
"with_data_action");
68 $tpl->setVariable(
"ACTION", $action);
69 $tpl->parseCurrentBlock();
72 $label = $component->getLabel();
73 if ($label !== null) {
74 $tpl->setVariable(
"LABEL", $component->getLabel());
76 if ($component->isActive()) {
79 if (is_string($action) && $action !=
"") {
80 $component = $component->withAdditionalOnLoadCode(
function ($id) use ($action) {
81 $action = str_replace(
"&",
"&", $action);
83 return "$('#$id').on('click', function(event) { 84 window.location = '{$action}'; 91 $component = $component->withAdditionalOnLoadCode(
function ($id) {
92 return "$('#$id').click(function(e) { il.UI.button.activateLoadingAnimation('$id')});";
96 $tpl->touchBlock(
"disabled");
98 $aria_label = $component->getAriaLabel();
99 if ($aria_label != null) {
100 $tpl->setCurrentBlock(
"with_aria_label");
101 $tpl->setVariable(
"ARIA_LABEL", $aria_label);
102 $tpl->parseCurrentBlock();
106 && $component->isEngageable()
108 if ($component->isEngaged()) {
109 $tpl->touchBlock(
"engaged");
110 $aria_pressed =
'true';
112 $aria_pressed =
'false';
116 if (!($component instanceof Bulky)) {
117 $tpl->setCurrentBlock(
"with_aria_pressed");
118 $tpl->setVariable(
"ARIA_PRESSED", $aria_pressed);
119 $tpl->parseCurrentBlock();
141 parent::registerResources($registry);
142 $registry->register(
'./src/UI/templates/js/Button/button.js');
143 $registry->register(
"./node_modules/moment/min/moment-with-locales.min.js");
144 $registry->register(
"./node_modules/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js");
152 $tpl->setVariable(
"FORCE_RENDERING",
"");
153 $tpl->setVariable(
"ARIA_LABEL", $this->
txt(
"close"));
162 $on_action = $component->getActionOn();
163 $off_action = $component->getActionOff();
165 $on_url = (is_string($on_action))
169 $off_url = (is_string($off_action))
175 foreach ($component->getTriggeredSignals() as $s) {
177 "signal_id" => $s->getSignal()->getId(),
178 "event" => $s->getEvent(),
179 "options" => $s->getSignal()->getOptions()
183 $signals = json_encode($signals);
185 $button_status =
'off';
186 if ($component->isEngaged()) {
187 $button_status =
'on';
190 if ($component->isActive()) {
191 $component = $component->withAdditionalOnLoadCode(
function ($id) use ($on_url, $off_url, $signals) {
192 $code =
"$('#$id').on('click', function(event) { 193 il.UI.button.handleToggleClick(event, '$id', '$on_url', '$off_url', $signals); 194 return false; // stop event propagation 199 $tpl->setCurrentBlock(
"with_on_off_label");
200 $tpl->setVariable(
"ON_LABEL", $this->
txt(
"toggle_on"));
201 $tpl->setVariable(
"OFF_LABEL", $this->
txt(
"toggle_off"));
202 $tpl->parseCurrentBlock();
204 $tpl->touchBlock(
"disabled");
205 $button_status =
'unavailable';
208 $tpl->touchBlock($button_status);
210 $label = $component->getLabel();
211 if (!empty($label)) {
212 $tpl->setCurrentBlock(
"with_label");
213 $tpl->setVariable(
"LABEL", $label);
214 $tpl->parseCurrentBlock();
216 $aria_label = $component->getAriaLabel();
217 if ($aria_label != null) {
218 $tpl->setCurrentBlock(
"with_aria_label");
219 $tpl->setVariable(
"ARIA_LABEL", $aria_label);
220 $tpl->parseCurrentBlock();
230 $tpl->setCurrentBlock(
"with_id");
231 $tpl->setVariable(
"ID", $id);
232 $tpl->parseCurrentBlock();
238 $def = $component->getDefault();
240 for (
$i = 1;
$i <= 12;
$i++) {
241 $this->
toJS(array(
"month_" . str_pad(
$i, 2,
"0", STR_PAD_LEFT) .
"_short"));
246 $month = explode(
"-", $def);
247 $tpl->setVariable(
"DEFAULT_LABEL", $this->
txt(
"month_" . str_pad($month[0], 2,
"0", STR_PAD_LEFT) .
"_short") .
" " . $month[1]);
248 $tpl->setVariable(
"DEF_DATE", $month[0] .
"/1/" . $month[1]);
250 $lang_key = in_array($this->
getLangKey(), array(
"ar",
"bg",
"cs",
"da",
"de",
"el",
"en",
"es",
"et",
"fa",
"fr",
"hu",
"it",
251 "ja",
"ka",
"lt",
"nl",
"pl",
"pt",
"ro",
"ru",
"sk",
"sq",
"sr",
"tr",
"uk",
"vi",
"zh"))
254 if ($lang_key ==
"zh") {
257 $tpl->setVariable(
"LANG", $lang_key);
262 $tpl->setCurrentBlock(
"with_id");
263 $tpl->setVariable(
"ID", $id);
264 $tpl->parseCurrentBlock();
265 $tpl->setVariable(
"JSID", $id);
273 $tpl->touchBlock(
'rel_' . $component->getRelevance());
275 $classes = trim(join(
' ', $component->getClasses()));
276 if ($classes !==
'') {
277 $tpl->setVariable(
"CLASSES", $classes);
280 $bgcol = $component->getBackgroundColor();
282 $tpl->setVariable(
"BGCOL", $bgcol->asHex());
284 $forecol = $component->getForegroundColor();
286 $tpl->setVariable(
"FORECOL", $forecol->asHex());
292 $renderer = $default_renderer->withAdditionalContext($component);
293 $tpl->setVariable(
"ICON_OR_GLYPH", $renderer->render($component->getIconOrGlyph()));
294 $label = $component->getLabel();
295 if ($label !== null) {
296 $tpl->setVariable(
"LABEL", $label);
299 $aria_role = $component->getAriaRole();
300 if ($aria_role != null) {
301 $tpl->setCurrentBlock(
"with_aria_role");
302 $tpl->setVariable(
"ARIA_ROLE", $aria_role);
303 $tpl->parseCurrentBlock();
305 if ($component->isEngageable()) {
307 $tpl->touchBlock(
"with_aria_haspopup");
310 $tpl->setCurrentBlock(
"with_aria_pressed");
311 if ($component->isEngaged()) {
312 $tpl->setVariable(
"ARIA_PRESSED",
"true");
314 $tpl->setVariable(
"ARIA_PRESSED",
"false");
316 $tpl->parseCurrentBlock();
checkComponent(Component $component)
Check if a given component fits this renderer and throw if that is not the case. ...
Class ChatMainBarProvider .
toJS($key)
Add language var to client side (il.Language)
txt($id)
Get a text from the language file.
render(Component $component, Renderer $default_renderer)
Render the component if possible and delegate additional rendering to the default_renderer.
getLangKey()
Get current language key.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
getTemplate($name, $purge_unfilled_vars, $purge_unused_blocks)
Get template of component this renderer is made for.
Base class for all component renderers.
bindJavaScript(JavaScriptBindable $component)
Bind the component to JavaScript.