diff --git a/system/autoload/Paginator.php b/system/autoload/Paginator.php
index 97553cd8..cb6e4b92 100644
--- a/system/autoload/Paginator.php
+++ b/system/autoload/Paginator.php
@@ -1,28 +1,29 @@
where($w1,$c1)->count();
- }elseif($w2 != ''){
- $totalReq = ORM::for_table($table)->where($w1,$c1)->where($w2,$c2)->count();
- }elseif($w3 != ''){
- $totalReq = ORM::for_table($table)->where($w1,$c1)->where($w2,$c2)->where($w3,$c3)->count();
- }elseif($w4 != ''){
- $totalReq = ORM::for_table($table)->where($w1,$c1)->where($w2,$c2)->where($w3,$c3)->where($w4,$c4)->count();
- }else{
+ if ($w1 != '') {
+ $totalReq = ORM::for_table($table)->where($w1, $c1)->count();
+ } elseif ($w2 != '') {
+ $totalReq = ORM::for_table($table)->where($w1, $c1)->where($w2, $c2)->count();
+ } elseif ($w3 != '') {
+ $totalReq = ORM::for_table($table)->where($w1, $c1)->where($w2, $c2)->where($w3, $c3)->count();
+ } elseif ($w4 != '') {
+ $totalReq = ORM::for_table($table)->where($w1, $c1)->where($w2, $c2)->where($w3, $c3)->where($w4, $c4)->count();
+ } else {
$totalReq = ORM::for_table($table)->count();
}
@@ -85,16 +86,103 @@ Class Paginator
}
if ($page < $counter - 1) {
- $pagination .= "
".$_L['Next']."";
- $pagination .= "".$_L['Last']."";
+ $pagination .= "" . $_L['Next'] . "";
+ $pagination .= "" . $_L['Last'] . "";
} else {
- $pagination .= "".$_L['Next']."";
- $pagination .= "".$_L['Last']."";
+ $pagination .= "" . $_L['Next'] . "";
+ $pagination .= "" . $_L['Last'] . "";
}
$pagination .= "";
-
+
$gen = array("startpoint" => $startpoint, "limit" => $limit, "found" => $totalReq, "page" => $page, "lastpage" => $lastpage, "contents" => $pagination);
return $gen;
}
}
-}
\ No newline at end of file
+
+ public static function bootstrapRaw($table, $w1 = '', $c1 = [], $per_page = '10')
+ {
+ global $routes;
+ global $_L;
+ $url = U . $routes['0'] . '/' . $routes['1'] . '/';
+ $adjacents = "2";
+ $page = (int)(!isset($routes['2']) ? 1 : $routes['2']);
+ $pagination = "";
+
+ if ($w1 != '') {
+ $totalReq = ORM::for_table($table)->where_raw($w1, $c1)->count();
+ } else {
+ $totalReq = ORM::for_table($table)->count();
+ }
+
+ $i = 0;
+ $page = ($page == 0 ? 1 : $page);
+ $start = ($page - 1) * $per_page;
+
+ $prev = $page - 1;
+ $next = $page + 1;
+ $lastpage = ceil($totalReq / $per_page);
+
+ $lpm1 = $lastpage - 1;
+ $limit = $per_page;
+ $startpoint = ($page * $limit) - $limit;
+
+ if ($lastpage >= 1) {
+ $pagination .= '";
+
+ $gen = array("startpoint" => $startpoint, "limit" => $limit, "found" => $totalReq, "page" => $page, "lastpage" => $lastpage, "contents" => $pagination);
+ return $gen;
+ }
+ }
+}
diff --git a/system/controllers/autoload.php b/system/controllers/autoload.php
index 369bf471..e3b782eb 100644
--- a/system/controllers/autoload.php
+++ b/system/controllers/autoload.php
@@ -42,16 +42,16 @@ switch ($action) {
if (empty($s)) {
$c = ORM::for_table('tbl_customers')->limit(30)->find_many();
} else {
- $c = ORM::for_table('tbl_customers')->where_raw("(`username` LIKE '%$s%' OR `fullname` LIKE '%$s%' OR `phonenumber` LIKE '%$s%' OR `email` LIKE '%$s%')", [$s,$s,$s,$s])->limit(30)->find_many();
+ $c = ORM::for_table('tbl_customers')->where_raw("(`username` LIKE '%$s%' OR `fullname` LIKE '%$s%' OR `phonenumber` LIKE '%$s%' OR `email` LIKE '%$s%')", [$s, $s, $s, $s])->limit(30)->find_many();
}
header('Content-Type: application/json');
- foreach ($c as $cust){
+ foreach ($c as $cust) {
$json[] = [
'id' => $cust['id'],
- 'text' => $cust['username'].' - '.$cust['fullname'].' - '.$cust['email']
+ 'text' => $cust['username'] . ' - ' . $cust['fullname'] . ' - ' . $cust['email']
];
}
- echo json_encode(['results'=>$json]);
+ echo json_encode(['results' => $json]);
die();
break;
default:
diff --git a/system/controllers/customers.php b/system/controllers/customers.php
index c684ed0e..c4c54603 100644
--- a/system/controllers/customers.php
+++ b/system/controllers/customers.php
@@ -24,15 +24,11 @@ switch ($action) {
case 'list':
$ui->assign('xfooter', '');
$search = _post('search');
- $what = _post('what');
- if (!in_array($what, ['username', 'fullname', 'phonenumber', 'email'])) {
- $what = 'username';
- }
run_hook('list_customers'); #HOOK
if ($search != '') {
- $paginator = Paginator::bootstrap('tbl_customers', 'username', '%' . $search . '%');
+ $paginator = Paginator::bootstrapRaw('tbl_customers', "(`username` LIKE '%$search%' OR `fullname` LIKE '%$search%' OR `phonenumber` LIKE '%$search%' OR `email` LIKE '%$search%')", [$search, $search, $search, $search]);
$d = ORM::for_table('tbl_customers')
- ->where_like($what, '%' . $search . '%')
+ ->where_raw("(`username` LIKE '%$search%' OR `fullname` LIKE '%$search%' OR `phonenumber` LIKE '%$search%' OR `email` LIKE '%$search%')", [$search, $search, $search, $search])
->offset($paginator['startpoint'])
->limit($paginator['limit'])
->order_by_desc('id')->find_many();
@@ -42,7 +38,6 @@ switch ($action) {
}
$ui->assign('search', htmlspecialchars($search));
- $ui->assign('what', $what);
$ui->assign('d', $d);
$ui->assign('paginator', $paginator);
$ui->display('customers.tpl');
@@ -53,10 +48,14 @@ switch ($action) {
$ui->display('customers-add.tpl');
break;
+ case 'viewu':
+ $customer = ORM::for_table('tbl_customers')->where('username', $routes['2'])->find_one();
case 'view':
$id = $routes['2'];
run_hook('view_customer'); #HOOK
- $customer = ORM::for_table('tbl_customers')->find_one($id);
+ if(!$customer){
+ $customer = ORM::for_table('tbl_customers')->find_one($id);
+ }
if ($customer) {
$v = $routes['3'];
if (empty($v) || $v == 'order') {
@@ -71,7 +70,7 @@ switch ($action) {
->find_many();
// $ui->assign('paginator', $paginator);
$ui->assign('order', $order);
- }else if($v=='activation'){
+ } else if ($v == 'activation') {
// $paginator = Paginator::bootstrap('tbl_transactions', 'username', $customer['username']);
$activation = ORM::for_table('tbl_transactions')
->where('username', $customer['username'])
@@ -82,6 +81,8 @@ switch ($action) {
// $ui->assign('paginator', $paginator);
$ui->assign('activation', $activation);
}
+ $package = ORM::for_table('tbl_user_recharges')->where('username',$customer['username'])->find_one();
+ $ui->assign('package', $package);
$ui->assign('v', $v);
$ui->assign('d', $customer);
$ui->display('customers-view.tpl');
diff --git a/system/controllers/order.php b/system/controllers/order.php
index 8d1184fe..68ac4eec 100644
--- a/system/controllers/order.php
+++ b/system/controllers/order.php
@@ -17,11 +17,12 @@ switch ($action) {
break;
case 'history':
$ui->assign('_system_menu', 'history');
+ $paginator = Paginator::bootstrap('tbl_payment_gateway', 'username', $user['username']);
$d = ORM::for_table('tbl_payment_gateway')
->where('username', $user['username'])
->order_by_desc('id')
+ ->offset($paginator['startpoint'])->limit($paginator['limit'])
->find_many();
- $paginator = Paginator::bootstrap('tbl_payment_gateway', 'username', $user['username']);
$ui->assign('paginator', $paginator);
$ui->assign('d', $d);
$ui->assign('_title', Lang::T('Order History'));
diff --git a/system/lan/english/common.lan.php b/system/lan/english/common.lan.php
index 0284c486..a5c1457e 100644
--- a/system/lan/english/common.lan.php
+++ b/system/lan/english/common.lan.php
@@ -359,18 +359,16 @@ $_L['Balance_Plans'] = 'Balance Plans';
$_L['Buy_Balance'] = 'Buy Balance?';
$_L['Price'] = 'Price';
$_L['Validity'] = 'Validity';
-$_L['Disable_auto_renewal'] = 'Disable auto renewal?';
-$_L['Auto_Renewal_On'] = 'Auto Renewal On';
-$_L['Enable_auto_renewal'] = 'Enable auto renewal?';
-$_L['Auto_Renewal_Off'] = 'Auto Renewal Off';
-$_L['Refill_Balance'] = 'Refill Balance';
-$_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';
+$_L['Disable_auto_renewal'] = 'Disable auto renewal?';
+$_L['Auto_Renewal_On'] = 'Auto Renewal On';
+$_L['Enable_auto_renewal'] = 'Enable auto renewal?';
+$_L['Auto_Renewal_Off'] = 'Auto Renewal Off';
+$_L['Refill_Balance'] = 'Refill Balance';
+$_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['Back'] = 'Back';
+$_L['Active'] = 'Active';
diff --git a/ui/ui/customers-view.tpl b/ui/ui/customers-view.tpl
index f1a37aff..68559ccf 100644
--- a/ui/ui/customers-view.tpl
+++ b/ui/ui/customers-view.tpl
@@ -2,9 +2,6 @@
+ {if $package}
+
+
+
{$package['type']} - {$package['namebp']}
+
+ -
+ {Lang::T('Active')} {if $package['status']=='on'}yes{else}no{/if}
+
+ -
+ {$_L['Created_On']} {Lang::dateFormat($package['recharged_on'])}
+
+ -
+ {$_L['Expires_On']} {Lang::dateTimeFormat($package['expiration']+' '+$package['time'])}
+
+ -
+ {$package['routers']} {$package['method']}
+
+
+
+
+ {/if}
+
{Lang::T('Back')}
diff --git a/ui/ui/customers.tpl b/ui/ui/customers.tpl
index b997bc50..38cd5d4e 100644
--- a/ui/ui/customers.tpl
+++ b/ui/ui/customers.tpl
@@ -9,17 +9,8 @@