forked from kevinowino869/mitrobill
View User
This commit is contained in:
@ -31,4 +31,22 @@ class Lang
|
||||
return $phone;
|
||||
}
|
||||
}
|
||||
|
||||
public static function dateFormat($date){
|
||||
global $config;
|
||||
return date($config['date_format'], strtotime($date));
|
||||
}
|
||||
|
||||
public static function dateTimeFormat($date){
|
||||
global $config;
|
||||
return date($config['date_format']. ' H:i', strtotime($date));
|
||||
}
|
||||
|
||||
public static function nl2br($text){
|
||||
return nl2br($text);
|
||||
}
|
||||
|
||||
public static function arrayCount($arr){
|
||||
return count($arr);
|
||||
}
|
||||
}
|
||||
|
@ -25,17 +25,17 @@ switch ($action) {
|
||||
$ui->assign('xfooter', '<script type="text/javascript" src="ui/lib/c/customers.js"></script>');
|
||||
$search = _post('search');
|
||||
$what = _post('what');
|
||||
if(!in_array($what,['username','fullname','phonenumber','email'])){
|
||||
if (!in_array($what, ['username', 'fullname', 'phonenumber', 'email'])) {
|
||||
$what = 'username';
|
||||
}
|
||||
run_hook('list_customers'); #HOOK
|
||||
if ($search != '') {
|
||||
$paginator = Paginator::bootstrap('tbl_customers', 'username', '%' . $search . '%');
|
||||
$d = ORM::for_table('tbl_customers')
|
||||
->where_like($what, '%' . $search . '%')
|
||||
->offset($paginator['startpoint'])
|
||||
->limit($paginator['limit'])
|
||||
->order_by_desc('id')->find_many();
|
||||
->where_like($what, '%' . $search . '%')
|
||||
->offset($paginator['startpoint'])
|
||||
->limit($paginator['limit'])
|
||||
->order_by_desc('id')->find_many();
|
||||
} else {
|
||||
$paginator = Paginator::bootstrap('tbl_customers');
|
||||
$d = ORM::for_table('tbl_customers')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many();
|
||||
@ -53,6 +53,42 @@ switch ($action) {
|
||||
$ui->display('customers-add.tpl');
|
||||
break;
|
||||
|
||||
case 'view':
|
||||
$id = $routes['2'];
|
||||
run_hook('view_customer'); #HOOK
|
||||
$customer = ORM::for_table('tbl_customers')->find_one($id);
|
||||
if ($customer) {
|
||||
$v = $routes['3'];
|
||||
if (empty($v) || $v == 'order') {
|
||||
$v = 'order';
|
||||
// $paginator = Paginator::bootstrap('tbl_payment_gateway', 'username', $customer['username']);
|
||||
// print_r($paginator);
|
||||
$order = ORM::for_table('tbl_payment_gateway')
|
||||
->where('username', $customer['username'])
|
||||
->offset(0)
|
||||
->limit(30)
|
||||
->order_by_desc('id')
|
||||
->find_many();
|
||||
// $ui->assign('paginator', $paginator);
|
||||
$ui->assign('order', $order);
|
||||
}else if($v=='activation'){
|
||||
// $paginator = Paginator::bootstrap('tbl_transactions', 'username', $customer['username']);
|
||||
$activation = ORM::for_table('tbl_transactions')
|
||||
->where('username', $customer['username'])
|
||||
->offset(0)
|
||||
->limit(30)
|
||||
->order_by_desc('id')
|
||||
->find_many();
|
||||
// $ui->assign('paginator', $paginator);
|
||||
$ui->assign('activation', $activation);
|
||||
}
|
||||
$ui->assign('v', $v);
|
||||
$ui->assign('d', $customer);
|
||||
$ui->display('customers-view.tpl');
|
||||
} else {
|
||||
r2(U . 'customers/list', 'e', $_L['Account_Not_Found']);
|
||||
}
|
||||
break;
|
||||
case 'edit':
|
||||
$id = $routes['2'];
|
||||
run_hook('edit_customer'); #HOOK
|
||||
@ -74,22 +110,22 @@ switch ($action) {
|
||||
if ($c) {
|
||||
$mikrotik = Mikrotik::info($c['routers']);
|
||||
if ($c['type'] == 'Hotspot') {
|
||||
if(!$config['radius_mode']){
|
||||
if (!$config['radius_mode']) {
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::removeHotspotUser($client,$c['username']);
|
||||
Mikrotik::removeHotspotActiveUser($client,$c['username']);
|
||||
Mikrotik::removeHotspotUser($client, $c['username']);
|
||||
Mikrotik::removeHotspotActiveUser($client, $c['username']);
|
||||
}
|
||||
} else {
|
||||
if(!$config['radius_mode']){
|
||||
if (!$config['radius_mode']) {
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::removePpoeUser($client,$c['username']);
|
||||
Mikrotik::removePpoeActive($client,$c['username']);
|
||||
Mikrotik::removePpoeUser($client, $c['username']);
|
||||
Mikrotik::removePpoeActive($client, $c['username']);
|
||||
}
|
||||
}
|
||||
try {
|
||||
$d->delete();
|
||||
} catch (Exception $e) {
|
||||
} catch(Throwable $e){
|
||||
} catch (Throwable $e) {
|
||||
}
|
||||
try {
|
||||
$c->delete();
|
||||
@ -99,12 +135,12 @@ switch ($action) {
|
||||
try {
|
||||
$d->delete();
|
||||
} catch (Exception $e) {
|
||||
} catch(Throwable $e){
|
||||
} catch (Throwable $e) {
|
||||
}
|
||||
try {
|
||||
$c->delete();
|
||||
} catch (Exception $e) {
|
||||
} catch(Throwable $e){
|
||||
} catch (Throwable $e) {
|
||||
}
|
||||
}
|
||||
|
||||
@ -193,23 +229,23 @@ switch ($action) {
|
||||
if ($c) {
|
||||
$mikrotik = Mikrotik::info($c['routers']);
|
||||
if ($c['type'] == 'Hotspot') {
|
||||
if(!$config['radius_mode']){
|
||||
if (!$config['radius_mode']) {
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
Mikrotik::setHotspotUser($client,$c['username'],$password);
|
||||
Mikrotik::removeHotspotActiveUser($client,$user['username']);
|
||||
Mikrotik::setHotspotUser($client, $c['username'], $password);
|
||||
Mikrotik::removeHotspotActiveUser($client, $user['username']);
|
||||
}
|
||||
|
||||
$d->password = $password;
|
||||
$d->save();
|
||||
} else {
|
||||
if(!$config['radius_mode']){
|
||||
if (!$config['radius_mode']) {
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
if(!empty($d['pppoe_password'])){
|
||||
if (!empty($d['pppoe_password'])) {
|
||||
Mikrotik::setPpoeUser($client, $c['username'], $d['pppoe_password']);
|
||||
}else{
|
||||
} else {
|
||||
Mikrotik::setPpoeUser($client, $c['username'], $password);
|
||||
}
|
||||
Mikrotik::removePpoeActive($client,$user['username']);
|
||||
Mikrotik::removePpoeActive($client, $user['username']);
|
||||
}
|
||||
|
||||
$d->password = $password;
|
||||
@ -244,5 +280,5 @@ switch ($action) {
|
||||
break;
|
||||
|
||||
default:
|
||||
r2(U . 'customers/list', 'e', 'action not defined');
|
||||
r2(U . 'customers/list', 'e', 'action not defined');
|
||||
}
|
||||
|
@ -368,3 +368,9 @@ $_L['Invoice_Footer'] = 'Invoice Footer';
|
||||
$_L['Pay_With_Balance'] = 'Pay With Balance';
|
||||
$_L['Pay_this_with_Balance_your_active_package_will_be_overwrite'] = 'Pay this with Balance? your active package will be overwrite';
|
||||
$_L['Success_to_buy_package'] = 'Success to buy package';
|
||||
$_L['Auto_Renewal'] = 'Auto Renewal';
|
||||
$_L['View'] = 'View';
|
||||
$_L['View'] = 'View';
|
||||
$_L['View'] = 'View';
|
||||
$_L['View'] = 'View';
|
||||
$_L['View'] = 'View';
|
||||
|
Reference in New Issue
Block a user