This commit is contained in:
2026-03-03 16:30:57 +07:00
parent a13304e40e
commit c253e1a370
7569 changed files with 1324841 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class appnotification extends CI_Controller
{
public function __construct()
{
parent::__construct();
is_logged_in();
$this->load->model('notification_model', 'notif');
$this->load->library('form_validation');
}
public function index()
{
$this->load->view('includes/header');
$this->load->view('appnotification/index');
$this->load->view('includes/footer');
}
public function send()
{
$topic = $this->input->post('topic');
$title = $this->input->post('title');
$message = $this->input->post('message');
$this->notif->send_notif($title, $message, $topic);
$this->session->set_flashdata('send', 'Notifikasi berhasil dikirim');
redirect('appnotification/index');
}
}

View File

@@ -0,0 +1,370 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Appsettings extends CI_Controller
{
public function __construct()
{
parent::__construct();
is_logged_in();
$this->load->library('form_validation');
$this->load->model('appsettings_model', 'app');
}
public function index()
{
$data['appsettings'] = $this->app->getappbyid();
$data['transfer'] = $this->app->gettransfer();
$this->load->view('includes/header');
$this->load->view('appsettings/index', $data);
$this->load->view('includes/footer');
}
public function ubahbank($id)
{
$this->form_validation->set_rules('nama_bank', 'nama_bank', 'trim|prep_for_form');
$this->form_validation->set_rules('nama_pemilik', 'nama_pemilik', 'trim|prep_for_form');
$this->form_validation->set_rules('rekening_bank', 'rekening_bank', 'trim|prep_for_form');
if ($this->form_validation->run() == TRUE) {
$config['upload_path'] = './images/bank/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '20000';
$config['file_name'] = time();
$config['encrypt_name'] = true;
$this->load->library('upload', $config);
$dataget = $this->app->getbankid($id);
if ($this->upload->do_upload('image_bank')) {
if ($dataget['image_bank'] != 'noimage.jpg') {
$gambar = $dataget['image_bank'];
unlink('./images/bank/' . $gambar);
}
$gambar = $dataget['image_bank'];
unlink('./images/bank/' . $gambar);
$app_logo = html_escape($this->upload->data('file_name'));
} else {
$app_logo = $dataget['image_bank'];
}
$data = [
'nama_bank' => html_escape($this->input->post('nama_bank', TRUE)),
'rekening_bank' => html_escape($this->input->post('rekening_bank', TRUE)),
'nama_pemilik' => html_escape($this->input->post('nama_pemilik', TRUE)),
'status_bank' => html_escape($this->input->post('status_bank', TRUE)),
'image_bank' => $app_logo
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'TIDAK DI IZINKAN!!');
redirect('appsettings/index');
} else {
$this->app->ubahdatarekening($data, $id);
$this->session->set_flashdata('ubah', 'Infomrasi aplikasi berhasil di ubah');
redirect('appsettings');
}
}
}
public function hapusbank($id)
{
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'TIDAK DI IZINKAN!!');
redirect('appsettings/index');
} else {
$dataget = $this->app->getbankid($id);
$gambar = $dataget['image_bank'];
unlink('./images/bank/' . $gambar);
$this->app->hapusrekening($id);
$this->session->set_flashdata('ubah', 'Informasi aplikasi berhasil di ubah');
redirect('appsettings');
}
}
public function adddatabank()
{
$this->form_validation->set_rules('nama_bank', 'nama_bank', 'trim|prep_for_form');
$this->form_validation->set_rules('nama_pemilik', 'nama_pemilik', 'trim|prep_for_form');
$this->form_validation->set_rules('rekening_bank', 'rekening_bank', 'trim|prep_for_form');
if ($this->form_validation->run() == TRUE) {
$config['upload_path'] = './images/bank/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '10000';
$config['file_name'] = time();
$config['encrypt_name'] = true;
$this->load->library('upload', $config);
if ($this->upload->do_upload('image_bank')) {
$app_logo = html_escape($this->upload->data('file_name'));
}
$data = [
'nama_bank' => html_escape($this->input->post('nama_bank', TRUE)),
'nama_pemilik' => html_escape($this->input->post('nama_pemilik', TRUE)),
'rekening_bank' => html_escape($this->input->post('rekening_bank', TRUE)),
'status_bank' => html_escape($this->input->post('status_bank', TRUE)),
'image_bank' => $app_logo
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'ANDA TIDAK DI IZINKAN MERUBAH');
redirect('appsettings/index');
} else {
$this->app->adddatarekening($data);
$this->session->set_flashdata('ubah', 'Informasi aplikasi berhasil diubah');
redirect('appsettings');
}
}
}
public function ubahapp()
{
$this->form_validation->set_rules('app_email', 'app_email', 'trim|prep_for_form');
$this->form_validation->set_rules('app_website', 'app_website', 'trim|prep_for_form');
$this->form_validation->set_rules('app_linkgoogle', 'app_linkgoogle', 'trim|prep_for_form');
$this->form_validation->set_rules('app_currency', 'app_currency', 'trim|prep_for_form');
if ($this->form_validation->run() == TRUE) {
$config['upload_path'] = './asset/images/icon/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '10000';
$config['file_name'] = 'name';
$config['encrypt_name'] = true;
$this->load->library('upload', $config);
$data = $this->app->getappbyid();
if ($this->upload->do_upload('app_logo')) {
if ($data['app_logo'] != 'noimage.jpg') {
$gambar = $data['app_logo'];
unlink('asset/images/icon/' . $gambar);
}
$app_logo = html_escape($this->upload->data('file_name'));
} else {
$app_logo = $data['app_logo'];
}
$data = [
'app_logo' => $app_logo,
'app_email' => html_escape($this->input->post('app_email', TRUE)),
'app_website' => html_escape($this->input->post('app_website', TRUE)),
'app_privacy_policy' => $this->input->post('app_privacy_policy', TRUE),
'app_aboutus' => $this->input->post('app_aboutus', TRUE),
'app_address' => $this->input->post('app_address'),
'app_linkgoogle' => html_escape($this->input->post('app_linkgoogle', TRUE)),
'app_name' => html_escape($this->input->post('app_name', TRUE)),
'app_contact' => html_escape($this->input->post('app_contact', TRUE)),
'app_currency' => html_escape($this->input->post('app_currency', TRUE))
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'TIDAK DI IZINKAN!!');
redirect('appsettings/index');
} else {
$this->app->ubahdataappsettings($data);
$this->session->set_flashdata('ubah', 'Informasi aplikasi berhasil diubah');
redirect('appsettings');
}
} else {
$data['appsettings'] = $this->app->getappbyid();
$this->load->view('includes/header');
$this->load->view('appsettings/index', $data);
$this->load->view('includes/footer');
}
}
public function ubahemail()
{
$this->form_validation->set_rules('email_subject', 'email_subject', 'trim|prep_for_form');
$this->form_validation->set_rules('email_subject_confirm', 'email_subject', 'trim|prep_for_form');
if ($this->form_validation->run() == TRUE) {
$data = [
'email_subject' => html_escape($this->input->post('email_subject', TRUE)),
'email_subject_confirm' => html_escape($this->input->post('email_subject_confirm', TRUE)),
'email_text1' => $this->input->post('email_text1'),
'email_text2' => $this->input->post('email_text2'),
'email_text3' => $this->input->post('email_text3'),
'email_text4' => $this->input->post('email_text4')
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'TIDAK DI IZINKAN!!');
redirect('appsettings/index');
} else {
$this->app->ubahdataemail($data);
$this->session->set_flashdata('ubah', 'Email berhasil di ubah');
redirect('appsettings');
}
} else {
$data['appsettings'] = $this->app->getappbyid();
$this->load->view('includes/header');
$this->load->view('appsettings/index', $data);
$this->load->view('includes/footer');
}
}
public function ubahsmtp()
{
$this->form_validation->set_rules('smtp_host', 'smtp_host', 'trim|prep_for_form');
$this->form_validation->set_rules('smtp_port', 'smtp_port', 'trim|prep_for_form');
$this->form_validation->set_rules('smtp_username', 'smtp_username', 'trim|prep_for_form');
$this->form_validation->set_rules('smtp_password', 'smtp_password', 'trim|prep_for_form');
$this->form_validation->set_rules('smtp_form', 'smtp_form', 'trim|prep_for_form');
$this->form_validation->set_rules('smtp_secure', 'smtp_secure', 'trim|prep_for_form');
if ($this->form_validation->run() == TRUE) {
$data = [
'smtp_host' => html_escape($this->input->post('smtp_host', TRUE)),
'smtp_port' => html_escape($this->input->post('smtp_port', TRUE)),
'smtp_username' => html_escape($this->input->post('smtp_username', TRUE)),
'smtp_password' => html_escape($this->input->post('smtp_password', TRUE)),
'smtp_from' => html_escape($this->input->post('smtp_from', TRUE)),
'smtp_secure' => html_escape($this->input->post('smtp_secure', TRUE))
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'ANDA TIDAK DI IZINKAN MERUBAH');
redirect('appsettings/index');
} else {
$this->app->ubahdatasmtp($data);
$this->session->set_flashdata('ubah', 'SMTP Berhasil di ubah');
redirect('appsettings');
}
} else {
$data['appsettings'] = $this->app->getappbyid();
$this->load->view('includes/header');
$this->load->view('appsettings/index', $data);
$this->load->view('includes/footer');
}
}
public function ubahmobilepulsa()
{
$this->form_validation->set_rules('mobilepulsa_username', 'mobilepulsa_username', 'trim|prep_for_form');
$this->form_validation->set_rules('mobilepulsa_harga', 'mobilepulsa_harga', 'trim|prep_for_form');
$this->form_validation->set_rules('mobilepulsa_api_key', 'mobilepulsa_api_key', 'trim|prep_for_form');
$this->form_validation->set_rules('mp_status', 'mp_status', 'trim|prep_for_form');
$this->form_validation->set_rules('mp_active', 'mp_active', 'trim|prep_for_form');
if ($this->form_validation->run() == TRUE) {
$data = [
'mobilepulsa_username' => html_escape($this->input->post('mobilepulsa_username', TRUE)),
'mobilepulsa_harga' => html_escape($this->input->post('mobilepulsa_harga', TRUE)),
'mobilepulsa_api_key' => html_escape($this->input->post('mobilepulsa_api_key', TRUE)),
'mp_status' => html_escape($this->input->post('mp_status', TRUE)),
'mp_active' => html_escape($this->input->post('mp_active', TRUE))
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'ANDA TIDAK DI IZINKAN MERUBAH');
redirect('appsettings/index');
} else {
$this->app->ubahdatamobilepulsa($data);
$this->session->set_flashdata('ubah', 'Mobile pulsa berhasil di ubah');
redirect('appsettings');
}
} else {
$data['appsettings'] = $this->app->getappbyid();
$this->load->view('includes/header');
$this->load->view('appsettings/index', $data);
$this->load->view('includes/footer');
}
}
public function ubahayopesan()
{
$this->form_validation->set_rules('api_password', 'api_password', 'trim|prep_for_form');
$this->form_validation->set_rules('harga_pulsa', 'harga_pulsa', 'trim|prep_for_form');
$this->form_validation->set_rules('api_token', 'api_token', 'trim|prep_for_form');
if ($this->form_validation->run() == TRUE) {
$data = [
'api_password' => html_escape($this->input->post('api_password', TRUE)),
'harga_pulsa' => html_escape($this->input->post('harga_pulsa', TRUE)),
'api_token' => html_escape($this->input->post('api_token', TRUE))
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'TIDAK DI IZINKAN!!');
redirect('appsettings/index');
} else {
$this->app->ubahdataayopesan($data);
$this->session->set_flashdata('ubah', 'api berhasil di ubah');
redirect('appsettings');
}
} else {
$data['appsettings'] = $this->app->getappbyid();
$this->load->view('includes/header');
$this->load->view('appsettings/index', $data);
$this->load->view('includes/footer');
}
}
public function addbank()
{
$this->load->view('includes/header');
$this->load->view('appsettings/addbank');
$this->load->view('includes/footer');
}
public function editbank($id)
{
$data['transfer'] = $this->app->getbankid($id);
$this->load->view('includes/header');
$this->load->view('appsettings/editbank', $data);
$this->load->view('includes/footer');
}
public function ubahxendit()
{
$data = [
'api_keyxendit' => html_escape($this->input->post('api_keyxendit', TRUE)),
'apikey_server' => html_escape($this->input->post('apikey_server', TRUE))
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'ANDA TIDAK DI IZINKAN MERUBAH');
redirect('appsettings/index');
} else {
$this->app->ubahxendit($data);
$this->session->set_flashdata('ubah', 'Data Berhasil di ubah');
redirect('appsettings');
}
}
}

View File

@@ -0,0 +1,77 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Categorymerchant extends CI_Controller
{
public function __construct()
{
parent::__construct();
is_logged_in();
$this->load->model('categorymerchant_model', 'cm');
$this->load->library('form_validation');
}
public function index()
{
$data['catmer'] = $this->cm->getallcm();
$data['fitur'] = $this->cm->getfiturmerchant();
$this->load->view('includes/header');
$this->load->view('categorymerchant/index', $data);
$this->load->view('includes/footer');
}
public function tambahcm()
{
$this->form_validation->set_rules('nama_kategori', 'nama_kategori', 'trim|prep_for_form');
if ($this->form_validation->run() == TRUE) {
$data = [
'nama_kategori' => html_escape($this->input->post('nama_kategori', TRUE)),
'id_fitur' => html_escape($this->input->post('id_fitur', TRUE)),
'status_kategori' => html_escape($this->input->post('status_kategori', TRUE)),
];
$this->cm->tambahcm($data);
$this->session->set_flashdata('tambah', 'Category Merchant Has Been Added');
redirect('categorymerchant');
}
}
public function hapus($id)
{
$this->cm->hapuscm($id);
$this->session->set_flashdata('hapus', 'Category Merchant Has Been Deleted');
redirect('categorymerchant');
}
public function ubahcm()
{
$this->form_validation->set_rules('nama_kategori', 'nama_kategori', 'trim|prep_for_form');
$this->form_validation->set_rules('id_fitur', 'id_fitur', 'trim|prep_for_form');
$this->form_validation->set_rules('status_kategori', 'status_kategori', 'trim|prep_for_form');
if ($this->form_validation->run() == TRUE) {
$id = $this->input->post('id_kategori_merchant');
$data = [
'nama_kategori' => html_escape($this->input->post('nama_kategori', TRUE)),
'id_fitur' => html_escape($this->input->post('id_fitur', TRUE)),
'status_kategori' => html_escape($this->input->post('status_kategori', TRUE)),
];
$this->cm->ubahcm($data, $id);
$this->session->set_flashdata('ubah', 'Category Merchant Has Been Updated');
redirect('categorymerchant');
}
}
}

View File

