Skip to content

Commit

Permalink
Merge pull request #252 from Qchmqs/1.9/develop
Browse files Browse the repository at this point in the history
added pagination to generated controllers
  • Loading branch information
WanWizard authored Apr 18, 2017
2 parents d87c773 + 5cede76 commit 0aa9dd0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
14 changes: 11 additions & 3 deletions views/admin/orm/actions/index.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
$data['<?php echo $plural_name ?>'] = Model_<?php echo $model_name; ?>::find('all');
$this->template->title = "<?php echo ucfirst($plural_name); ?>";
$this->template->content = View::forge('<?php echo $view_path; ?>/index', $data);
$query = Model_<?php echo $model_name; ?>::query();
$pagination = Pagination::forge(array(
'total_items' => $query->count(),
'uri_segment' => 'page',
));
$data['<?php echo $plural_name ?>'] = $query->rows_offset($pagination->offset)
->rows_limit($pagination->per_page)
->get();
$this->template->set_global('pagination',$pagination,true);
$this->template->title = "<?php echo ucfirst($plural_name); ?>";
$this->template->content = View::forge('<?php echo $view_path; ?>/index', $data);
1 change: 1 addition & 0 deletions views/admin/orm/views/actions/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
</td>
</tr>
<?php echo '<?php endforeach; ?>'; ?>
<?php echo $pagination;?>
</tbody>
</table>

Expand Down

0 comments on commit 0aa9dd0

Please sign in to comment.