Chamilo is a learning management system focused on ease of use and accessibility
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
chamilo-lms/main/inc/lib/SortableTableFromArrayConfi...

119 lines
3.6 KiB

<?php
/* For licensing terms, see /license.txt */
/**
* Sortable table which can be used for data available in an array.
*
* Is a variation of SortableTableFromArray because we add 2 new arrays $column_show and $column_order
* $column_show is an array that lets us decide which are going to be the columns to show
* $column_order is an array that lets us decide the ordering of the columns
* i.e: $column_header=array('a','b','c','d','e'); $column_order=array(1,2,5,4,5);
* These means that the 3th column (letter "c") will be sort like the order we use in the 5th column
*/
class SortableTableFromArrayConfig extends SortableTable
{
/**
* The array containing the columns that will be show
* i.e $column_show=array('1','0','0'); we will show only the 1st column.
*/
private $column_show;
/**
* The array containing the real sort column
* $column_order=array('1''4','3','4');
* The 2nd column will be order like the 4th column.
*/
private $column_order;
private $doc_filter;
Global: Fix CAPTCHA image missing in registration and lost password pages - refs #3839 Squashed commit of the following: commit 48538d6c59e5adac9ec9703fe35ae498d40d4792 Author: Yannick Warnier <ywarnier@beeznest.org> Date: Wed Aug 11 01:02:56 2021 +0200 Minor - Code styling commit ebfb1db3aec7ec5b8410f3f7a260fb2dfe4209c8 Merge: 899bfcfe76 5c946a9b44 Author: Yannick Warnier <ywarnier@beeznest.org> Date: Wed Aug 11 00:59:03 2021 +0200 Merge branch '3839' of https://github.com/christianbeeznest/chamilo-lms into 3839 commit 5c946a9b441a3454c30193bac4eb836380ce16a6 Author: Christian <christian1827@gmail.com> Date: Tue May 25 19:02:23 2021 -0500 Fix captcha image is not displayed in lost password and inscription pages - refs #3839 commit b2ac9da2adf08cf295236b8ea65a12016eb2a7f6 Merge: e07a555432 615b90bd41 Author: Christian <christian1827@gmail.com> Date: Tue May 25 18:49:54 2021 -0500 Merge branch '1.11.x' of https://github.com/chamilo/chamilo-lms into 1.11.x commit e07a555432e31f9de8fd232c0210158892baebe2 Merge: 44251f9d10 a562622d50 Author: Christian <christian1827@gmail.com> Date: Fri May 21 14:51:16 2021 -0500 Merge branch '1.11.x' of https://github.com/chamilo/chamilo-lms into 1.11.x commit 44251f9d10a9a014fbc2e144c4d312deba2a86de Merge: b06bdd0a50 9d41b63eb5 Author: Christian <christian1827@gmail.com> Date: Fri May 21 10:51:30 2021 -0500 qMerge branch '1.11.x' of https://github.com/chamilo/chamilo-lms into 1.11.x commit b06bdd0a502e766c4988882ab645f6c528ad2898 Merge: f35edf31a4 7e3f9afbd1 Author: Christian <christian1827@gmail.com> Date: Fri May 21 05:50:29 2021 -0500 Merge branch '1.11.x' of https://github.com/chamilo/chamilo-lms into 1.11.x commit f35edf31a4be99780501fb667d0e67e5457e5ade Merge: d43e3a5f2e 905a21037e Author: Christian <christian1827@gmail.com> Date: Thu May 20 15:05:44 2021 -0500 Merge branch '1.11.x' of https://github.com/chamilo/chamilo-lms into 1.11.x commit d43e3a5f2ed28dbe7e6b5b970f3688d404e5da36 Author: Christian <christian1827@gmail.com> Date: Wed May 19 17:34:20 2021 -0500 Fixed Document tool : pagination broken #3748
4 years ago
private $handlePagination = true;
/**
* Constructor.
*
* @param array $data All the information of the table
* @param int $column Default column that will be used in the sort functions
* @param int $itemsPerPage Number of items per pages that we are going to see
* @param string $tableName Name of the table
* @param array $columnShow An array with binary values: 1 = show column, 2 = don't show it
* @param array $columnOrder An array of integers that let us decide how the columns are going to be sort
* @param string $direction ASC/DESC
* @param bool $docFilter special modification to fix the document name order
*/
public function __construct(
$data,
$column = 1,
$itemsPerPage = 20,
$tableName = 'tablename',
$columnShow = [],
$columnOrder = [],
$direction = 'ASC',
$docFilter = false
) {
$this->column_show = $columnShow;
$this->column_order = $columnOrder;
$this->doc_filter = $docFilter;
Global: Fix CAPTCHA image missing in registration and lost password pages - refs #3839 Squashed commit of the following: commit 48538d6c59e5adac9ec9703fe35ae498d40d4792 Author: Yannick Warnier <ywarnier@beeznest.org> Date: Wed Aug 11 01:02:56 2021 +0200 Minor - Code styling commit ebfb1db3aec7ec5b8410f3f7a260fb2dfe4209c8 Merge: 899bfcfe76 5c946a9b44 Author: Yannick Warnier <ywarnier@beeznest.org> Date: Wed Aug 11 00:59:03 2021 +0200 Merge branch '3839' of https://github.com/christianbeeznest/chamilo-lms into 3839 commit 5c946a9b441a3454c30193bac4eb836380ce16a6 Author: Christian <christian1827@gmail.com> Date: Tue May 25 19:02:23 2021 -0500 Fix captcha image is not displayed in lost password and inscription pages - refs #3839 commit b2ac9da2adf08cf295236b8ea65a12016eb2a7f6 Merge: e07a555432 615b90bd41 Author: Christian <christian1827@gmail.com> Date: Tue May 25 18:49:54 2021 -0500 Merge branch '1.11.x' of https://github.com/chamilo/chamilo-lms into 1.11.x commit e07a555432e31f9de8fd232c0210158892baebe2 Merge: 44251f9d10 a562622d50 Author: Christian <christian1827@gmail.com> Date: Fri May 21 14:51:16 2021 -0500 Merge branch '1.11.x' of https://github.com/chamilo/chamilo-lms into 1.11.x commit 44251f9d10a9a014fbc2e144c4d312deba2a86de Merge: b06bdd0a50 9d41b63eb5 Author: Christian <christian1827@gmail.com> Date: Fri May 21 10:51:30 2021 -0500 qMerge branch '1.11.x' of https://github.com/chamilo/chamilo-lms into 1.11.x commit b06bdd0a502e766c4988882ab645f6c528ad2898 Merge: f35edf31a4 7e3f9afbd1 Author: Christian <christian1827@gmail.com> Date: Fri May 21 05:50:29 2021 -0500 Merge branch '1.11.x' of https://github.com/chamilo/chamilo-lms into 1.11.x commit f35edf31a4be99780501fb667d0e67e5457e5ade Merge: d43e3a5f2e 905a21037e Author: Christian <christian1827@gmail.com> Date: Thu May 20 15:05:44 2021 -0500 Merge branch '1.11.x' of https://github.com/chamilo/chamilo-lms into 1.11.x commit d43e3a5f2ed28dbe7e6b5b970f3688d404e5da36 Author: Christian <christian1827@gmail.com> Date: Wed May 19 17:34:20 2021 -0500 Fixed Document tool : pagination broken #3748
4 years ago
// if data is empty the pagination is handled with query in database
if (empty($data)) {
$this->handlePagination = false;
}
parent::__construct(
$tableName,
null,
null,
$column,
$itemsPerPage,
$direction
);
$this->table_data = $data;
}
/**
* Get table data to show on current page.
*
* @see SortableTable#get_table_data
*/
public function get_table_data(
$from = 1,
$perPage = null,
$column = null,
$direction = null,
$sort = true
) {
$table = TableSort::sort_table_config(
$this->table_data,
$this->column,
'ASC' === $this->direction ? SORT_ASC : SORT_DESC,
$this->column_show,
$this->column_order,
SORT_REGULAR,
$this->doc_filter
);
Global: Fix CAPTCHA image missing in registration and lost password pages - refs #3839 Squashed commit of the following: commit 48538d6c59e5adac9ec9703fe35ae498d40d4792 Author: Yannick Warnier <ywarnier@beeznest.org> Date: Wed Aug 11 01:02:56 2021 +0200 Minor - Code styling commit ebfb1db3aec7ec5b8410f3f7a260fb2dfe4209c8 Merge: 899bfcfe76 5c946a9b44 Author: Yannick Warnier <ywarnier@beeznest.org> Date: Wed Aug 11 00:59:03 2021 +0200 Merge branch '3839' of https://github.com/christianbeeznest/chamilo-lms into 3839 commit 5c946a9b441a3454c30193bac4eb836380ce16a6 Author: Christian <christian1827@gmail.com> Date: Tue May 25 19:02:23 2021 -0500 Fix captcha image is not displayed in lost password and inscription pages - refs #3839 commit b2ac9da2adf08cf295236b8ea65a12016eb2a7f6 Merge: e07a555432 615b90bd41 Author: Christian <christian1827@gmail.com> Date: Tue May 25 18:49:54 2021 -0500 Merge branch '1.11.x' of https://github.com/chamilo/chamilo-lms into 1.11.x commit e07a555432e31f9de8fd232c0210158892baebe2 Merge: 44251f9d10 a562622d50 Author: Christian <christian1827@gmail.com> Date: Fri May 21 14:51:16 2021 -0500 Merge branch '1.11.x' of https://github.com/chamilo/chamilo-lms into 1.11.x commit 44251f9d10a9a014fbc2e144c4d312deba2a86de Merge: b06bdd0a50 9d41b63eb5 Author: Christian <christian1827@gmail.com> Date: Fri May 21 10:51:30 2021 -0500 qMerge branch '1.11.x' of https://github.com/chamilo/chamilo-lms into 1.11.x commit b06bdd0a502e766c4988882ab645f6c528ad2898 Merge: f35edf31a4 7e3f9afbd1 Author: Christian <christian1827@gmail.com> Date: Fri May 21 05:50:29 2021 -0500 Merge branch '1.11.x' of https://github.com/chamilo/chamilo-lms into 1.11.x commit f35edf31a4be99780501fb667d0e67e5457e5ade Merge: d43e3a5f2e 905a21037e Author: Christian <christian1827@gmail.com> Date: Thu May 20 15:05:44 2021 -0500 Merge branch '1.11.x' of https://github.com/chamilo/chamilo-lms into 1.11.x commit d43e3a5f2ed28dbe7e6b5b970f3688d404e5da36 Author: Christian <christian1827@gmail.com> Date: Wed May 19 17:34:20 2021 -0500 Fixed Document tool : pagination broken #3748
4 years ago
if ($this->handlePagination) {
return array_slice($table, $from, $this->per_page);
}
return $table;
}
/**
* Get total number of items.
*
* @see SortableTable#get_total_number_of_items
*/
public function get_total_number_of_items()
{
if (!empty($this->total_number_of_items) && $this->total_number_of_items !== -1) {
return $this->total_number_of_items;
} else {
if (!empty($this->table_data)) {
return count($this->table_data);
}
return 0;
}
}
}