| Server IP : 162.214.74.102 / Your IP : 216.73.217.103 Web Server : Apache System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64 User : lrsys ( 1015) PHP Version : 5.6.40 Disable Function : exec,passthru,shell_exec,system MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/lrsys/public_html/lrsys_projetos/sopizzas/application/controllers/ |
Upload File : |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
session_start(); //we need to call PHP's session object to access it through CI
class Applydriveronline extends CI_Controller {
function __construct()
{
parent::__construct();
$this->load->helper("url");
$this->load->helper('form');
$this->load->library('form_validation');
$this->load->model('frontend_model');
$this->load->model('driver_model');
$this->load->model('dashboard_model');
$this->load->model('menumanagement_model');
$this->load->model('restaurantmanagement_model');
$session_data = $this->session->userdata('logged_in');
$this->load->library('m_pdf');
$this->load->library('myemail');
if($this->session->userdata('user_language'))
{
$language = $this->session->userdata('user_language');
}
else
{
$language = $this->config->item("language");
}
$data['user_language'] = $language;
$this->lang->load('frontpage', $language);
}
function index( $restaurant_id = 0 ) {
if ($this->input->server('REQUEST_METHOD') == 'POST') {
if ($this->input->post('form_name') && $this->input->post('form_name') == 'driver_apply_main') {
$this->addDriverApplyMain();
}
else if ($this->input->post('form_name') && $this->input->post('form_name') == 'driver_apply_details') {
$this->addDriverApplyDetails();
}
else if ($this->input->post('form_name') && $this->input->post('form_name') == 'driver_apply_license') {
$this->addDriverApplyLicense();
}
else if ($this->input->post('form_name') && $this->input->post('form_name') == 'driver_apply_files') {
$this->addDriverApplyFiles();
}
}
else {
$this->showDriverApplyMain();
}
}
function showDriverApplyMain() {
$data['title']="Driver Apply online";
$data['page']="driverapplyonline";
$this->load->view('frontend/header',$data);
$this->load->view('frontend/applydriveronline_main');
$this->load->view('frontend/footer');
}
function addDriverApplyMain() {
/*echo "<pre>";
print_r ($this->input->post());
echo "</pre>";
exit();*/
$now = date('Y-m-d H:i:s');
$this->form_validation->set_rules('driver_email', 'Email address', 'trim|required|callback_isEmailExist');
$this->form_validation->set_message('is_unique', 'Entered email is already registered!');
$this->form_validation->set_rules('driver_password', 'Driver Password', 'trim|required');
if ($this->form_validation->run() == FALSE) {
$this->showDriverApplyMain();
} else {
$this->db->trans_start();
$driver_email = $this->input->post('driver_email');
$driver_password = $this->input->post('driver_password');
$data_in = array(
'driver_email' => $driver_email,
'driver_password' => md5($driver_password),
'addeddate' => $now
);
$this->db->insert('rt_driver_temp', $data_in);
$driver_id = $this->db->insert_id();
$this->session->set_userdata('driver_registration_id', $driver_id);
$this->db->trans_complete();
redirect('applydriveronline/details');
}
}
function isEmailExist() {
/*echo "<pre>";
print_r ($this->input->post());
echo "</pre>";
exit();*/
$driver_id = $this->input->post('EditId');
if ($driver_id == '') {
$driver_id = 0;
}
$driver_email = $this->input->post('driver_email');
$isEmailExists = $this->driver_model->isEmailExist($driver_email,$driver_id);
if ($isEmailExists) {
$this->form_validation->set_message('isEmailExist', 'Email already exist');
return false;
}
else {
return true;
}
}
function details() {
$data['title'] = "Driver Apply online";
$data['page'] = "driverapplyonline";
$driver_id = $this->session->userdata('driver_registration_id');
if (isset($driver_id) && $driver_id != '') {
$data['driver_id'] = $driver_id;
$data['driver_details'] = $this->driver_model->getDriverData($driver_id);
$myMonths = array('1' => 'January', '2' => 'February', '3' => 'March', '4' => 'April', '5' => 'May', '6' => 'June', '7' => 'July', '8' => 'August', '9' => 'September', '10' => 'October', '11' => 'November', '12' => 'December');
$myDevices = array('1' => 'iPhone', '2' => 'Android');
$myVehicles = array('1' => 'Bicycle', '2' => 'Car', '3' => 'Scooter', '4' => 'Motorcycle', '5' => 'Walker');
$data['myMonths'] = $myMonths;
$data['myDevices'] = $myDevices;
$data['myVehicles'] = $myVehicles;
$this->load->view('frontend/header',$data);
$this->load->view('frontend/applydriveronline_details');
$this->load->view('frontend/footer');
}
else {
redirect('apply-driver-online');
}
}
function addDriverApplyDetails() {
/*echo "<pre>";
print_r ($this->input->post());
echo "</pre>";
exit();*/
$this->form_validation->set_rules('driver_first_name', 'trim|xss_clean');
$this->form_validation->set_rules('driver_last_name', 'trim|xss_clean');
$this->form_validation->set_rules('driver_mobile_number', 'trim|xss_clean');
$this->form_validation->set_rules('driver_device', 'trim|xss_clean');
$this->form_validation->set_rules('driver_vehicle_make', 'trim|xss_clean');
$this->form_validation->set_rules('driver_vehicle_model', 'trim|xss_clean');
$this->form_validation->set_rules('driver_vehicle_year', 'trim|xss_clean');
$this->form_validation->set_rules('driver_street_address', 'trim|xss_clean');
$this->form_validation->set_rules('driver_social_security_number', 'trim|xss_clean');
$this->form_validation->set_rules('driver_state', 'trim|xss_clean');
$this->form_validation->set_rules('driver_city', 'trim|xss_clean');
$this->form_validation->set_rules('driver_zipcode', 'trim|xss_clean');
$driver_id = $this->input->post('driver_id');
$this->db->trans_start();
$driver_first_name = $this->input->post('driver_first_name');
$driver_last_name = $this->input->post('driver_last_name');
$driver_mobile_number = $this->input->post('driver_mobile_number');
$driver_device = $this->input->post('driver_device');
$driver_vehicle_make = $this->input->post('driver_vehicle_make');
$driver_vehicle_model = $this->input->post('driver_vehicle_model');
$driver_vehicle_year = $this->input->post('driver_vehicle_year');
$driver_street_address = $this->input->post('driver_street_address');
$driver_social_security_number = $this->input->post('driver_social_security_number');
$driver_state = $this->input->post('driver_state');
$driver_city = $this->input->post('driver_city');
$driver_zipcode = $this->input->post('driver_zipcode');
//FOR AUS
$ownVehicle = $this->input->post('ownVehicle');
$ageConfirm = $this->input->post('ageConfirm');
$hasWorkPermit = $this->input->post('hasWorkPermit');
$hasABN = $this->input->post('hasABN');
$workingHour = $this->input->post('workingHour');
$data_up = array(
'driver_first_name' => $driver_first_name,
'driver_last_name' => $driver_last_name,
'driver_mobile_number' => $driver_mobile_number,
'driver_device' => $driver_device,
'driver_vehicle_make' => $driver_vehicle_make,
'driver_vehicle_model' => $driver_vehicle_model,
'driver_vehicle_year' => $driver_vehicle_year,
'driver_street_address' => $driver_street_address,
'driver_social_security_number' => $driver_social_security_number,
'driver_state' => $driver_state,
'driver_city' => $driver_city,
'driver_zipcode' => $driver_zipcode,
'own_vehicle' => $ownVehicle,
'age_confirm' => $ageConfirm,
'has_work_permit' => $hasWorkPermit,
'has_abn' => $hasABN,
'working_hour' => $workingHour
);
$this->db->where('driver_id', $driver_id);
$this->db->update('rt_driver_temp', $data_up);
$this->db->trans_complete();
$this->session->set_userdata('driver_vehicle_make', $driver_vehicle_make);
redirect('applydriveronline/license');
}
function license() {
$data['title'] = "Driver Apply online";
$data['page'] = "driverapplyonline";
$driver_id = $this->session->userdata('driver_registration_id');
if (isset($driver_id) && $driver_id != '') {
$data['driver_id'] = $driver_id;
$data['vehicle_type'] = $this->session->userdata('driver_vehicle_make');
$data['driver_details'] = $this->driver_model->getDriverData($driver_id);
$data['StateList'] = $this->frontend_model->StateList();
$this->load->view('frontend/header',$data);
$this->load->view('frontend/applydriveronline_license');
$this->load->view('frontend/footer');
}
else {
redirect('apply-driver-online');
}
}
function addDriverApplyLicense() {
/*echo "<pre>";
print_r ($this->input->post());
echo "</pre>";
exit();*/
$this->form_validation->set_rules('driver_license_first_name', 'trim|xss_clean|required|required');
$this->form_validation->set_rules('driver_license_middle_name', 'trim|xss_clean');
$this->form_validation->set_rules('driver_license_last_name', 'trim|xss_clean|required');
$this->form_validation->set_rules('driver_license_dob', 'trim|xss_clean|required');
$this->form_validation->set_rules('driver_license_number', 'trim|xss_clean|required');
$this->form_validation->set_rules('driver_license_plate_number ', 'trim|xss_clean|required');
$this->form_validation->set_rules('driver_license_state', 'trim|xss_clean|required');
$this->form_validation->set_rules('driver_license_expire_dob', 'trim|xss_clean|required');
$this->form_validation->set_rules('driver_insurance_provider', 'trim|xss_clean|required');
$this->form_validation->set_rules('driver_insurance_number', 'trim|xss_clean|required');
$this->form_validation->set_rules('is_vehicle_certify', 'trim|xss_clean|required');
$driver_id = $this->input->post('driver_id');
$this->db->trans_start();
$driver_license_first_name = $this->input->post('driver_license_first_name');
$driver_license_middle_name = $this->input->post('driver_license_middle_name');
$driver_license_last_name = $this->input->post('driver_license_last_name');
$driver_license_dob = $this->input->post('driver_license_dob');
$date1 = str_replace('/', '-', $driver_license_dob);
$date_array = explode('-', $date1);
$date1 = $date_array[1]."-".$date_array[0]."-".$date_array[2];
$driver_license_dob = date("Y-m-d", strtotime($date1));
$driver_license_number = $this->input->post('driver_license_number');
$driver_license_plate_number = $this->input->post('driver_license_plate_number');
$driver_license_state = $this->input->post('driver_license_state');
$driver_license_expire_dob = $this->input->post('driver_license_expire_dob');
$date2 = str_replace('/', '-', $driver_license_expire_dob);
$date_array = explode('-', $date2);
$date2 = $date_array[1]."-".$date_array[0]."-".$date_array[2];
$driver_license_expire_dob = date("Y-m-d", strtotime($date2));
$driver_insurance_provider = $this->input->post('driver_insurance_provider');
$driver_insurance_number = $this->input->post('driver_insurance_number');
$is_vehicle_certify = $this->input->post('is_vehicle_certify');
$data_up = array(
'driver_license_first_name' => $driver_license_first_name,
'driver_license_middle_name' => $driver_license_middle_name,
'driver_license_last_name' => $driver_license_last_name,
'driver_license_dob' => $driver_license_dob,
'driver_license_number' => $driver_license_number,
'driver_license_plate_number' => $driver_license_plate_number,
'driver_license_state' => $driver_license_state,
'driver_license_expire_dob' => $driver_license_expire_dob,
'driver_insurance_provider' => $driver_insurance_provider,
'driver_insurance_number' => $driver_insurance_number,
'is_vehicle_certify' => $is_vehicle_certify
);
$this->db->where('driver_id', $driver_id);
$this->db->update('rt_driver_temp', $data_up);
$this->db->trans_complete();
redirect('applydriveronline/files');
}
function files() {
$data['title'] = "Driver Apply online";
$data['page'] = "driverapplyonline";
$driver_id = $this->session->userdata('driver_registration_id');
if (isset($driver_id) && $driver_id != '') {
$data['driver_id'] = $driver_id;
$this->load->view('frontend/header',$data);
$this->load->view('frontend/applydriveronline_files');
$this->load->view('frontend/footer');
}
else {
redirect('apply-driver-online');
}
}
function addDriverApplyFiles() {
/*echo "<pre>";
print_r ($_FILES);
echo "</pre>";
exit();*/
$driver_id = $this->session->userdata('driver_registration_id');
if ($_FILES['driver_photo']['name'] != '') {
$driver_photo = $this->do_upload_driver_image('driver_photo');
}
else {
$driver_photo = '';
}
if ($_FILES['driver_license_photo']['name'] != '') {
$driver_license_photo = $this->do_upload_license_image('driver_license_photo');
//$driver_license_photo = str_replace(' ', '_', $_FILES['driver_license_photo']['name']);
}
else {
$driver_license_photo = '';
}
if ($_FILES['driver_insurance_photo']['name'] != '') {
$driver_insurance_photo = $this->do_upload_insurance_image('driver_insurance_photo');
//$driver_insurance_photo = str_replace(' ', '_', $_FILES['driver_insurance_photo']['name']);
}
else {
$driver_insurance_photo = '';
}
$this->db->trans_start();
$data_up = array(
'driver_license_photo' => $driver_license_photo,
'driver_insurance_photo' => $driver_insurance_photo,
'driver_photo' => $driver_photo
);
$this->db->where('driver_id', $driver_id);
$this->db->update('rt_driver_temp', $data_up);
$this->db->trans_complete();
redirect('applydriveronline/thankyou');
// redirect('applydriveronline/files');
}
function do_upload_driver_image($db_field_name, $old_photo_name = '') {
$rendid = date('Ymdhis');
$new_name = $rendid.'_driver_photo.jpg';
$config1 = array(
'upload_path' => DRIVER_IMAGE_PATH,
'allowed_types' => "gif|jpg|png|jpeg",
'overwrite' => TRUE,
'file_name' => $new_name
);
$this->load->library('upload', $config1);
$this->upload->initialize($config1);
if($this->upload->do_upload($db_field_name))
{
$config2['image_library'] = 'gd2';
$config2['source_image'] = $this->upload->upload_path.$this->upload->file_name;
$config2['new_image'] = DRIVER_IMAGE_PATH_THUMBS;
$config2['maintain_ratio'] = TRUE;
//$config2['create_thumb'] = TRUE;
//$config2['thumb_marker'] = '_thumb';
$config2['width'] = DRIVER_IMAGE_WIDTH;
$config2['height'] = DRIVER_IMAGE_HEIGHT;
$this->load->library('image_lib',$config2);
$this->image_lib->initialize($config2);
if ( !$this->image_lib->resize()){
$this->session->set_flashdata('error_msg', $this->image_lib->display_errors('', ''));
}
unlink(DRIVER_IMAGE_PATH.$new_name);
if ($old_photo_name != '' && file_exists(DRIVER_IMAGE_PATH_THUMBS.$old_photo_name)) {
unlink(DRIVER_IMAGE_PATH_THUMBS.$old_photo_name);
}
return $new_name;
}
else {
$error = $this->upload->display_errors();
$this->session->set_flashdata('error_msg', $error);
redirect('applydriveronline/files');
}
}
/*function do_upload_license_image($db_field_name, $old_photo_name = '') {
$rendid = date('Ymdhis');
$new_name = $rendid.'_license_photo.jpg';
$config1 = array(
'upload_path' => DRIVER_LICENSE_PATH,
'allowed_types' => "gif|jpg|png|jpeg|pdf|xls|docx|doc",
'overwrite' => TRUE,
'file_name' => $new_name
);
$this->load->library('upload', $config1);
$this->upload->initialize($config1);
if($this->upload->do_upload($db_field_name))
{
$config2['image_library'] = 'gd2';
$config2['source_image'] = $this->upload->upload_path.$this->upload->file_name;
$config2['new_image'] = DRIVER_LICENSE_PATH.'thumbs';
$config2['maintain_ratio'] = TRUE;
//$config2['create_thumb'] = TRUE;
//$config2['thumb_marker'] = '_thumb';
$config2['width'] = DRIVER_LICENSE_WIDTH;
$config2['height'] = DRIVER_LICENSE_HEIGHT;
$this->load->library('image_lib',$config2);
$this->image_lib->initialize($config2);
if ( !$this->image_lib->resize()){
$this->session->set_flashdata('error_msg', $this->image_lib->display_errors('', ''));
}
unlink(DRIVER_LICENSE_PATH.$new_name);
if ($old_photo_name != '' && file_exists(DRIVER_LICENSE_PATH_THUMBS.$old_photo_name)) {
unlink(DRIVER_LICENSE_PATH_THUMBS.$old_photo_name);
}
return $new_name;
}
else {
$error = $this->upload->display_errors();
$this->session->set_flashdata('error_msg', $error);
redirect('applydriveronline/files');
}
}*/
function do_upload_license_image($db_field_name, $old_photo_name = '') {
$rendid = date('Ymdhis');
$last_name = $this->input->post('driver_last_name');
$filename = $_FILES['driver_license_photo']['name'];
$vid_ext_arr = explode(".",$filename);
$vid_ext_arr_cnt= count($vid_ext_arr);
$vid_ext = strtolower($vid_ext_arr[$vid_ext_arr_cnt-1]);
$new_name = $last_name.'_DLImage_'.$rendid.'.'.$vid_ext;
$config1 = array(
'upload_path' => DRIVER_LICENSE_PATH_THUMBS,
'allowed_types' => "gif|jpg|png|jpeg|pdf|doc|xml|docx",
'overwrite' => TRUE,
'file_name' => $new_name
);
$this->load->library('upload', $config1);
$this->upload->initialize($config1);
if($this->upload->do_upload($db_field_name))
{
return $new_name;
}
else {
$error = $this->upload->display_errors();
$this->session->set_flashdata('error_msg', $error);
redirect('applydriveronline/files');
}
}
function do_upload_insurance_image($db_field_name, $old_photo_name = '') {
$rendid = date('Ymdhis');
$last_name = $this->input->post('driver_last_name');
$filename = $_FILES['driver_insurance_photo']['name'];
$vid_ext_arr = explode(".",$filename);
$vid_ext_arr_cnt= count($vid_ext_arr);
$vid_ext = strtolower($vid_ext_arr[$vid_ext_arr_cnt-1]);
$new_name = $last_name.'_DIImage_'.$rendid.'.'.$vid_ext;
$config1 = array(
'upload_path' => DRIVER_INSURANCE_PATH_THUMBS,
'allowed_types' => "gif|jpg|png|jpeg|pdf|doc|xml|docx",
'overwrite' => TRUE,
'file_name' => $new_name
);
$this->load->library('upload', $config1);
$this->upload->initialize($config1);
if($this->upload->do_upload($db_field_name))
{
return $new_name;
}
else {
$error = $this->upload->display_errors();
$this->session->set_flashdata('error_msg', $error);
redirect('applydriveronline/files');
}
}
/*function do_upload_insurance_image($db_field_name, $old_photo_name = '') {
$rendid = date('Ymdhis');
$new_name = $rendid.'_insurance_photo.jpg';
$config1 = array(
'upload_path' => DRIVER_INSURANCE_PATH,
'allowed_types' => "gif|jpg|png|jpeg|pdf|xls|docx|doc",
'overwrite' => TRUE,
'file_name' => $new_name
);
$this->load->library('upload', $config1);
$this->upload->initialize($config1);
if($this->upload->do_upload($db_field_name))
{
$config2['image_library'] = 'gd2';
$config2['source_image'] = $this->upload->upload_path.$this->upload->file_name;
$config2['new_image'] = DRIVER_INSURANCE_PATH.'thumbs';
$config2['maintain_ratio'] = TRUE;
//$config2['create_thumb'] = TRUE;
//$config2['thumb_marker'] = '_thumb';
$config2['width'] = DRIVER_INSURANCE_WIDTH;
$config2['height'] = DRIVER_INSURANCE_HEIGHT;
$this->load->library('image_lib',$config2);
$this->image_lib->initialize($config2);
if ( !$this->image_lib->resize()){
$this->session->set_flashdata('error_msg', $this->image_lib->display_errors('', ''));
}
unlink(DRIVER_INSURANCE_PATH.$new_name);
if ($old_photo_name != '' && file_exists(DRIVER_INSURANCE_PATH_THUMBS.$old_photo_name)) {
unlink(DRIVER_INSURANCE_PATH_THUMBS.$old_photo_name);
}
return $new_name;
}
else {
$error = $this->upload->display_errors();
$this->session->set_flashdata('error_msg', $error);
redirect('applydriveronline/files');
}
}*/
function thankyou() {
$driver_id = $this->session->userdata('driver_registration_id');
//$driver_id = 30;
$data['driver_id'] = $driver_id;
$this->db->trans_start();
$data_up = array(
'driver_validate_id' => md5($driver_id)
);
$this->db->where('driver_id', $driver_id);
$this->db->update('rt_driver_temp', $data_up);
$this->db->trans_complete();
$logo=base_url().'assets/logo-main.png';
$image_path = base_url().'assets/';
$variables = array();
$driver_data = $this->driver_model->getDriverData($driver_id);
$to = $driver_data['driver_email'];
$driver_name = $driver_data['driver_first_name'].' '.$driver_data['driver_last_name'];
$link_button=anchor('applydriveronline/validateDriver/' . md5($driver_id),'<button>Verify Email</button>');
$link = anchor('applydriveronline/validateDriver/' . md5($driver_id));
$only_link = base_url().'applydriveronline/validateDriver/' . md5($driver_id);
//$logo="<img src='". $path."' style='height:48px; width:auto;'>";
//$variables['recipient'] = $driver_name;
//$variables['name'] = $driver_name;
$variables['link_button'] = $link_button;
$variables['link'] = $link;
$variables['only_link'] = $only_link;
$variables['logo'] = $logo;
$variables['image_path'] = $image_path;
$variables['to_email'] = $to;
//$variables['sender_email'] = SITE_CONTACT_EMAIL;
$variables['site_address'] = SITE_ADDRESS;
$variables['sender_name'] = SITENAME;
$variables['site_name'] = SITENAME;
$template_name = 'driver_email_verification';
$mail_data = $this->frontend_model->getEmailTemplate($template_name);
$mailcontent=htmlspecialchars_decode($mail_data->template);
$subject = $mail_data->subject;
foreach($variables as $key => $value) {
$mailcontent = str_replace('{{'.$key.'}}', $value, $mailcontent);
}
/*echo($mailcontent);
exit();*/
/*$this->load->library('email');
$config['charset'] = 'utf-8';
$config['wordwrap'] = TRUE;
$config['mailtype'] = 'html';
$this->email->initialize($config);
$this->email->from(SITENAME);
$this->email->to($to);
$this->email->subject($subject);
$this->email->message($mailcontent);
$this->email->send();*/
$this->send_my_mail($to,$subject,$mailcontent);
$this->session->unset_userdata('driver_registration_id');
$data['title'] = "Thank You";
$data['page'] = "driverapplyonline";
$this->load->view('frontend/header',$data);
$this->load->view('frontend/thankyou');
$this->load->view('frontend/footer');
}
function validateDriver($verify_code) {
$now = date('Y-m-d H:i:s');
if ($verify_code != '') {
$checkDriver = $this->driver_model->validateDriver($verify_code);
if ($checkDriver == 1) {
$data = $this->driver_model->getDriverData_byCode($verify_code);
$this->db->trans_start();
$data_in = array(
'driver_email' => $data['driver_email'],
'driver_password' => $data['driver_password'],
'addeddate' => $now,
'driver_first_name' => $data['driver_first_name'],
'driver_last_name' => $data['driver_last_name'],
'driver_mobile_number' => $data['driver_mobile_number'],
'driver_street_address' => $data['driver_street_address'],
'driver_social_security_number' => $data['driver_social_security_number'],
'driver_device' => $data['driver_device'],
'driver_vehicle_make' => $data['driver_vehicle_make'],
'driver_vehicle_model' => $data['driver_vehicle_model'],
'driver_vehicle_year' => $data['driver_vehicle_year'],
'driver_license_first_name' => $data['driver_license_first_name'],
'driver_license_middle_name' => $data['driver_license_middle_name'],
'driver_license_last_name' => $data['driver_license_last_name'],
'driver_license_dob' => $data['driver_license_dob'],
'driver_license_number' => $data['driver_license_number'],
'driver_license_plate_number' => $data['driver_license_plate_number'],
'driver_license_state' => $data['driver_license_state'],
'driver_license_expire_dob' => $data['driver_license_expire_dob'],
'driver_insurance_provider' => $data['driver_insurance_provider'],
'driver_insurance_number' => $data['driver_insurance_number'],
'is_vehicle_certify' => $data['is_vehicle_certify'],
'driver_license_photo' => $data['driver_license_photo'],
'driver_insurance_photo' => $data['driver_insurance_photo'],
'driver_photo' => $data['driver_photo'],
'driver_state' => $data['driver_state'],
'driver_city' => $data['driver_city'],
'driver_zipcode' => $data['driver_zipcode'],
'driver_validate' => $data['driver_validate'],
'driver_validate_id' => $data['driver_validate_id'],
'own_vehicle' => $data['own_vehicle'],
'age_confirm' => $data['age_confirm'],
'has_work_permit' => $data['has_work_permit'],
'has_abn' => $data['has_abn'],
'working_hour' => $data['working_hour']
);
$this->db->insert('rt_driver', $data_in);
$driver_id = $this->db->insert_id();
$this->db->trans_complete();
$data['title'] = "Thank You";
$data['page'] = "driverapplyonlinevalid";
$this->load->view('frontend/header',$data);
$this->load->view('frontend/thankyou');
$this->load->view('frontend/footer');
}
else if ($checkDriver == 2) {
$data['title'] = "Thank You";
$data['page'] = "driverapplyonlinealreadyvalid";
$this->load->view('frontend/header',$data);
$this->load->view('frontend/thankyou');
$this->load->view('frontend/footer');
}
else if ($checkDriver == 0) {
$data['title'] = "Thank You";
$data['page'] = "driverapplyonlineinvalid";
$this->load->view('frontend/header',$data);
$this->load->view('frontend/thankyou');
$this->load->view('frontend/footer');
}
}
}
function send_my_mail($mail_To,$mail_subject,$mail_Body,$mail_CC="")
{
$mail_From = SITENAME;
$mail = new PHPMailer();
//Your SMTP servers details
$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = SMTP_HOST; // specify main and backup server or localhost
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = SMTP_USER; // SMTP username
$mail->Password = SMTP_PASSWORD; // SMTP password It should be same as that of the SMTP user
//$mail->PluginDir = "/home/phpaucti/public_html/website_development/coding/includes/";
$mail->From = $mail->Username; //Default From email same as smtp user
$mail->FromName = $mail_From;
$emailArr = explode(',',$mail_To);
foreach($emailArr AS $emailVal) {
$mail->AddAddress($emailVal, ""); //Email address where you wish to receive/collect those emails.
}
/*$emailCCArr = explode(',',$mail_CC);
foreach($emailCCArr AS $emailCCVal) {
$mail->AddCC($emailCCVal, ""); //Email address where you wish to receive/collect those emails.
}*/
$mail->WordWrap = 100; // set word wrap to 50 characters
$mail->IsHTML(true); // set email format to HTML
$mail->Subject = $mail_subject;
$message = $mail_Body;
$mail->Body = $message;
if(!$mail->Send())
{
/*echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;*/
}
else
{
//echo 'ok';
}
}
function earning_details($invoice_id)
{
//$orderid = 190;
$pdfContent = $this->DriverEarning4PDF($invoice_id);
$this->m_pdf->pdf->list_indent_first_level = 0; // 1 or 0 - whether to indent the first level of a list
$this->m_pdf->pdf->useOnlyCoreFonts = true; // false is default
$stylesheet = file_get_contents(base_url().'assets/css/mpdfstyletables.css');
$this->m_pdf->pdf->WriteHTML($stylesheet,1);
$this->m_pdf->pdf->WriteHTML($pdfContent,2);
$this->m_pdf->pdf->Output('invoice_'.$orderid.'.pdf','D');
exit;
}
function DriverEarning4PDF($invoice_id)
{
$invoice_details = $this->dashboard_model->get_driver_earning($invoice_id);
if($invoice_details)
{
$website_settings = $this->dashboard_model->get_website_settings();
$fr_date=$invoice_details['from_date'];
$to_date=$invoice_details['to_date'];
$driver_id = $invoice_details['driverid'];
$orderdetails = '';
$status = 'Delivered';
$this -> db -> select('*');
$this -> db -> from('rt_order');
$this -> db -> where('driverid', $driver_id);
$this -> db -> where('status', $status);
$this -> db -> where('date(delivery_completed_date) >=', $fr_date);
$this -> db -> where('date(delivery_completed_date) <=', $to_date);
$query = $this -> db -> get();
$result= $query->result_array();
if(is_array($result) && sizeof($result)>0)
{
$sl_no =1;
foreach($result as $row) {
$rowTotal[] = $row['driver_commission'];
$TipsTotal[] = $row['tip'];
$DriverCommission[] = $row['driver_commission']+$row['tip'];
$orderdetails .= '<tr>
<td align="left" style="height:35px;border-bottom:1px solid #CCC; max-width:40%;">'.$row['ordergenerateid'].'</td>
<td align="left" style="height:35px;border-bottom:1px solid #CCC;">'.$row['restaurant_name'].'</td>
<td align="left" style="height:35px;border-bottom:1px solid #CCC;">'.date('m/d/Y',strtotime($row['delivery_completed_date'])).'</td>
<td align="left" style="height:35px;border-bottom:1px solid #CCC;">'.SITENAME_CURRENCY.''.$row['driver_commission'].'</td>
<td align="left" style="height:35px;border-bottom:1px solid #CCC;">'.SITENAME_CURRENCY.''.number_format($row['tip'],2).'</td>
</tr>';
$sl_no = $sl_no+1;
}
if(!empty($rowTotal) && is_array($rowTotal))
{
$EarnTotal = array_sum($rowTotal);
}
if(!empty($TipsTotal) && is_array($TipsTotal))
{
$TipsTotal = array_sum($TipsTotal);
}
if(!empty($DriverCommission) && is_array($DriverCommission))
{
$DriverCommission = array_sum($DriverCommission);
}
}
$logo = base_url().SITE_LOGO_PATH_THUMBS.$website_settings['sitelogo'];
$order_payment_details = '<tr>
<td align="left" colspan="3">
<table width="100%" cellpadding="5" cellspacing="0" border="0" style="border:1px solid #CCC;">
<tr><td width="18%">Payment Method</td><td width="2%">:</td><td width="30%">'.$payment_type.'</td>'.$trasnsId_details.'</tr>
</table>
</td>
</tr>';
//___________JOSE___________ Aca se modifico lo que se imprimia en el pdf para que mostrara el deliverydoornumber y el deliverylandmark
//.......................................................................................................................................................
$pdf_content .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>
<div style="display:block; width:760px; padding:0 10px;">
<div style="display:block; width:100%; vertical-align:top;">
<div style="display:block; width:100%; vertical-align:top;">
<table width="100%" align="center">
<tr>
<td valign="top" width="70%">
<table style="display:inline-block; width:100%; vertical-align:top; float:right;font-family:Arial; font-size:13px; ">
<tr style="display:block; width:100%; font-family:Arial; font-size:13px;">
<td style="display:inline-block; width:100%; vertical-align:top; font-size:20px; font-weight:bold;">#INV'.$invoice_details['invoice_id'].'</td>
</tr>
<tr style="display:block; width:100%; font-family:Arial; font-size:13px;">
<td style="display:inline-block; width:100%; vertical-align:top; font-size:12px; ">Date : '.date('m/d/Y',strtotime($invoice_details['addeddate'])).'</td>
</tr>
<tr style="display:block; width:100%; font-family:Arial; font-size:13px;">
<td style="display:inline-block; width:100%; vertical-align:top; font-size:12px; ">Billing Period : '.date('m/d/Y',strtotime($invoice_details['from_date'])).' to '.date('m/d/Y',strtotime($invoice_details['to_date'])).'</td>
</tr>
<tr style="display:block; width:100%; font-family:Arial; font-size:13px;">
<td style="display:inline-block; width:100%; vertical-align:top; font-size:12px; "> </td>
</tr>
<tr style="display:block; width:100%;">
<td style="display:inline-block; width:100%; vertical-align:top;font-weight:bold;font-size:18px;">'.$invoice_details['driver_first_name'].' '.$invoice_details['driver_last_name'].'</td>
</tr>
<tr style="display:block; width:100%;">
<td style="display:inline-block; width:100%; vertical-align:top;font-weight:bold;">'.$invoice_details['driver_email'].'</td>
</tr>
<tr style="display:block; width:100%;">
<td style="display:inline-block; width:100%; vertical-align:top;">Question? Call us at '.SITE_PHONE_NO.'</td>
</tr>
</table>
</td>
<td valign="top" width="30%">
<div style="display:inline-block; width:100%; vertical-align:top;">
<img width="100" src="'.$logo.'" title="'.SITENAME.'" alt="'.SITENAME.'" />
</div>
</td>
</tr>
</table>
</div>
<div style="clear:both;"></div>
<div style="display: block; width: 100%; margin: 5px 0px; text-align: center; font-weight: bold; font-size: 20px;">Invoice Amt: '.SITENAME_CURRENCY.''.number_format($DriverCommission, 2).'</div>
<div style="clear:both;"></div>
<div style="clear:both;"></div>
<div style="display:block; width:100%; vertical-align:top; margin-top:20px;margin-bottom:10px;">
<div style="display:block; width:100%;font-weight:bold; font-family:Arial; font-size:13px;line-height:26px; margin-bottom:8px;">'.$restaurant_name.'</div>
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td align="left" style="height:25px; font-weight:bold;border-bottom:1px dotted #CCC;">Order Id </td>
<td align="left" style="height:25px; font-weight:bold;border-bottom:1px dotted #CCC;">Restaurant Name </td>
<td align="left" style="height:25px; font-weight:bold;border-bottom:1px dotted #CCC;">Delivery Date</td>
<td align="left" style="height:25px; font-weight:bold;border-bottom:1px dotted #CCC;">Earning from delivery</td>
<td align="left" style="height:25px; font-weight:bold;border-bottom:1px dotted #CCC;">Earning from tips</td>
</tr>
'.$orderdetails;
$pdf_content .= '<tr>
<td style="border-top:1px solid #CCC;"> </td>
<td style="border-top:1px solid #CCC;"> </td>
<td style="border-top:1px solid #CCC;"> </td>
<td align="left" style="height:35px;font-weight:bold;border-top:1px solid #CCC;">'.SITENAME_CURRENCY.''.number_format($EarnTotal,2).'</td>
<td align="left" style="height:35px;font-weight:bold;border-top:1px solid #CCC;">'.SITENAME_CURRENCY.''.number_format($TipsTotal,2).'</td>
</tr>
</table>
</div>
<div style="width:100%; font-family:Arial; font-size:13px;"></div>
</div>
<div style="width:100%; vertical-align:top; border-top:1px solid #000000;font-size:13px; font-family:Arial; margin-top:5px; margin-bottom:10px;padding-top:10px;">
<div style="float:left; width:40%;">';
$pdf_content .= '</div>
</div>
</div>
</body>
</html>';
/*<td> </td><td> </td><td>Tax('.$taxperchantage.' %)</td><td>'.SITENAME_CURRENCY.''.$taxamount.'</td>*/
//.......................................................................................................................................................
return $pdf_content;
}
}
}