From 0d2331cce375a1d61d1b85718c7762026901bac1 Mon Sep 17 00:00:00 2001 From: David Mudrak Date: Fri, 20 Apr 2012 11:15:28 +0200 Subject: [PATCH] MDL-27508 workshop supports pagination at the submissions list in the submission phase --- mod/workshop/view.php | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/mod/workshop/view.php b/mod/workshop/view.php index 01525d5249f..6c4d2a9af94 100644 --- a/mod/workshop/view.php +++ b/mod/workshop/view.php @@ -190,20 +190,26 @@ case workshop::PHASE_SUBMISSION: } } - echo $output->container(groups_print_activity_menu($workshop->cm, $PAGE->url, true), 'groupwidget'); - - $submissions = $workshop->get_submissions('all', $groupid); - - print_collapsible_region_start('', 'workshop-viewlet-allsubmissions', get_string('allsubmissions', 'workshop', count($submissions))); + $countsubmissions = $workshop->count_submissions('all', $groupid); + $perpage = 10; + $pagingbar = new paging_bar($countsubmissions, $page, $perpage, $PAGE->url, 'page'); + print_collapsible_region_start('', 'workshop-viewlet-allsubmissions', get_string('allsubmissions', 'workshop', $countsubmissions)); echo $output->box_start('generalbox allsubmissions'); - if (empty($submissions)) { + echo $output->container(groups_print_activity_menu($workshop->cm, $PAGE->url, true), 'groupwidget'); + echo $output->render($pagingbar); + + if ($countsubmissions == 0) { echo $output->container(get_string('nosubmissions', 'workshop'), 'nosubmissions'); + + } else { + $submissions = $workshop->get_submissions('all', $groupid, $page * $perpage, $perpage); + $shownames = has_capability('mod/workshop:viewauthornames', $workshop->context); + foreach ($submissions as $submission) { + echo $output->render($workshop->prepare_submission_summary($submission, $shownames)); + } } - $shownames = has_capability('mod/workshop:viewauthornames', $workshop->context); - foreach ($submissions as $submission) { - echo $output->render($workshop->prepare_submission_summary($submission, $shownames)); - } + echo $output->box_end(); print_collapsible_region_end(); }