/** * start($args) function is called by do_action('pagination') * @param $args */ public static function generate($args) { $self = new ReportPagination; $self->totalPages = floor($args['count'] / $args['limit']); $self->currentPage = $args['paginate']; $self->range = isset($args['range']) ? $args['range'] : $self->totalPages; $self->generate_links(); echo '<div class="large-12 medium-12 small-12 pagination">'; foreach($self->links as $link) { if(isset($link['self'])) { echo "<a class='active'>".$link['self']."</a>"; } else { $class = isset($link['class']) ? $link['class'] : ''; echo '<a href="'.$link['link'].'" class="'.$class.'">'.$link['label'].'</a>'; } } echo '</div>'; }
?> </tr> </thead> <tbody> <?php foreach ($this->data['result'] as $datum) { echo '<tr>'; foreach ($datum as $key => $value) { echo "<td>$value</td>"; } echo '</tr>'; } ?> </tbody> </table> <?php endif; ?> </div> <?php elseif(!empty($this->error)): echo "<div class='error'>$this->error</div>"; endif;?> <?php if($this->data['count'] > 0) { ReportPagination::generate([ 'paginate' => $this->paginate, 'limit' => $this->limit, 'count' => $this->data['count'] ]); } ?> </div>