/** * @param string $onClass - if not specified use btn-success * @param string $offClass - if not specified use none * @param bool|true $isOn - on by default * @param string $id optional. If specified added to the btn-toggle container. * @param array $classes * @param string $onValue 1 by default * @param string $offValue 0 by default * @param bool|true $isSmall the bootstrap small seems like the right size. I use small by default */ public function toogle_button($onClass = '', $offClass = '', $isOn = true, $id = '', $onValue = '1', $offValue = '0', $isSmall = true) { $onClass = empty($onClass) ? 'btn-success' : $onClass; $onClass = empty($offClass) ? 'btn-default' : $onClass; ?> <div<?php echo empty($id) ? '' : ' id="' . $id . '" '; ?> class="btn-group btn-toggle"> <button class="btn <?php echo $isOn ? $onClass : 'btn-default'; ?> <?php echo $isOn ? ' active' : ''; echo $isSmall ? ' btn-sm' : ''; ?> " data-value="<?php echo $onValue; ?> " data-on-class="<?php echo $onClass; ?> "><?php _tfc('ON'); ?> </button> <button class="btn <?php echo !$isOn ? $offClass : 'btn-default'; ?> <?php echo !$isOn ? ' active' : ''; echo $isSmall ? ' btn-sm' : ''; ?> " data-value="<?php echo $offValue; ?> " data-on-class="<?php echo $offClass; ?> "><?php _tfc('OFF'); ?> </button> </div> <?php }
public function get_modal() { ?> <!-- Modal Dialog--> <div class="modal fade" id="<?php echo $this->id; ?> " tabindex="-1" role="dialog" aria-labelledby="add-title-label"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> <h4 class="modal-title" id="add-title-label"> <?php echo $this->title; ?> </h4> </div> <div class="modal-body"> <div class="filter-box bg-info form-inline <?php echo $this->has_filter ? '' : 'hidden'; ?> "> <?php do_action('modal_post_selection_filter'); ?> <button type="submit" class="btn btn-primary btn-sm"><i class="fa fa-filter"></i></button> </div> <div class="plan-items"> <table class="post-type-table table table-hover table-condensed table-striped" data-chk-id="chk_item_select"> <caption> <div class="river-waiting"> <span class="spinner"></span> </div> <em><?php _etfc('Loading...'); ?> </em> </caption> <thead> <?php $this->get_column_headers($this->columns, $this->sort_by); ?> </thead> <tbody> <?php $rows = apply_filters('get_modal_post_selection_rows', $this->current_page); if (!isset($this->columns) || !is_array($this->columns) || count($this->columns) < 1) { throw new Exception('missing column definition'); } if (!isset($rows) || !is_array($rows) || count($rows) == 0) { ?> <tr> <td colspan="<?php echo $this->get_column_count(); ?> " class="message no-items"><?php _e('No items', 'forest-manager'); ?> </td> </tr> <?php } else { foreach ($rows as $row) { echo '<tr>'; echo '<td><input type="radio" name="chk_item_select" value="' . $row[$this->row_id] . '"/></td>'; foreach ($this->columns as $column_id => $column_title) { echo '<td>' . $row[$column_id] . '</td>'; } echo '</tr>'; } } ?> </tbody> <tfoot> <tr> <td colspan="<?php echo count($this->columns); ?> "> <div class="pagination-container"> <?php $this->get_bootstrap_pagination(); ?> </div> </td> </tr> </tfoot> </table> </div> </div><!--modal body end--> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal"><?php _etfm('Close'); ?> </button> <button type="button" class="btn btn-primary"><?php _etfm('Select'); ?> </button> </div> </div> </div> </div> <?php $labels = array('NoItemsFound' => _tfc('No items found')); ?> <script type="application/javascript"> jQuery(document).ready(function(){ try { var modalSelection = new ForestModalPostSelection( '<?php echo $this->id; ?> ', <?php echo ForestUtils::get_instance()->get_js_object($this->post_types); ?> , <?php echo ForestUtils::get_instance()->get_js_object($this->sort_by); ?> , <?php echo $this->has_filter ? 'true' : 'false'; ?> , <?php echo ForestUtils::get_instance()->get_js_object($this->columns); ?> , <?php echo ForestUtils::get_instance()->get_js_object($this->ajax); ?> , <?php echo ForestUtils::get_instance()->get_js_object($labels); ?> ); modalSelection.init(); } catch(e){ console.log(e.message); } }); </script> <?php }