@@ -0,0 +1,157 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Dashboard extends CI_Controller
{
public function __construct()
{
parent::__construct();
if ($this->session->userdata('user_name') == NULL && $this->session->userdata('password') == NULL) {
redirect(base_url() . "login");
}
$this->load->model('Appsettings_model', 'app');
$this->load->model('Dashboard_model', 'dashboard');
$this->load->model('users_model', 'user');
$this->load->model('driver_model', 'driver');
$this->load->model('notification_model', 'notif');
// $this->load->library('form_validation');
}
public function index()
{
$data['jan1'] = $this->dashboard->getTotalTransaksiBulanan(1, date('Y'), 1);
$data['feb1'] = $this->dashboard->getTotalTransaksiBulanan(2, date('Y'), 1);
$data['mar1'] = $this->dashboard->getTotalTransaksiBulanan(3, date('Y'), 1);
$data['apr1'] = $this->dashboard->getTotalTransaksiBulanan(4, date('Y'), 1);
$data['mei1'] = $this->dashboard->getTotalTransaksiBulanan(5, date('Y'), 1);
$data['jun1'] = $this->dashboard->getTotalTransaksiBulanan(6, date('Y'), 1);
$data['jul1'] = $this->dashboard->getTotalTransaksiBulanan(7, date('Y'), 1);
$data['aug1'] = $this->dashboard->getTotalTransaksiBulanan(8, date('Y'), 1);
$data['sep1'] = $this->dashboard->getTotalTransaksiBulanan(9, date('Y'), 1);
$data['okt1'] = $this->dashboard->getTotalTransaksiBulanan(10, date('Y'), 1);
$data['nov1'] = $this->dashboard->getTotalTransaksiBulanan(11, date('Y'), 1);
$data['des1'] = $this->dashboard->getTotalTransaksiBulanan(12, date('Y'), 1);
$data['jan2'] = $this->dashboard->getTotalTransaksiBulanan(1, date('Y'), 2);
$data['feb2'] = $this->dashboard->getTotalTransaksiBulanan(2, date('Y'), 2);
$data['mar2'] = $this->dashboard->getTotalTransaksiBulanan(3, date('Y'), 2);
$data['apr2'] = $this->dashboard->getTotalTransaksiBulanan(4, date('Y'), 2);
$data['mei2'] = $this->dashboard->getTotalTransaksiBulanan(5, date('Y'), 2);
$data['jun2'] = $this->dashboard->getTotalTransaksiBulanan(6, date('Y'), 2);
$data['jul2'] = $this->dashboard->getTotalTransaksiBulanan(7, date('Y'), 2);
$data['aug2'] = $this->dashboard->getTotalTransaksiBulanan(8, date('Y'), 2);
$data['sep2'] = $this->dashboard->getTotalTransaksiBulanan(9, date('Y'), 2);
$data['okt2'] = $this->dashboard->getTotalTransaksiBulanan(10, date('Y'), 2);
$data['nov2'] = $this->dashboard->getTotalTransaksiBulanan(11, date('Y'), 2);
$data['des2'] = $this->dashboard->getTotalTransaksiBulanan(12, date('Y'), 2);
$data['jan3'] = $this->dashboard->getTotalTransaksiBulanan(1, date('Y'), 3);
$data['feb3'] = $this->dashboard->getTotalTransaksiBulanan(2, date('Y'), 3);
$data['mar3'] = $this->dashboard->getTotalTransaksiBulanan(3, date('Y'), 3);
$data['apr3'] = $this->dashboard->getTotalTransaksiBulanan(4, date('Y'), 3);
$data['mei3'] = $this->dashboard->getTotalTransaksiBulanan(5, date('Y'), 3);
$data['jun3'] = $this->dashboard->getTotalTransaksiBulanan(6, date('Y'), 3);
$data['jul3'] = $this->dashboard->getTotalTransaksiBulanan(7, date('Y'), 3);
$data['aug3'] = $this->dashboard->getTotalTransaksiBulanan(8, date('Y'), 3);
$data['sep3'] = $this->dashboard->getTotalTransaksiBulanan(9, date('Y'), 3);
$data['okt3'] = $this->dashboard->getTotalTransaksiBulanan(10, date('Y'), 3);
$data['nov3'] = $this->dashboard->getTotalTransaksiBulanan(11, date('Y'), 3);
$data['des3'] = $this->dashboard->getTotalTransaksiBulanan(12, date('Y'), 3);
$data['jan4'] = $this->dashboard->getTotalTransaksiBulanan(1, date('Y'), 4);
$data['feb4'] = $this->dashboard->getTotalTransaksiBulanan(2, date('Y'), 4);
$data['mar4'] = $this->dashboard->getTotalTransaksiBulanan(3, date('Y'), 4);
$data['apr4'] = $this->dashboard->getTotalTransaksiBulanan(4, date('Y'), 4);
$data['mei4'] = $this->dashboard->getTotalTransaksiBulanan(5, date('Y'), 4);
$data['jun4'] = $this->dashboard->getTotalTransaksiBulanan(6, date('Y'), 4);
$data['jul4'] = $this->dashboard->getTotalTransaksiBulanan(7, date('Y'), 4);
$data['aug4'] = $this->dashboard->getTotalTransaksiBulanan(8, date('Y'), 4);
$data['sep4'] = $this->dashboard->getTotalTransaksiBulanan(9, date('Y'), 4);
$data['okt4'] = $this->dashboard->getTotalTransaksiBulanan(10, date('Y'), 4);
$data['nov4'] = $this->dashboard->getTotalTransaksiBulanan(11, date('Y'), 4);
$data['des4'] = $this->dashboard->getTotalTransaksiBulanan(12, date('Y'), 4);
$data['harian'] = $this->dashboard->getbydate();
$data['currency'] = $this->app->getappbyid();
$data['transaksi'] = $this->dashboard->getAlltransaksi();
$data['transaksi1'] = $this->dashboard->getAlltransaksi1();
$data['transaksi3'] = $this->dashboard->getAlltransaksi3();
$data['transaksi_sukses'] = $this->dashboard->getSuksestransaksi();
$data['transaksi_sukses1'] = $this->dashboard->getSuksestransaksi1();
$data['transaksi_sukses3'] = $this->dashboard->getSuksestransaksi3();
$data['fitur'] = $this->dashboard->getAllfitur();
$data['saldo'] = $this->dashboard->getallsaldo();
$data['saldo1'] = $this->dashboard->getallsaldo1();
$data['saldo3'] = $this->dashboard->getallsaldo3();
$data['user'] = $this->user->getallusers();
$data['driver'] = $this->driver->getalldriver();
$data['mitra0'] = $this->dashboard->countmitra0();
$data['mitra'] = $this->dashboard->countmitra();
$data['mitra3'] = $this->dashboard->countmitra3();
$data['hitungdriver0'] = $this->dashboard->countdriver0();
$data['hitungdriver'] = $this->dashboard->countdriver();
$data['hitungdriver3'] = $this->dashboard->countdriver3();
$this->load->view('includes/header');
$this->load->view('dashboard/index', $data);
}
public function detail($id)
{
$data['transaksi'] = $this->dashboard->gettransaksiById($id);
$data['currency'] = $this->app->getappbyid();
$data['transitem'] = $this->dashboard->getitem($id);
$this->load->view('includes/header');
$this->load->view('dashboard/detailtransaction', $data);
$this->load->view('includes/footer');
}
public function cancletransaction($id)
{
$dataget = $this->dashboard->gettransaksiById($id);
$id_driver = $dataget['id_driver'];
$id_transaksi = $dataget['id'];
$token_user = $dataget['token'];
$token_driver = $dataget['reg_id'];
$this->notif->notif_cancel_user($id_driver, $id_transaksi, $token_user);
$this->notif->notif_cancel_driver($id_transaksi, $token_driver);
$this->dashboard->ubahstatustransaksibyid($id);
$this->dashboard->ubahstatusdriverbyid($id_driver);
$this->session->set_flashdata('cancel', 'Transaction Has Been Cancel');
redirect('dashboard/index');
}
public function delete($id)
{
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('transaction/index');
} else {
$this->dashboard->deletetransaksi($id);
$this->session->set_flashdata('hapus', 'Transaction Has Been Delete ');
redirect('transaction/index');
}
}
}

View File

@@ -0,0 +1,546 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Driver extends CI_Controller
{
public function __construct()
{
parent::__construct();
is_logged_in();
$this->load->model('driver_model', 'driver');
$this->load->model('appsettings_model', 'app');
$this->load->model('Pelanggan_model');
$this->load->library('form_validation');
$this->load->library('upload');
}
public function index()
{
$data['driver'] = $this->driver->getalldriver();
$this->load->view('includes/header');
$this->load->view('drivers/index', $data);
$this->load->view('includes/footer');
}
public function tracking_driver()
{
$this->load->view('includes/header');
$this->load->view('drivers/tracking_driver');
}
public function detail($id)
{
$data['driver'] = $this->driver->getdriverbyid($id);
$data['currency'] = $this->app->getappbyid();
$data['countorder'] = $this->driver->countorder($id);
$data['transaksi'] = $this->driver->transaksi($id);
$data['wallet'] = $this->driver->wallet($id);
$data['driverjob'] = $this->driver->driverjob();
$data['partner_region'] = $this->driver->partner_region();
$this->load->view('includes/header');
$this->load->view('drivers/detail', $data);
$this->load->view('includes/footer');
}
public function ubahid()
{
$this->form_validation->set_rules('nama_driver', 'nama_driver', 'trim|prep_for_form');
$this->form_validation->set_rules('email', 'email', 'trim|prep_for_form');
$this->form_validation->set_rules('tempat_lahir', 'tempat_lahir', 'trim|prep_for_form');
$this->form_validation->set_rules('tgl_lahir', 'tgl_lahir', 'trim|prep_for_form');
$this->form_validation->set_rules('gender', 'gender', 'trim|prep_for_form');
$this->form_validation->set_rules('alamat_driver', 'alamat_driver', 'trim|prep_for_form');
if ($this->form_validation->run() == TRUE) {
$phone = html_escape($this->input->post('phone', TRUE));
$countrycode = html_escape($this->input->post('countrycode', TRUE));
$data = [
'id' => html_escape($this->input->post('id', TRUE)),
'nama_driver' => html_escape($this->input->post('nama_driver', TRUE)),
'email' => html_escape($this->input->post('email', TRUE)),
'countrycode' => html_escape($this->input->post('countrycode', TRUE)),
'phone' => html_escape($this->input->post('phone', TRUE)),
'no_telepon' => str_replace("+", "", $countrycode) . $phone,
'tempat_lahir' => html_escape($this->input->post('tempat_lahir', TRUE)),
'tgl_lahir' => html_escape($this->input->post('tgl_lahir', TRUE)),
'gender' => html_escape($this->input->post('gender', TRUE)),
'alamat_driver' => html_escape($this->input->post('alamat_driver', TRUE))
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('driver/detail/' . $this->input->post('id', TRUE));
} else {
$id = html_escape($this->input->post('id', TRUE));
$this->driver->ubahdataid($data);
$this->session->set_flashdata('ubah', 'Driver ID Has Been Changed');
redirect('driver/detail/' . $id);
}
} else {
$data['driver'] = $this->driver->getdriverbyid($id);
$data['currency'] = $this->app->getappbyid();
$data['countorder'] = $this->driver->countorder($id);
$this->load->view('includes/header');
$this->load->view('drivers/detail', $data);
$this->load->view('includes/footer');
}
}
public function ubahkendaraan()
{
$this->form_validation->set_rules('jenis', 'jenis', 'trim|prep_for_form');
$this->form_validation->set_rules('merek', 'merek', 'trim|prep_for_form');
$this->form_validation->set_rules('tipe', 'tipe', 'trim|prep_for_form');
$this->form_validation->set_rules('nomor_kendaraan', 'nomor_kendaraan', 'trim|prep_for_form');
$this->form_validation->set_rules('warna', 'warna', 'trim|prep_for_form');
$this->form_validation->set_rules('wilayah', 'wilayah', 'trim|prep_for_form');
if ($this->form_validation->run() == TRUE) {
$data = [
'id_k' => html_escape($this->input->post('id_k', TRUE)),
'jenis' => html_escape($this->input->post('jenis', TRUE)),
'merek' => html_escape($this->input->post('merek', TRUE)),
'tipe' => html_escape($this->input->post('tipe', TRUE)),
'nomor_kendaraan' => html_escape($this->input->post('nomor_kendaraan', TRUE)),
'warna' => html_escape($this->input->post('warna', TRUE))
];
$data2 = [
'id' => html_escape($this->input->post('id', TRUE)),
'job' => html_escape($this->input->post('jenis', TRUE)),
];
$data3 = [
'id' => html_escape($this->input->post('id', TRUE)),
'wilayah' => html_escape($this->input->post('driverregion', TRUE)),
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('driver/detail/' . $this->input->post('id', TRUE));
} else {
$id = html_escape($this->input->post('id', TRUE));
$this->driver->ubahdatakendaraan($data, $data2, $data3);
$this->session->set_flashdata('ubah', 'Driver Vechile Has Been Changed');
redirect('driver/detail/' . $id);
}
} else {
$data['driver'] = $this->driver->getdriverbyid($id);
$data['currency'] = $this->app->getappbyid();
$data['countorder'] = $this->driver->countorder($id);
$this->load->view('includes/header');
$this->load->view('drivers/detail', $data);
$this->load->view('includes/footer');
}
}
public function ubahfoto()
{
@$_FILES['foto']['name'];
if ($_FILES != NULL) {
$config['upload_path'] = './images/fotodriver/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '100000';
$config['file_name'] = 'name';
$config['encrypt_name'] = true;
$this->upload->initialize($config);
$this->upload->do_upload('foto');
$id = $id = html_escape($this->input->post('id', TRUE));
$data = $this->driver->getdriverbyid($id);
if ($this->upload->do_upload('foto')) {
if ($data['foto'] != 'noimage.jpg') {
$gambar = $data['foto'];
unlink('images/fotodriver/' . $gambar);
}
$foto = html_escape($this->upload->data('file_name'));
} else {
$foto = $data['foto'];
}
$data = [
'foto' => $foto,
'id' => html_escape($this->input->post('id', TRUE))
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('driver/detail/' . $id);
} else {
$this->driver->ubahdatafoto($data);
$this->session->set_flashdata('ubah', 'Driver Picture Has Been Changed');
redirect('driver/detail/' . $id);
}
} else {
$data['driver'] = $this->driver->getdriverbyid($id);
$data['currency'] = $this->app->getappbyid();
$data['countorder'] = $this->driver->countorder($id);
$this->load->view('includes/header');
$this->load->view('drivers/detail', $data);
$this->load->view('includes/footer');
}
}
public function ubahpassword()
{
$this->form_validation->set_rules('password', 'password', 'trim|prep_for_form');
if ($this->form_validation->run() == TRUE) {
$id = $this->input->post('id');
$data = $this->input->post('password');
$dataencrypt = sha1($data);
$data = [
'id' => html_escape($this->input->post('id', TRUE)),
'password' => $dataencrypt
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('driver/detail/' . $id);
} else {
$this->driver->ubahdatapassword($data);
$this->session->set_flashdata('ubah', 'Driver Password Has Been Changed');
redirect('driver/detail/' . $id);
}
} else {
$data['driver'] = $this->driver->getdriverbyid($id);
$data['currency'] = $this->app->getappbyid();
$data['countorder'] = $this->driver->countorder($id);
$this->load->view('includes/header');
$this->load->view('drivers/detail', $data);
$this->load->view('includes/footer');
}
}
public function block($id)
{
$this->driver->blockdriverbyid($id);
redirect('driver');
}
public function unblock($id)
{
$this->driver->unblockdriverbyid($id);
redirect('driver');
}
public function ubahcard()
{
$this->form_validation->set_rules('no_ktp', 'no_ktp', 'trim|prep_for_form');
$this->form_validation->set_rules('id_sim', 'id_sim', 'trim|prep_for_form');
$this->form_validation->set_rules('exp_stnk', 'exp_stnk', 'trim|prep_for_form');
$id = html_escape($this->input->post('id', TRUE));
$data = $this->driver->getdriverbyid($id);
if ($this->form_validation->run() == TRUE) {
if (@$_FILES['foto_ktp']['name']) {
$config['upload_path'] = './images/fotoberkas/ktp';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '100000';
$config['file_name'] = 'name';
$config['encrypt_name'] = true;
$this->upload->initialize($config);
if ($this->upload->do_upload('foto_ktp')) {
if ($data['foto_ktp'] != 'noimage.jpg') {
$gambar = $data['foto_ktp'];
unlink('images/fotoberkas/ktp/' . $gambar);
}
$foto_ktp = html_escape($this->upload->data('file_name'));
} else {
$foto_ktp = $data['foto_ktp'];
}
}
if (@$_FILES['foto_sim']['name']) {
$config['upload_path'] = './images/fotoberkas/sim';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '100000';
$config['file_name'] = 'name';
$config['encrypt_name'] = true;
$this->upload->initialize($config);
if ($this->upload->do_upload('foto_sim')) {
if ($data['foto_sim'] != 'noimage.jpg') {
$gambar = $data['foto_sim'];
unlink('images/fotoberkas/sim/' . $gambar);
}
$foto_sim = html_escape($this->upload->data('file_name'));
} else {
$foto_sim = $data['foto_sim'];
}
}
if (@$_FILES['foto_stnk']['name']) {
$config['upload_path'] = './images/fotoberkas/stnk';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '100000';
$config['file_name'] = 'name';
$config['encrypt_name'] = true;
$this->upload->initialize($config);
if ($this->upload->do_upload('foto_stnk')) {
if ($data['foto_stnk'] != 'noimage.jpg') {
$gambar = $data['foto_stnk'];
unlink('images/fotoberkas/stnk/' . $gambar);
}
$foto_stnk = html_escape($this->upload->data('file_name'));
} else {
$foto_stnk = $data['foto_stnk'];
}
}
$data = [
'foto_ktp' => $foto_ktp,
'foto_sim' => $foto_sim,
'foto_stnk' => $foto_stnk,
'id_sim' => html_escape($this->input->post('id_sim', TRUE)),
'exp_stnk' => html_escape($this->input->post('exp_stnk', TRUE)),
'id' => html_escape($this->input->post('id', TRUE))
];
$data2 = [
'no_ktp' => html_escape($this->input->post('no_ktp', TRUE)),
'id' => html_escape($this->input->post('id', TRUE))
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('driver/detail/' . $id);
} else {
$this->driver->ubahdatacard($data, $data2);
$this->session->set_flashdata('ubah', 'Driver Licence Has Been Changed');
redirect('driver/detail/' . $id);
}
} else {
$data['driver'] = $this->driver->getdriverbyid($id);
$data['currency'] = $this->app->getappbyid();
$data['countorder'] = $this->driver->countorder($id);
$this->load->view('includes/header');
$this->load->view('drivers/detail', $data);
$this->load->view('includes/footer');
}
}
public function hapus($id)
{
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('driver/index');
} else {
$data = $this->driver->getdriverbyid($id);
$gambar = $data['foto'];
$gambarsim = $data['foto_sim'];
$gambarktp = $data['foto_ktp'];
$gambarstnk = $data['foto_stnk'];
unlink('images/fotodriver/' . $gambar);
unlink('images/fotoberkas/ktp/' . $gambarktp);
unlink('images/fotoberkas/sim/' . $gambarsim);
unlink('images/fotoberkas/stnk/' . $gambarstnk);
$this->session->set_flashdata('hapus', 'Driver Has Been Deleted');
$this->driver->hapusdriverbyid($id);
redirect('driver');
}
}
public function tambah()
{
$phone = html_escape($this->input->post('phone', TRUE));
$email = html_escape($this->input->post('email', TRUE));
// $check_exist = $this->Pelanggan_model->check_exist($email, $phone);
// $check_exist_phone = $this->Pelanggan_model->check_exist_phone($phone);
// $check_exist_email = $this->Pelanggan_model->check_exist_email($email);
// if ($check_exist) {
// $this->session->set_flashdata('invalid', 'phone or email has been used');
// redirect('users/tambah');
// } else if ($check_exist_phone) {
// $this->session->set_flashdata('invalid', 'phone has been used');
// redirect('users/tambah');
// } else if ($check_exist_email) {
// $this->session->set_flashdata('invalid', 'email has been used');
// redirect('users/tambah');
// } else {
$this->form_validation->set_rules('nama_driver', 'nama_driver', 'trim|prep_for_form');
$this->form_validation->set_rules('phone', 'Phone', 'trim|prep_for_form|is_unique[driver.phone]');
$this->form_validation->set_rules('email', 'Email', 'trim|prep_for_form|is_unique[driver.email]');
$this->form_validation->set_rules('password', 'password', 'trim|prep_for_form');
if ($this->form_validation->run() == TRUE) {
if (@$_FILES['foto']['name']) {
$config['upload_path'] = './images/fotodriver/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '100000';
$config['file_name'] = 'name';
$config['encrypt_name'] = true;
$this->upload->initialize($config);
if ($this->upload->do_upload('foto')) {
$foto = html_escape($this->upload->data('file_name'));
} else {
$foto = 'noimage.jpg';
}
}
if ($this->form_validation->run() == TRUE) {
if (@$_FILES['foto_sim']['name']) {
$config['upload_path'] = './images/fotoberkas/sim';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '100000';
$config['file_name'] = 'name';
$config['encrypt_name'] = true;
$this->upload->initialize($config);
if ($this->upload->do_upload('foto_sim')) {
$fotosim = html_escape($this->upload->data('file_name'));
} else {
$fotosim = 'noimage.jpg';
}
}
}
if ($this->form_validation->run() == TRUE) {
if (@$_FILES['foto_ktp']['name']) {
$config['upload_path'] = './images/fotoberkas/ktp';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '100000';
$config['file_name'] = 'name';
$config['encrypt_name'] = true;
$this->upload->initialize($config);
if ($this->upload->do_upload('foto_ktp')) {
$fotoktp = html_escape($this->upload->data('file_name'));
} else {
$fotoktp = 'noimage.jpg';
}
}
}
$countrycode = html_escape($this->input->post('countrycode', TRUE));
$id = 'D' . time();
$datasignup = [
'id' => $id,
'phone' => html_escape($this->input->post('phone', TRUE)),
'countrycode' => html_escape($this->input->post('countrycode', TRUE)),
'tgl_lahir' => html_escape($this->input->post('tgl_lahir', TRUE)),
'reg_id' => 'R' . time(),
'foto' => $foto,
'password' => sha1(time()),
'nama_driver' => html_escape($this->input->post('nama_driver', TRUE)),
'no_telepon' => str_replace("+", "", $countrycode) . $phone,
'email' => html_escape($this->input->post('email', TRUE)),
'gender' => html_escape($this->input->post('gender', TRUE)),
'alamat_driver' => html_escape($this->input->post('alamat_driver', TRUE)),
'job' => html_escape($this->input->post('job', TRUE)),
'wilayah' => html_escape($this->input->post('wilayah', TRUE)),
'no_ktp' => html_escape($this->input->post('no_ktp', TRUE))
];
$datakendaraan = [
'merek' => html_escape($this->input->post('merek', TRUE)),
'tipe' => html_escape($this->input->post('tipe', TRUE)),
'warna' => html_escape($this->input->post('warna', TRUE)),
'nomor_kendaraan' => html_escape($this->input->post('nomor_kendaraan', TRUE))
];
$databerkas = [
'id_driver' => $id,
'foto_sim' => $fotosim,
'foto_ktp' => $fotoktp,
'id_sim' => html_escape($this->input->post('id_sim', TRUE))
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('driver/tambah');
} else {
$this->driver->signup($datasignup, $datakendaraan, $databerkas);
$this->session->set_flashdata('tambah', 'Driver Has Been Added');
redirect('newregistration/index');
}
} else {
$data['driverjob'] = $this->driver->driverjob();
$data['partner_region'] = $this->driver->partner_region();
$this->load->view('includes/header');
$this->load->view('drivers/tambahdriver', $data);
$this->load->view('includes/footer');
}
// }
}
}

