-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutility_helper.php
116 lines (101 loc) · 2.44 KB
/
utility_helper.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
function pr($array) {
echo "<pre>";
print_r($array);
echo "</pre>";
die();
}
/// Get Day name
function getDayName($date){
return date('D', strtotime($date));
}
/// Date Formate
function get_date($date){
return date('d M Y', strtotime($date));
}
function get_time($time){
$date = new DateTime($time);
return $date->format('g:i A ');
}
/// Date Formate
function Y_M_D($date){
return date('Y-m-d', strtotime($date));
}
/// Get Current Time in H:i, hour minute formate
function getCurrentTime(){
return date('H:i');
}
/// Get Current Day Name
function getCurrentDay(){
return date('D');
}
function current_full_url()
{
$CI =& get_instance();
$url = $CI->config->site_url($CI->uri->uri_string());
return $_SERVER['QUERY_STRING'] ? $url.'?'.$_SERVER['QUERY_STRING'] : $url;
}
function publicview($template, $data='')
{
$CI =& get_instance();
$CI->load->view('inc/header.php', $data);
$CI->load->view($template, $data);
$CI->load->view('inc/footer.php', $data);
}
// *****************admin *********************
function order_view($template, $data='')
{
$CI =& get_instance();
$CI->load->view('admin/inc/header.php', $data);
$CI->load->view('admin/order/page', $data);
$CI->load->view($template, $data);
$CI->load->view('admin/inc/footer.php', $data);
}
function admin_view($template, $data='')
{
$CI =& get_instance();
$CI->load->view('admin/inc/header.php', $data);
$CI->load->view($template, $data);
$CI->load->view('admin/inc/footer.php', $data);
}
// option from database
function get_option($value='')
{
$CI =& get_instance();
$CI->db->select('option_value');
$CI->db->where('option_name' , $value);
$query = $CI->db->get('options');
$var = $query->row_array();
return $var['option_value'];
}
function Consignee_no()
{
$CI =& get_instance();
$CI->db->select_max('consinNo');
$query = $CI->db->get('orders');
$var = $query->row_array();
$var = str_replace('khi-', '', $var['consinNo']);
if (empty($var)) {
return "khi-000001";
} else {
$no = $var+1;
if ($no < 10) {
return 'khi-00000'.$no;
}elseif ($no < 100 ) {
return 'khi-0000'.$no;
}
elseif ($no < 1000 ) {
return 'khi-000'.$no;
}
elseif ($no < 10000 ) {
return 'khi-00'.$no;
}
elseif ($no < 100000 ) {
return 'khi-0'.$no;
}
else {
return $no;
}
}
}