View file www/admin/partners/index.php

File size: 3.71Kb
<?
define("ADMIN_AUTHORIZATION",1);
include("../../../includes/common.php");


/*PAGE TITLE*/
$page_title = "Список партнеров";

$header = "Список партнеров";

$table = "partners";
/* 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'> - Удалить</option>
                      <option value='./action.php?action=activate'> - Активировать</option>
                      <option value='./action.php?action=unactivate'> - Деактивировать</option>");

$table_headers = Array(
	"itter"=>Array("№","width=20 align=center"),
	"id"=>Array("<a href='".$pager['new_sort']."$table".".id' title='Sort'>ID</a>",""),
	"login"=>Array("<a href='".$pager['new_sort']."$table".".login' title='Sort'>Логин</a>",""),
	"email"=>Array("<a href='".$pager['new_sort']."$table".".email' title='Sort'>E-mail</a>",""),
	"site_url"=>Array("<a href='".$pager['new_sort']."$table".".site_url' title='Sort'>Сайт</a>",""),
	"regdate"=>Array("<a href='".$pager['new_sort']."$table".".regdate' title='Sort'><nobr>Дата регистрации</a>",""),
	"status"=>Array("<a href='".$pager['new_sort']."$table".".status' title='Sort'>Статус</a>",""),
	"payout_perc"=>Array("<a href='".$pager['new_sort']."$table".".payout_perc' title='Sort'>Комиссия</a>",""),
	"amount"=>Array("<a href='".$pager['new_sort']."$table".".amount' 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'>-Удалить<option value='./action.php?action=activate'>-Активировать<option value='./action.php?action=unactivate'>-Деактивировать</select>"));

$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);
$table_items=Array();
$itter =$pager['start_item'];
$i=0;

while ($row = mysql_fetch_object($res)){
	switch($row->status){
		case 0:
			$s= $ADMIN_ICONS[status_off];
		break;
		case 1:
			$s= $ADMIN_ICONS[status_on];
		break;
	}
	$table_items[$itter] = Array(
		"itter"=>Array($itter,"align=center"),
		"id"=>Array($row->id,"align=center"),
		"login"=>array("<a target=\"blank\" title=\"Войти в личный кабинет партнера\" href=\"/admin/loginaspartner.php?partner_id=$row->id\">".stripslashes($row->login)."</a>","align=center"),
		"email"=>Array("<a href=\"mailto:$row->email\">$row->email</a>"),
		"site_url"=>Array("<a href=\"$row->site_url\">$row->site_url</a>", ""),
		"regdate"=>Array(strftime("%d %b %y"), ""),
		"status"=>array($s, "align=center"),
		"payout_perc"=>Array(100*$row->payout_perc."%", "align=center"),
		"amount"=>Array($row->amount."$", "align=center"),
		"funcs"=>Array("<nobr><a href='./add.php?id=$row->id' title='Редактировать'>$ADMIN_ICONS[edit]</a>&nbsp;<a href='#' onClick=\"if(confirm('Удалить??')){document.location.href='./action.php?action=delete&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_partners_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');
?>