PageRenderTime 40ms CodeModel.GetById 28ms app.highlight 5ms RepoModel.GetById 2ms app.codeStats 0ms

/admin/current-commissions.php

https://github.com/intelliants/elitius
PHP | 131 lines | 97 code | 15 blank | 19 comment | 4 complexity | 3db2c2c4ef9ffdccbd43ae1c3f14e7df MD5 | raw file
  1<?php
  2/***************************************************************************
  3 *
  4 *	 PROJECT: eLitius Open Source Affiliate Software
  5 *	 VERSION: 1.0
  6 *	 LISENSE: GNU GPL (http://www.opensource.org/licenses/gpl-license.html)
  7 *
  8 *   This program is free software; you can redistribute it and/or modify
  9 *   it under the terms of the GNU General Public License as published by
 10 *   the Free Software Foundation.
 11 *
 12 *   Link to eLitius.com can not be removed from the software pages without
 13 *	 permission of the eLitius respective owners. It is the only requirement
 14 *	 for using this software.
 15 *
 16 *   Copyright 2009 Intelliants LLC
 17 *   http://www.intelliants.com/
 18 *
 19 ***************************************************************************/
 20
 21require_once('./init.php');
 22$gDesc = $gXpLang['current_commissions'];
 23$gPage = $gXpLang['current_commissions'];
 24$gPath = 'current-commissions';
 25require_once('header.php');
 26
 27$items = (int)$_GET['items'];
 28$items = $items ? $items : 5 ;
 29
 30define(ITEMS_PER_PAGE, $items);
 31
 32$page = (int)$_GET['page'];
 33$page = ($page < 1) ? 1 : $page;
 34$start = ($page - 1) * ITEMS_PER_PAGE;
 35
 36$suser = addslashes(htmlentities(strip_tags($_GET['su'])));
 37
 38$accounts =& $gXpAdmin->getApprovedAccounts($start, ITEMS_PER_PAGE, 0, $suser);
 39$accounts_num = count($gXpAdmin->getApprovedAccounts(0, 0, 0));
 40?>
 41
 42<br />
 43
 44		<form action="manage-commissions.php" method="post" name="adminForm">
 45
 46			<table class="adminlist">
 47				<tr>
 48					<th style="border-bottom: 1px solid #fff;"></th>
 49					<th style="border-bottom: 1px solid #fff;" colspan="5">
 50						Filter Username: 
 51						<input id="search_user" type="text" name="user" value="<?php echo $suser;?>" style="margin:0" /> 
 52						<input type="button" value="Search" onclick="setAction();" />
 53					</th>
 54					
 55				</tr>
 56				<tr>
 57					<th width="20">ID</th>
 58					<th align="left" nowrap><?php echo $gXpLang['username']; ?></th>
 59					<th width="10%" nowrap><?php echo $gXpLang['approved']; ?></th>
 60					<th width="11%" nowrap><?php echo $gXpLang['non_approved']; ?></th>
 61					<th width="11%" nowrap><?php echo $gXpLang['total']; ?></th>
 62					<th width="11%" nowrap></th>
 63				</tr>
 64<?php
 65	for($i=0; $i<count($accounts); $i++)
 66	{
 67		$approved = $gXpAdmin->getApprovedCommissionSum($accounts[$i]['id'])*$gXpConfig['payout_percent']/100;
 68		$approval = $gXpAdmin->getApprovalCommissionSum($accounts[$i]['id'])*$gXpConfig['payout_percent']/100;
 69?>	
 70				<tr class="row<?php echo ($i%2) ? '0' : '1' ;?>">
 71					<td><?php echo $accounts[$i]['id'];?></td>
 72					<td><a href="manage-account.php?id=<?php echo $accounts[$i]['id'];?>" title="<?php  echo $gXpLang['view_details']; ?>"><?php echo $accounts[$i]['username'];?></a></td>
 73					<td><?php echo $approved;?></td>
 74					<td><?php echo $approval;?></td>
 75					<td><?php echo $approved + $approval;?></td>
 76					<td><a href="commissions.php?user=<?php echo $accounts[$i]['id']; ?>&mg=3"><?php echo $gXpLang['small_view_details']; ?></a></td>
 77				</tr>
 78<?php
 79	}
 80	if(count($accounts)==0)
 81	{ ?>
 82		<tr class="row0">
 83			<td colspan="6" align="center">No Items</td>
 84		</tr>
 85	<?php
 86	}
 87?>
 88			</table>
 89			
 90			<input type="hidden" name="task" value="" />
 91		</form>
 92
 93		<div style="height: 30px;"></div>
 94<?php
 95	$url = "current-commissions.php?items=".ITEMS_PER_PAGE;
 96	navigation($accounts_num, $start, count($accounts), $url, ITEMS_PER_PAGE);
 97
 98?>
 99<script type="text/javascript">
100function setAction()
101{
102	var suser = $("#search_user").val();
103	var link = 'current-commissions.php';
104	link += suser? "?su="+suser :"";
105	document.location.href = link;
106}
107$(document).ready(function(){
108	jQuery.fn.enterEscape = function()
109	{
110		this.keypress(
111		function(e)
112		{
113			// get key pressed (charCode from Mozilla/Firefox and Opera / keyCode in IE)
114			var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
115			
116			if(key == 13)
117			{
118				setAction();
119				return false;
120			}
121		});
122		return this;
123	}
124	$(document).enterEscape();
125});
126</script>
127	<!--main part ends-->
128	
129<?php
130require_once('footer.php');	
131?>