';
}
}
/**
* Show table headers.
* @param array $headers column name => column title (for table heads)
* @param string $type type of list that is being shown
* @param bool $sortable whether or not to show sortable column headers (links in th's)
*/
function show_headers($headers,$type,$sortable=true)
{
echo "\n".'
';
}
/**
* Show table data.
* @param array $headers column name => column title (for knowing which ones to display)
* @param array $row table row, assoc
* @param string $type type of table, determines first column, which could be an input
* @param array|string $selected selected items; if type is checkbox, array otherwise string with one val
*/
function show_row($headers,$row,$type,$num=null,$selected=null)
{
$indexes=array_keys($headers);
$idname = $indexes[0];
$count=0;
$tr_class=($num%2)?' class="row1" ':' class="row2" ';
echo "\n".'
';
foreach ($indexes as $index)
{
$row[$index]=clean_out($row[$index]);
if ($type!='simple'&&$count==0)
{
$id=preg_replace('/[^[:alnum:]]/', '', $index).$row[$index];
if ($type=='checkbox'||$type=='checkbox-small')
{
echo "\n".'
';
}
/**
* Determine current sort order.
*/
function get_order()
{
return ($_GET['order']=='ASC')?'DESC':'ASC';
}
/**
* Determine whether or not list is currently sorted.
* @param string $method which http method to check for sort information
* @return mixed cleaned orderby clause based on saved sort information or null if no orderby is set in the defined method
*/
function get_orderby($method='get')
{
if ( $method=='get' && !empty($_GET['sort']) && !empty($_GET['order']) )
{
$sort=clean_in($_GET['sort']);
$order=clean_in($_GET['order']);
return " ORDER BY $sort $order ";
}
elseif ( $method=='post' && !empty($_POST['sort']) && !empty($_POST['order']) )
{
$sort=clean_in($_POST['sort']);
$order=clean_in($_POST['order']);
return " ORDER BY $sort $order ";
}
elseif ( $method=='session' && !empty($_SESSION['sort']) && !empty($_SESSION['order']) )
{
$sort=clean_in($_SESSION['sort']);
$order=clean_in($_SESSION['order']);
return " ORDER BY $sort $order ";
}
else return null;
}