View File

@@ -0,0 +1,21 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Error404 extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('wallet_model');
}
public function index()
{
$this->load->view('nodata');
}
public function cron()
{
$this->wallet_model->updatekadaluarsa();
}
}

View File

@@ -0,0 +1,65 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Login extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->model('login_model', 'login');
}
function index()
{
if ($this->session->userdata('user_name') != NULL && $this->session->userdata('password') != NULL) {
redirect(base_url("dashboard"));
}
$this->load->view('login/index');
}
function aksi_login()
{
$nama = html_escape($this->input->post('user_name', TRUE));
$acak = html_escape($this->input->post('password', TRUE));
$pass = sha1($acak);
$user = $this->db->get_where('admin', ['user_name' => $nama])->row_array();
$passDB = $user['password'];
if ($user) {
if ($passDB != $pass) {
$this->session->set_flashdata('error', 'Wrong password!');
redirect('login');
} else {
$data = [
'id' => $user['id'],
'user_name' => $user['user_name'],
'password' => $user['password'],
'admin_role' => $user['admin_role'],
'wilayah' => $user['wilayah'],
'status' => $user['status'],
'image' => $user['image']
];
$data['menu'] = $this->login->ambil_menu($data);
$this->session->set_userdata($data);
header('Location: ' . base_url());
}
} else {
$this->session->set_flashdata('error', 'Account not registered');
redirect('login');
}
}
function logout()
{
$this->session->sess_destroy();
redirect('login');
}
}

View File

@@ -0,0 +1,734 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Mitra extends CI_Controller
{
public function __construct()
{
parent::__construct();
is_logged_in();
$this->load->model('Pelanggan_model');
$this->load->model('mitra_model', 'mitra');
$this->load->model('appsettings_model', 'app');
$this->load->model('email_model');
$this->load->library('form_validation');
$this->load->library('upload');
}
public function index()
{
$data['mitra'] = $this->mitra->getallmitra();
$this->load->view('includes/header');
$this->load->view('mitra/index', $data);
$this->load->view('includes/footer');
}
public function detail($id)
{
$data['mitra'] = $this->mitra->getmitrabyid($id);
$data['item'] = $this->mitra->getitembyid($data['mitra']['id_merchant']);
$data['itemk'] = $this->mitra->getitemkbyid($data['mitra']['id_merchant']);
$data['currency'] = $this->app->getappbyid();
$data['countorder'] = $this->mitra->countorder($data['mitra']['id_merchant']);
$data['wallet'] = $this->mitra->wallet($id);
$data['jumlah'] = count($data['item']);
$data['merchantk'] = $this->mitra->getmerchantk();
$data['transaksi'] = $this->mitra->gettranshistory($data['mitra']['id_merchant']);
$data['fitur'] = $this->mitra->get_fitur_merchant();
$data['partner_region'] = $this->mitra->partner_region();
$this->load->view('includes/header');
$this->load->view('mitra/detail', $data);
$this->load->view('includes/footer');
}
public function block($id)
{
$this->mitra->blockmitrabyid($id);
redirect('mitra');
}
public function unblock($id)
{
$this->mitra->unblockmitrabyid($id);
redirect('mitra');
}
public function tambahitem()
{
$this->form_validation->set_rules('nama_item', 'nama_item', 'trim|prep_for_form');
$this->form_validation->set_rules('harga_item', 'harga_item', 'trim|prep_for_form');
$this->form_validation->set_rules('deskripsi_item', 'deskripsi_item', 'trim|prep_for_form');
if ($this->form_validation->run() == TRUE) {
if (@$_FILES['foto_item']['name']) {
$config['upload_path'] = './images/itemmerchant';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '100000';
$config['file_name'] = 'name';
$config['encrypt_name'] = true;
$this->upload->initialize($config);
if ($this->upload->do_upload('foto_item')) {
$fotoitem = html_escape($this->upload->data('file_name'));
} else {
$fotoitem = 'noimage.jpg';
}
if ($this->input->post('status_promo') == 1) {
$promo = html_escape($this->input->post('harga_promo', TRUE));
} else {
$promo = '0';
}
$id = $this->input->post('id_mitra');
$hargaitem = html_escape($this->input->post('harga_item', TRUE));
$hargapromo = $promo;
$remove = array(".", ",");
$add = array("", "");
$data = [
'kategori_item' => html_escape($this->input->post('kategori_item', TRUE)),
'nama_item' => html_escape($this->input->post('nama_item', TRUE)),
'harga_item' => str_replace($remove, $add, $hargaitem),
'harga_promo' => str_replace($remove, $add, $hargapromo),
'id_merchant' => html_escape($this->input->post('id_merchant', TRUE)),
'deskripsi_item' => html_escape($this->input->post('deskripsi_item', TRUE)),
'status_item' => html_escape($this->input->post('status_item', TRUE)),
'status_promo' => html_escape($this->input->post('status_promo', TRUE)),
'foto_item' => $fotoitem
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('mitra/detail/' . $id);
} else {
$this->mitra->insertitem($data);
$this->session->set_flashdata('tambah', 'Item Has Been Added');
redirect('mitra/detail/' . $id);
}
}
} else {
$id = $this->input->post('id_mitra');
$this->session->set_flashdata('gagal', 'Error, Please Try Again');
$this->load->view('includes/header');
$this->load->view('mitra/detail/' . $id);
$this->load->view('includes/footer');
}
}
public function ubahitem($id)
{
$idmerchant = $this->input->post('id_merchant');
$mitra = $this->mitra->getidmitra($idmerchant);
$idm = $mitra['id_mitra'];
$this->form_validation->set_rules('nama_item', 'nama_item', 'trim|prep_for_form');
$this->form_validation->set_rules('harga_item', 'harga_item', 'trim|prep_for_form');
$this->form_validation->set_rules('deskripsi_item', 'deskripsi_item', 'trim|prep_for_form');
if ($this->form_validation->run() == TRUE) {
if (@$_FILES['foto_item']['name']) {
$config['upload_path'] = './images/itemmerchant';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '100000';
$config['file_name'] = 'name';
$config['encrypt_name'] = true;
$this->upload->initialize($config);
$foto = $this->mitra->getfotoitem($id);
if ($this->upload->do_upload('foto_item')) {
$fotoitem = $this->upload->data('file_name');
$fotolama = $foto['foto_item'];
unlink('images/itemmerchant/' . $fotolama);
} else {
$fotolama = $foto['foto_item'];
$fotoitem = $fotolama;
}
if ($this->input->post('status_promo') == 1) {
$promo = html_escape($this->input->post('harga_promo', TRUE));
} else {
$promo = '0';
}
$hargaitem = html_escape($this->input->post('harga_item', TRUE));
$hargapromo = $promo;
$remove = array(".", ",");
$add = array("", "");
$data = [
'kategori_item' => html_escape($this->input->post('kategori_item', TRUE)),
'nama_item' => html_escape($this->input->post('nama_item', TRUE)),
'harga_item' => str_replace($remove, $add, $hargaitem),
'harga_promo' => str_replace($remove, $add, $hargapromo),
'id_merchant' => html_escape($this->input->post('id_merchant', TRUE)),
'deskripsi_item' => html_escape($this->input->post('deskripsi_item', TRUE)),
'status_item' => html_escape($this->input->post('status_item', TRUE)),
'status_promo' => html_escape($this->input->post('status_promo', TRUE)),
'foto_item' => $fotoitem
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('mitra/detail/' . $idm);
} else {
$this->mitra->updateitem($data, $id);
$this->session->set_flashdata('ubah', 'Item Has Been Changed');
redirect('mitra/detail/' . $idm);
}
} else {
$foto = $this->mitra->getfotoitem($id);
$fotolama = $foto['foto_item'];
if ($this->input->post('status_promo') == 1) {
$promo = html_escape($this->input->post('harga_promo', TRUE));
} else {
$promo = '0';
}
$hargaitem = html_escape($this->input->post('harga_item', TRUE));
$hargapromo = $promo;
$remove = array(".", ",");
$add = array("", "");
$data = [
'kategori_item' => html_escape($this->input->post('kategori_item', TRUE)),
'nama_item' => html_escape($this->input->post('nama_item', TRUE)),
'harga_item' => str_replace($remove, $add, $hargaitem),
'harga_promo' => str_replace($remove, $add, $hargapromo),
'id_merchant' => html_escape($this->input->post('id_merchant', TRUE)),
'deskripsi_item' => html_escape($this->input->post('deskripsi_item', TRUE)),
'status_item' => html_escape($this->input->post('status_item', TRUE)),
'status_promo' => html_escape($this->input->post('status_promo', TRUE)),
'foto_item' => $fotolama
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('mitra/detail/' . $idm);
} else {
$this->mitra->updateitem($data, $id);
$this->session->set_flashdata('ubah', 'Item Has Been Changed');
redirect('mitra/detail/' . $idm);
}
}
} else {
$this->session->set_flashdata('gagal', 'Error, Please Try Again');
$this->load->view('includes/header');
$this->load->view('mitra/detail/' . $idm);
$this->load->view('includes/footer');
}
}
public function hapusitem($id)
{
$data = $this->mitra->getfotoitem($id);
$idmerchant = $data['id_merchant'];
$idmitra = $this->mitra->getidmitra($idmerchant);
$idm = $idmitra['id_mitra'];
$gambar = $data['foto_item'];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('mitra/detail/' . $idm);
} else {
unlink('images/itemmerchant/' . $gambar);
$this->mitra->hapusitembyid($id);
$this->session->set_flashdata('hapus', 'Item Has Been Deleted');
redirect('mitra/detail/' . $idm);
}
}
public function ubahmerchant($id)
{
$this->form_validation->set_rules('nama_merchant', 'nama_merchant', 'trim|prep_for_form');
$this->form_validation->set_rules('alamat_merchant', 'alamat_merchant', 'trim|prep_for_form');
$datafitur['fitur'] = $this->mitra->get_fitur_merchant();
if ($this->form_validation->run() == TRUE) {
$merchant = $this->mitra->getmerchantdetail($this->input->post('id_merchant'));
$fotomerchant = $merchant['foto_merchant'];
if (@$_FILES['foto_merchant']['name']) {
$config['upload_path'] = './images/merchant';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '30000';
$config['file_name'] = 'name';
$config['encrypt_name'] = true;
$this->upload->initialize($config);
if ($this->upload->do_upload('foto_merchant')) {
$fotobarumerchant = $this->upload->data('file_name');
unlink('images/itemmerchant/' . $fotomerchant);
} else {
$fotobarumerchant = $fotomerchant;
}
$data = [
'id_merchant' => html_escape($this->input->post('id_merchant', TRUE)),
'id_fitur' => html_escape($this->input->post('id_fitur', TRUE)),
'nama_merchant' => html_escape($this->input->post('nama_merchant', TRUE)),
'category_merchant' => html_escape($this->input->post('category_merchant', TRUE)),
'alamat_merchant' => html_escape($this->input->post('alamat_merchant', TRUE)),
'latitude_merchant' => html_escape($this->input->post('latitude_merchant', TRUE)),
'longitude_merchant' => html_escape($this->input->post('longitude_merchant', TRUE)),
'jam_buka' => html_escape($this->input->post('jam_buka', TRUE)),
'jam_tutup' => html_escape($this->input->post('jam_tutup', TRUE)),
'foto_merchant' => $fotobarumerchant
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('mitra/detail/' . $id);
} else {
$this->mitra->updatemerchant($data);
$this->session->set_flashdata('ubah', 'Merchant Has Been Changed');
redirect('mitra/detail/' . $id);
}
} else {
$data = [
'id_merchant' => html_escape($this->input->post('id_merchant', TRUE)),
'id_fitur' => html_escape($this->input->post('id_fitur', TRUE)),
'nama_merchant' => html_escape($this->input->post('nama_merchant', TRUE)),
'category_merchant' => html_escape($this->input->post('category_merchant', TRUE)),
'alamat_merchant' => html_escape($this->input->post('alamat_merchant', TRUE)),
'latitude_merchant' => html_escape($this->input->post('latitude_merchant', TRUE)),
'longitude_merchant' => html_escape($this->input->post('longitude_merchant', TRUE)),
'jam_buka' => html_escape($this->input->post('jam_buka', TRUE)),
'jam_tutup' => html_escape($this->input->post('jam_tutup', TRUE)),
'foto_merchant' => $fotomerchant
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('mitra/detail/' . $id);
} else {
$this->mitra->updatemerchant($data);
$this->session->set_flashdata('ubah', 'Merchant Has Been Changed');
redirect('mitra/detail/' . $id);
}
}
} else {
$this->session->set_flashdata('gagal', 'Error, Please Try Again');
$this->load->view('includes/header');
$this->load->view('mitra/detail/' . $id, $datafitur);
$this->load->view('includes/footer');
}
}
public function hapuscategoryitem($id)
{
$mitra = $this->mitra->getidmitrabycategory($id);
$idm = $mitra['id_mitra'];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('mitra/detail/' . $idm);
} else {
$this->mitra->hapuskategoryitembyid($id);
$this->session->set_flashdata('hapus', 'Item Category Has Been Deleted');
redirect('mitra/detail/' . $idm);
}
}
public function tambahcategoryitem()
{
$this->form_validation->set_rules('nama_kategori_item', 'nama_kategori_item', 'trim|prep_for_form');
if ($this->form_validation->run() == TRUE) {
$idm = $this->input->post('id_merchant');
$data = [
'nama_kategori_item' => html_escape($this->input->post('nama_kategori_item', TRUE)),
'id_merchant' => html_escape($this->input->post('id_mitra', TRUE)),
'all_category' => '0'
];
$this->mitra->tambahkategoryitembyid($data);
$this->session->set_flashdata('tambah', 'Item Category Has Been Added');
redirect('mitra/detail/' . $idm);
} else {
$idm = $this->input->post('id_merchant');
$this->session->set_flashdata('gagal', 'Error, Please Try Again');
$this->load->view('includes/header');
$this->load->view('mitra/detail/' . $idm);
$this->load->view('includes/footer');
}
}
public function ubahcategoryitem()
{
$this->form_validation->set_rules('nama_kategori_item', 'nama_kategori_item', 'trim|prep_for_form');
if ($this->form_validation->run() == TRUE) {
$idm = $this->input->post('id_mitra');
$id = $this->input->post('id_kategori_item');
$data = [
'nama_kategori_item' => html_escape($this->input->post('nama_kategori_item', TRUE)),
];
$this->mitra->ubahkategoryitembyid($data, $id);
$this->session->set_flashdata('ubah', 'Item Category Has Been Updated');
redirect('mitra/detail/' . $idm);
} else {
$idm = $this->input->post('id_mitra');
$this->session->set_flashdata('gagal', 'Error, Please Try Again');
$this->load->view('includes/header');
$this->load->view('mitra/detail/' . $idm);
$this->load->view('includes/footer');
}
}
public function editmitradetail()
{
$this->form_validation->set_rules('nama_mitra', 'nama_mitra', 'trim|prep_for_form');
$this->form_validation->set_rules('alamat_mitra', 'alamat_mitra', 'trim|prep_for_form');
$this->form_validation->set_rules('email_mitra', 'email_mitra', 'trim|prep_for_form');
$this->form_validation->set_rules('partner_region', 'partner_region', 'trim|prep_for_form');
$this->form_validation->set_rules('countrycode', 'countrycode', 'trim|prep_for_form');
$this->form_validation->set_rules('phone', 'phone', 'trim|prep_for_form');
$this->form_validation->set_rules('bank', 'bank', 'trim|prep_for_form');
$this->form_validation->set_rules('norek_mitra', 'norek_mitra', 'trim|prep_for_form');
$this->form_validation->set_rules('nama_rekening', 'nama_rekening', 'trim|prep_for_form');
$this->form_validation->set_rules('wilayah', 'wilayah', 'trim|prep_for_form');
if ($this->form_validation->run() == TRUE) {
$idm = $this->input->post('id_mitra');
$phone = html_escape($this->input->post('phone_mitra', TRUE));
$countrycode = html_escape($this->input->post('country_code_mitra', TRUE));
$remove = array("+", "-");
$data = [
'nama_mitra' => html_escape($this->input->post('nama_mitra', TRUE)),
'alamat_mitra' => html_escape($this->input->post('alamat_mitra', TRUE)),
'email_mitra' => html_escape($this->input->post('email_mitra', TRUE)),
'partner' => $this->input->post('partner'),
'phone_mitra' => $phone,
'country_code_mitra' => $countrycode,
'telepon_mitra' => str_replace($remove, '', $countrycode) . $phone,
'bank' => html_escape($this->input->post('bank', TRUE)),
'norek_mitra' => html_escape($this->input->post('norek_mitra', TRUE)),
'nama_rekening' => html_escape($this->input->post('nama_rekening', TRUE)),
'wilayah' => html_escape($this->input->post('wilayah', TRUE)),
];
$datamerchant = [
'id_merchant' => html_escape($this->input->post('id_merchant', TRUE)),
'phone_merchant' => $phone,
'country_code_merchant' => $countrycode,
'telepon_merchant' => str_replace($remove, '', $countrycode) . $phone,
];
$this->mitra->ubahmitrabyid($data, $idm);
$this->mitra->updatemerchant($datamerchant);
$this->session->set_flashdata('ubah', 'Mitra Has Been Updated');
redirect('mitra/detail/' . $idm);
} else {
$idm = $this->input->post('id_mitra');
$this->session->set_flashdata('gagal', 'Error, Please Try Again');
$this->load->view('includes/header');
$this->load->view('mitra/detail/' . $idm);
$this->load->view('includes/footer');
}
}
public function editmitrafile()
{
$this->form_validation->set_rules('jenis_identitas_mitra', 'jenis_identitas_mitra', 'trim|prep_for_form');
$this->form_validation->set_rules('nomor_identitas_mitra', 'nomor_identitas_mitra', 'trim|prep_for_form');
$id = $this->input->post('id_mitra');
if ($this->form_validation->run() == TRUE) {
$foto = $this->mitra->getmitrabyid($id);
$fotoktp = $foto['foto_ktp'];
if (@$_FILES['foto_ktp']['name']) {
$config['upload_path'] = './images/fotoberkas/ktp';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '100000';
$config['file_name'] = 'name';
$config['encrypt_name'] = true;
$this->upload->initialize($config);
if ($this->upload->do_upload('foto_ktp')) {
$fotobaruktp = $this->upload->data('file_name');
unlink('images/fotoberkas/ktp/' . $fotoktp);
} else {
$fotobaruktp = $fotoktp;
}
$data = [
'jenis_identitas_mitra' => html_escape($this->input->post('jenis_identitas_mitra', TRUE)),
'nomor_identitas_mitra' => html_escape($this->input->post('nomor_identitas_mitra', TRUE)),
'foto_ktp' => $fotobaruktp
];
$this->mitra->ubahfilemitrabyid($data, $id);
$this->session->set_flashdata('ubah', 'Mitra files Has Been Updated');
redirect('mitra/detail/' . $id);
} else {
$data = [
'jenis_identitas_mitra' => html_escape($this->input->post('jenis_identitas_mitra', TRUE)),
'nomor_identitas_mitra' => html_escape($this->input->post('nomor_identitas_mitra', TRUE)),
'foto_ktp' => $fotoktp
];
$this->mitra->ubahfilemitrabyid($data, $id);
$this->session->set_flashdata('ubah', 'Mitra files Has Been Updated');
redirect('mitra/detail/' . $id);
}
} else {
$this->session->set_flashdata('gagal', 'Error, Please Try Again');
$this->load->view('includes/header');
$this->load->view('mitra/detail/' . $id);
$this->load->view('includes/footer');
}
}
public function editmitrapass()
{
$this->form_validation->set_rules('password', 'password', 'trim|prep_for_form');
$idm = $this->input->post('id_mitra');
if ($this->form_validation->run() == TRUE) {
$pass = html_escape($this->input->post('password', TRUE));
$data = [
'password' => sha1($pass),
];
$this->mitra->ubahpassmitrabyid($data, $idm);
$this->session->set_flashdata('ubah', 'Mitra password Has Been Updated');
redirect('mitra/detail/' . $idm);
} else {
$this->session->set_flashdata('gagal', 'Error, Please Try Again');
$this->load->view('includes/header');
$this->load->view('mitra/detail/' . $idm);
$this->load->view('includes/footer');
}
}
public function hapus($id)
{
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('mitra/detail/' . $id);
} else {
$berkas = $this->mitra->getberkasbyid($id);
$fotoktp = $berkas['foto_ktp'];
unlink('images/fotoberkas/ktp/' . $fotoktp);
$this->mitra->hapusmitrabyid($id);
$this->session->set_flashdata('hapus', 'Owner Merchant Has Been Deleted');
redirect('mitra');
}
}
public function newregmitra()
{
$data['mitra'] = $this->mitra->getallmitra();
$data['merchantk'] = $this->mitra->getmerchantk();
$data['fitur'] = $this->mitra->get_fitur_merchant();
$this->load->view('includes/header');
$this->load->view('mitra/newreg', $data);
$this->load->view('includes/footer');
}
public function confirmmitra($id)
{
$this->mitra->ubahstatusmitra($id);
$item = $this->app->getappbyid();
$token = sha1(rand(0, 999999) . time());
$dataforgot = array(
'userid' => $id,
'token' => $token,
'idKey' => '3'
);
$this->Pelanggan_model->dataforgot($dataforgot);
$linkbtn = base_url() . 'resetpass/rest/' . $token . '/3';
$judul_email = $item['email_subject_confirm'] . '[ticket-' . rand(0, 999999) . ']';
$template = $this->Pelanggan_model->template1($item['email_subject_confirm'], $item['email_text3'], $item['email_text4'], $item['app_website'], $item['app_name'], $linkbtn, $item['app_linkgoogle'], $item['app_address']);
$email = $this->mitra->getmitrabyid($id);
$emailuser = $email['email_mitra'];
$host = $item['smtp_host'];
$port = $item['smtp_port'];
$username = $item['smtp_username'];
$password = $item['smtp_password'];
$from = $item['smtp_from'];
$appname = $item['app_name'];
$secure = $item['smtp_secure'];
$this->email_model->emailsend($judul_email, $emailuser, $template, $host, $port, $username, $password, $from, $appname, $secure);
$this->session->set_flashdata('ubah', 'Mitra Has Been Confirm');
redirect('mitra');
}
public function tambahmitra()
{
$this->form_validation->set_rules('nama_mitra', 'nama_mitra', 'trim|prep_for_form');
$this->form_validation->set_rules('alamat_mitra', 'alamat_mitra', 'trim|prep_for_form');
$this->form_validation->set_rules('email_mitra', 'email_mitra', 'trim|prep_for_form|is_unique[mitra.email_mitra]');
$this->form_validation->set_rules('phone_mitra', 'phone_mitra', 'trim|prep_for_form|is_unique[mitra.phone_mitra]');
$this->form_validation->set_rules('country_code_mitra', 'country_code_mitra', 'trim|prep_for_form');
$this->form_validation->set_rules('jenis_identitas_mitra', 'jenis_identitas_mitra', 'trim|prep_for_form');
$this->form_validation->set_rules('nomor_identitas_mitra', 'nomor_identitas_mitra', 'trim|prep_for_form');
$this->form_validation->set_rules('nama_merchant', 'nama_merchant', 'trim|prep_for_form');
$this->form_validation->set_rules('id_fitur', 'id_fitur', 'trim|prep_for_form');
$this->form_validation->set_rules('category_merchant', 'category_merchant', 'trim|prep_for_form');
$this->form_validation->set_rules('alamat_merchant', 'alamat_merchant', 'trim|prep_for_form');
$this->form_validation->set_rules('jam_buka', 'jam_buka', 'trim|prep_for_form');
$this->form_validation->set_rules('jam_tutup', 'jam_tutup', 'trim|prep_for_form');
if ($this->input->post('category_merchant') == NUll) {
$this->session->set_flashdata('gagal', 'Please Add Category Merchant First');
redirect('mitra/newregmitra');
}
if ($this->form_validation->run() == TRUE) {
if (@$_FILES['foto_merchant']['name']) {
$config['upload_path'] = './images/merchant';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '100000';
$config['file_name'] = 'name';
$config['encrypt_name'] = true;
$this->upload->initialize($config);
if ($this->upload->do_upload('foto_merchant')) {
$fotomerchant = html_escape($this->upload->data('file_name'));
}
if ($this->form_validation->run() == TRUE) {
if (@$_FILES['katepe']['name']) {
$config['upload_path'] = './images/fotoberkas/ktp';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '100000';
$config['file_name'] = 'name';
$config['encrypt_name'] = true;
$this->upload->initialize($config);
if ($this->upload->do_upload('katepe')) {
$fotoktp = html_escape($this->upload->data('file_name'));
}
}
}
}
$countrycode = html_escape($this->input->post('country_code_mitra', TRUE));
$phone = html_escape($this->input->post('phone_mitra', TRUE));
$id = 'M' . time();
$datamerchant = [
'id_fitur' => html_escape($this->input->post('id_fitur', TRUE)),
'nama_merchant' => html_escape($this->input->post('nama_merchant', TRUE)),
'alamat_merchant' => html_escape($this->input->post('alamat_merchant', TRUE)),
'latitude_merchant' => html_escape($this->input->post('latitude_merchant', TRUE)),
'longitude_merchant' => html_escape($this->input->post('longitude_merchant', TRUE)),
'jam_buka' => html_escape($this->input->post('jam_buka', TRUE)),
'jam_tutup' => html_escape($this->input->post('jam_tutup', TRUE)),
'category_merchant' => html_escape($this->input->post('category_merchant', TRUE)),
'foto_merchant' => $fotomerchant,
'telepon_merchant' => str_replace("+", "", $countrycode) . $phone,
'country_code_merchant' => $countrycode,
'phone_merchant' => $phone,
'status_merchant' => '0',
'token_merchant' => sha1(time())
];
$idmerchant = $this->mitra->insertmerchant($datamerchant);
$datamitra = [
'id_mitra' => $id,
'nama_mitra' => html_escape($this->input->post('nama_mitra', TRUE)),
'jenis_identitas_mitra' => html_escape($this->input->post('jenis_identitas_mitra', TRUE)),
'nomor_identitas_mitra' => html_escape($this->input->post('nomor_identitas_mitra', TRUE)),
'alamat_mitra' => html_escape($this->input->post('alamat_mitra', TRUE)),
'email_mitra' => html_escape($this->input->post('email_mitra', TRUE)),
'password' => sha1(time()),
'telepon_mitra' => str_replace("+", "", $countrycode) . $phone,
'country_code_mitra' => $countrycode,
'phone_mitra' => $phone,
'id_merchant' => $idmerchant,
'partner' => '0',
'status_mitra' => '0'
];
$databerkas = [
'id_driver' => $id,
'foto_ktp' => $fotoktp,
];
$datasaldo = [
'id_user' => $id,
'saldo' => 0
];
$this->mitra->tambahkanmitra($datamitra, $databerkas, $datasaldo);
$this->session->set_flashdata('tambah', 'Merchant Has Been Added');
redirect('mitra/newregmitra');
} else {
$data['mitra'] = $this->mitra->getallmitra();
$data['merchantk'] = $this->mitra->getmerchantk();
$this->load->view('includes/header');
$this->load->view('mitra/newreg', $data);
$this->load->view('includes/footer');
}
}
public function edititem($id)
{
$data['item'] = $this->mitra->getitembyiditem($id);
$data['itemk'] = $this->mitra->getitemkbyid($data['item']['id_merchant']);
$data['currency'] = $this->app->getappbyid();
$this->load->view('includes/header');
$this->load->view('mitra/edititem', $data);
$this->load->view('includes/footer');
}
}

