@ -103,7 +103,7 @@ class SortableTable extends HTML_Table {
* @param string $default_order_direction The default order direction;
* @param string $default_order_direction The default order direction;
* either the constant 'ASC' or 'DESC'
* either the constant 'ASC' or 'DESC'
*/
*/
public function __construct ($table_name = 'table', $get_total_number_function = null, $get_data_function = null, $default_column = 1, $default_items_per_page = 20, $default_order_direction = 'ASC') {
public function __construct($table_name = 'table', $get_total_number_function = null, $get_data_function = null, $default_column = 1, $default_items_per_page = 20, $default_order_direction = 'ASC') {
parent :: __construct (array ('class' => 'data_table'));
parent :: __construct (array ('class' => 'data_table'));
$this->table_name = $table_name;
$this->table_name = $table_name;
$this->additional_parameters = array ();
$this->additional_parameters = array ();
@ -169,7 +169,7 @@ class SortableTable extends HTML_Table {
/**
/**
* Get the Pager object to split the showed data in several pages
* Get the Pager object to split the showed data in several pages
*/
*/
public function get_pager () {
public function get_pager() {
if (is_null($this->pager)) {
if (is_null($this->pager)) {
$total_number_of_items = $this->get_total_number_of_items();
$total_number_of_items = $this->get_total_number_of_items();
$params['mode'] = 'Sliding';
$params['mode'] = 'Sliding';
@ -195,7 +195,7 @@ class SortableTable extends HTML_Table {
}
}
$query_vars_exclude = array_diff($query_vars, $query_vars_needed);
$query_vars_exclude = array_diff($query_vars, $query_vars_needed);
$params['excludeVars'] = $query_vars_exclude;
$params['excludeVars'] = $query_vars_exclude;
$this->pager = & Pager :: factory($params);
$this->pager = & Pager::factory($params);
}
}
return $this->pager;
return $this->pager;
}
}
@ -282,7 +282,7 @@ class SortableTable extends HTML_Table {
* This function shows the content of a table in a grid.
* This function shows the content of a table in a grid.
* Should not be use to edit information (edit/delete rows) only.
* Should not be use to edit information (edit/delete rows) only.
* */
* */
public function display_grid () {
public function display_grid() {
$empty_table = false;
$empty_table = false;
if ($this->get_total_number_of_items() == 0) {
if ($this->get_total_number_of_items() == 0) {
@ -411,7 +411,7 @@ class SortableTable extends HTML_Table {
* @param bool sort data optionally
* @param bool sort data optionally
* @return string grid html
* @return string grid html
*/
*/
public function display_simple_grid($visibility_options, $hide_navigation = true, $per_page = 0, $sort_data = true) {
public function display_simple_grid($visibility_options, $hide_navigation = true, $per_page = 2 0, $sort_data = true) {
$empty_table = false;
$empty_table = false;
if ($this->get_total_number_of_items() == 0) {
if ($this->get_total_number_of_items() == 0) {
@ -422,11 +422,11 @@ class SortableTable extends HTML_Table {
$empty_table = true;
$empty_table = true;
}
}
$html = '';
$html = '';
if (!$empty_table) {
if (!$empty_table) {
// If we show the pagination
// If we show the pagination
if (!$hide_navigation) {
if (!$hide_navigation) {
$form = ' ';
$form = ' ';
if ($this->get_total_number_of_items() > $per_page) {
if ($per_page > 10) {
if ($per_page > 10) {
$form = $this->get_page_select_form();
$form = $this->get_page_select_form();
}
}
@ -438,6 +438,7 @@ class SortableTable extends HTML_Table {
$html .= '< div class = "grid_nav" > '.$nav.'< / div > ';
$html .= '< div class = "grid_nav" > '.$nav.'< / div > ';
$html .= '< / div > ';
$html .= '< / div > ';
}
}
}
$html .= '< div class = "clear" > < / div > ';
$html .= '< div class = "clear" > < / div > ';
if (count($this->form_actions) > 0) {
if (count($this->form_actions) > 0) {
@ -463,6 +464,7 @@ class SortableTable extends HTML_Table {
} else {
} else {
// The normal way
// The normal way
$items = $this->get_clean_html($sort_data); // Getting the items of the table
$items = $this->get_clean_html($sort_data); // Getting the items of the table
}
}
@ -477,7 +479,7 @@ class SortableTable extends HTML_Table {
}
}
$html .= '< div class = "'.$this->table_name.'_grid_container" > ';
$html .= '< div class = "'.$this->table_name.'_grid_container" > ';
if (is_array($items) & & count($items) >0) {
if (is_array($items) & & count($items) > 0) {
foreach ($items as & $row) {
foreach ($items as & $row) {
$html .= '< div class = "'.$this->table_name.'_grid_item" > ';
$html .= '< div class = "'.$this->table_name.'_grid_item" > ';
$i = 0;
$i = 0;
@ -539,7 +541,7 @@ class SortableTable extends HTML_Table {
* @param bool true for sorting table data or false otherwise
* @param bool true for sorting table data or false otherwise
* @return array table row items
* @return array table row items
*/
*/
public function get_clean_html ($sort = true) {
public function get_clean_html($sort = true) {
$pager = $this->get_pager();
$pager = $this->get_pager();
$val = $pager->getOffsetByPageId();
$val = $pager->getOffsetByPageId();
$offset = $pager->getOffsetByPageId();
$offset = $pager->getOffsetByPageId();