/** * This method render the navigation bar with pages and all information. * Also creates the message "Shogin ..." that can be get after. * * @param bool INdicates if this method must show the navbar or only render it * @return string|echo */ public function render($caption, $showing = 0) { // If we have the content of render then return it if ($this->displayed) { return $this->rendered; } $total_pages = ceil($this->total_results / $this->items_page); $current_page = $this->current_page > $total_pages ? $total_pages : $this->current_page; $current_page = $current_page == 0 ? 1 : $current_page; $items_page = $this->items_page; $total_results = $this->total_results; $steps = $this->steps(); $url = $this->url; if ($current_page == 1) { $first_element = 1; } else { $first_element = $total_results > 0 ? $current_page * $items_page - $items_page + 1 : 0; } $last_element = $current_page * $items_page; $last_element = $last_element > $total_results ? $total_results : $last_element; $this->showing = sprintf(__('Showing <strong>%u</strong> to <strong>%u</strong> of <strong>%u</strong>.', 'rmcommon'), $first_element, $last_element, $total_results); if ($total_pages <= 1) { return; } if ($showing) { $showing_legend = $this->showing; } ob_start(); $start = 1; if ($current_page > $steps - 1) { $start = $current_page - floor($steps / 2); } //echo "$start>($total_pages - $steps) ? ($total_pages - $steps)+1 : $start;"; die(); $start = $start >= $total_pages - $steps && $start != 1 ? $total_pages - $steps + 1 : $start; $start = $start < 1 ? 1 : $start; $end = $start + ($steps - 1); $end = $end > $total_pages ? $total_pages : $end; if ($this->template != '' && is_file($this->template)) { include $this->template; } else { include RMTemplate::get_template('navigation_pages.php', 'module', 'rmcommon'); } $this->displayed = true; $this->rendered = ob_get_clean(); return $this->rendered; }
/** * Escribe directamente el conetnido HTML con la funcin echo */ public function display($js = true) { $form =& $this; include RMTemplate::get_template('forms.php', 'rmcommon'); //echo $this->render($js); }