View File

@@ -0,0 +1,61 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class newregistration extends CI_Controller
{
public function __construct()
{
parent::__construct();
is_logged_in();
$this->load->model('driver_model', 'driver');
$this->load->model('Pelanggan_model');
$this->load->model('email_model');
$this->load->model('appsettings_model', 'app');
}
public function index()
{
$data['driver'] = $this->driver->getalldriver();
$this->load->view('includes/header');
$this->load->view('newregistration/index', $data);
$this->load->view('includes/footer');
}
public function confirm($id)
{
$this->driver->ubahstatusnewreg($id);
$item = $this->app->getappbyid();
$token = sha1(rand(0, 999999) . time());
$dataforgot = array(
'userid' => $id,
'token' => $token,
'idKey' => '2'
);
$this->Pelanggan_model->dataforgot($dataforgot);
$linkbtn = base_url() . 'resetpass/rest/' . $token . '/2';
$judul_email = $item['email_subject_confirm'] . '[ticket-' . rand(0, 999999) . ']';
$template = $this->Pelanggan_model->template1($item['email_subject_confirm'], $item['email_text3'], $item['email_text4'], $item['app_website'], $item['app_name'], $linkbtn, $item['app_linkgoogle'], $item['app_address']);
$email = $this->driver->getdriverbyid($id);
$emailuser = $email['email'];
$host = $item['smtp_host'];
$port = $item['smtp_port'];
$username = $item['smtp_username'];
$password = $item['smtp_password'];
$from = $item['smtp_from'];
$appname = $item['app_name'];
$secure = $item['smtp_secure'];
$this->email_model->emailsend($judul_email, $emailuser, $template, $host, $port, $username, $password, $from, $appname, $secure);
$this->session->set_flashdata('ubah', 'Driver berhasil bergabung');
redirect('driver');
}
}

View File

@@ -0,0 +1,184 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class News extends CI_Controller
{
public function __construct()
{
parent::__construct();
is_logged_in();
$this->load->model('news_model', 'news');
$this->load->library('form_validation');
}
public function index()
{
$data['news'] = $this->news->getallnews();
$data['kategori'] = $this->news->getallkategorinews();
$this->load->view('includes/header');
$this->load->view('news/index', $data);
$this->load->view('includes/footer');
}
public function hapuscategory($id)
{
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('news/index');
} else {
$this->news->hapuskategoribyid($id);
$this->session->set_flashdata('hapus', 'Category News Has Been Deleted');
redirect('news');
}
}
public function tambah()
{
$this->form_validation->set_rules('title', 'title', 'trim|prep_for_form');
$this->form_validation->set_rules('id_kategori', 'id_kategori', 'trim|prep_for_form');
if ($this->form_validation->run() == TRUE) {
$config['upload_path'] = './images/berita/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '100000';
$config['file_name'] = 'name';
$config['encrypt_name'] = true;
$this->load->library('upload', $config);
if ($this->upload->do_upload('foto_berita')) {
$gambar = html_escape($this->upload->data('file_name'));
} else {
$gambar = 'noimage.jpg';
}
$data = [
'foto_berita' => $gambar,
'title' => html_escape($this->input->post('title', TRUE)),
'content' => $this->input->post('content', TRUE),
'id_kategori' => html_escape($this->input->post('id_kategori', TRUE)),
'status_berita' => html_escape($this->input->post('status_berita', TRUE))
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('news/tambah');
} else {
$this->news->tambahdataberita($data);
$this->session->set_flashdata('tambah', 'Category News Has Been Added');
redirect('news');
}
} else {
$data['news'] = $this->news->getallkategorinews();
$this->load->view('includes/header');
$this->load->view('news/addnews', $data);
$this->load->view('includes/footer');
}
}
public function hapus($id)
{
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('news/index');
} else {
$data = $this->news->getnewsById($id);
if ($data['foto_berita'] != 'noimage.jpg') {
$gambar = $data['foto_berita'];
unlink('images/berita/' . $gambar);
}
$this->news->hapusberitaById($id);
$this->session->set_flashdata('hapus', 'News Has Been Deleted');
redirect('news');
}
}
public function ubah($id)
{
$this->form_validation->set_rules('title', 'title', 'trim|prep_for_form');
$this->form_validation->set_rules('id_kategori', 'id_kategori', 'trim|prep_for_form');
$data['news'] = $this->news->getnewsById($id);
$id = html_escape($this->input->post('id_berita', TRUE));
if ($this->form_validation->run() == TRUE) {
$config['upload_path'] = './images/berita/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '100000';
$config['file_name'] = 'name';
$config['encrypt_name'] = true;
$this->load->library('upload', $config);
if ($this->upload->do_upload('foto_berita')) {
if ($data['news']['foto_berita'] != 'noimage.jpg') {
$gambar = $data['news']['foto_berita'];
unlink('images/berita/' . $gambar);
}
$gambar = html_escape($this->upload->data('file_name'));
} else {
$gambar = $data['news']['foto_berita'];
}
$data = [
'id_berita' => html_escape($this->input->post('id_berita', TRUE)),
'foto_berita' => $gambar,
'title' => html_escape($this->input->post('title', TRUE)),
'content' => $this->input->post('content'),
'id_kategori' => html_escape($this->input->post('id_kategori', TRUE)),
'status_berita' => html_escape($this->input->post('status_berita', TRUE))
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('news/index');
} else {
$this->news->ubahdataberita($data);
$this->session->set_flashdata('ubah', 'News Has Been Changed');
redirect('news');
}
} else {
$data['knews'] = $this->news->getallkategorinews();
$this->load->view('includes/header');
$this->load->view('news/editnews', $data);
$this->load->view('includes/footer');
}
}
public function tambahcategory()
{
$this->form_validation->set_rules('kategori', 'kategori', 'trim|prep_for_form');
if ($this->form_validation->run() == TRUE) {
$data = [
'kategori' => html_escape($this->input->post('kategori', TRUE))
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('news/index');
} else {
$this->news->tambahdatakategori($data);
$this->session->set_flashdata('tambah', 'Has Been added');
redirect('news');
}
} else {
$this->load->view('includes/header');
$this->load->view('news/addcategory');
$this->load->view('includes/footer');
}
}
}

View File

