Exemple #1
0
 /**
  * Render mr_html_paging
  *
  * @param mr_html_paging $paging mr_html_paging instance
  * @return string
  */
 public function render_mr_html_paging(mr_html_paging $paging)
 {
     $output = '';
     if ($paging->get_perpage()) {
         $output = $this->output->paging_bar($paging->get_total(), $paging->get_page(), $paging->get_perpage(), $paging->get_url(), $paging->REQUEST_PAGE);
     }
     if ($paging->get_perpageopts()) {
         $options = array();
         foreach ($paging->get_perpageopts() as $opt) {
             if ($opt == 'all') {
                 $options[10000] = get_string('all');
             } else {
                 $options[$opt] = $opt;
             }
         }
         $singleselect = new single_select($paging->get_url(), $paging->REQUEST_PERPAGE, $options, $paging->get_perpage(), array());
         $singleselect->set_label(get_string('rowsperpage', 'local_mr'), array('class' => 'accesshide'));
         $select = $this->output->render($singleselect);
         // Attempt to place it within the paging bar's div
         if (substr($output, strlen($output) - 6) == '</div>') {
             $output = substr($output, 0, -6) . "{$select}</div>";
         } else {
             $output .= $this->output->box($select, 'paging');
         }
         $output = html_writer::tag('div', $output, array('class' => 'mr_html_paging'));
     }
     return $output;
 }