PluginProbe
Booking Calendar / 11.8.4
Booking Calendar v11.8.4
11.8.4 11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 10.11 All 204 releases
← All changes | includes/_pagination/pagination.php +149 -11 10.1011.8.4 View file →
@@ -37,9 +37,9 @@
37 37
38 38 <script type="text/javascript">
39 39 jQuery( document ).ready( function (){
40 40
41 - wpbc_pagination_echo( '.wpbc_rules_pagination',
41 + wpbc_pagination_echo( '.wpbc_rules_pagination','.wpbc_rules_pagination_header','.wpbc_rules_pagination_footer',
42 42 {
43 43 'page_active': page_number,
44 44 'pages_count': Math.ceil( ajx_count / ajx_page_items_count )
45 45 }
@@ -91,9 +91,8 @@
91 91 $in_footer = true;
92 92
93 93 if ( ( is_admin() ) && ( in_array( $where_to_load, array( 'admin', 'both' ) ) ) ) {
94 94
95 - //wp_enqueue_script( 'wpbc-live_search', wpbc_plugin_url( '/_out/js/live_search.js' ), array( 'wpbc_all' ), WP_BK_VERSION_NUM, $in_footer );
96 95 wp_enqueue_script( 'wpbc-pagination'
97 96 , trailingslashit( plugins_url( '', __FILE__ ) ) . 'pagination.js' /* wpbc_plugin_url( '/_out/js/code_mirror.js' ) */
98 97 , array( 'wpbc_all' ), WP_BK_VERSION_NUM, $in_footer );
99 98
@@ -139,15 +138,147 @@
139 138 public function hook__page_footer_tmpl( $page ){
140 139
141 140 if ( $this->get_settings( 'load_on_page' ) === $page ) {
142 141
143 - $this->template__pagination();
142 + $this->template__prev_next();
143 + $this->template__items_per_page();
144 + $this->template__active_page_in_selectbox();
144 145 }
145 146 }
146 147
148 + /**
149 + * Pagination - " 1 - 9 of many | < > "
150 + *
151 + * @return void
152 + */
153 + private function template__prev_next() {
147 154
148 - private function template__pagination(){
155 + ?>
156 + <script type="text/html" id="tmpl-wpbc_pagination__prev_next">
157 + <div class="wpbc_pagination__prev_next wpbc_pagination_el">
158 + <#
159 + var items = {};
160 + items['start'] = ( data.page_active - 1 ) * data.page_items_count + 1;
161 + items['end'] = data.page_active * data.page_items_count;
162 + items['end'] = ( items['end'] > data.total_count ) ? data.total_count : items['end'];
163 + items['total'] = data.total_count;
164 + #>
165 + <# if ( data.pages_count > 1 ) { #>
166 + <?php
167 + echo '<div class="wpbc_ui_el">{{items.start}} - {{items.end}} ' . esc_html__( 'of', 'booking' ) . ' {{items.total}}</div>';
168 + ?>
169 + <# } else { #>
170 + <?php
171 + echo '<div class="wpbc_ui_el">{{items.start}} - {{items.end}} ' . esc_html__( 'bookings', 'booking' ) . ' </div>';
172 + ?>
173 + <# } #>
174 + <# if ( data.pages_count > 1 ) { #>
175 + <div class="wpbc_ui_el">
176 + <a class="wpbc_ui_el__a <# if ( 1 == data.page_active ) { #> disabled<# } #>"
177 + href="javascript:void(0)"
178 + <# if ( 1 != data.page_active ) { #> onclick="javascript:<?php
179 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
180 + echo $this->get_settings( 'on_click' ); ?>( parseInt( {{ data.page_active }} ) - 1 );" <# } #>
181 + >
182 + <?php
183 + echo '<i class="menu_icon icon-1x wpbc_icn_chevron_left"></i>';
184 + ?>
185 + </a>
186 + </div>
187 + <# } #>
188 + <# if ( data.pages_count > 1 ) { #>
189 + <div class="wpbc_ui_el">
190 + <a class="wpbc_ui_el__a <# if ( data.pages_count == data.page_active ) { #> disabled<# } #>"
191 + href="javascript:void(0)"
192 + <# if ( data.pages_count != data.page_active ) { #> onclick="javascript:<?php
193 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
194 + echo $this->get_settings( 'on_click' ); ?>( parseInt( {{ data.page_active }} ) + 1 );" <# } #>
195 + >
196 + <?php
197 + echo '<i class="menu_icon icon-1x wpbc_icn_chevron_right"></i>';
198 + ?>
199 + </a>
200 + </div>
201 + <# } #>
149 202
203 + </div>
204 + </script><?php
205 +
206 + }
207 +
208 +
209 + /**
210 + * Pagination - select Number of Items / Page.
211 + *
212 + * @return void
213 + */
214 + private function template__items_per_page() {
215 + ?>
216 + <script type="text/html" id="tmpl-wpbc_pagination_items_per_page">
217 + <div class="wpbc_pagination_items_per_page wpbc_pagination_el">
218 + <div class="">
219 + <label class="wpbc_ui_el"><?php esc_html_e( 'Show', 'booking' ); ?></label>
220 + <select class="wpbc_ui_el wpbc_items_per_page" autocomplete="off">
221 + <#
222 + var my_options_arr = [5, 10, 50, 100];
223 + var is_selected = '';
224 + _.each(
225 + my_options_arr,
226 + function ( p_val, p_key, p_data ) {
227 + is_selected = '';
228 + if ( data.page_items_count == p_val ) {
229 + is_selected = ' selected="selected" ';
230 + }
231 + #><option value="{{p_val}}" {{is_selected}}>{{p_val}}</option><#
232 + }
233 + );
234 + #>
235 + </select>
236 + <label class="wpbc_ui_el"><?php esc_html_e( 'per page', 'booking' ); ?></label>
237 + </div>
238 + </div>
239 + </script>
240 + <?php
241 + }
242 +
243 + /**
244 + * Pagination - Active page Number in Selectbox
245 + *
246 + * @return void
247 + */
248 + private function template__active_page_in_selectbox(){
249 + ?>
250 + <script type="text/html" id="tmpl-wpbc_pagination_active_page_in_selectbox">
251 + <div class="wpbc_pagination_active_page_in_selectbox wpbc_pagination_el">
252 + <# if ( data.pages_count > 1 ) { #>
253 + <div class="">
254 + <label class="wpbc_ui_el"><?php esc_html_e( 'Page', 'booking' ); ?>: </label>
255 + <select class="wpbc_ui_el"
256 + autocomplete="off"
257 + onchange="javascript:<?php
258 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
259 + echo $this->get_settings( 'on_click' );
260 + ?>( ( parseInt( jQuery( this ).val() ) ) );"
261 + >
262 + <#
263 + var is_selected = '';
264 + for ( var pg_num = 1; pg_num <= data.pages_count; pg_num++ ){
265 + is_selected = ( pg_num == data.page_active ) ? ' selected="selected" ' : '';
266 + #><option value="{{pg_num}}" {{is_selected}}>{{pg_num}}</option><#
267 + }
268 + #>
269 + </select>
270 + </div>
271 + <# } #>
272 + </div>
273 + </script>
274 + <?php
275 + }
276 +
277 +
278 +
279 + private function template__pagination_old(){
280 +
150 281 // Pagination
151 282 ?><script type="text/html" id="tmpl-wpbc_pagination">
152 283 <div class="wpbc-ajax-pagination wpbc-ajax-pagination-container">
153 284 <# if ( data.pages_count > 1 ) { #>
@@ -289,24 +420,31 @@
289 420 */
290 421 public function show( $params = array() ) {
291 422 $defaults = array(
292 423 'page_active' => 1,
293 - 'pages_count' => 1
424 + 'pages_count' => 1,
425 + 'total_count' => 1
294 426 );
295 427 $params = wp_parse_args( $params, $defaults );
296 428 ?>
297 429 <script type="text/javascript">
298 430
299 - jQuery( document ).ready( function (){
431 + jQuery( document ).ready( function () {
300 432
301 - wpbc_pagination_echo( '<?php echo esc_attr( $this->get_settings( 'container' ) ); ?>', <?php
433 + wpbc_pagination_echo(
434 + '<?php echo esc_attr( $this->get_settings( 'container' ) ); ?>',
435 + '<?php echo esc_attr( $this->get_settings( 'container_header' ) ); ?>',
436 + '<?php echo esc_attr( $this->get_settings( 'container_footer' ) ); ?>',
437 + <?php
302 438 echo wp_json_encode(
303 439 array(
304 440 'page_active' => $params['page_active'],
305 - 'pages_count' => $params['pages_count']
441 + 'pages_count' => $params['pages_count'],
442 + 'total_count' => $params['total_count'],
306 443 )
307 444 );
308 - ?> );
445 + ?>
446 + );
309 447 } );
310 448 </script>
311 449 <?php
312 450 }
@@ -315,10 +453,10 @@
315 453 /**
316 454 * Just for loading CSS and JavaScript files for all Settings pages
317 455 */
318 456 if ( true ) {
319 - $js_css_loading = new WPBC_Pagination;
320 - $js_css_loading->init_load_css_js();
457 + $wpbc_js_css_loading = new WPBC_Pagination;
458 + $wpbc_js_css_loading->init_load_css_js();
321 459 }
322 460
323 461
324 462 //TODO: delete ../email-reminders/_src/css/o-pagination.css