@@ -0,0 +1,105 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Partnerjob extends CI_Controller
{
public function __construct()
{
parent::__construct();
is_logged_in();
$this->load->model('Partnerjob_model', 'partnerjob');
$this->load->library('form_validation');
}
public function index()
{
$data['partnerjob'] = $this->partnerjob->getAllpartnerjob();
$this->load->view('includes/header');
$this->load->view('partnerjob/index', $data);
$this->load->view('includes/footer');
}
public function addpartnerjob()
{
$this->form_validation->set_rules('icon', 'icon', 'trim|prep_for_form');
$this->form_validation->set_rules('driver_job', 'driver_job', 'trim|prep_for_form');
$this->form_validation->set_rules('status_job', 'status_job', 'trim|prep_for_form');
if ($this->form_validation->run() == TRUE) {
$data = [
'icon' => html_escape($this->input->post('icon', TRUE)),
'driver_job' => html_escape($this->input->post('driver_job', TRUE)),
'status_job' => html_escape($this->input->post('status_job', TRUE))
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('partnerjob/addpartnerjob');
} else {
$this->partnerjob->addpartnerjob($data);
$this->session->set_flashdata('tambah', 'Partner Job Has Been Added');
redirect('partnerjob');
}
} else {
$this->load->view('includes/header');
$this->load->view('partnerjob/addpartnerjob');
$this->load->view('includes/footer');
}
}
public function editpartnerjob($id)
{
$this->form_validation->set_rules('icon', 'icon', 'trim|prep_for_form');
$this->form_validation->set_rules('driver_job', 'driver_job', 'trim|prep_for_form');
$this->form_validation->set_rules('status_job', 'status_job', 'trim|prep_for_form');
$data['partnerjob'] = $this->partnerjob->getpartnerjobById($id);
$id = html_escape($this->input->post('id', TRUE));
if ($this->form_validation->run() == TRUE) {
$data = [
'id' => html_escape($this->input->post('id', TRUE)),
'icon' => html_escape($this->input->post('icon', TRUE)),
'driver_job' => html_escape($this->input->post('driver_job', TRUE)),
'status_job' => html_escape($this->input->post('status_job', TRUE))
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('partnerjob/index');
} else {
$this->partnerjob->editdatapartnerjob($data);
$this->session->set_flashdata('tambah', 'Partner Job Has Been Changed');
redirect('partnerjob');
}
} else {
$this->load->view('includes/header');
$this->load->view('partnerjob/editpartnerjob', $data);
$this->load->view('includes/footer');
}
}
public function deletepartnerjob($id)
{
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('partnerjob/index');
} else {
$data = $this->partnerjob->getpartnerjobById($id);
$this->partnerjob->deletepartnerjobById($id);
$this->session->set_flashdata('hapus', 'Partner Job Has Been deleted');
redirect('partnerjob');
}
}
}

View File

@@ -0,0 +1,105 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class partnerregion extends CI_Controller
{
public function __construct()
{
parent::__construct();
is_logged_in();
$this->load->model('PartnerRegion_model', 'partnerregion');
$this->load->library('form_validation');
}
public function index()
{
$data['partnerregion'] = $this->partnerregion->getAllpartnerregion();
$this->load->view('includes/header');
$this->load->view('partnerregion/index', $data);
$this->load->view('includes/footer');
}
public function addpartnerregion()
{
$this->form_validation->set_rules('nama_cabang', 'nama_cabang', 'trim|prep_for_form');
$this->form_validation->set_rules('partner_region', 'partner_region', 'trim|prep_for_form');
$this->form_validation->set_rules('status_region', 'status_region', 'trim|prep_for_form');
if ($this->form_validation->run() == TRUE) {
$data = [
'nama_cabang' => html_escape($this->input->post('nama_cabang', TRUE)),
'partner_region' => html_escape($this->input->post('partner_region', TRUE)),
'status_region' => html_escape($this->input->post('status_region', TRUE))
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('partnerregion/addpartnerregion');
} else {
$this->partnerregion->addpartnerregion($data);
$this->session->set_flashdata('tambah', 'Partner Region Has Been Added');
redirect('partnerregion');
}
} else {
$this->load->view('includes/header');
$this->load->view('partnerregion/addpartnerregion');
$this->load->view('includes/footer');
}
}
public function editpartnerregion($id)
{
$this->form_validation->set_rules('nama_cabang', 'nama_cabang', 'trim|prep_for_form');
$this->form_validation->set_rules('partner_region', 'partner_region', 'trim|prep_for_form');
$this->form_validation->set_rules('status_region', 'status_region', 'trim|prep_for_form');
$data['partnerregion'] = $this->partnerregion->getpartnerregionById($id);
$id = html_escape($this->input->post('id', TRUE));
if ($this->form_validation->run() == TRUE) {
$data = [
'id' => html_escape($this->input->post('id', TRUE)),
'nama_cabang' => html_escape($this->input->post('nama_cabang', TRUE)),
'partner_region' => html_escape($this->input->post('partner_region', TRUE)),
'status_region' => html_escape($this->input->post('status_region', TRUE))
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('partnerregion/index');
} else {
$this->partnerregion->editdatapartnerregion($data);
$this->session->set_flashdata('tambah', 'Partner Region Has Been Changed');
redirect('partnerregion');
}
} else {
$this->load->view('includes/header');
$this->load->view('partnerregion/editpartnerregion', $data);
$this->load->view('includes/footer');
}
}
public function deletepartnerregion($id)
{
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('partnerregion/index');
} else {
$data = $this->partnerregion->getpartnerregionById($id);
$this->partnerregion->deletepartnerregionById($id);
$this->session->set_flashdata('hapus', 'Partner Region Has Been deleted');
redirect('partnerregion');
}
}
}

View File

@@ -0,0 +1,413 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Profile extends CI_Controller
{
public function __construct()
{
parent::__construct();
is_logged_in();
$this->load->model('profile_model', 'profile');
// $this->load->model('news_model', 'news');
$this->load->library('form_validation');
}
public function index()
{
// $data['news'] = $this->news->getallnews();
$data['pengguna'] = $this->profile->getadmin();
$data['admin_role'] = $this->profile->getadminRole();
$data['role_privilage'] = $this->profile->getadminRolePrivilage();
$this->load->view('includes/header');
$this->load->view('profile/index', $data);
$this->load->view('includes/footer');
}
public function user_pengguna($id="")
{
$data['region'] = $this->profile->getRegion();
$id_admin = html_escape($this->input->post('id', TRUE));
$username = html_escape($this->input->post('username', TRUE));
$password = html_escape($this->input->post('password', TRUE));
$countrycode = html_escape($this->input->post('countrycode', TRUE));
$phone = html_escape($this->input->post('phone', TRUE));
$email = html_escape($this->input->post('e_mail', TRUE));
$this->form_validation->set_rules('username', 'USERNAME', 'trim|prep_for_form');
$this->form_validation->set_rules('fullnama', 'NAME', 'trim|prep_for_form');
$this->form_validation->set_rules('phone', 'PHONE', 'trim|prep_for_form|is_unique[pelanggan.phone]');
$this->form_validation->set_rules('e_mail', 'E_MAIL', 'trim|prep_for_form|is_unique[pelanggan.email]');
$this->form_validation->set_rules('password', 'PASSWORD', 'trim|prep_for_form');
if ($this->form_validation->run() == TRUE) {
$config['upload_path'] = './images/admin/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '100000';
$config['file_name'] = 'name';
$config['encrypt_name'] = true;
$this->load->library('upload', $config);
if ($this->upload->do_upload('image_profile')) {
$foto = html_escape($this->upload->data('file_name'));
} else {
$foto = 'noimage.jpg';
}
$data = [
'id' => html_escape($this->input->post('id', TRUE)),
'user_name' => html_escape($this->input->post('username', TRUE)),
'password' => sha1($password),
'email' => html_escape($this->input->post('e_mail', TRUE)),
'image' => $foto,
'nama' => html_escape($this->input->post('fullnama', TRUE)),
'wilayah' => html_escape($this->input->post('region', TRUE)),
'no_telepon' => str_replace("+", "", $countrycode) . $phone,
'admin_role' => html_escape($this->input->post('role', TRUE)),
'status' => html_escape($this->input->post('status', TRUE)),
];
if ($id_admin !="") {
$this->profile->ubahdataadmin($data);
$this->session->set_flashdata('tambah', 'Berhasil merubah data role user');
redirect('profile/index');
} else {
$this->profile->tambahadmin($data);
$this->session->set_flashdata('tambah', 'User Has Been Added');
redirect('profile/index');
}
} else {
if($id !=""){
// echo $id;
$data['data'] = $this->profile->getadmingedit($id);
$data['role'] = $this->profile->getRole();
$data['role1'] = $this->profile->getRole1();
// dd ($data['nama_fitur']);
$this->load->view('includes/header');
$this->load->view('profile/tambahuseradmin', $data);
$this->load->view('includes/footer');
}else{
$data['role'] = $this->profile->getRole();
$data['role1'] = $this->profile->getRole1();
$data['data'] ="";
$this->load->view('includes/header');
$this->load->view('profile/tambahuseradmin',$data);
$this->load->view('includes/footer');
}
// }
}
}
public function hapus_pengguna($id)
{
$data = $this->profile->getadmingedit($id);
if ($data['image'] != 'noimage.jpg') {
$gambar = $data['image'];
unlink('images/promo/' . $gambar);
}
$this->profile->hapus_pengguna($id);
$this->session->set_flashdata('hapus', 'User berhasil dihapus');
redirect('profile');
}
public function ubah()
{
$this->form_validation->set_rules('user_name', 'user_name', 'trim|prep_for_form');
$this->form_validation->set_rules('nama', 'nama', 'trim|prep_for_form');
$this->form_validation->set_rules('email', 'email', 'trim|prep_for_form');
$data = $this->profile->getadmin();
if ($this->form_validation->run() == TRUE) {
$config['upload_path'] = './images/admin/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '10000';
$config['file_name'] = 'name';
$config['encrypt_name'] = true;
$this->load->library('upload', $config);
if ($this->upload->do_upload('image')) {
if ($data['image'] != 'noimage.jpg') {
$image = $data['image'];
unlink('images/admin/' . $image);
}
$gambar = html_escape($this->upload->data('file_name'));
} else {
$gambar = $data['image'];
}
if ($this->input->post('password', TRUE) == NULL) {
$pass = $data['password'];
} else {
$pass = html_escape(sha1($this->input->post('password', TRUE)));
}
$data = [
'id' => html_escape($this->input->post('id', TRUE)),
'image' => $gambar,
'user_name' => html_escape($this->input->post('user_name', TRUE)),
'nama' => html_escape($this->input->post('nama', TRUE)),
'email' => html_escape($this->input->post('email', TRUE)),
'password' => $pass
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NGAPAIN DIGANTI PASSWORDNYA :D :P');
redirect('profile/index');
} else {
$this->profile->ubahdataadmin($data);
$this->session->set_userdata($data);
$this->session->set_flashdata('diubah', 'Has Been Changed');
redirect('profile');
}
} else {
$data['data'] = $this->profile->ubahdataadmin();
$this->load->view('includes/header');
$this->load->view('profile/ubahpengguna', $data);
$this->load->view('includes/footer');
}
}
public function role($id="")
{
$id_prifilage = html_escape($this->input->post('id', TRUE));
$role = html_escape($this->input->post('role', TRUE));
$this->form_validation->set_rules('role', 'NAME', 'trim|prep_for_form');
if ($this->form_validation->run() == TRUE) {
$data = [
'id' => html_escape($this->input->post('id', TRUE)),
'nama_role' => html_escape($this->input->post('role', TRUE)),
];
if ($id_prifilage !="") {
$this->profile->editrole($data);
$this->session->set_flashdata('tambah', 'Berhasil merubah data role user');
redirect('profile/index');
} else {
$this->profile->tambahrole($data);
$this->session->set_flashdata('tambah', 'Berhasil menambahkan data role user');
redirect('profile/index');
}
} else {
if($id !=""){
// echo $id;
$data['data'] = $this->profile->getadminrolegedit($id);
// dd ($data['nama_fitur']);
$this->load->view('includes/header');
$this->load->view('profile/tambahrole', $data);
$this->load->view('includes/footer');
}else{
$data['data'] ="";
$this->load->view('includes/header');
$this->load->view('profile/tambahrole', $data);
$this->load->view('includes/footer');
}
// }
}
}
public function privilage($id="")
{
$id_prifilage = html_escape($this->input->post('id', TRUE));
$namafitur = html_escape($this->input->post('namafitur', TRUE));
$url = html_escape($this->input->post('url', TRUE));
$icon = html_escape($this->input->post('icon', TRUE));
$this->form_validation->set_rules('fullnama', 'NAME', 'trim|prep_for_form');
$this->form_validation->set_rules('icon', 'ICON', 'trim|prep_for_form');
if ($this->form_validation->run() == TRUE) {
$data = [
'id' => html_escape($this->input->post('id', TRUE)),
'nama_fitur' => html_escape($this->input->post('namafitur', TRUE)),
'url' => html_escape($this->input->post('url', TRUE)),
'icon' => html_escape($this->input->post('icon', TRUE)),
];
if ($id_prifilage !="") {
$this->profile->editprifilage($data);
$this->session->set_flashdata('tambah', 'Berhasil merubah data privilage');
redirect('profile/index');
} else {
$this->profile->tambahprifilage($data);
$this->session->set_flashdata('tambah', 'Berhasil menambahkan data privilage');
redirect('profile/index');
}
} else {
if($id !=""){
// echo $id;
$data['data'] = $this->profile->getadminPrifilagedit($id);
// dd ($data['nama_fitur']);
$this->load->view('includes/header');
$this->load->view('profile/tambahprivilage', $data);
$this->load->view('includes/footer');
}else{
$data['data'] ="";
$this->load->view('includes/header');
$this->load->view('profile/tambahprivilage', $data);
$this->load->view('includes/footer');
}
// }
}
}
public function sub_privilage($id="")
{
$id_prifilage = html_escape($this->input->post('id', TRUE));
$namafitur = html_escape($this->input->post('namafitur', TRUE));
$url = html_escape($this->input->post('url', TRUE));
$icon = html_escape($this->input->post('icon', TRUE));
$this->form_validation->set_rules('fullnama', 'NAME', 'trim|prep_for_form');
$this->form_validation->set_rules('icon', 'ICON', 'trim|prep_for_form');
if ($this->form_validation->run() == TRUE) {
$data = [
'id' => html_escape($this->input->post('id', TRUE)),
'nama_fitur' => html_escape($this->input->post('namafitur', TRUE)),
'url' => html_escape($this->input->post('url', TRUE)),
'foregn' => html_escape($this->input->post('role', TRUE)),
];
if ($id_prifilage !="") {
$this->profile->editprifilage($data);
$this->session->set_flashdata('tambah', 'Berhasil merubah data privilage');
redirect('profile/index');
} else {
$this->profile->tambahprifilage($data);
$this->session->set_flashdata('tambah', 'Berhasil menambahkan data privilage');
redirect('profile/index');
}
} else {
if($id !=""){
// echo $id;
$data['data'] = $this->profile->getadminPrifilagedit($id);
// dd ($data['nama_fitur']);
$data['menu_sub'] = $this->profile->getmenuSubPrifilage();
$this->load->view('includes/header');
$this->load->view('profile/tambahprivilagesub', $data);
$this->load->view('includes/footer');
}else{
$data['data'] ="";
$data['menu_sub'] = $this->profile->getmenuSubPrifilage();
// dd( $data);
$this->load->view('includes/header');
$this->load->view('profile/tambahprivilagesub',$data);
$this->load->view('includes/footer');
}
// }
}
}
public function role_privilage($id="")
{
$cek_menu_prifilage = $this->profile->getmenuPrifilage($id);
// dd($cek_menu_prifilage);
$id_prifilage = html_escape($this->input->post('id', TRUE));
$role = html_escape($this->input->post('role', TRUE));
$this->form_validation->set_rules('role', 'NAME', 'trim|prep_for_form');
if ($this->form_validation->run() == TRUE) {
$id_role = $_POST['id_role'];
$parent = $_POST['parent'];
$child = $_POST['child'];
foreach ($parent as $pr) {
$id_privilage = isset($pr['id_privilage']) ? ($pr['id_privilage']) : NULL;
$id_menu_role = isset($pr['id_menu_role']) ? ($pr['id_menu_role']) : NULL;
$cek = isset($pr['cek']) ? ($pr['cek']) : NULL;
if($id_menu_role !=""){
$this->profile->deledemenurolprifilage($id_menu_role);
}
if($cek !=""){
$data = [
'id_privilage' => html_escape($id_privilage, TRUE),
'id_role' => html_escape($id_role, TRUE),
'parent' => 'Y',
];
$this->profile->tambahmenurolprifilage($data);
}
}
foreach ($child as $ch) {
$id_privilage = isset($ch['id_privilage']) ? ($ch['id_privilage']) : NULL;
$id_menu_role_child = isset($ch['id_menu_role']) ? ($ch['id_menu_role']) : NULL;
$cek_child = isset($ch['cek_child']) ? ($ch['cek_child']) : NULL;
// dd($child);
if($id_menu_role_child !=""){
$this->profile->deledemenurolprifilage($id_menu_role_child);
}
if($cek_child !=""){
$data = [
'id_privilage' => html_escape($id_privilage, TRUE),
'id_role' => html_escape($id_role, TRUE),
];
$this->profile->tambahmenurolprifilage($data);
}
}
$this->session->set_flashdata('tambah', 'Berhasil menambahkan menu role');
redirect('profile/index');
// $data = [
// 'id' => html_escape($this->input->post('id', TRUE)),
// 'nama_role' => html_escape($this->input->post('role', TRUE)),
// ];
// if ($id_prifilage !="") {
// $this->profile->editrole($data);
// $this->session->set_flashdata('tambah', 'Berhasil merubah data role user');
// redirect('profile/index');
// } else {
// $this->profile->tambahrole($data);
// $this->session->set_flashdata('tambah', 'Berhasil menambahkan data role user');
// redirect('profile/index');
// }
} else {
if($cek_menu_prifilage !=""){
$data['act'] = $this->profile->getadminRolePrivilage();
$data['sub'] = $this->profile->getadminRolePrivilage();
$data['role'] = $this->profile->getadminrolegedit($id);
$data['privilage_menu'] = $this->profile->getmenuPrifilage($id);
// dd ($data['nama_fitur']);
$this->load->view('includes/header');
$this->load->view('profile/tambahroleprivilage', $data);
$this->load->view('includes/footer');
}else{
$data['act'] = $this->profile->getadminRolePrivilage();
$data['sub'] = $this->profile->getadminRolePrivilage();
$data['role'] = $this->profile->getadminrolegedit($id);
$data['privilage_menu'] = $this->profile->getmenuPrifilage($id);
$this->load->view('includes/header');
$this->load->view('profile/tambahroleprivilage', $data);
$this->load->view('includes/footer');
}
// }
}
}
public function unblock($id)
{
$this->profile->unblockuserbyid($id);
redirect('profile');
}
public function userblock($id)
{
$this->profile->blockuserbyid($id);
redirect('profile');
}
}

