19 declare(strict_types=1);
21 require_once(
"vendor/composer/vendor/autoload.php");
22 require_once(__DIR__ .
"/../../Base.php");
37 public function symbol(): IC\Symbol\Factory
39 return new IC\Symbol\Factory(
45 public function button(): IC\Button\Factory
47 return new IC\Button\Factory();
49 public function dropdown(): IC\Dropdown\Factory
51 return new IC\Dropdown\Factory();
65 $pagination =
$f->pagination();
66 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\ViewControl\\Pagination", $pagination);
67 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Signal", $pagination->getInternalSignal());
76 $target_url =
'http://testurl';
77 $parameter_name =
"param_name";
78 $max_page_options = 10;
82 ->withTargetURL($target_url, $parameter_name)
83 ->withTotalEntries($total_entries)
84 ->withPageSize($page_size)
85 ->withCurrentPage($current_page)
86 ->withMaxPaginationButtons($max_page_options)
89 $this->assertEquals($target_url, $p->getTargetURL());
90 $this->assertEquals($parameter_name, $p->getParameterName());
91 $this->assertEquals($page_size, $p->getPageSize());
92 $this->assertEquals($current_page, $p->getCurrentPage());
93 $this->assertEquals($max_page_options, $p->getMaxPaginationButtons());
94 $this->assertEquals(2, $p->getNumberOfPages());
100 ->withTotalEntries(2)
105 $expected_html = <<<EOT
106 <div
class=
"il-viewcontrol-pagination l-bar__element">
107 <
button class=
"btn btn-default" data-action=
"?pagination_offset=0" disabled=
"disabled">
108 <span
class=
"glyph" aria-label=
"back" role=
"img"><span
class=
"glyphicon glyphicon-chevron-left" aria-hidden=
"true"></span></span>
110 <
button class=
"btn btn-link engaged" aria-pressed=
"true" data-action=
"?pagination_offset=0" id=
"id_1">1</button>
111 <button
class=
"btn btn-link" data-action=
"?pagination_offset=1" id=
"id_2">2</button>
112 <button
class=
"btn btn-default" data-action=
"?pagination_offset=1" id=
"id_3">
113 <span
class=
"glyph" aria-label=
"next" role=
"img"><span
class=
"glyphicon glyphicon-chevron-right" aria-hidden=
"true"></span></span>
118 $html = $this->getDefaultRenderer()->render($p);
119 $this->assertEquals($this->brutallyTrimHTML($expected_html), $this->brutallyTrimHTML($html));
125 ->withTotalEntries(2)
127 ->withCurrentPage(1);
131 $expected_html = <<<EOT
132 <div
class=
"il-viewcontrol-pagination l-bar__element">
133 <
button class=
"btn btn-default" data-action=
"?pagination_offset=0" id=
"id_3">
134 <span
class=
"glyph" aria-label=
"back" role=
"img"><span
class=
"glyphicon glyphicon-chevron-left" aria-hidden=
"true"></span></span>
136 <
button class=
"btn btn-link" data-action=
"?pagination_offset=0" id=
"id_1">1</button>
137 <button
class=
"btn btn-link engaged" aria-pressed=
"true" data-action=
"?pagination_offset=1" id=
"id_2">2</button>
138 <button
class=
"btn btn-default" data-action=
"?pagination_offset=2" disabled=
"disabled">
139 <span
class=
"glyph" aria-label=
"next" role=
"img"><span
class=
"glyphicon glyphicon-chevron-right" aria-hidden=
"true"></span></span>
144 $html = $this->getDefaultRenderer()->render($p);
145 $this->assertHTMLEquals(
146 $this->brutallyTrimHTML($expected_html),
147 $this->brutallyTrimHTML($html)
154 ->withTotalEntries(3)
156 ->withMaxPaginationButtons(1);
161 $expected_html = <<<EOT
162 <div
class=
"il-viewcontrol-pagination l-bar__element">
163 <
button class=
"btn btn-default" data-action=
"?pagination_offset=0" disabled=
"disabled">
164 <span
class=
"glyph" aria-label=
"back" role=
"img"><span
class=
"glyphicon glyphicon-chevron-left" aria-hidden=
"true"></span></span>
166 <
button class=
"btn btn-link engaged" aria-pressed=
"true" data-action=
"?pagination_offset=0" id=
"id_1">1</button>
167 <span
class=
"last"><button
class=
"btn btn-link" data-action=
"?pagination_offset=2" id=
"id_2">3</button></span>
168 <button
class=
"btn btn-default" data-action=
"?pagination_offset=1" id=
"id_3">
169 <span
class=
"glyph" aria-label=
"next" role=
"img"><span
class=
"glyphicon glyphicon-chevron-right" aria-hidden=
"true"></span></span>
173 $html = $this->getDefaultRenderer()->render($p);
175 $this->brutallyTrimHTML($expected_html),
176 $this->brutallyTrimHTML($html)
183 ->withTotalEntries(3)
185 ->withMaxPaginationButtons(1)
186 ->withCurrentPage(1);
191 $expected_html = <<<EOT
192 <div
class=
"il-viewcontrol-pagination l-bar__element">
193 <
button class=
"btn btn-default" data-action=
"?pagination_offset=0" id=
"id_4">
194 <span
class=
"glyph" aria-label=
"back" role=
"img"><span
class=
"glyphicon glyphicon-chevron-left" aria-hidden=
"true"></span></span>
195 </
button><span
class=
"first"><
button class=
"btn btn-link" data-action=
"?pagination_offset=0" id=
"id_2">1</
button></span>
196 <
button class=
"btn btn-link engaged" aria-pressed=
"true" data-action=
"?pagination_offset=1" id=
"id_1">2</button>
197 <span
class=
"last"><button
class=
"btn btn-link" data-action=
"?pagination_offset=2" id=
"id_3">3</button></span>
198 <button
class=
"btn btn-default" data-action=
"?pagination_offset=2" id=
"id_5">
199 <span
class=
"glyph" aria-label=
"next" role=
"img"><span
class=
"glyphicon glyphicon-chevron-right" aria-hidden=
"true"></span></span>
203 $html = $this->getDefaultRenderer()->render($p);
204 $this->assertHTMLEquals(
205 $this->brutallyTrimHTML($expected_html),
206 $this->brutallyTrimHTML($html)
213 ->withTotalEntries(3)
215 ->withMaxPaginationButtons(1)
216 ->withCurrentPage(2);
221 $expected_html = <<<EOT
222 <div
class=
"il-viewcontrol-pagination l-bar__element">
223 <
button class=
"btn btn-default" data-action=
"?pagination_offset=1" id=
"id_3">
224 <span
class=
"glyph" aria-label=
"back" role=
"img"><span
class=
"glyphicon glyphicon-chevron-left" aria-hidden=
"true"></span></span>
226 <span
class=
"first"><
button class=
"btn btn-link" data-action=
"?pagination_offset=0" id=
"id_2">1</
button></span>
227 <
button class=
"btn btn-link engaged" aria-pressed=
"true" data-action=
"?pagination_offset=2" id=
"id_1">3</button>
228 <button
class=
"btn btn-default" data-action=
"?pagination_offset=3" disabled=
"disabled">
229 <span
class=
"glyph" aria-label=
"next" role=
"img"><span
class=
"glyphicon glyphicon-chevron-right" aria-hidden=
"true"></span></span>
233 $html = $this->getDefaultRenderer()->render($p);
235 $this->brutallyTrimHTML($expected_html),
236 $this->brutallyTrimHTML($html)
243 ->withTotalEntries(3)
247 $expected_html = <<<EOT
248 <div
class=
"il-viewcontrol-pagination l-bar__element">
249 <
button class=
"btn btn-default" data-action=
"?pagination_offset=0" disabled=
"disabled">
250 <span
class=
"glyph" aria-label=
"back" role=
"img"><span
class=
"glyphicon glyphicon-chevron-left" aria-hidden=
"true"></span></span>
252 <div
class=
"dropdown" id=
"id_4">
253 <
button class=
"btn btn-default dropdown-toggle" type=
"button" aria-haspopup=
"true" aria-expanded=
"false" aria-controls=
"id_4_menu">pagination_label_x_of_y<span
class=
"caret"></span></
button>
254 <ul
id=
"id_4_menu" class=
"dropdown-menu">
256 <
button class=
"btn btn-link engaged" aria-pressed=
"true" data-action=
"?pagination_offset=0" id=
"id_1">1</button>
259 <button
class=
"btn btn-link" data-action=
"?pagination_offset=1" id=
"id_2">2</button>
262 <button
class=
"btn btn-link" data-action=
"?pagination_offset=2" id=
"id_3">3</button>
266 <button
class=
"btn btn-default" data-action=
"?pagination_offset=1" id=
"id_5">
267 <span
class=
"glyph" aria-label=
"next" role=
"img"><span
class=
"glyphicon glyphicon-chevron-right" aria-hidden=
"true"></span></span>
271 $html = $this->getDefaultRenderer()->render($p);
273 $this->brutallyTrimHTML($expected_html),
274 $this->brutallyTrimHTML($html)
284 $pagination = $this->
getFactory()->pagination()
285 ->withCurrentPage($current_page)
286 ->withPageSize($page_size);
288 $this->assertNull($pagination->getRange());
289 $this->assertEquals(
$range, $pagination->getRange());
295 ->withTotalEntries(30)
298 $html = $this->getDefaultRenderer()->render($p);
299 $this->assertEquals($expected_html, $html);
button(string $caption, string $cmd)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null