ILIAS  trunk Revision v5.2.0beta1-34132-g2d4d73d4a0
ILIAS\UI\Implementation\Component\ViewControl\Renderer Class Reference
+ Inheritance diagram for ILIAS\UI\Implementation\Component\ViewControl\Renderer:
+ Collaboration diagram for ILIAS\UI\Implementation\Component\ViewControl\Renderer:

Public Member Functions

 render (Component\Component $component, RendererInterface $default_renderer)
 
 registerResources (ResourceRegistry $registry)
 Announce resources this renderer requires. More...
 
- Public Member Functions inherited from ILIAS\UI\Implementation\Render\AbstractComponentRenderer
 __construct (private Factory $ui_factory, private TemplateFactory $tpl_factory, private ilLanguage $lng, private JavaScriptBinding $js_binding, private \ILIAS\Refinery\Factory $refinery, private ImagePathResolver $image_path_resolver, private DataFactory $data_factory, private HelpTextRetriever $help_text_retriever, private UploadLimitResolver $upload_limit_resolver,)
 
 registerResources (ResourceRegistry $registry)
 Announce resources this renderer requires. More...
 
 txt (string $id)
 Get a text from the language file. More...
 
 toJS ($key)
 Add language var to client side (il.Language) More...
 
 getLangKey ()
 Get current language key. More...
 
 getImagePathResolver ()
 
 getHelpText (Help\Purpose $purpose, Help\Topic ... $topics)
 
- Public Member Functions inherited from ILIAS\UI\Implementation\Render\ComponentRenderer
 render (Component $component, Renderer $default_renderer)
 Render the component if possible and delegate additional rendering to the default_renderer. More...
 
- Public Member Functions inherited from ILIAS\UI\HelpTextRetriever
 getHelpText (Help\Purpose $purpose, Help\Topic ... $topics)
 Try to find according help texts for the purpose an topics. More...
 

Data Fields

const MODE_ROLE = "group"
 

Protected Member Functions

 renderMode (Component\ViewControl\Mode $component, RendererInterface $default_renderer)
 
 renderSection (Component\ViewControl\Section $component, RendererInterface $default_renderer)
 
 renderSectionButton (Component\Button\Button $component, Template $tpl, string $type)
 
 renderSortation (Component\ViewControl\Sortation $component, RendererInterface $default_renderer)
 
 renderPagination (Component\ViewControl\Pagination $component, RendererInterface $default_renderer)
 
 getPaginationRange (Component\ViewControl\Pagination $component)
 Get the range of pagination-buttons to show. More...
 
 getPaginationShyButton (int $val, Component\ViewControl\Pagination $component, string $label='')
 
 setPaginationBrowseControls (Component\ViewControl\Pagination $component, RendererInterface $default_renderer, Template $tpl)
 Add back/next-glyphs to the template for left/right browsing in pagination. More...
 
 setPaginationFirstLast (Component\ViewControl\Pagination $component, array $range, RendererInterface $default_renderer, Template $tpl)
 Add quick-access to first/last pages in pagination. More...
 
 renderId (Component\JavaScriptBindable $component, Template $tpl, string $block, string $template_var)
 
 getComponentInterfaceName ()
 
- Protected Member Functions inherited from ILIAS\UI\Implementation\Render\AbstractComponentRenderer
 getUIFactory ()
 Get a UI factory. More...
 
 getDataFactory ()
 
 getRefinery ()
 
 getUploadLimitResolver ()
 
 getJavascriptBinding ()
 
 getTemplate (string $name, bool $purge_unfilled_vars, bool $purge_unused_blocks)
 Get template of component this renderer is made for. More...
 
 getTemplatePath (string $name)
 Get the path to the template of this component. More...
 
 bindJavaScript (JavaScriptBindable $component)
 Bind the component to JavaScript. More...
 
 createId ()
 Get a fresh unique id. More...
 
 checkComponent (Component $component)
 Check if a given component fits this renderer and throw if that is not the case. More...
 
 getComponentInterfaceName ()
 Get the name of the component-interface this renderer is supposed to render. More...
 
 getTooltipRenderer ()
 