View File

@@ -0,0 +1,193 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Promocode extends CI_Controller
{
public function __construct()
{
parent::__construct();
is_logged_in();
$this->load->model('Promocode_model', 'promocode');
$this->load->model('Service_model', 'fitur');
$this->load->library('form_validation');
}
public function index()
{
$data['promocode'] = $this->promocode->getallpromocode();
$this->load->view('includes/header');
$this->load->view('promocode/index',$data);
$this->load->view('includes/footer');
}
public function addpromocode()
{
$this->form_validation->set_rules('nama_promo', 'nama_promo', 'trim|prep_for_form');
$this->form_validation->set_rules('kode_promo', 'kode_promo', 'trim|prep_for_form');
$this->form_validation->set_rules('nominal_promo', 'nominal_promo', 'trim|prep_for_form');
$this->form_validation->set_rules('type_promo', 'type_promo', 'trim|prep_for_form');
$this->form_validation->set_rules('fitur', 'fitur', 'trim|prep_for_form');
$this->form_validation->set_rules('status', 'status', 'trim|prep_for_form');
if ($this->form_validation->run() == TRUE) {
$config['upload_path'] = './images/promo/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '10000';
$config['file_name'] = 'name';
$config['encrypt_name'] = true;
$this->load->library('upload', $config);
if ($this->upload->do_upload('image_promo')) {
$gambar = html_escape($this->upload->data('file_name'));
} else {
$gambar = 'noimage.jpg';
}
if ($this->input->post('type_promo') == 'persen'){
$nominal = html_escape($this->input->post('nominal_promo_persen', TRUE));
} else {
$nominal = str_replace(".","",html_escape($this->input->post('nominal_promo', TRUE)));
}
$data = [
'image_promo' => $gambar,
'nama_promo' => html_escape($this->input->post('nama_promo', TRUE)),
'kode_promo' => html_escape($this->input->post('kode_promo', TRUE)),
'nominal_promo' => $nominal,
'type_promo' => html_escape($this->input->post('type_promo', TRUE)),
'expired' => html_escape($this->input->post('expired', TRUE)),
'fitur' => html_escape($this->input->post('fitur', TRUE)),
'status' => html_escape($this->input->post('status', TRUE)),
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('promocode/addpromocode');
} else {
$cekpromo = $this->promocode->cekpromo($this->input->post('kode_promo'));
if ($cekpromo->num_rows() > 0){
$this->session->set_flashdata('demo', 'Promotion code already exist');
redirect('promocode/addpromocode');
}else{
$this->promocode->addpromocode($data);
$this->session->set_flashdata('tambah', 'Promotion Slider Has Been Added');
redirect('promocode');
}
}
} else {
$data['fitur'] = $this->fitur->getallservice();
$this->load->view('includes/header');
$this->load->view('promocode/addpromocode', $data);
$this->load->view('includes/footer');
}
}
public function editpromocode($id)
{
$this->form_validation->set_rules('nama_promo', 'nama_promo', 'trim|prep_for_form');
$this->form_validation->set_rules('kode_promo', 'kode_promo', 'trim|prep_for_form');
$this->form_validation->set_rules('nominal_promo', 'nominal_promo', 'trim|prep_for_form');
$this->form_validation->set_rules('type_promo', 'type_promo', 'trim|prep_for_form');
$this->form_validation->set_rules('fitur', 'fitur', 'trim|prep_for_form');
$this->form_validation->set_rules('status', 'status', 'trim|prep_for_form');
$data['promo'] = $this->promocode->getpromobyid($id)->row_array();
$data['fitur'] = $this->fitur->getallservice();
if ($this->form_validation->run() == TRUE) {
if ($this->input->post('type_promo') == 'persen'){
$nominal = html_escape($this->input->post('nominal_promo_persen', TRUE));
} else {
$nominal = str_replace(".","",html_escape($this->input->post('nominal_promo', TRUE)));
}
$config['upload_path'] = './images/promo/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '10000';
$config['file_name'] = time();
$config['encrypt_name'] = true;
$this->load->library('upload', $config);
if ($this->upload->do_upload('image_promo')) {
unlink('images/promo/' . $this->promocode->getpromobyid($id)->row('image_promo'));
$gambar = html_escape($this->upload->data('file_name'));
$datainsert = [
'id_promo' => html_escape($this->input->post('id_promo', TRUE)),
'image_promo' => $gambar,
'nama_promo' => html_escape($this->input->post('nama_promo', TRUE)),
'kode_promo' => html_escape($this->input->post('kode_promo', TRUE)),
'nominal_promo' => $nominal,
'type_promo' => html_escape($this->input->post('type_promo', TRUE)),
'expired' => html_escape($this->input->post('expired', TRUE)),
'fitur' => html_escape($this->input->post('fitur', TRUE)),
'status' => html_escape($this->input->post('status', TRUE)),
];
} else {
$datainsert = [
'id_promo' => html_escape($this->input->post('id_promo', TRUE)),
'nama_promo' => html_escape($this->input->post('nama_promo', TRUE)),
'kode_promo' => html_escape($this->input->post('kode_promo', TRUE)),
'nominal_promo' => $nominal,
'type_promo' => html_escape($this->input->post('type_promo', TRUE)),
'expired' => html_escape($this->input->post('expired', TRUE)),
'fitur' => html_escape($this->input->post('fitur', TRUE)),
'status' => html_escape($this->input->post('status', TRUE)),
];
}
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
$this->load->view('includes/header');
$this->load->view('promocode/editpromocode', $data);
$this->load->view('includes/footer');
} else {
$cekpromo = $this->promocode->cekpromo($this->input->post('kode_promo'));
if ($cekpromo->num_rows() > 0 && $cekpromo->row_array()['id_promo'] != $this->input->post('id_promo')){
$this->session->set_flashdata('demo', 'Promotion code already exist');
$this->load->view('includes/header');
$this->load->view('promocode/editpromocode', $data);
$this->load->view('includes/footer');
}else{
$this->promocode->editpromocode($datainsert);
$this->session->set_flashdata('tambah', 'Promotion code Has Been Changed');
redirect('promocode');
}
}
} else {
$this->load->view('includes/header');
$this->load->view('promocode/editpromocode', $data);
$this->load->view('includes/footer');
}
}
public function hapus($id)
{
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('promocode/index');
} else {
$data = $this->promocode->getpromocodeById($id);
if ($data['image_promo'] != 'noimage.jpg') {
$gambar = $data['image_promo'];
unlink('images/promo/' . $gambar);
}
$this->promocode->hapuspromocodeById($id);
$this->session->set_flashdata('hapus', 'Promo Code Has Been deleted');
redirect('promocode');
}
}
}

View File

@@ -0,0 +1,163 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Promoslider extends CI_Controller
{
public function __construct()
{
parent::__construct();
is_logged_in();
$this->load->model('promoslider_model', 'promo');
$this->load->model('service_model', 'fitur');
$this->load->library('form_validation');
}
public function index()
{
$data['promo'] = $this->promo->getallpromo();
$this->load->view('includes/header');
$this->load->view('promoslider/index', $data);
$this->load->view('includes/footer');
}
public function tambah()
{
$this->form_validation->set_rules('tanggal_berakhir', 'tanggal_berakhir', 'trim|prep_for_form');
$this->form_validation->set_rules('fitur_promosi', 'fitur_promosi', 'trim|prep_for_form');
$this->form_validation->set_rules('link_promosi', 'link_promosi', 'trim|prep_for_form');
$this->form_validation->set_rules('is_show', 'is_show', 'trim|prep_for_form');
$this->form_validation->set_rules('type_promosi', 'type_promosi', 'trim|prep_for_form');
if ($this->form_validation->run() == TRUE) {
$config['upload_path'] = './images/promo/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '20000';
$config['file_name'] = 'name';
$config['encrypt_name'] = true;
$this->load->library('upload', $config);
if ($this->upload->do_upload('foto')) {
$gambar = html_escape($this->upload->data('file_name'));
} else {
$gambar = 'noimage.jpg';
}
$type = html_escape($this->input->post('type_promosi', TRUE));
if ($type != 'link') {
$fitur = html_escape($this->input->post('fitur_promosi', TRUE));
} else {
$fitur = 0;
}
$data = [
'foto' => $gambar,
'tanggal_berakhir' => html_escape($this->input->post('tanggal_berakhir', TRUE)),
'fitur_promosi' => $fitur,
'type_promosi' => html_escape($this->input->post('type_promosi', TRUE)),
'is_show' => html_escape($this->input->post('is_show', TRUE)),
'link_promosi' => html_escape($this->input->post('link_promosi', TRUE))
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('promoslider/tambah');
} else {
$this->promo->tambahdatapromo($data);
$this->session->set_flashdata('tambah', 'Promotion Slider Has Been Added');
redirect('promoslider');
}
} else {
$data['fitur'] = $this->fitur->getallservice();
$this->load->view('includes/header');
$this->load->view('promoslider/addslider', $data);
$this->load->view('includes/footer');
}
}
public function hapus($id)
{
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('promoslider/index');
} else {
$data = $this->promo->getpromoById($id);
if ($data['foto'] != 'noimage.jpg') {
$gambar = $data['foto'];
unlink('images/promo/' . $gambar);
}
$this->promo->hapuspromoById($id);
$this->session->set_flashdata('hapus', 'Promotion Slider Has Been deleted');
redirect('promoslider');
}
}
public function ubah($id)
{
$this->form_validation->set_rules('tanggal_berakhir', 'tanggal_berakhir', 'trim|prep_for_form');
$this->form_validation->set_rules('fitur_promosi', 'fitur_promosi', 'trim|prep_for_form');
$this->form_validation->set_rules('link_promosi', 'link_promosi', 'trim|prep_for_form');
$this->form_validation->set_rules('is_show', 'is_show', 'trim|prep_for_form');
$this->form_validation->set_rules('type_promosi', 'type_promosi', 'trim|prep_for_form');
$data = $this->promo->getpromoById($id);
$data['fitur'] = $this->fitur->getallservice();
$id = html_escape($this->input->post('id', TRUE));
if ($this->form_validation->run() == TRUE) {
$config['upload_path'] = './images/promo/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '20000';
$config['file_name'] = 'name';
$config['encrypt_name'] = true;
$this->load->library('upload', $config);
if ($this->upload->do_upload('foto')) {
if ($data['foto'] != 'noimage.jpg') {
$gambar = $data['foto'];
}
$gambar = html_escape($this->upload->data('file_name'));
} else {
$gambar = $data['foto'];
}
$type = html_escape($this->input->post('type_promosi', TRUE));
if ($type != 'link') {
$fitur = html_escape($this->input->post('fitur_promosi', TRUE));
$link = 'service';
} else {
$fitur = 0;
$link = html_escape($this->input->post('link_promosi', TRUE));
}
$data = [
'id' => html_escape($this->input->post('id', TRUE)),
'foto' => $gambar,
'tanggal_berakhir' => html_escape($this->input->post('tanggal_berakhir', TRUE)),
'fitur_promosi' => $fitur,
'type_promosi' => $type,
'is_show' => html_escape($this->input->post('is_show', TRUE)),
'link_promosi' => $link,
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('promoslider/index');
} else {
$this->promo->ubahdatapromo($data);
$this->session->set_flashdata('ubah', 'Promotion Slider Has Been Changed');
redirect('promoslider');
}
} else {
$this->load->view('includes/header');
$this->load->view('promoslider/editslider' . $id, $data);
$this->load->view('includes/footer');
}
}
}

View File

@@ -0,0 +1,35 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Resetpass extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model('Resetpass_model');
$this->load->library('form_validation');
}
public function index() {
$this->load->view('nodata');
}
public function rest($token=null,$idkey=null) {
$data['user'] = $this->Resetpass_model->check_token($token,$idkey);
$this->form_validation->set_rules('password', 'password', 'required');
if ($data['user']) {
if ($this->form_validation->run() == false) {
$this->load->view('resetpass',$data);
} else {
$reset = $this->Resetpass_model->resetpass();
if($reset) {
$this->Resetpass_model->deletetoken();
$this->load->view('success');
}
}
} else {
$this->load->view('nodata');
}
}
}

View File

@@ -0,0 +1,81 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class sendemail extends CI_Controller
{
public function __construct()
{
parent::__construct();
is_logged_in();
$this->load->library('form_validation');
$this->load->model('driver_model', 'driver');
$this->load->model('users_model', 'user');
$this->load->model('mitra_model', 'mitra');
$this->load->model('appsettings_model', 'app');
$this->load->model('email_model', 'email_model');
}
public function index()
{
$data['driver'] = $this->driver->getalldriver();
$data['user'] = $this->user->getallusers();
$data['mitra'] = $this->mitra->getallmitra();
$this->load->view('includes/header');
$this->load->view('sendemail/index', $data);
$this->load->view('includes/footer');
}
public function send()
{
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'TIDAK DI IZINKAN');
redirect('sendemail/index');
} else {
$data['app'] = $this->app->getappbyid();
$emailpelanggan = $this->input->post('emailpelanggan');
$emaildriver = $this->input->post('emaildriver');
$emailmitra = $this->input->post('emailmitra');
$emailothers = $this->input->post('emailothers');
$sendto = $this->input->post('sendto');
if ($sendto == 'users') {
$emailuser = $emailpelanggan;
} elseif ($sendto == 'drivers') {
$emailuser = $emaildriver;
} elseif ($sendto == 'merchant') {
$emailuser = $emailmitra;
} else {
$emailuser = $emailothers;
}
$subject = $this->input->post('subject');
$emailmessage = $this->input->post('content');
$host = $data['app']['smtp_host'];
$port = $data['app']['smtp_port'];
$username = $data['app']['smtp_username'];
$password = $data['app']['smtp_password'];
$from = $data['app']['smtp_from'];
$appname = $data['app']['app_name'];
$secure = $data['app']['smtp_secure'];
$address = $data['app']['app_address'];
$linkgoogle = $data['app']['app_linkgoogle'];
$web = $data['app']['app_website'];
$content = $this->email_model->template2($subject, $emailmessage, $address, $appname, $linkgoogle, $web);
$this->email_model->emailsend($subject, $emailuser, $content, $host, $port, $username, $password, $from, $appname, $secure);
$this->session->set_flashdata('send', 'Email berhasil dikirim');
redirect('sendemail');
}
}
}

View File

