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.id AS id,
|
||||||
a.is_admin as is_admin,
|
a.is_admin as is_admin,
|
||||||
a.is_locked as is_locked,
|
a.is_locked as is_locked,
|
||||||
|
a.no_fees as no_fees,
|
||||||
a.username AS username,
|
a.username AS username,
|
||||||
a.donate_percent AS donate_percent,
|
a.donate_percent AS donate_percent,
|
||||||
a.email AS email,
|
a.email AS email,
|
||||||
|
|||||||
@ -43,6 +43,9 @@ class User {
|
|||||||
public function getUserEmail($username) {
|
public function getUserEmail($username) {
|
||||||
return $this->getSingle($username, 'email', 'username', 's');
|
return $this->getSingle($username, 'email', 'username', 's');
|
||||||
}
|
}
|
||||||
|
public function getUserNoFee($id) {
|
||||||
|
return $this->getSingle($id, 'no_fees', 'id');
|
||||||
|
}
|
||||||
public function getUserAdmin($id) {
|
public function getUserAdmin($id) {
|
||||||
return $this->getSingle($id, 'is_admin', 'id');
|
return $this->getSingle($id, 'is_admin', 'id');
|
||||||
}
|
}
|
||||||
@ -58,12 +61,19 @@ class User {
|
|||||||
public function getUserFailed($id) {
|
public function getUserFailed($id) {
|
||||||
return $this->getSingle($id, 'failed_logins', 'id');
|
return $this->getSingle($id, 'failed_logins', 'id');
|
||||||
}
|
}
|
||||||
|
public function isNoFee($id) {
|
||||||
|
return $this->getUserNoFee($id);
|
||||||
|
}
|
||||||
public function isLocked($id) {
|
public function isLocked($id) {
|
||||||
return $this->getUserLocked($id);
|
return $this->getUserLocked($id);
|
||||||
}
|
}
|
||||||
public function isAdmin($id) {
|
public function isAdmin($id) {
|
||||||
return $this->getUserAdmin($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) {
|
public function changeLocked($id) {
|
||||||
$field = array('name' => 'is_locked', 'type' => 'i', 'value' => !$this->isLocked($id));
|
$field = array('name' => 'is_locked', 'type' => 'i', 'value' => !$this->isLocked($id));
|
||||||
return $this->updateSingle($id, $field);
|
return $this->updateSingle($id, $field);
|
||||||
|
|||||||
@ -11,16 +11,19 @@ if (!$user->isAuthenticated() || !$user->isAdmin($_SESSION['USERDATA']['id'])) {
|
|||||||
|
|
||||||
$aRoundShares = $statistics->getRoundShares();
|
$aRoundShares = $statistics->getRoundShares();
|
||||||
|
|
||||||
// Change account lock
|
switch (@$_POST['do']) {
|
||||||
if (@$_POST['do'] == 'lock') {
|
case 'lock':
|
||||||
$supress_master = 1;
|
$supress_master = 1;
|
||||||
$user->changeLocked($_POST['account_id']);
|
$user->changeLocked($_POST['account_id']);
|
||||||
}
|
break;
|
||||||
|
case 'fee':
|
||||||
// Change account admin
|
$supress_master = 1;
|
||||||
if (@$_POST['do'] == 'admin') {
|
$user->changeNoFee($_POST['account_id']);
|
||||||
|
break;
|
||||||
|
case 'admin':
|
||||||
$supress_master = 1;
|
$supress_master = 1;
|
||||||
$user->changeAdmin($_POST['account_id']);
|
$user->changeAdmin($_POST['account_id']);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (@$_POST['query']) {
|
if (@$_POST['query']) {
|
||||||
|
|||||||
@ -1,4 +1,11 @@
|
|||||||
<script language="javascript">
|
<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) {
|
function storeLock(id) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
@ -41,6 +48,7 @@
|
|||||||
<th class="right">Balance </th>
|
<th class="right">Balance </th>
|
||||||
<th class="center">Admin</th>
|
<th class="center">Admin</th>
|
||||||
<th class="center">Locked</th>
|
<th class="center">Locked</th>
|
||||||
|
<th class="center">No Fees</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<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} />
|
<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>
|
<label for="locked[{$USERS[user].id}]"></label>
|
||||||
</td>
|
</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>
|
</tr>
|
||||||
{sectionelse}
|
{sectionelse}
|
||||||
<tr>
|
<tr>
|
||||||
@ -85,6 +98,7 @@
|
|||||||
<th class="right">Balance </th>
|
<th class="right">Balance </th>
|
||||||
<th class="center">Admin</th>
|
<th class="center">Admin</th>
|
||||||
<th class="center">Locked</th>
|
<th class="center">Locked</th>
|
||||||
|
<th class="center">No Fees</th>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user