19 declare(strict_types=1);
49 $this->original_default_renderer = $default_renderer;
55 case ($component instanceof
F\
Group):
58 case ($component instanceof
F\
Text):
61 case ($component instanceof
F\
Numeric):
64 case ($component instanceof
F\
Select):
87 $input_labels = array();
88 foreach ($group->getInputs() as $input) {
89 $inputs .= $default_renderer->render($input);
90 $input_labels[] = $input->getLabel();
100 $tpl = $this->
getTemplate(
"tpl.context_filter.html",
true,
true);
101 $add_tpl = $this->
getTemplate(
"tpl.filter_add_list.html",
true,
true);
104 foreach ($input_labels as $label) {
105 $links[] =
$f->button()->shy($label,
"")->withAdditionalOnLoadCode(fn(
$id) =>
"$('#$id').on('click', function(event) { 106 il.UI.filter.onAddClick(event, '$id'); 107 return false; // stop event propagation 110 $add_tpl->setVariable(
"LIST", $default_renderer->render(
$f->listing()->unordered($links)));
111 $list =
$f->legacy()->content($add_tpl->get());
112 $popover =
$f->popover()->standard($list)->withVerticalPosition();
113 $tpl->setVariable(
"POPOVER", $default_renderer->render($popover));
114 $add =
$f->button()->bulky(
$f->symbol()->glyph()->add(),
"",
"")->withOnClick($popover->getShowSignal());
116 $tpl->setCurrentBlock(
"filter_field");
117 $tpl->setVariable(
"FILTER_FIELD", $default_renderer->render($add));
118 $tpl->parseCurrentBlock();
127 ?
string $id_for_label =
null,
128 ?
string $dependant_group_html =
null 133 protected function wrapInFilterContext(
137 ?
string $id_pointing_to_input =
null,
138 string $dependant_group_html =
'' 141 $tpl = $this->
getTemplate(
"tpl.context_filter.html",
true,
true);
146 $remove_glyph =
$f->symbol()->glyph()->remove(
"")->withAdditionalOnLoadCode(fn(
$id) =>
"$('#$id').on('click', function(event) { 147 il.UI.filter.onRemoveClick(event, '$id'); 148 return false; // stop event propagation 151 $tpl->setCurrentBlock(
"addon_left");
152 $tpl->setVariable(
"LABEL", $component->
getLabel());
153 if ($id_pointing_to_input) {
154 $tpl->setCurrentBlock(
"for");
155 $tpl->setVariable(
"ID", $id_pointing_to_input);
156 $tpl->parseCurrentBlock();
158 $tpl->parseCurrentBlock();
159 $tpl->setCurrentBlock(
"filter_field");
160 if ($component->isComplex()) {
161 $tpl->setVariable(
"FILTER_FIELD", $this->
renderProxyField($input_html, $default_renderer));
163 $tpl->setVariable(
"FILTER_FIELD", $input_html);
165 $tpl->parseCurrentBlock();
166 $tpl->setCurrentBlock(
"addon_right");
167 $tpl->setVariable(
"DELETE", $default_renderer->render($remove_glyph));
168 $tpl->parseCurrentBlock();
183 $tpl = $this->
getTemplate(
"tpl.filter_field.html",
true,
true);
185 $popover =
$f->popover()->standard(
$f->legacy()->content($input_html))->withVerticalPosition();
186 $tpl->setVariable(
"POPOVER", $default_renderer->render($popover));
189 $prox = $prox->withOnClick($popover->getShowSignal());
190 $tpl->touchBlock(
"tabindex");
198 $inputs = $component->getInputs();
203 $input_html = $default_renderer->render($input);
206 ->withAdditionalPickerconfig([
'useCurrent' =>
false]);
207 $input_html .= $default_renderer->render($input);
209 $tpl = $this->
getTemplate(
"tpl.duration.html",
true,
true);
211 $tpl->setVariable(
'DURATION', $input_html);
213 return $this->
wrapInFormContext($component, $component->getLabel(), $tpl->get());
218 parent::registerResources($registry);
219 $registry->
register(
'assets/js/filter.js');
Registry for resources required by rendered output like Javascript or CSS.
renderFieldGroups(Group $group, RendererInterface $default_renderer)
RendererInterface $original_default_renderer
renderDurationField(F\Duration $component, RendererInterface $default_renderer)
renderProxyField(string $input_html, RendererInterface $default_renderer)
renderAddField(array $input_labels, RendererInterface $default_renderer)
maybeDisable(FormInput $component, Template $tpl)
wrapInFormContext(FormInput $component, string $label, string $input_html, ?string $id_for_label=null, ?string $dependant_group_html=null)
render(Component\Component $component, RendererInterface $default_renderer)
This implements the text input.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getTemplate(string $name, bool $purge_unfilled_vars, bool $purge_unused_blocks)
Get template of component this renderer is made for.
cannotHandleComponent(Component $component)
This method MUST be called by derived component renderers, if.
register(string $name)
Add a dependency.
getOriginalDefaultRenderer()
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
getUIFactory()
Get a UI factory.
registerResources(ResourceRegistry $registry)
Announce resources this renderer requires.