@@ -0,0 +1,215 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Services extends CI_Controller
{
public function __construct()
{
parent::__construct();
is_logged_in();
$this->load->model('service_model', 'service');
// $this->load->model('news_model', 'news');
$this->load->library('form_validation');
}
public function index()
{
$data = $this->service->getcurrency();
$data['service'] = $this->service->getallservice();
$data['driverjob'] = $this->service->getAlldriverjob();
$this->load->view('includes/header');
$this->load->view('services/index', $data);
$this->load->view('includes/footer');
}
public function ubah($id)
{
$this->form_validation->set_rules('fitur', 'fitur', 'trim|prep_for_form');
$this->form_validation->set_rules('home', 'home', 'trim|prep_for_form');
$this->form_validation->set_rules('biaya', 'biaya', 'trim|prep_for_form');
$this->form_validation->set_rules('keterangan_biaya', 'keterangan_biaya', 'trim|prep_for_form');
$this->form_validation->set_rules('komisi', 'komisi', 'trim|prep_for_form');
$this->form_validation->set_rules('driver_job', 'driver_job', 'trim|prep_for_form');
$this->form_validation->set_rules('biaya_minimum', 'biaya_minimum', 'trim|prep_for_form');
$this->form_validation->set_rules('jarak_minimum', 'jarak_minimum', 'trim|prep_for_form');
$this->form_validation->set_rules('maks_distance', 'maks_distance', 'trim|prep_for_form');
$this->form_validation->set_rules('wallet_minimum', 'wallet_minimum', 'trim|prep_for_form');
$this->form_validation->set_rules('keterangan', 'keterangan', 'trim|prep_for_form');
$data = $this->service->getfiturbyid($id);
$data['job'] = $this->service->getalldriverjob($id);
$data['driverjob'] = $this->service->getAlldriverjob();
$id = html_escape($this->input->post('id_fitur', TRUE));
// $data['service'] = $this->service->getallservice();
if ($this->form_validation->run() == TRUE) {
$config['upload_path'] = './images/fitur/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '100000';
$config['file_name'] = 'name';
$config['encrypt_name'] = true;
$this->load->library('upload', $config);
if ($this->upload->do_upload('icon')) {
if ($data['icon'] != 'noimage.jpg') {
$gambar = $data['icon'];
unlink('images/fitur/' . $gambar);
}
$gambar = html_escape($this->upload->data('file_name'));
} else {
$gambar = $data['icon'];
}
$biaya = html_escape($this->input->post('biaya', TRUE));
$biaya_minimum = html_escape($this->input->post('biaya_minimum', TRUE));
$wallet_minimum = html_escape($this->input->post('wallet_minimum', TRUE));
$remove = array(".", ",");
$add = array("", "");
$data = [
'icon' => $gambar,
'id_fitur' => html_escape($this->input->post('id_fitur', TRUE)),
'fitur' => html_escape($this->input->post('fitur', TRUE)),
'home' => html_escape($this->input->post('home', TRUE)),
'urutan' => html_escape($this->input->post('urutan', TRUE)),
'biaya' => str_replace($remove, $add, $biaya),
'keterangan_biaya' => html_escape($this->input->post('keterangan_biaya', TRUE)),
'komisi' => html_escape($this->input->post('komisi', TRUE)),
'driver_job' => html_escape($this->input->post('driver_job', TRUE)),
'biaya_minimum' => str_replace($remove, $add, $biaya_minimum),
'jarak_minimum' => html_escape($this->input->post('jarak_minimum', TRUE)),
'maks_distance' => html_escape($this->input->post('maks_distance', TRUE)),
'wallet_minimum' => str_replace($remove, $add, $wallet_minimum),
'keterangan' => html_escape($this->input->post('keterangan', TRUE)),
'nilai' => html_escape($this->input->post('nilai', TRUE)),
'keterangan' => html_escape($this->input->post('keterangan', TRUE)),
'active' => html_escape($this->input->post('active', TRUE))
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('services/index');
} else {
$this->service->ubahdatafitur($data);
$this->session->set_flashdata('ubah', 'Services Has Been Changed');
redirect('services');
}
} else {
$this->load->view('includes/header');
$this->load->view('services/editservices' . $id, $data);
$this->load->view('includes/footer');
}
}
public function addservice()
{
$this->form_validation->set_rules('fitur', 'fitur', 'trim|prep_for_form');
$this->form_validation->set_rules('home', 'home', 'trim|prep_for_form');
$this->form_validation->set_rules('biaya', 'biaya', 'trim|prep_for_form');
$this->form_validation->set_rules('keterangan_biaya', 'keterangan_biaya', 'trim|prep_for_form');
$this->form_validation->set_rules('komisi', 'komisi', 'trim|prep_for_form');
$this->form_validation->set_rules('driver_job', 'driver_job', 'trim|prep_for_form');
$this->form_validation->set_rules('biaya_minimum', 'biaya_minimum', 'trim|prep_for_form');
$this->form_validation->set_rules('jarak_minimum', 'jarak_minimum', 'trim|prep_for_form');
$this->form_validation->set_rules('maks_distance', 'maks_distance', 'trim|prep_for_form');
$this->form_validation->set_rules('wallet_minimum', 'wallet_minimum', 'trim|prep_for_form');
$this->form_validation->set_rules('keterangan', 'keterangan', 'trim|prep_for_form');
$this->form_validation->set_rules('nilai', 'nilai', 'trim|prep_for_form');
$this->form_validation->set_rules('active', 'active', 'trim|prep_for_form');
if ($this->form_validation->run() == TRUE) {
$config['upload_path'] = './images/fitur/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '100000';
$config['file_name'] = 'name';
$config['encrypt_name'] = true;
$this->load->library('upload', $config);
if ($this->upload->do_upload('icon')) {
$gambar = html_escape($this->upload->data('file_name'));
} else {
$gambar = 'noimage.jpg';
}
$biaya = html_escape($this->input->post('biaya', TRUE));
$biaya_minimum = html_escape($this->input->post('biaya_minimum', TRUE));
$wallet_minimum = html_escape($this->input->post('wallet_minimum', TRUE));
$remove = array(".", ",");
$add = array("", "");
$data = [
'icon' => $gambar,
'fitur' => html_escape($this->input->post('fitur', TRUE)),
'home' => html_escape($this->input->post('home', TRUE)),
'biaya' => str_replace($remove, $add, $biaya),
'keterangan_biaya' => html_escape($this->input->post('keterangan_biaya', TRUE)),
'komisi' => html_escape($this->input->post('komisi', TRUE)),
'driver_job' => html_escape($this->input->post('driver_job', TRUE)),
'biaya_minimum' => str_replace($remove, $add, $biaya_minimum),
'jarak_minimum' => html_escape($this->input->post('jarak_minimum', TRUE)),
'maks_distance' => html_escape($this->input->post('maks_distance', TRUE)),
'wallet_minimum' => str_replace($remove, $add, $wallet_minimum),
'keterangan' => html_escape($this->input->post('keterangan', TRUE)),
'active' => html_escape($this->input->post('active', TRUE))
];
$datanilai = [
'nilai' => html_escape($this->input->post('nilai', TRUE)),
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('services/index');
} else {
$this->service->tambahdatafitur($data, $datanilai);
$this->session->set_flashdata('ubah', 'Services Has Been Added');
redirect('services');
}
} else {
$data['driverjob'] = $this->service->getAlldriverjob();
$this->load->view('includes/header');
$this->load->view('services/addservice', $data);
$this->load->view('includes/footer');
}
}
public function hapusservice($id)
{
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('services/index');
} else {
$data = $this->service->getfiturbyid($id);
if ($data['icon'] != 'noimage.jpg') {
$gambar = $data['icon'];
}
$this->service->hapusserviceById($id);
$this->session->set_flashdata('hapus', 'Service Has Been deleted');
redirect('services');
}
}
}

View File

@@ -0,0 +1,89 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class transaction extends CI_Controller
{
public function __construct()
{
parent::__construct();
is_logged_in();
$this->load->model('Appsettings_model', 'app');
$this->load->model('Dashboard_model', 'dashboard');
// $this->load->library('form_validation');
$params = array('server_key' => 'your_server_key', 'production' => false);
$this->load->library('veritrans');
$this->veritrans->config($params);
$this->load->helper('url');
}
public function index()
{
$data['currency'] = $this->app->getappbyid();
$data['transaksi'] = $this->dashboard->getAlltransaksi();
$data['transaksi1'] = $this->dashboard->getAlltransaksi1();
$data['transaksi3'] = $this->dashboard->getAlltransaksi3();
$data['fitur'] = $this->dashboard->getAllfitur();
$data['saldo'] = $this->dashboard->getallsaldo();
$this->load->view('includes/header');
$this->load->view('transaction/index', $data);
$this->load->view('includes/footer');
}
public function process()
{
$data['currency'] = $this->app->getappbyid();
$data['transaksi'] = $this->dashboard->getAlltransaksi();
$data['fitur'] = $this->dashboard->getAllfitur();
$data['saldo'] = $this->dashboard->getallsaldo();
$this->load->view('includes/header');
$this->load->view('transaction/index', $data);
$this->load->view('includes/footer');
$order_id = $this->input->post('order_id');
$action = $this->input->post('action');
switch ($action) {
case 'status':
$this->status($order_id);
break;
case 'approve':
$this->approve($order_id);
break;
case 'expire':
$this->expire($order_id);
break;
case 'cancel':
$this->cancel($order_id);
break;
}
}
public function status($order_id)
{
echo 'test get status </br>';
print_r($this->veritrans->status($order_id));
}
public function cancel($order_id)
{
echo 'test cancel trx </br>';
echo $this->veritrans->cancel($order_id);
}
public function approve($order_id)
{
echo 'test get approve </br>';
print_r($this->veritrans->approve($order_id));
}
public function expire($order_id)
{
echo 'test get expire </br>';
print_r($this->veritrans->expire($order_id));
}
}

View File

@@ -0,0 +1,270 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Users extends CI_Controller
{
public function __construct()
{
parent::__construct();
is_logged_in();
// $this->load->model('Appsettings_model', 'app');
$this->load->model('Users_model', 'user');
$this->load->model('Pelanggan_model');
$this->load->library('form_validation');
}
public function index()
{
$data['user'] = $this->user->getallusers();
// $data['transaksi']= $this->dashboard->getAlltransaksi();
// $data['fitur']= $this->dashboard->getAllfitur();
$this->load->view('includes/header');
$this->load->view('users/index', $data);
$this->load->view('includes/footer');
}
public function detail($id)
{
$data = $this->user->getcurrency();
$data['user'] = $this->user->getusersbyid($id);
$data['countorder'] = $this->user->countorder($id);
$data['wallet'] = $this->user->wallet($id);
// $data['fitur']= $this->dashboard->getAllfitur();
$this->load->view('includes/header');
$this->load->view('users/detailusers', $data);
$this->load->view('includes/footer');
}
public function block($id)
{
$this->user->blockusersById($id);
$this->session->set_flashdata('block', 'blocked');
redirect('users');
}
public function unblock($id)
{
$this->user->unblockusersById($id);
$this->session->set_flashdata('block', 'unblock');
redirect('users');
}
public function ubahid()
{
$this->form_validation->set_rules('fullnama', 'fullnama', 'trim|prep_for_form');
$this->form_validation->set_rules('no_telepon', 'no_telepon', 'trim|prep_for_form');
$this->form_validation->set_rules('email', 'email', 'trim|prep_for_form');
$id = html_escape($this->input->post('id', TRUE));
$countrycode = html_escape($this->input->post('countrycode', TRUE));
$phone = html_escape($this->input->post('phone', TRUE));
if ($this->form_validation->run() == TRUE) {
$data = [
'phone' => html_escape($this->input->post('phone', TRUE)),
'countrycode' => html_escape($this->input->post('countrycode', TRUE)),
'id' => html_escape($this->input->post('id', TRUE)),
'fullnama' => html_escape($this->input->post('fullnama', TRUE)),
'no_telepon' => str_replace("+", "", $countrycode) . $phone,
'email' => html_escape($this->input->post('email', TRUE)),
'tgl_lahir' => html_escape($this->input->post('tgl_lahir', TRUE))
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('users/detail/' . $id);
} else {
$this->user->ubahdataid($data);
$this->session->set_flashdata('ubah', 'User Has Been Change');
redirect('users/detail/' . $id);
}
} else {
$data = $this->user->getcurrency();
$data['user'] = $this->user->getusersbyid($id);
$data['countorder'] = $this->user->countorder($id);
// $data['transaksi']= $this->dashboard->getAlltransaksi();
// $data['fitur']= $this->dashboard->getAllfitur();
$this->load->view('includes/header');
$this->load->view('users/detailusers', $data);
$this->load->view('includes/footer');
}
}
public function ubahfoto()
{
$config['upload_path'] = './images/pelanggan/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '100000';
$config['file_name'] = 'name';
$config['encrypt_name'] = true;
$this->load->library('upload', $config);
$id = $id = html_escape($this->input->post('id', TRUE));
$data = $this->user->getusersbyid($id);
if ($this->upload->do_upload('fotopelanggan')) {
if ($data['fotopelanggan'] != 'noimage.jpg') {
$gambar = $data['fotopelanggan'];
unlink('images/pelanggan/' . $gambar);
}
$foto = html_escape($this->upload->data('file_name'));
$data = [
'fotopelanggan' => $foto,
'id' => html_escape($this->input->post('id', TRUE))
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('users/detail/' . $id);
} else {
$this->user->ubahdatafoto($data);
$this->session->set_flashdata('ubah', 'User Has Been Change');
redirect('users/detail/' . $id);
}
} else {
$data = $this->user->getcurrency();
$data['user'] = $this->user->getusersbyid($id);
$data['countorder'] = $this->user->countorder($id);
// $data['transaksi']= $this->dashboard->getAlltransaksi();
// $data['fitur']= $this->dashboard->getAllfitur();
$this->load->view('includes/header');
$this->load->view('users/detailusers', $data);
$this->load->view('includes/footer');
}
}
public function ubahpass()
{
$this->form_validation->set_rules('password', 'password', 'trim|prep_for_form');
if ($this->form_validation->run() == TRUE) {
$id = $this->input->post('id');
$data = $this->input->post('password');
$dataencrypt = sha1($data);
$data = [
'id' => html_escape($this->input->post('id', TRUE)),
'password' => $dataencrypt
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('users/detail/' . $id);
} else {
$this->user->ubahdatapassword($data);
$this->session->set_flashdata('ubah', 'User Has Been Change');
redirect('users/detail/' . $id);
}
} else {
$data = $this->user->getcurrency();
$data['user'] = $this->user->getusersbyid($id);
$data['countorder'] = $this->user->countorder($id);
// $data['transaksi']= $this->dashboard->getAlltransaksi();
// $data['fitur']= $this->dashboard->getAllfitur();
$this->load->view('includes/header');
$this->load->view('users/detailusers', $data);
$this->load->view('includes/footer');
}
}
public function userblock($id)
{
$this->user->blockuserbyid($id);
redirect('users');
}
public function userunblock($id)
{
$this->user->unblockuserbyid($id);
redirect('users');
}
public function tambah()
{
$password = html_escape($this->input->post('password', TRUE));
$countrycode = html_escape($this->input->post('countrycode', TRUE));
$phone = html_escape($this->input->post('phone', TRUE));
$email = html_escape($this->input->post('email', TRUE));
$this->form_validation->set_rules('fullnama', 'NAME', 'trim|prep_for_form');
$this->form_validation->set_rules('phone', 'PHONE', 'trim|prep_for_form|is_unique[pelanggan.phone]');
$this->form_validation->set_rules('email', 'EMAIL', 'trim|prep_for_form|is_unique[pelanggan.email]');
$this->form_validation->set_rules('password', 'PASSWORD', 'trim|prep_for_form');
if ($this->form_validation->run() == TRUE) {
$config['upload_path'] = './images/pelanggan/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '100000';
$config['file_name'] = 'name';
$config['encrypt_name'] = true;
$this->load->library('upload', $config);
if ($this->upload->do_upload('fotopelanggan')) {
$foto = html_escape($this->upload->data('file_name'));
} else {
$foto = 'noimage.jpg';
}
$data = [
'id' => 'P' . time(),
'phone' => html_escape($this->input->post('phone', TRUE)),
'countrycode' => html_escape($this->input->post('countrycode', TRUE)),
'tgl_lahir' => html_escape($this->input->post('tgl_lahir', TRUE)),
'token' => 'T' . time(),
'fotopelanggan' => $foto,
'fullnama' => html_escape($this->input->post('fullnama', TRUE)),
'no_telepon' => str_replace("+", "", $countrycode) . $phone,
'email' => html_escape($this->input->post('email', TRUE)),
'password' => sha1($password),
];
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('users/index');
} else {
$this->user->tambahdatausers($data);
$this->session->set_flashdata('tambah', 'User Has Been Added');
redirect('users/index');
}
} else {
$this->load->view('includes/header');
$this->load->view('users/tambahuser');
$this->load->view('includes/footer');
// }
}
}
public function hapususers($id)
{
if (demo == TRUE) {
$this->session->set_flashdata('demo', 'NOT ALLOWED FOR DEMO');
redirect('users/index');
} else {
$data = $this->user->getusersbyid($id);
$gambar = $data['fotopelanggan'];
unlink('images/pelanggan/' . $gambar);
$this->user->hapusdatauserbyid($id);
$this->session->set_flashdata('hapus', 'User Has Been Deleted');
redirect('users/index');
}
}
}

View File

