columns[] = $column;
return $this;
}
/// Sets the images to use for indicating sort methods.
/**
* \param $sort_asc_image the image to use for ascending sort
* \param $sort_desc_image the image to use for descending sort
* \return the current instance
*/
public function SetSortImages($sort_asc_image, $sort_desc_image)
{
$this->sort_asc_image = $sort_asc_image;
$this->sort_desc_image = $sort_desc_image;
return $this;
}
/// Generates the table and returns the HTML for the table.
/**
* \param $current_sort the current sort method (null if none)
* \param $current_order the current ordering (null if none)
* \return the HTML for the table
*/
public function GetHTML($current_sort=null, $current_order=null)
{
$table_data = '
';
// Loop through the columns, generating the table header
foreach($this->columns as $column)
{
// Determine whether we need to display a sort image
$sort_html = '';
if($current_sort !== null &&
$current_sort === $column->GetSort() &&
$this->sort_asc_image !== null &&
$this->sort_desc_image !== null)
{
if($current_order !== null && $current_order == 'asc')
$sort_html = "";
else
$sort_html = "";
}
$table_data .= $column->GetHeaderHTML($sort_html);
}
// End the header row
$table_data .= '
';
// Call Fetch() on the response object, retrieving the items
while($item = $this->response->Fetch($this->fetch_pages))
{
$table_data .= '
';
return $table_data;
}
/// Generates a <select> element containing the sorting methods available.
/**
* \param $id the value to be used for the ID and NAME attribute
* \param $current_selection the currently selected value (or an empty string if none)
* \return the HTML for the <select>
*
* Note: the list of available sorting methods is pulled from the data provided
* to AddColumn.
*/
public function GetSortHTML($id, $current_selection='')
{
$select_data = "';
return $select_data;
}
/// Generates a <select> element containing the available sort orders.
/**
* \param $id the value to be used for the ID and NAME attribute
* \param $current_selection the currently selected value (or an empty string if none)
* \return the HTML for the <select>
*
* Note: the list of currently accepted sorting orders is ascending and descending.
*/
public function GetOrderHTML($id, $current_selection='')
{
$select_data = "';
return $select_data;
}
}
endif;