<?php
// HISTORY PAGING

function _convert_html($text){
	return html_entity_decode($text);
}

$history_smarty = new yesSmarty;

$class = xtc_db_input($_GET['class']);
if(!xtc_not_null($class))
	die('MISSING PARAMETER: class');
$class_id = xtc_db_input($_GET['id']);

$class_id_sql = '';
if(xtc_not_null($class_id))
 	$class_id_sql = " and class_id='".$class_id."' ";
$query_raw = sprintf("SELECT history_id,date_added,customers_id,message FROM %s WHERE class='%s' %s ORDER BY date_added DESC",TABLE_HISTORY,$class,$class_id_sql );
$pager = new ADODB_Pager($conn,$query_raw);
$pager->index_field = 'history_id';
$pager->hide_columns(array('history_id'));
$pager->set_in_div('snippet_history');

$pager->get_row_selector = 'hID';
$pager->gridHeader = array(TEXT_DATE_CREATED,TEXT_EDITOR,TEXT_COMMENTS);
$pager->gridHelper = array(
	'customers_id'=>'xtc_get_editor_name',
	'message'=>'_convert_html'
);
// KEINE AJAX BOX
$pager->pager_tab_file = false;
// KEINE JAVASCRIPT ROW-ACTION
$pager->javascript_row_click_action = false;

$pager->Render($rows_per_page=MAX_DISPLAY_SEARCH_RESULTS_ADMIN);

$selected_item = $pager->selected_row;

$grid_smarty = new yesSmarty;
$grid_smarty->assign('grid',$pager->getGrid());
$grid = $grid_smarty->fetch(DIR_FS_ADMIN.'templates/pager_grid.tpl');
$history_smarty->assign('HEADER',$pager->getHeader());

$grid_smarty->assign('grid',$pager->getGrid());
$grid = $grid_smarty->fetch(DIR_FS_ADMIN.'templates/pager_grid.tpl');

$history_smarty->assign('GRID',$grid);
$history_smarty->assign('FOOTER',$pager->getFooter());

header('Content-Type: text/html; charset=iso-8859-1');
echo $history_smarty->fetch(DIR_FS_ADMIN.'templates/pager.tpl');
