File size: 2.48Kb
<?
define("ADMIN_AUTHORIZATION",1);
include("../../../includes/common.php");
/*PAGE TITLE*/
$page_title = "Шаблоны писем";
$header = "E-mail шаблоны";
$table = "email_tpl";
/* pager start */
$params['tables'] = $table;
$params['s_prefix'] = "mail_tpls";
$pager = GetPagerParams($params);
/* pager end */
/*
$group_funcs_options=("<option >Select action<option value='./mail_action.php?action=delete'> - Delete</option>
");
*/
$table_headers = Array(
"itter"=>Array("№","width=20 align=center"),
"name"=>Array("<a href='".$pager['new_sort']."$table".".name' title='Sort'>Название</a>",""),
"code"=>Array("<a href='".$pager['new_sort']."$table".".code' title='Sort'>Код</a>","align=center"),
"format"=>Array("<a href='".$pager['new_sort']."$table".".format' title='Sort'>Формат</a>","width=40 align=center"),
"funcs"=>Array("Операции","width=5% align=center"));
/*
if ($group_funcs_options) {
$table_headers["group_funcs"]=Array("<select name=act_sel onChange='SubmitForm();'>
$group_funcs_options
</select>");
}
*/
$table_items = Array();
$query = "
select
* from $table".
($search_string?" where $search_string":"")
." ORDER BY ".$pager['sort_by']." ".$pager['sort_ord']
." LIMIT ".$SETTINGS['admin_items_per_page']." OFFSET ".($pager['start_item']-1);
$res = mysql_query($query);
//echo $query;
$itter =$pager['start_item'];
$i=0;
while ($row = mysql_fetch_object($res)){
$table_items[$i++] = Array(
"id"=>Array($row->id,"align=center"),
"itter"=>Array($itter,"align=center"),
"name"=>Array(stripslashes($row->name)),
"code"=>Array($row->code,"align=center"),
"format"=>Array(strtoupper($row->format), "align=center"),
"funcs"=>Array("<nobr><a href='./mail_add.php?id=$row->id' title='Edit'>$ADMIN_ICONS[edit]</a> <a href='#' onClick=\"if(confirm('Удалить?')){document.location.href='./mail_action.php?action=delete&id=$row->id';}return false;\" title='Delete'>$ADMIN_ICONS[del]</a></nobr>","align=center"));
$itter++;
}
/* table template */
$smarty->assign('pager',$pager);
$smarty->assign('table_headers',$table_headers);
$smarty->assign('table_items',$table_items);
$smarty->assign('table_width',"100%");
$smarty->assign('top_menu_tpl',"admin_settings_menu.tpl");
$smarty->assign('main_tpl',"admin_list_table.tpl");
$smarty->assign('use_group_funcs',array_key_exists("group_funcs",$table_headers));
/* display content */
$smarty->display('admin_index.tpl');
?>