Просмотр файла www/admin/currs/currencies.php

Размер файла: 2.84Kb
<?
define("ADMIN_AUTHORIZATION",1);
include("../../../includes/common.php");


/*PAGE TITLE*/
$page_title = "Список мировых валют";

$header = "Список мировых валют";

$table = "currencies";
/* pager start */
$params['tables'] = $table;
$params['nocheckfield']=true;
$params['s_prefix'] = $table;
$pager = GetPagerParams($params);
/* pager end */

$group_funcs_options=("<option >Выберите действие<option value='./action.php?action=delete_curr'> - Удалить</option>");

$table_headers = Array(
	"itter"=>Array("№","width=20 align=center"),
	"c_img"=>Array("",""),
	"id"=>Array("<a href='".$pager['new_sort']."$table".".id' title='Sort'>ID</a>","align=center width=5px"),
	"name"=>Array("<a href='".$pager['new_sort']."$table".".name' title='Sort'>Название</a>",""),
	"code"=>Array("<a href='".$pager['new_sort']."$table".".code' title='Sort'>Код</a>",""),
	"country"=>Array("<a href='".$pager['new_sort']."$table".".country' title='Sort'>Страна</a>",""),
	"funcs"=>Array("Операции","width=5% align=center"),
	"group_funcs"=>Array("<select name=act_sel onChange='SubmitForm();'><option>Выберите действие<option value='./action.php?action=delete_curr'>-Удалить</select>"));

$query = "
	SELECT $table.*, countries.name_rus as country
	FROM $table
	LEFT OUTER JOIN countries ON countries.id=$table.country_id
	".
	($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);
$table_items=Array();
$itter =$pager['start_item'];
$i=0;

while ($row = mysql_fetch_object($res)){
	if(file_exists($_SERVER["DOCUMENT_ROOT"].$COUNTRY_IMG_PATH."/$row->country_id.gif")){
		$c_img = "<img src='$COUNTRY_IMG_PATH/$row->country_id.gif'>";
	}
	else{
		$c_img = "&nbsp;";
	}
	
	$table_items[$itter] = Array(
		"itter"=>array($itter,"align=center"),
		"id"=>Array($row->id,"align=center"),
		"c_img"=>Array($c_img,"align=center"),
		"name"=>Array($row->name),
		"code"=>Array($row->code, ""),
		"country"=>array($row->country, ""),
		"funcs"=>Array("<nobr><a href='./add_curr.php?id=$row->id' title='Редактировать'>$ADMIN_ICONS[edit]</a>&nbsp;<a href='#' onClick=\"if(confirm('Удалить??')){document.location.href='./action.php?action=delete_curr&id=$row->id';}return false;\" title='Удалить'>$ADMIN_ICONS[del]</a></nobr>","align=center")
		);
	$itter++;
}

$smarty->assign('page_title', $page_title);

$smarty->assign('error',$error);

/* 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_cources_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');
?>