Additional Inherited Members

- Protected Attributes inherited from ILIAS\UI\Implementation\Render\AbstractComponentRenderer
TooltipRenderer $tooltip_renderer = null
 

Detailed Description

Definition at line 35 of file Renderer.php.

Member Function Documentation

◆ getComponentInterfaceName()

ILIAS\UI\Implementation\Component\ViewControl\Renderer::getComponentInterfaceName ( )
protected

Definition at line 398 of file Renderer.php.

398  : array
399  {
400  return array(
401  Component\ViewControl\Mode::class,
402  Component\ViewControl\Section::class,
403  Component\ViewControl\Sortation::class,
404  Component\ViewControl\Pagination::class
405  );
406  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ getPaginationRange()

ILIAS\UI\Implementation\Component\ViewControl\Renderer::getPaginationRange ( Component\ViewControl\Pagination  $component)
protected

Get the range of pagination-buttons to show.

Returns
int[]

Definition at line 251 of file Renderer.php.

References ILIAS\Repository\int().

Referenced by ILIAS\UI\Implementation\Component\ViewControl\Renderer\renderPagination().

251  : array
252  {
253  if (!$component->getMaxPaginationButtons()) {
254  $start = 0;
255  $stop = max($component->getNumberOfPages() - 1, 0);
256  } else {
257  //current page should be in the middle, so start is half the amount of max entries:
258  $start = (int) ($component->getCurrentPage() - floor($component->getMaxPaginationButtons() / 2));
259  $start = max($start, 0); //0, if negative
260  //stop is (calculated) start plus number of entries:
261  $stop = $start + $component->getMaxPaginationButtons() - 1;
262  //if stop exceeds max pages, recalculate both:
263  if ($stop > $component->getNumberOfPages() - 1) {
264  $stop = max($component->getNumberOfPages() - 1, 0); //0, if negative
265  $start = $stop - $component->getMaxPaginationButtons();
266  $start = max($start, 0); //0, if negative
267  }
268  }
269  return range($start, $stop);
270  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPaginationShyButton()

ILIAS\UI\Implementation\Component\ViewControl\Renderer::getPaginationShyButton ( int  $val,
Component\ViewControl\Pagination  $component,
string  $label = '' 
)
protected

Definition at line 272 of file Renderer.php.

References Vendor\Package\$f, $params, $url, and ILIAS\UI\Implementation\Render\AbstractComponentRenderer\getUIFactory().

Referenced by ILIAS\UI\Implementation\Component\ViewControl\Renderer\renderPagination(), and ILIAS\UI\Implementation\Component\ViewControl\Renderer\setPaginationFirstLast().

276  : Shy {
277  $f = $this->getUIFactory();
278 
279  if ($label === '') {
280  $label = (string) ($val + 1);
281  }
282 
283  if ($component->getTriggeredSignals()) {
284  $shy = $f->button()->shy($label, (string) $val)->withOnClick($component->getInternalSignal());
285  } else {
286  $url = $component->getTargetURL() ?? '';
287  if (strpos($url, '?') === false) {
288  $url .= '?' . $component->getParameterName() . '=' . $val;
289  } else {
290  $base = substr($url, 0, strpos($url, '?') + 1);
291  $query = parse_url($url, PHP_URL_QUERY);
292  parse_str($query, $params);
293  $params[$component->getParameterName()] = $val;
294  $url = $base . http_build_query($params);
295  }
296  $shy = $f->button()->shy($label, $url);
297  }
298  return $shy;
299  }
$url
Definition: ltiregstart.php:36
if(strtoupper($DIC->http() ->request() ->getMethod()) !=="GET") $params
Definition: ltiregstart.php:34
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ registerResources()

ILIAS\UI\Implementation\Component\ViewControl\Renderer::registerResources ( ResourceRegistry  $registry)

Announce resources this renderer requires.

Implements ILIAS\UI\Implementation\Render\ComponentRenderer.

Definition at line 373 of file Renderer.php.

References ILIAS\UI\Implementation\Render\ResourceRegistry\register().

373  : void
374  {
375  parent::registerResources($registry);
376  $registry->register('./src/UI/templates/js/ViewControl/sortation.js');
377  $registry->register('./src/UI/templates/js/ViewControl/pagination.js');
378  }
+ Here is the call graph for this function:

◆ render()

ILIAS\UI\Implementation\Component\Tree\Renderer::render ( Component\Component  $component,
RendererInterface  $default_renderer 
)

Definition at line 39 of file Renderer.php.

References ILIAS\UI\Implementation\Render\AbstractComponentRenderer\checkComponent(), ILIAS\UI\Implementation\Component\ViewControl\Renderer\renderMode(), ILIAS\UI\Implementation\Component\ViewControl\Renderer\renderPagination(), ILIAS\UI\Implementation\Component\ViewControl\Renderer\renderSection(), and ILIAS\UI\Implementation\Component\ViewControl\Renderer\renderSortation().

39  : string
40  {
41  $this->checkComponent($component);
42 
43  if ($component instanceof Component\ViewControl\Mode) {
44  return $this->renderMode($component, $default_renderer);
45  }
46  if ($component instanceof Component\ViewControl\Section) {
47  return $this->renderSection($component, $default_renderer);
48  }
49  if ($component instanceof Component\ViewControl\Sortation) {
50  return $this->renderSortation($component, $default_renderer);
51  }
52  if ($component instanceof Component\ViewControl\Pagination) {
53  return $this->renderPagination($component, $default_renderer);
54  }
55  throw new LogicException("Component '{$component->getCanonicalName()}' isn't supported by this renderer.");
56  }
renderSection(Component\ViewControl\Section $component, RendererInterface $default_renderer)
Definition: Renderer.php:93
renderSortation(Component\ViewControl\Sortation $component, RendererInterface $default_renderer)
Definition: Renderer.php:131
checkComponent(Component $component)
Check if a given component fits this renderer and throw if that is not the case. ...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
renderMode(Component\ViewControl\Mode $component, RendererInterface $default_renderer)
Definition: Renderer.php:58
renderPagination(Component\ViewControl\Pagination $component, RendererInterface $default_renderer)
Definition: Renderer.php:176
+ Here is the call graph for this function:

◆ renderId()

ILIAS\UI\Implementation\Component\ViewControl\Renderer::renderId ( Component\JavaScriptBindable  $component,
Template  $tpl,
string  $block,
string  $template_var 
)
protected

Definition at line 380 of file Renderer.php.

References $id, ILIAS\UI\Implementation\Render\AbstractComponentRenderer\bindJavaScript(), ILIAS\UI\Implementation\Render\AbstractComponentRenderer\createId(), ILIAS\UI\Implementation\Render\Template\parseCurrentBlock(), ILIAS\UI\Implementation\Render\Template\setCurrentBlock(), and ILIAS\UI\Implementation\Render\Template\setVariable().

Referenced by ILIAS\UI\Implementation\Component\ViewControl\Renderer\renderSectionButton(), and ILIAS\UI\Implementation\Component\ViewControl\Renderer\renderSortation().

385  : void {
386  $id = $this->bindJavaScript($component);
387  if (!$id) {
388  $id = $this->createId();
389  }
390  $tpl->setCurrentBlock($block);
391  $tpl->setVariable($template_var, $id);
392  $tpl->parseCurrentBlock();
393  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
bindJavaScript(JavaScriptBindable $component)
Bind the component to JavaScript.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderMode()

ILIAS\UI\Implementation\Component\ViewControl\Renderer::renderMode ( Component\ViewControl\Mode  $component,
RendererInterface  $default_renderer 
)
protected

Definition at line 58 of file Renderer.php.

References Vendor\Package\$f, ILIAS\UI\Implementation\Render\AbstractComponentRenderer\getTemplate(), ILIAS\UI\Implementation\Render\AbstractComponentRenderer\getUIFactory(), and ILIAS\UI\Implementation\Render\AbstractComponentRenderer\txt().

Referenced by ILIAS\UI\Implementation\Component\ViewControl\Renderer\render().

58  : string
59  {
60  $f = $this->getUIFactory();
61 
62  $tpl = $this->getTemplate("tpl.mode.html", true, true);
63 
64  $activate_first_item = false;
65  $active = $component->getActive();
66  if ($active == "") {
67  $activate_first_item = true;
68  }
69 
70  $tpl->setVariable("ARIA", $this->txt($component->getAriaLabel()));
71  $tpl->setVariable("ROLE", self::MODE_ROLE);
72  foreach ($component->getLabelledActions() as $label => $action) {
73  $tpl->setCurrentBlock("view_control");
74 
75  //At this point we don't have a specific text for the button aria label.
76  // component->getAriaLabel gets the main view control aria label.
77  $button = $f->button()->standard($label, $action)->withAriaLabel($label);
78  if ($activate_first_item) {
79  $button = $button->withEngagedState(true);
80  $activate_first_item = false;
81  } elseif ($active == $label) {
82  $button = $button->withEngagedState(true);
83  } else {
84  $button = $button->withEngagedState(false);
85  }
86  $tpl->setVariable("BUTTON", $default_renderer->render($button));
87  $tpl->parseCurrentBlock();
88  }
89 
90  return $tpl->get();
91  }
txt(string $id)
Get a text from the language file.
getTemplate(string $name, bool $purge_unfilled_vars, bool $purge_unused_blocks)
Get template of component this renderer is made for.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderPagination()

ILIAS\UI\Implementation\Component\ViewControl\Renderer::renderPagination ( Component\ViewControl\Pagination  $component,
RendererInterface  $default_renderer 
)
protected

Definition at line 176 of file Renderer.php.

References Vendor\Package\$f, $id, ILIAS\UI\Implementation\Render\AbstractComponentRenderer\bindJavaScript(), ILIAS\UI\Implementation\Component\ViewControl\Renderer\getPaginationRange(), ILIAS\UI\Implementation\Component\ViewControl\Renderer\getPaginationShyButton(), ILIAS\UI\Implementation\Render\AbstractComponentRenderer\getTemplate(), ILIAS\UI\Implementation\Render\AbstractComponentRenderer\getUIFactory(), ILIAS\UI\Implementation\Component\ViewControl\Renderer\setPaginationBrowseControls(), ILIAS\UI\Implementation\Component\ViewControl\Renderer\setPaginationFirstLast(), and ILIAS\UI\Implementation\Render\AbstractComponentRenderer\txt().

Referenced by ILIAS\UI\Implementation\Component\ViewControl\Renderer\render().

179  : string {
180  $range = $this->getPaginationRange($component);
181 
182  if($component->getNumberOfPages() < 2) {
183  return '';
184  }
185 
186  $tpl = $this->getTemplate("tpl.pagination.html", true, true);
187  $component = $component->withResetSignals();
188  $triggeredSignals = $component->getTriggeredSignals();
189  if ($triggeredSignals) {
190  $internal_signal = $component->getInternalSignal();
191  $signal = $triggeredSignals[0]->getSignal();
192  $component = $component->withOnLoadCode(
193  fn($id) => "$(document).on('$internal_signal', function(event, signalData) {
194  il.UI.viewcontrol.pagination.onInternalSelect(event, signalData, '$signal', '$id');
195  return false;
196  })"
197  );
198  $id = $this->bindJavaScript($component);
199  $tpl->setVariable('ID', $id);
200  }
201 
202  $chunk_options = array();
203  foreach ($range as $entry) {
204  $shy = $this->getPaginationShyButton($entry, $component);
205  if ($entry === $component->getCurrentPage()) {
206  $shy = $shy->withEngagedState(true);
207  }
208  $chunk_options[] = $shy;
209  }
210 
211  if ($component->getDropdownAt() == null ||
212  $component->getDropdownAt() > $component->getNumberOfPages()) {
213  foreach ($chunk_options as $entry) {
214  $tpl->setCurrentBlock("entry");
215  $tpl->setVariable('BUTTON', $default_renderer->render($entry));
216  $tpl->parseCurrentBlock();
217  }
218  } else {
219  //if threshold is reached, render as dropdown
220  $f = $this->getUIFactory();
221 
222  $dd_label_template = $component->getDropdownLabel();
223  if ($dd_label_template === $component->getDefaultDropdownLabel()) {
224  $dd_label_template = $this->txt($dd_label_template);
225  }
226  $dd_label = sprintf(
227  $dd_label_template,
228  $component->getCurrentPage() + 1,
229  $component->getNumberOfPages()
230  );
231 
232  $dd = $f->dropdown()->standard($chunk_options)->withLabel($dd_label);
233  $tpl->setCurrentBlock("entry");
234  $tpl->setVariable('BUTTON', $default_renderer->render($dd));
235  $tpl->parseCurrentBlock();
236  }
237 
238  if ($component->getMaxPaginationButtons()) {
239  $this->setPaginationFirstLast($component, $range, $default_renderer, $tpl);
240  }
241 
242  $this->setPaginationBrowseControls($component, $default_renderer, $tpl);
243  return $tpl->get();
244  }
txt(string $id)
Get a text from the language file.
setPaginationBrowseControls(Component\ViewControl\Pagination $component, RendererInterface $default_renderer, Template $tpl)
Add back/next-glyphs to the template for left/right browsing in pagination.
Definition: Renderer.php:304
getPaginationShyButton(int $val, Component\ViewControl\Pagination $component, string $label='')
Definition: Renderer.php:272
getPaginationRange(Component\ViewControl\Pagination $component)
Get the range of pagination-buttons to show.
Definition: Renderer.php:251
getTemplate(string $name, bool $purge_unfilled_vars, bool $purge_unused_blocks)
Get template of component this renderer is made for.
setPaginationFirstLast(Component\ViewControl\Pagination $component, array $range, RendererInterface $default_renderer, Template $tpl)
Add quick-access to first/last pages in pagination.
Definition: Renderer.php:353
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
bindJavaScript(JavaScriptBindable $component)
Bind the component to JavaScript.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderSection()

ILIAS\UI\Implementation\Component\ViewControl\Renderer::renderSection ( Component\ViewControl\Section  $component,
RendererInterface  $default_renderer 
)
protected

Definition at line 93 of file Renderer.php.

References ILIAS\UI\Implementation\Render\AbstractComponentRenderer\getTemplate(), and ILIAS\UI\Implementation\Component\ViewControl\Renderer\renderSectionButton().

Referenced by ILIAS\UI\Implementation\Component\ViewControl\Renderer\render().

96  : string {
97  $tpl = $this->getTemplate("tpl.section.html", true, true);
98 
99  // render middle button
100  $tpl->setVariable("BUTTON", $default_renderer->render($component->getSelectorButton()));
101 
102  // previous button
103  $this->renderSectionButton($component->getPreviousActions(), $tpl, "prev");
104 
105  // next button
106  $this->renderSectionButton($component->getNextActions(), $tpl, "next");
107 
108  return $tpl->get();
109  }
getTemplate(string $name, bool $purge_unfilled_vars, bool $purge_unused_blocks)
Get template of component this renderer is made for.
renderSectionButton(Component\Button\Button $component, Template $tpl, string $type)
Definition: Renderer.php:111
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderSectionButton()

ILIAS\UI\Implementation\Component\ViewControl\Renderer::renderSectionButton ( Component\Button\Button  $component,
Template  $tpl,
string  $type 
)
protected

Definition at line 111 of file Renderer.php.

References ILIAS\UI\Implementation\Render\Template\parseCurrentBlock(), ILIAS\UI\Implementation\Component\ViewControl\Renderer\renderId(), ILIAS\UI\Implementation\Render\Template\setCurrentBlock(), ILIAS\UI\Implementation\Render\Template\setVariable(), ILIAS\UI\Implementation\Render\Template\touchBlock(), and ILIAS\UI\Implementation\Render\AbstractComponentRenderer\txt().

Referenced by ILIAS\UI\Implementation\Component\ViewControl\Renderer\renderSection().

111  : void
112  {
113  $uptype = strtoupper($type);
114 
115  $action = $component->getAction();
116  $tpl->setVariable($uptype . "_ACTION", $action);
117  $label = ($type == "next")
118  ? $this->txt("next")
119  : $this->txt("previous");
120  $tpl->setVariable($uptype . "_LABEL", $label);
121  if ($component->isActive()) {
122  $tpl->setCurrentBlock($type . "_with_href");
123  $tpl->setVariable($uptype . "_HREF", $action);
124  $tpl->parseCurrentBlock();
125  } else {
126  $tpl->touchBlock($type . "_disabled");
127  }
128  $this->renderId($component, $tpl, $type . "_with_id", $uptype . "_ID");
129  }
txt(string $id)
Get a text from the language file.
renderId(Component\JavaScriptBindable $component, Template $tpl, string $block, string $template_var)
Definition: Renderer.php:380
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderSortation()

ILIAS\UI\Implementation\Component\ViewControl\Renderer::renderSortation ( Component\ViewControl\Sortation  $component,
RendererInterface  $default_renderer 
)
protected

Definition at line 131 of file Renderer.php.

References Vendor\Package\$f, $id, $url, ILIAS\UI\Implementation\Render\AbstractComponentRenderer\getTemplate(), ILIAS\UI\Implementation\Render\AbstractComponentRenderer\getUIFactory(), and ILIAS\UI\Implementation\Component\ViewControl\Renderer\renderId().

Referenced by ILIAS\UI\Implementation\Component\ViewControl\Renderer\render().

134  : string {
135  $f = $this->getUIFactory();
136 
137  $tpl = $this->getTemplate("tpl.sortation.html", true, true);
138 
139  $component = $component->withResetSignals();
140  $triggeredSignals = $component->getTriggeredSignals();
141  if ($triggeredSignals) {
142  $internal_signal = $component->getSelectSignal();
143  $signal = $triggeredSignals[0]->getSignal();
144 
145  $component = $component->withAdditionalOnLoadCode(fn($id) => "$(document).on('$internal_signal', function(event, signalData) {
146  il.UI.viewcontrol.sortation.onInternalSelect(event, signalData, '$signal', '$id');
147  return false;
148  })");
149  }
150 
151  $this->renderId($component, $tpl, "id", "ID");
152 
153  //setup entries
154  $options = $component->getOptions();
155  $init_label = $component->getLabel();
156  $items = array();
157  foreach ($options as $val => $label) {
158  if ($triggeredSignals) {
159  $shy = $f->button()->shy($label, $val)->withOnClick($internal_signal);
160  } else {
161  $url = $component->getTargetURL() ?? '';
162  $url .= (strpos($url, '?') === false) ? '?' : '&';
163  $url .= $component->getParameterName() . '=' . $val;
164  $shy = $f->button()->shy($label, $url);
165  }
166  $items[] = $shy;
167  }
168 
169  $dd = $f->dropdown()->standard($items)
170  ->withAriaLabel($init_label);
171 
172  $tpl->setVariable('SORTATION_DROPDOWN', $default_renderer->render($dd));
173  return $tpl->get();
174  }
renderId(Component\JavaScriptBindable $component, Template $tpl, string $block, string $template_var)
Definition: Renderer.php:380
getTemplate(string $name, bool $purge_unfilled_vars, bool $purge_unused_blocks)
Get template of component this renderer is made for.
$url
Definition: ltiregstart.php:36
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setPaginationBrowseControls()

