<?php
// exports PAGING
function _convert_html($text){
	return html_entity_decode($text);
}

function _get_export_link($id){
	$number = yes_get_export_number_from_exports_id($id);
	return yes_draw_href_text($number,xtc_href_link(FILENAME_EXPORTS,'action=overview&id='.$id),'exports','','');
}

$exports_smarty = new yesSmarty;

$class_id = xtc_db_input($_GET['id']);

$query_raw = sprintf("SELECT et.exports_id,et.invoice_recipient_name,et.eta,et.ets FROM %s e LEFT JOIN %s et USING(exports_id) LEFT JOIN %s etis USING(export_targets_id) WHERE et.ships_id='%s' ORDER BY e.date_added DESC",TABLE_EXPORTS,TABLE_EXPORT_TARGETS,TABLE_EXPORT_TARGET_IMPORT_SHIPS,$class_id );
$pager = new ADODB_Pager($conn,$query_raw);
$pager->index_field = 'exports_id';
//$pager->hide_columns(array('history_id'));
$pager->set_in_div('snippet_exports');

$pager->get_row_selector = 'iID';
$pager->gridHeader = array(ENTRY_EXPORT_NUMBER,ENTRY_INVOICE_RECIPIENT,ENTRY_ETA,ENTRY_ETS);
$pager->gridHelper = array(
	'exports_id'=>'_get_export_link'
);

// 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');
$exports_smarty->assign('HEADER',$pager->getHeader());

$grid_smarty->assign('grid',$pager->getGrid());

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

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

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