@@ -0,0 +1,220 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Wallet extends CI_Controller
{
public function __construct()
{
parent::__construct();
is_logged_in();
// $this->load->library('form_validation');
$this->load->model('wallet_model', 'wallet');
$this->load->model('users_model', 'user');
}
public function index()
{
$data['jumlahdiskon'] = $this->wallet->getjumlahdiskon();
$data['orderplus'] = $this->wallet->gettotalorderplus();
$data['ordermin'] = $this->wallet->gettotalordermin();
$data['withdraw'] = $this->wallet->gettotalwithdraw();
$data['topup'] = $this->wallet->gettotaltopup();
$data['saldo'] = $this->wallet->getallsaldo();
$data['currency'] = $this->user->getcurrency();
$data['wallet'] = $this->wallet->getwallet();
$this->load->view('includes/header');
$this->load->view('wallet/index', $data);
$this->load->view('includes/footer');
}
public function wconfirm($id, $id_user, $amount)
{
$token = $this->wallet->gettoken($id_user);
$regid = $this->wallet->getregid($id_user);
$tokenmerchant = $this->wallet->gettokenmerchant($id_user);
if ($token == NULL and $tokenmerchant == NULL and $regid != NULL) {
$topic = $regid['reg_id'];
} else if ($regid == NULL and $tokenmerchant == NULL and $token != NULL) {
$topic = $token['token'];
} else if ($regid == NULL and $token == NULL and $tokenmerchant != NULL) {
$topic = $tokenmerchant['token_merchant'];
}
$title = 'Sukses';
$message = 'Permintaan berhasil dikirim';
$saldo = $this->wallet->getsaldo($id_user);
$this->wallet->ubahsaldo($id_user, $amount, $saldo);
$this->wallet->ubahstatuswithdrawbyid($id);
$this->wallet->send_notif($title, $message, $topic);
$this->session->set_flashdata('ubah', 'Permintaan berhasil dikirim');
redirect('wallet/index');
}
public function wcancel($id, $id_user)
{
$token = $this->wallet->gettoken($id_user);
$regid = $this->wallet->getregid($id_user);
$tokenmerchant = $this->wallet->gettokenmerchant($id_user);
if ($token == NULL and $tokenmerchant == NULL and $regid != NULL) {
$topic = $regid['reg_id'];
} else if ($regid == NULL and $tokenmerchant == NULL and $token != NULL) {
$topic = $token['token'];
} else if ($regid == NULL and $token == NULL and $tokenmerchant != NULL) {
$topic = $tokenmerchant['token_merchant'];
}
$title = 'Permintaan dibatalkan';
$message = 'Mohon maaf permintaan dibatalkan';
$this->wallet->cancelstatuswithdrawbyid($id);
$this->wallet->send_notif($title, $message, $topic);
$this->session->set_flashdata('ubah', 'Permintaan dibatalkan');
redirect('wallet/index');
}
public function tconfirm($id, $id_user, $amount)
{
$token = $this->wallet->gettoken($id_user);
$regid = $this->wallet->getregid($id_user);
$tokenmerchant = $this->wallet->gettokenmerchant($id_user);
if ($token == NULL and $tokenmerchant == NULL and $regid != NULL) {
$topic = $regid['reg_id'];
} else if ($regid == NULL and $tokenmerchant == NULL and $token != NULL) {
$topic = $token['token'];
} else if ($regid == NULL and $token == NULL and $tokenmerchant != NULL) {
$topic = $tokenmerchant['token_merchant'];
}
$title = 'Topup berhasil';
$message = 'Permintaan topup berhasil';
$saldo = $this->wallet->getsaldo($id_user);
$this->wallet->ubahsaldotopup($id_user, $amount, $saldo);
$this->wallet->ubahstatuswithdrawbyid($id);
$this->wallet->send_notif($title, $message, $topic);
$this->session->set_flashdata('ubah', 'Permintaan topup berhasil');
redirect('wallet/index');
}
public function tcancel($id, $id_user)
{
$token = $this->wallet->gettoken($id_user);
$regid = $this->wallet->getregid($id_user);
$tokenmerchant = $this->wallet->gettokenmerchant($id_user);
if ($token == NULL and $regid != NULL) {
$topic = $regid['reg_id'];
}
if ($regid == NULL and $token != NULL) {
$topic = $token['token'];
}
if ($regid == NULL and $token == NULL and $tokenmerchant != NULL) {
$topic = $tokenmerchant['token_merchant'];
}
$title = 'Topup dibatalkan';
$message = 'Maaf, topup dibatalkan';
$this->wallet->cancelstatuswithdrawbyid($id);
$this->wallet->send_notif($title, $message, $topic);
$this->session->set_flashdata('ubah', 'topup dibatalkan');
redirect('wallet/index');
}
public function tambahtopup()
{
$data['currency'] = $this->user->getcurrency();
$data['saldo'] = $this->wallet->getallsaldouser();
if ($_POST != NULL) {
if ($this->input->post('type_user') == 'pelanggan') {
$id_user = $this->input->post('id_pelanggan');
} elseif ($this->input->post('type_user') == 'mitra') {
$id_user = $this->input->post('id_mitra');
} else {
$id_user = $this->input->post('id_driver');
}
$saldo = html_escape($this->input->post('saldo', TRUE));
$remove = array(".", ",");
$add = array("", "");
$data = [
'id_user' => $id_user,
'saldo' => str_replace($remove, $add, $saldo),
'type_user' => $this->input->post('type_user')
];
$this->wallet->updatesaldowallet($data);
$this->session->set_flashdata('ubah', 'Top Up Has Been Added');
redirect('wallet');
} else {
$this->load->view('includes/header');
$this->load->view('wallet/tambahtopup', $data);
$this->load->view('includes/footer');
}
}
public function tambahwithdraw()
{
$data['currency'] = $this->user->getcurrency();
$data['saldo'] = $this->wallet->getallsaldouser();
if ($_POST != NULL) {
if ($this->input->post('type_user') == 'pelanggan') {
$id_user = $this->input->post('id_pelanggan');
} elseif ($this->input->post('type_user') == 'mitra') {
$id_user = $this->input->post('id_mitra');
} else {
$id_user = $this->input->post('id_driver');
}
$saldo = html_escape($this->input->post('saldo', TRUE));
$remove = array(".", ",");
$add = array("", "");
$data = [
'id_user' => $id_user,
'saldo' => str_replace($remove, $add, $saldo),
'type_user' => $this->input->post('type_user')
];
$data2 = [
'bank' => $this->input->post('bank'),
'nama_pemilik' => $this->input->post('nama_pemilik'),
'rekening' => $this->input->post('rekening'),
];
$this->wallet->updatesaldowalletwithdraw($data, $data2);
$this->session->set_flashdata('ubah', 'Permintaan berhasil ditambah');
redirect('wallet');
} else {
$this->load->view('includes/header');
$this->load->view('wallet/tambahwithdraw', $data);
$this->load->view('includes/footer');
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,134 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
require APPPATH . '/libraries/REST_Controller.php';
class Map extends REST_Controller
{
public function __construct()
{
parent::__construct();
$this->load->helper(array('url', 'maps_helper', 'quota_limiter'));
date_default_timezone_set('Asia/Jakarta');
}
public function index_get()
{
$this->response(array(
'message' => 'Map API ready',
), 200);
}
/**
* POST /api/map/directions
* Body: { "origin_lat": 0.0, "origin_lng": 0.0, "dest_lat": 0.0, "dest_lng": 0.0, "mode": "driving" }
*/
public function directions_post()
{
// Simple per-IP quota limiting for map directions.
$hour_limit = (defined('MAPS_LIMIT_PER_HOUR') && MAPS_LIMIT_PER_HOUR !== '') ? (int) MAPS_LIMIT_PER_HOUR : 1000;
$day_limit = (defined('MAPS_LIMIT_PER_DAY') && MAPS_LIMIT_PER_DAY !== '') ? (int) MAPS_LIMIT_PER_DAY : 5000;
$limits = array(
'hour' => $hour_limit,
'day' => $day_limit,
);
$key = 'maps:ip:' . $this->input->ip_address();
if (!quota_limiter_allow($key, $limits)) {
$this->response(array(
'code' => '429',
'message' => 'maps_quota_exceeded',
), 200);
return;
}
$data = json_decode(file_get_contents('php://input'), true);
if (!is_array($data)) {
$this->response(array(
'code' => '400',
'message' => 'invalid_json',
), 200);
return;
}
if (!isset($data['origin_lat'], $data['origin_lng'], $data['dest_lat'], $data['dest_lng'])) {
$this->response(array(
'code' => '400',
'message' => 'missing_coordinates',
), 200);
return;
}
$mode = isset($data['mode']) && is_string($data['mode']) ? $data['mode'] : 'driving';
$result = maps_directions(
(float) $data['origin_lat'],
(float) $data['origin_lng'],
(float) $data['dest_lat'],
(float) $data['dest_lng'],
$mode
);
if ($result === null) {
$this->response(array(
'code' => '500',
'message' => 'maps_error',
), 200);
return;
}
// Proxy Google Directions JSON structure directly so clients can parse as before.
$this->response($result, 200);
}
/**
* POST /api/map/geocode
* Body: { "lat": 0.0, "lng": 0.0 }
*/
public function geocode_post()
{
$hour_limit = (defined('MAPS_LIMIT_PER_HOUR') && MAPS_LIMIT_PER_HOUR !== '') ? (int) MAPS_LIMIT_PER_HOUR : 1000;
$day_limit = (defined('MAPS_LIMIT_PER_DAY') && MAPS_LIMIT_PER_DAY !== '') ? (int) MAPS_LIMIT_PER_DAY : 5000;
$limits = array(
'hour' => $hour_limit,
'day' => $day_limit,
);
$key = 'maps:ip:' . $this->input->ip_address() . ':geocode';
if (!quota_limiter_allow($key, $limits)) {
$this->response(array(
'code' => '429',
'message' => 'maps_quota_exceeded',
), 200);
return;
}
$data = json_decode(file_get_contents('php://input'), true);
if (!is_array($data)) {
$this->response(array(
'code' => '400',
'message' => 'invalid_json',
), 200);
return;
}
if (!isset($data['lat'], $data['lng'])) {
$this->response(array(
'code' => '400',
'message' => 'missing_lat_lng',
), 200);
return;
}
$result = maps_geocode((float) $data['lat'], (float) $data['lng']);
if ($result === null) {
$this->response(array(
'code' => '500',
'message' => 'maps_error',
), 200);
return;
}
// Proxy Google Geocode JSON structure directly.
$this->response($result, 200);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,58 @@
<?php
$server_key = "SB-Mid-server-hsIqSFfLTy9a5YPggvT48agq";
$is_production = false;
$api_url = $is_production ?
'https://app.midtrans.com/snap/v1/transactions' :
'https://app.sandbox.midtrans.com/snap/v1/transactions';
if (!strpos($_SERVER['REQUEST_URI'], '/charge')) {
http_response_code(404);
echo "wrong path, make sure it's `/charge`";
exit();
}
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
http_response_code(404);
echo "Page not found or wrong HTTP request method is used";
exit();
}
$request_body = file_get_contents('php://input');
header('Content-Type: application/json');
$charge_result = chargeAPI($api_url, $server_key, $request_body);
http_response_code($charge_result['http_code']);
echo $charge_result['body'];
function chargeAPI($api_url, $server_key, $request_body)
{
$ch = curl_init();
$curl_options = array(
CURLOPT_URL => $api_url,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Accept: application/json',
'Authorization: Basic ' . base64_encode($server_key . ':')
),
CURLOPT_POSTFIELDS => $request_body
);
curl_setopt_array($ch, $curl_options);
$result = array(
'body' => curl_exec($ch),
'http_code' => curl_getinfo($ch, CURLINFO_HTTP_CODE),
);
return $result;
}

View File

@@ -0,0 +1,91 @@
<?php
defined('BASEPATH') or exit('No direct script access allowed');
require APPPATH . '/libraries/REST_Controller.php';
class Notification extends REST_Controller
{
public function __construct()
{
parent::__construct();
$this->load->helper(array('url'));
$this->load->model('notification_model', 'notif');
date_default_timezone_set('Asia/Jakarta');
}
/**
* Simple health check for the notification API.
*/
public function index_get()
{
$this->response(array(
'message' => 'Notification API ready',
), 200);
}
/**
* Generic FCM send endpoint.
*
* Expected JSON body:
* {
* "target": "device_or_topic",
* "is_topic": false,
* "data": { ... arbitrary key/value pairs ... },
* "title": "optional notification title",
* "body": "optional notification body"
* }
*/
public function send_generic_post()
{
$raw = file_get_contents('php://input');
$decoded = json_decode($raw, true);
if (!is_array($decoded)) {
$this->response(array(
'code' => '400',
'message' => 'invalid_json',
), 200);
return;
}
$target = isset($decoded['target']) ? trim($decoded['target']) : '';
$is_topic = !empty($decoded['is_topic']);
$data = isset($decoded['data']) && is_array($decoded['data']) ? $decoded['data'] : array();
$title = isset($decoded['title']) ? (string) $decoded['title'] : '';
$body = isset($decoded['body']) ? (string) $decoded['body'] : '';
if ($target === '' || empty($data)) {
$this->response(array(
'code' => '400',
'message' => 'missing_target_or_data',
), 200);
return;
}
$options = array();
if ($title !== '' || $body !== '') {
$options['title'] = $title;
$options['body'] = $body;
}
if ($is_topic) {
$result = $this->notif->send_generic_to_topic($target, $data, $options);
} else {
$result = $this->notif->send_generic_to_token($target, $data, $options);
}
if ($result === false) {
$this->response(array(
'code' => '500',
'message' => 'fcm_send_failed_or_quota_exceeded',
), 200);
return;
}
$this->response(array(
'code' => '200',
'message' => 'success',
), 200);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,51 @@
<?php
class Xendit extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('appsettings_model', 'app');
}
public function data_post()
{
$model = $this->app->getappbyid();
$data = json_decode(file_get_contents('php://input'), true);
$key = $model['api_keyxendit']; //jika ganti xendit akun cukup ubah ini aja
$pass = "";
if($data['ServerKey'] == $model['apikey_server']){ //dan ini untuk sisi authorization dari android request ke server kita "UkFKQU1BU1RFUlNFUlZFUg=="
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.xendit.co/ewallets",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => false,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HTTPHEADER => array(
"Authorization: Basic ".base64_encode("$key:$pass")."",
"Content-Type: application/json",
//"Cookie: nlbi_2182539=BeDEGL4nnQIMRSl/jjCKbQAAAACdtzIPLHKtA/1t0rshQlnG; visid_incap_2182539=T63r/YikR3SNAzVcIiMVuBJtRl8AAAAAQUIPAAAAAAAO48RqXhljt8XIX4HsIaBQ; incap_ses_1114_2182539=ilBwI4mA+ynuqcDyQrl1DxJtRl8AAAAApLvYahTdJBFGMhOzY0AX0A=="
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
}else{
echo json_encode(array(['msg'=> "Failed Key", 'code'=> 500]));
}
}
}

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View File

@@ -0,0 +1,76 @@
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Notification extends CI_Controller
{
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/welcome/<method_name>
* @see http://codeigniter.com/user_guide/general/urls.html
*/
public function __construct()
{
parent::__construct();
$params = array('server_key' => 'your_server_key', 'production' => false);
$this->load->library('midtrans');
$this->midtrans->config($params);
$this->load->helper('url');
}
public function index()
{
echo 'test notification handler';
$json_result = file_get_contents('php://input');
$result = json_decode($json_result);
if ($result) {
$notif = $this->midtrans->status($result->order_id);
}
error_log(print_r($result, TRUE));
//notification handler sample
$transaction = $notif->transaction_status;
$type = $notif->payment_type;
$order_id = $notif->order_id;
$fraud = $notif->fraud_status;
if ($transaction == 'capture') {
// For credit card transaction, we need to check whether transaction is challenge by FDS or not
if ($type == 'credit_card') {
if ($fraud == 'challenge') {
// TODO set payment status in merchant's database to 'Challenge by FDS'
// TODO merchant should decide whether this transaction is authorized or not in MAP
echo "Transaction order_id: " . $order_id . " is challenged by FDS";
} else {
// TODO set payment status in merchant's database to 'Success'
echo "Transaction order_id: " . $order_id . " successfully captured using " . $type;
}
}
} else if ($transaction == 'settlement') {
// TODO set payment status in merchant's database to 'Settlement'
echo "Transaction order_id: " . $order_id . " successfully transfered using " . $type;
} else if ($transaction == 'pending') {
// TODO set payment status in merchant's database to 'Pending'
echo "Waiting customer to finish transaction order_id: " . $order_id . " using " . $type;
} else if ($transaction == 'deny') {
// TODO set payment status in merchant's database to 'Denied'
echo "Payment using " . $type . " for transaction order_id: " . $order_id . " is denied.";
}
}
}

View File

@@ -0,0 +1,90 @@
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
require APPPATH . '/libraries/Midtrans.php';
//require APPPATH . '/libraries/Veritrans.php';
class Snap extends CI_Controller
{
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/welcome/<method_name>
* @see http://codeigniter.com/user_guide/general/urls.html
*/
public function __construct()
{
parent::__construct();
$params = array('server_key' => 'SB-Mid-server-qjMkTCJmmL0DwPIBM3KPLul', 'midtrans_status' => false);
$this->midtrans->config($params);
$this->load->helper('url');
$this->load->model('Pelanggan_model');
$this->load->library('midtrans');
$this->veritrans->config($params);
}
public function index()
{
// Required
$transaction_details = array(
'order_id' => $this->db->get_where('transaction_details_Midtrans', 'order_detail' . uniqid()()),
'gross_amount' => 10000, // no decimal allowed for creditcard
);
// Optional
$item_details = array(
'id' => $this->Pelanggan_model->get_data_pelanggan('pelanggan', 'fullnama')->row_array(),
'price' => $this->db->get_where('item', 'harga_item')->row_array(),
'kategori_item' => $this->db->get_where('item', 'kategori_item')->row_array(),
'name' => $this->db->get_where('item', 'nama_item')->row_array()
);
// Optional
$billing_address = array(
$this->db->get('pelanggan')->result_array()
);
// Data yang akan dikirim untuk request redirect_url.
$credit_card['save_card'] = true;
//ser save_card true to enable oneclick or 2click
//$credit_card['save_card'] = true;
$time = time();
$custom_expiry = array(
'start_time' => date("Y-m-d H:i:s O", $time),
'unit' => 'minute',
'duration' => 5
);
$transaction_data = array(
'transaction_details' => $transaction_details,
'item_details' => $item_details,
'customer_details' => $billing_address,
'credit_card' => $credit_card,
'expiry' => $custom_expiry
);
error_log(json_encode($transaction_data));
$snapToken = $this->midtrans->getSnapToken($transaction_data);
error_log($snapToken);
echo $snapToken;
}
public function finish($result)
{
$result = json_decode($this->input->post('result_data'));
echo 'RESULT <br><pre>';
var_dump($result);
echo '</pre>';
}
}

View File

@@ -0,0 +1,154 @@
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Vtweb extends CI_Controller
{
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/welcome/<method_name>
* @see http://codeigniter.com/user_guide/general/urls.html
*/
public function __construct()
{
parent::__construct();
$params = array('server_key' => 'SB-Mid-server-qjMkTCJmmL0DwPIBM3KPLull', 'production' => false);
$this->load->library('veritrans');
$this->veritrans->config($params);
$this->load->helper('url');
}
public function index()
{
$this->load->view('checkout_vtweb');
}
public function vtweb_checkout()
{
$transaction_details = array(
'order_id' => uniqid(),
'gross_amount' => 200000
);
// Populate items
$items = [
array(
'id' => 'item1',
'price' => 100000,
'quantity' => 1,
'name' => 'Adidas f50'
),
array(
'id' => 'item2',
'price' => 50000,
'quantity' => 2,
'name' => 'Nike N90'
)
];
// Populate customer's billing address
$billing_address = array(
'first_name' => "Andri",
'last_name' => "Setiawan",
'address' => "Karet Belakang 15A, Setiabudi.",
'city' => "Jakarta",
'postal_code' => "51161",
'phone' => "081322311801",
'country_code' => 'IDN'
);
// Populate customer's shipping address
$shipping_address = array(
'first_name' => "John",
'last_name' => "Watson",
'address' => "Bakerstreet 221B.",
'city' => "Jakarta",
'postal_code' => "51162",
'phone' => "081322311801",
'country_code' => 'IDN'
);
// Populate customer's Info
$customer_details = array(
'first_name' => "Andri",
'last_name' => "Setiawan",
'email' => "andrisetiawan@me.com",
'phone' => "081322311801",
'billing_address' => $billing_address,
'shipping_address' => $shipping_address
);
// Data yang akan dikirim untuk request redirect_url.
// Uncomment 'credit_card_3d_secure' => true jika transaksi ingin diproses dengan 3DSecure.
$transaction_data = array(
'payment_type' => 'vtweb',
'vtweb' => array(
//'enabled_payments' => ['credit_card'],
'credit_card_3d_secure' => true
),
'transaction_details' => $transaction_details,
'item_details' => $items,
'customer_details' => $customer_details
);
try {
$vtweb_url = $this->veritrans->vtweb_charge($transaction_data);
header('Location: ' . $vtweb_url);
} catch (Exception $e) {
echo $e->getMessage();
}
}
public function notification()
{
echo 'test notification handler';
$json_result = file_get_contents('php://input');
$result = json_decode($json_result);
if ($result) {
$notif = $this->veritrans->status($result->order_id);
}
error_log(print_r($result, TRUE));
//notification handler sample
$transaction = $notif->transaction_status;
$type = $notif->payment_type;
$order_id = $notif->order_id;
$fraud = $notif->fraud_status;
if ($transaction == 'capture') {
// For credit card transaction, we need to check whether transaction is challenge by FDS or not
if ($type == 'credit_card') {
if ($fraud == 'challenge') {
// TODO set payment status in merchant's database to 'Challenge by FDS'
// TODO merchant should decide whether this transaction is authorized or not in MAP
echo "Transaction order_id: " . $order_id . " is challenged by FDS";
} else {
// TODO set payment status in merchant's database to 'Success'
echo "Transaction order_id: " . $order_id . " successfully captured using " . $type;
}
}
} else if ($transaction == 'settlement') {
// TODO set payment status in merchant's database to 'Settlement'
echo "Transaction order_id: " . $order_id . " successfully transfered using " . $type;
} else if ($transaction == 'pending') {
// TODO set payment status in merchant's database to 'Pending'
echo "Waiting customer to finish transaction order_id: " . $order_id . " using " . $type;
} else if ($transaction == 'deny') {
// TODO set payment status in merchant's database to 'Denied'
echo "Payment using " . $type . " for transaction order_id: " . $order_id . " is denied.";
}
}
}