ILIAS\UI\Implementation\Component\ViewControl\Renderer::setPaginationBrowseControls ( Component\ViewControl\Pagination  $component,
RendererInterface  $default_renderer,
Template  $tpl 
)
protected

Add back/next-glyphs to the template for left/right browsing in pagination.

Definition at line 304 of file Renderer.php.

References Vendor\Package\$f, $params, $url, ILIAS\UI\Implementation\Render\AbstractComponentRenderer\getUIFactory(), and ILIAS\UI\Implementation\Render\Template\setVariable().

Referenced by ILIAS\UI\Implementation\Component\ViewControl\Renderer\renderPagination().

308  : void {
309  $prev = max(0, $component->getCurrentPage() - 1);
310  $next = $component->getCurrentPage() + 1;
311 
312  $f = $this->getUIFactory();
313 
314  if ($component->getTriggeredSignals()) {
315  $back = $f->symbol()->glyph()->back('')->withOnClick($component->getInternalSignal());
316  $forward = $f->symbol()->glyph()->next('')->withOnClick($component->getInternalSignal());
317  } else {
318  $url = $component->getTargetURL() ?? '';
319  if (strpos($url, '?') === false) {
320  $url_prev = $url . '?' . $component->getParameterName() . '=' . $prev;
321  $url_next = $url . '?' . $component->getParameterName() . '=' . $next;
322  } else {
323  $base = substr($url, 0, strpos($url, '?') + 1);
324  $query = parse_url($url, PHP_URL_QUERY);
325  parse_str($query, $params);
326 
327  $params[$component->getParameterName()] = $prev;
328  $url_prev = $base . http_build_query($params);
329  $params[$component->getParameterName()] = $next;
330  $url_next = $base . http_build_query($params);
331  }
332 
333  $back = $f->symbol()->glyph()->back($url_prev);
334  $forward = $f->symbol()->glyph()->next($url_next);
335  }
336 
337  if ($component->getCurrentPage() === 0) {
338  $back = $back->withUnavailableAction();
339  }
340  if ($component->getCurrentPage() >= $component->getNumberOfPages() - 1) {
341  $forward = $forward->withUnavailableAction();
342  }
343 
344  $tpl->setVariable('PREVIOUS', $default_renderer->render($back));
345  $tpl->setVariable('NEXT', $default_renderer->render($forward));
346  }
$url
Definition: ltiregstart.php:36
if(strtoupper($DIC->http() ->request() ->getMethod()) !=="GET") $params
Definition: ltiregstart.php:34
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setPaginationFirstLast()

