<?php
// EMAILS PAGING
$email_smarty = new yesSmarty;
$id = xtc_db_input($_GET['id']);

$pager = new ADODB_Pager($conn,sprintf("SELECT emails_id,date_saved,subject,concat(from_email,' ',from_name) as from_string FROM %s",TABLE_EMAILS ));
$pager->whereConditions = array(
	"customers_id='$id'"
);
$pager->orderbyDefault = array(
	'date_saved DESC'
);

$pager->index_field = 'emails_id';
$pager->hide_columns(array('emails_id'));
$pager->set_in_div('snippet_emails');

$pager->get_row_selector = 'eID';
$pager->gridHeader = array(TEXT_DATE_CREATED,TEXT_SUBJECT,TEXT_SENDER,TEXT_SUBJECT);

// KEINE AJAX BOX
$pager->pager_tab_file = false;
// KEINE JAVASCRIPT ROW-ACTION
$pager->javascript_row_click_action = true;

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

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

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

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