HEX
Server: Apache/2.4.41 (Amazon) OpenSSL/1.0.2k-fips PHP/5.6.40
System: Linux ip-172-31-40-18 4.14.146-93.123.amzn1.x86_64 #1 SMP Tue Sep 24 00:45:23 UTC 2019 x86_64
User: apache (48)
PHP: 5.6.40
Disabled: NONE
Upload Files
File: //var/www/html/pmw24/app/application/controllers/admin/Userjob.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Userjob extends MY_Controller {
	public function __construct() {
		parent::__construct();
		$this->redirect_guest();
		$this->admin=$this->session->userdata('admin');
		$this->load->model('admin/muserjob');
	}
		
	public function index() {
		$data['content'] = 'admin/userjob/list';
		$this->load->view('admin/layouts/index', $data);	
	}
	
	public function all_content_list(){
		$start_date = $_POST['start_date'];
		$end_date = $_POST['end_date'];	
		$list = $this->muserjob->get_datatables($start_date,$end_date);
		$data = array();
		$no = $_POST['start'];
		$i=1;
		foreach ($list as $person) {
            $no++;
            $row = array();
			$row[] = '<input type="checkbox" class="cstm_view" title="'.$person->users_job_id.'">';
			//$row[] = '<input type="checkbox" class="cstm_view" title="'.$person->user_id.'">';				
			//$row[]=$i;		
			$row[] = $person->category_name;
			$row[] = $person->client_name;
			$row[] = $person->job_address;
			$row[] = $person->location;			
			$row[] =  $person->job_date;
			$row[] = $person->job_start_time;
			$row[] = $person->job_end_time;
			$job_date = explode('/',$person->job_date);
			$new_job_date = $job_date[2]."-".$job_date[1]."-".$job_date[0];
			if($new_job_date < date('Y-m-d'))
			{
				$job_status = "Completed";
			}else{
				$job_status = "Waitting";
			}
			$row[] = $person->name;	
			$row[] = $job_status;
            $row[] = '<a class="cstm_view" id="view" style="padding-left:5px" href="javascript:void(0)" title="'.$person->users_job_id.'">View</a>';			
            $data[] = $row;
			$i++;
        }
		
		$output = array(
                        "draw" => $_POST['draw'],
                        "recordsTotal" => $this->muserjob->count_all(),
                        "recordsFiltered" => $this->muserjob->count_filtered($start_date,$end_date),
                        "data" => $data,
                );
        echo json_encode($output);
	}
	
	public function all_details(){
		$users_job_id = $this->input->post('users_job_id');
		$result = $this->muserjob->get_details($users_job_id);
		$result['sub_category'] = $this->muserjob->get_sub_category($result['sub_cat_id']);		
		echo json_encode($result);
	}
	
	public function multiple_del()
	{
		$users_job_ids = explode(',',$this->input->post('users_job_ids'));
		foreach($users_job_ids as $users_job_id)
		{
			$condition['users_job_id'] = $users_job_id;					
			$this->muserjob->delete($condition);			
			$response=array('status'=>1,'message'=>'Success');
		}		
		echo header('Content-Type: application/json');
		echo json_encode($response);
	}
}