ILIAS\UI\Implementation\Component\ViewControl\Renderer::setPaginationFirstLast ( Component\ViewControl\Pagination  $component,
array  $range,
RendererInterface  $default_renderer,
Template  $tpl 
)
protected

Add quick-access to first/last pages in pagination.

Parameters
int[]$range

Definition at line 353 of file Renderer.php.

References ILIAS\UI\Implementation\Component\ViewControl\Renderer\getPaginationShyButton(), and ILIAS\UI\Implementation\Render\Template\setVariable().

Referenced by ILIAS\UI\Implementation\Component\ViewControl\Renderer\renderPagination().

358  : void {
359  if (!in_array(0, $range)) {
360  $shy = $this->getPaginationShyButton(0, $component);
361  $tpl->setVariable('FIRST', $default_renderer->render($shy));
362  }
363  $last = max($component->getNumberOfPages() - 1, 0);
364  if (!in_array($last, $range)) {
365  $shy = $this->getPaginationShyButton($component->getNumberOfPages() - 1, $component);
366  $tpl->setVariable('LAST', $default_renderer->render($shy));
367  }
368  }
getPaginationShyButton(int $val, Component\ViewControl\Pagination $component, string $label='')
Definition: Renderer.php:272
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ MODE_ROLE

const ILIAS\UI\Implementation\Component\ViewControl\Renderer::MODE_ROLE = "group"

Definition at line 37 of file Renderer.php.


The documentation for this class was generated from the following file: