Adding No Fee option to admin panel
Admins can disable a users fee via admin panel now. Fixes #260
This commit is contained in:
parent
3cfef93580
commit
63b942a7e1
@ -224,6 +224,7 @@ class Statistics {
|
||||
a.id AS id,
|
||||
a.is_admin as is_admin,
|
||||
a.is_locked as is_locked,
|
||||
a.no_fees as no_fees,
|
||||
a.username AS username,
|
||||
a.donate_percent AS donate_percent,
|
||||
a.email AS email,
|
||||
|
||||
@ -43,6 +43,9 @@ class User {
|
||||
public function getUserEmail($username) {
|
||||
return $this->getSingle($username, 'email', 'username', 's');
|
||||
}
|
||||
public function getUserNoFee($id) {
|
||||
return $this->getSingle($id, 'no_fees', 'id');
|
||||
}
|
||||
public function getUserAdmin($id) {
|
||||
return $this->getSingle($id, 'is_admin', 'id');
|
||||
}
|
||||
@ -58,12 +61,19 @@ class User {
|
||||
public function getUserFailed($id) {
|
||||
return $this->getSingle($id, 'failed_logins', 'id');
|
||||
}
|
||||
public function isNoFee($id) {
|
||||
return $this->getUserNoFee($id);
|
||||
}
|
||||
public function isLocked($id) {
|
||||
return $this->getUserLocked($id);
|
||||
}
|
||||
public function isAdmin($id) {
|
||||
return $this->getUserAdmin($id);
|
||||
}
|
||||
public function changeNoFee($id) {
|
||||
$field = array('name' => 'no_fees', 'type' => 'i', 'value' => !$this->isNoFee($id));
|
||||
return $this->updateSingle($id, $field);
|
||||
}
|
||||
public function changeLocked($id) {
|
||||
$field = array('name' => 'is_locked', 'type' => 'i', 'value' => !$this->isLocked($id));
|
||||
return $this->updateSingle($id, $field);
|
||||
|
||||
@ -11,16 +11,19 @@ if (!$user->isAuthenticated() || !$user->isAdmin($_SESSION['USERDATA']['id'])) {
|
||||
|
||||
$aRoundShares = $statistics->getRoundShares();
|
||||
|
||||
// Change account lock
|
||||
if (@$_POST['do'] == 'lock') {
|
||||
switch (@$_POST['do']) {
|
||||
case 'lock':
|
||||
$supress_master = 1;
|
||||
$user->changeLocked($_POST['account_id']);
|
||||
}
|
||||
|
||||
// Change account admin
|
||||
if (@$_POST['do'] == 'admin') {
|
||||
break;
|
||||
case 'fee':
|
||||
$supress_master = 1;
|
||||
$user->changeNoFee($_POST['account_id']);
|
||||
break;
|
||||
case 'admin':
|
||||
$supress_master = 1;
|
||||
$user->changeAdmin($_POST['account_id']);
|
||||
break;
|
||||
}
|
||||
|
||||
if (@$_POST['query']) {
|
||||
|
||||
@ -1,4 +1,11 @@
|
||||
<script language="javascript">
|
||||
function storeFee(id) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "{$smarty.server.PHP_SELF}",
|
||||
data: "page={$smarty.request.page}&action={$smarty.request.action}&do=fee&account_id=" + id,
|
||||
});
|
||||
}
|
||||
function storeLock(id) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
@ -41,6 +48,7 @@
|
||||
<th class="right">Balance </th>
|
||||
<th class="center">Admin</th>
|
||||
<th class="center">Locked</th>
|
||||
<th class="center">No Fees</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -65,6 +73,11 @@
|
||||
<input type="checkbox" onclick="storeLock({$USERS[user].id})" name="locked[{$USERS[user].id}]" value="1" id="locked[{$USERS[user].id}]" {if $USERS[user].is_locked}checked{/if} />
|
||||
<label for="locked[{$USERS[user].id}]"></label>
|
||||
</td>
|
||||
<td class="center">
|
||||
<input type="hidden" name="nofee[{$USERS[user].id}]" value="0"/>
|
||||
<input type="checkbox" onclick="storeFee({$USERS[user].id})" name="nofee[{$USERS[user].id}]" value="1" id="nofee[{$USERS[user].id}]" {if $USERS[user].no_fees}checked{/if} />
|
||||
<label for="nofee[{$USERS[user].id}]"></label>
|
||||
</td>
|
||||
</tr>
|
||||
{sectionelse}
|
||||
<tr>
|
||||
@ -85,6 +98,7 @@
|
||||
<th class="right">Balance </th>
|
||||
<th class="center">Admin</th>
|
||||
<th class="center">Locked</th>
|
||||
<th class="center">No Fees</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user