forked from kevinowino869/mitrobill
Widget For Customer
This commit is contained in:
@ -95,8 +95,7 @@ if (_post('send') == 'balance') {
|
||||
}
|
||||
r2(getUrl('home'), 'w', Lang::T('Your friend do not have active package'));
|
||||
}
|
||||
$_bill = User::_billing();
|
||||
$ui->assign('_bills', $_bill);
|
||||
|
||||
|
||||
// Sync plan to router
|
||||
if (isset($_GET['sync']) && !empty($_GET['sync'])) {
|
||||
@ -310,46 +309,25 @@ if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'] && !empty($_SESSI
|
||||
}
|
||||
}
|
||||
|
||||
$tcf = ORM::for_table('tbl_customers_fields')
|
||||
->where('customer_id', $user['id'])
|
||||
->find_many();
|
||||
$vpn = ORM::for_table('tbl_port_pool')
|
||||
->find_one();
|
||||
$ui->assign('cf', $tcf);
|
||||
$ui->assign('vpn', $vpn);
|
||||
|
||||
$unpaid = ORM::for_table('tbl_payment_gateway')
|
||||
->where('username', $user['username'])
|
||||
->where('status', 1)
|
||||
->find_one();
|
||||
|
||||
// check expired payments
|
||||
if ($unpaid) {
|
||||
try {
|
||||
if (strtotime($unpaid['expired_date']) < time()) {
|
||||
$unpaid->status = 4;
|
||||
$unpaid->save();
|
||||
$unpaid = [];
|
||||
$widgets = ORM::for_table('tbl_widgets')->where("enabled", 1)->where('user', 'Customer')->order_by_asc("orders")->findArray();
|
||||
$count = count($widgets);
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
try{
|
||||
if(file_exists($WIDGET_PATH . DIRECTORY_SEPARATOR . 'customer' . DIRECTORY_SEPARATOR . $widgets[$i]['widget'].".php")){
|
||||
require_once $WIDGET_PATH . DIRECTORY_SEPARATOR . 'customer' . DIRECTORY_SEPARATOR . $widgets[$i]['widget'].".php";
|
||||
$widgets[$i]['content'] = (new $widgets[$i]['widget'])->getWidget($widgets[$i]);
|
||||
}else{
|
||||
$widgets[$i]['content'] = "Widget not found";
|
||||
}
|
||||
} catch (Throwable $e) {
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
try {
|
||||
if (strtotime($unpaid['created_date'], "+24 HOUR") < time()) {
|
||||
$unpaid->status = 4;
|
||||
$unpaid->save();
|
||||
$unpaid = [];
|
||||
}
|
||||
} catch (Throwable $e) {
|
||||
} catch (Exception $e) {
|
||||
$widgets[$i]['content'] = $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
$ui->assign('unpaid', $unpaid);
|
||||
$ui->assign('code', alphanumeric(_get('code'), "-"));
|
||||
$ui->assign('widgets', $widgets);
|
||||
|
||||
$abills = User::getAttributes("Bill");
|
||||
$ui->assign('abills', $abills);
|
||||
$ui->assign('code', alphanumeric(_get('code'), "-"));
|
||||
|
||||
run_hook('view_customer_dashboard'); #HOOK
|
||||
$ui->display('customer/dashboard.tpl');
|
||||
|
14
system/widgets/customer/account_info.php
Normal file
14
system/widgets/customer/account_info.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
|
||||
class account_info
|
||||
{
|
||||
public function getWidget()
|
||||
{
|
||||
global $ui;
|
||||
|
||||
$abills = User::getAttributes("Bill");
|
||||
$ui->assign('abills', $abills);
|
||||
return $ui->fetch('widget/customers/account_info.tpl');
|
||||
}
|
||||
}
|
20
system/widgets/customer/active_internet_plan.php
Normal file
20
system/widgets/customer/active_internet_plan.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
|
||||
class active_internet_plan
|
||||
{
|
||||
public function getWidget()
|
||||
{
|
||||
global $ui, $user;
|
||||
$_bill = User::_billing();
|
||||
$ui->assign('_bills', $_bill);
|
||||
$tcf = ORM::for_table('tbl_customers_fields')
|
||||
->where('customer_id', $user['id'])
|
||||
->find_many();
|
||||
$vpn = ORM::for_table('tbl_port_pool')
|
||||
->find_one();
|
||||
$ui->assign('cf', $tcf);
|
||||
$ui->assign('vpn', $vpn);
|
||||
return $ui->fetch('widget/customers/active_internet_plan.tpl');
|
||||
}
|
||||
}
|
11
system/widgets/customer/announcement.php
Normal file
11
system/widgets/customer/announcement.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
|
||||
class announcement
|
||||
{
|
||||
public function getWidget()
|
||||
{
|
||||
global $ui;
|
||||
return $ui->fetch('widget/customers/announcement.tpl');
|
||||
}
|
||||
}
|
11
system/widgets/customer/balance_transfer.php
Normal file
11
system/widgets/customer/balance_transfer.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
|
||||
class balance_transfer
|
||||
{
|
||||
public function getWidget()
|
||||
{
|
||||
global $ui;
|
||||
return $ui->fetch('widget/customers/balance_transfer.tpl');
|
||||
}
|
||||
}
|
11
system/widgets/customer/button_order_internet_plan.php
Normal file
11
system/widgets/customer/button_order_internet_plan.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
|
||||
class button_order_internet_plan
|
||||
{
|
||||
public function getWidget()
|
||||
{
|
||||
global $ui;
|
||||
return $ui->fetch('widget/customers/button_order_internet_plan.tpl');
|
||||
}
|
||||
}
|
11
system/widgets/customer/html_only.php
Normal file
11
system/widgets/customer/html_only.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
class html_only
|
||||
{
|
||||
|
||||
public function getWidget($data = null)
|
||||
{
|
||||
global $ui;
|
||||
return $data['content'];
|
||||
}
|
||||
}
|
22
system/widgets/customer/html_php.php
Normal file
22
system/widgets/customer/html_php.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
class html_php
|
||||
{
|
||||
|
||||
public function getWidget($data = null)
|
||||
{
|
||||
global $ui;
|
||||
$ui->assign('card_header', $data['title']);
|
||||
ob_start();
|
||||
try{
|
||||
eval('?>'. $data['content']);
|
||||
}catch(Exception $e){
|
||||
echo $e->getMessage();
|
||||
echo "<br>";
|
||||
echo $e->getTraceAsString();
|
||||
}
|
||||
$content = ob_get_clean();
|
||||
$ui->assign('card_body', $content);
|
||||
return $ui->fetch('widget/card_html.tpl');
|
||||
}
|
||||
}
|
11
system/widgets/customer/recharge_a_friend.php
Normal file
11
system/widgets/customer/recharge_a_friend.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
|
||||
class recharge_a_friend
|
||||
{
|
||||
public function getWidget()
|
||||
{
|
||||
global $ui;
|
||||
return $ui->fetch('widget/customers/recharge_a_friend.tpl');
|
||||
}
|
||||
}
|
39
system/widgets/customer/unpaid_order.php
Normal file
39
system/widgets/customer/unpaid_order.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
|
||||
class unpaid_order
|
||||
{
|
||||
public function getWidget()
|
||||
{
|
||||
global $ui, $user;
|
||||
$unpaid = ORM::for_table('tbl_payment_gateway')
|
||||
->where('username', $user['username'])
|
||||
->where('status', 1)
|
||||
->find_one();
|
||||
|
||||
// check expired payments
|
||||
if ($unpaid) {
|
||||
try {
|
||||
if (strtotime($unpaid['expired_date']) < time()) {
|
||||
$unpaid->status = 4;
|
||||
$unpaid->save();
|
||||
$unpaid = [];
|
||||
}
|
||||
} catch (Throwable $e) {
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
try {
|
||||
if (strtotime($unpaid['created_date'], "+24 HOUR") < time()) {
|
||||
$unpaid->status = 4;
|
||||
$unpaid->save();
|
||||
$unpaid = [];
|
||||
}
|
||||
} catch (Throwable $e) {
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
}
|
||||
|
||||
$ui->assign('unpaid', $unpaid);
|
||||
return $ui->fetch('widget/customers/unpaid_order.tpl');
|
||||
}
|
||||
}
|
11
system/widgets/customer/voucher_activation.php
Normal file
11
system/widgets/customer/voucher_activation.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
|
||||
class voucher_activation
|
||||
{
|
||||
public function getWidget()
|
||||
{
|
||||
global $ui;
|
||||
return $ui->fetch('widget/customers/voucher_activation.tpl');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user