-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdealer.php
84 lines (73 loc) · 2.02 KB
/
dealer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once('admin_main.php');
class Dealer extends Admin_main
{
function __construct()
{
parent::__construct();
}
function index()
{
header("Location: " . site_url('dealer/list_view'));
exit();
}
public function list_view ($start = 0) // PAGE VIEW
{
$data = $this->data;
$data['title'] = 'Car Dealers';
$limit = 10;
$count_result = $this->user_model->get_dealers_count($_GET); // Record count
$data['dealers'] = $this->user_model->get_dealers($_GET, $start, $limit); // Main Query
$this->load->library('pagination');
$config['base_url'] = site_url('dealer/list_view/');
$config['total_rows'] = $count_result['cnt'];
$config['per_page'] = $limit;
$config['first_url'] = $config['base_url'].'?'.http_build_query($_GET);
$this->pagination->initialize($config);
$data['links'] = $this->pagination->create_links();
$data['result_count'] = $count_result['cnt'];
$this->load->view('admin/dealers', $data);
}
public function activate ($user_id) // PAGE ACTION (Convert to AJAX)
{
$this->user_model->activate_dealer($user_id);
header("Location: ".site_url('dealer/list_view'));
exit();
}
public function add_document_tender($uploadKey='')
{
if($uploadKey!="")
{
$where = array("uploadKey"=>$uploadKey);
$row = $this->user_model->getRow("dealer_requests",$where);
if($row)
{
$data = array();
$data['id_dealer'] = $row->fk_user;
$data['company'] = array("favicon"=>"");
$this->load->view("admin/upload_document",$data);
}
else
{
redirect(site_url());
}
}
else
{
redirect(site_url());
}
}
public function deactivate ($user_id) // PAGE ACTION (Convert to AJAX)
{
$this->user_model->deactivate_dealer($user_id);
header("Location: ".site_url('dealer/list_view'));
exit();
}
public function delete ($user_id) // PAGE ACTION (Convert to AJAX)
{
$this->user_model->delete_dealer($user_id);
header("Location: ".site_url('dealer/list_view'));
exit();
}
}
?>