<?php
function get_currency() {
$ci = &get_instance();
$ci->load->model("Currency_settings_Model");
$currency_settings = $ci->Currency_settings_Model->get_currency_settings();
return !empty($currency_settings->currency_symbol) ?
$currency_settings->currency_symbol : '';
}
function get_time_zone() {
}
function get_current_date_and_time($date = NULL) {
get_time_zone();
if ($date == NULL) {
return $current_date_time = date('Y-m-d H:i:s');
} else {
return $current_date_time = date($date . ' H:i:s');
}
}
function get_current_date() {
get_time_zone();
return $current_date = date('Y-m-d');
}
function get_current_time() {
get_time_zone();
return $time = date('G:i:s');
}
function get_string_to_date_fromat($date) {
}
function get_string_to_time_fromat($time) {
}
function get_current_year() {
get_time_zone();
return $current_year = date("Y");
}
function get_current_month_name() {
get_time_zone();
return $current_month_name = date("F");
}
function convert_number_to_words($number) {
$hyphen = '-';
$conjunction = ' and ';
$separator = ', ';
$negative = 'negative ';
$decimal = ' point ';
0 => 'zero',
1 => 'one',
2 => 'two',
3 => 'three',
4 => 'four',
5 => 'five',
6 => 'six',
7 => 'seven',
8 => 'eight',
9 => 'nine',
10 => 'ten',
11 => 'eleven',
12 => 'twelve',
13 => 'thirteen',
14 => 'fourteen',
15 => 'fifteen',
16 => 'sixteen',
17 => 'seventeen',
18 => 'eighteen',
19 => 'nineteen',
20 => 'twenty',
30 => 'thirty',
40 => 'fourty',
50 => 'fifty',
60 => 'sixty',
70 => 'seventy',
80 => 'eighty',
90 => 'ninety',
100 => 'hundred',
1000 => 'thousand',
1000000 => 'million',
1000000000 => 'billion',
1000000000000 => 'trillion',
1000000000000000 => 'quadrillion',
1000000000000000000 => 'quintillion'
);
return false;
}
if (($number >= 0 && (int) $number < 0) || (int) $number < 0 - PHP_INT_MAX) {
// overflow
'convert_number_to_words only accepts numbers between -' . PHP_INT_MAX . ' and ' . PHP_INT_MAX, E_USER_WARNING
);
return false;
}
if ($number < 0) {
return $negative . convert_number_to_words
(abs($number));
}
$string = $fraction = null;
if (strpos($number, '.') !== false) {
}
switch (true) {
case $number < 21:
$string = $dictionary[$number];
break;
case $number < 100:
$tens = ((int) ($number / 10)) * 10;
$units = $number % 10;
$string = $dictionary[$tens];
if ($units) {
$string .= $hyphen . $dictionary[$units];
}
break;
case $number < 1000:
$hundreds = $number / 100;
$remainder = $number % 100;
$string = $dictionary[$hundreds] . ' ' . $dictionary[100];
if ($remainder) {
$string .= $conjunction . convert_number_to_words($remainder);
}
break;
default:
$numBaseUnits = (int) ($number / $baseUnit);
$remainder = $number % $baseUnit;
$string = convert_number_to_words($numBaseUnits) . ' ' . $dictionary[$baseUnit];
if ($remainder) {
$string .= $remainder < 100 ? $conjunction : $separator;
$string .= convert_number_to_words($remainder);
}
break;
}
if (null !== $fraction && is_numeric($fraction)) {
$string .= $decimal;
foreach (str_split((string
) $fraction) as $number) {
$words[] = $dictionary[$number];
}
}
return $string;
}
function valid_numeric_number_check($amount) {
return FALSE;
}
return TRUE;
}
function get_floating_point_number($number = 0, $thousands_separator = FALSE) {
if ($thousands_separator == FALSE) {
} else {
}
return $result;
}
function get_date_interval($start_date, $end_date) {
$datetime1 = new DateTime($start_date);
$datetime2 = new DateTime($end_date);
$interval = $datetime1->diff($datetime2);
$result = $interval->format('%a');
return $result = (int) $result + 1;
}
function get_days_name_list() {
for ($i = 0; $i < 7; $i++) {
$timestamp = strtotime('+1 day', $timestamp);
}
return $days;
}
function get_start_year_to_current_year_array() {
$start_Year = '2016';
$current_year = get_current_year();
$diff = ($current_year - $start_Year);
$lastYear = ($start_Year + $diff);
if ($start_Year == $current_year) {
} else {
for ($i = $start_Year; $i <= $lastYear; $i++) {
}
}
return $years;
}
function get_months_name_array() {
for ($m = 1; $m <= 12; ++$m) {
}
return $months_name;
}
function get_user_ip_address() {
$client = @$_SERVER['HTTP_CLIENT_IP'];
$forward = @$_SERVER['HTTP_X_FORWARDED_FOR'];
$remote = $_SERVER['REMOTE_ADDR'];
$ip = $client;
} elseif (filter_var($forward, FILTER_VALIDATE_IP
)) {
$ip = $forward;
} else {
$ip = $remote;
}
return $ip;
}
function get_user_server_information() {
return $_SERVER;
}
function get_ip_info($ip = NULL, $purpose = "location", $deep_detect = TRUE) {
$output = NULL;
if (filter_var($ip, FILTER_VALIDATE_IP
) === FALSE) {
$ip = get_user_ip_address();
if ($deep_detect) {
if (filter_var(@$_SERVER['HTTP_X_FORWARDED_FOR'], FILTER_VALIDATE_IP
))
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
if (filter_var(@$_SERVER['HTTP_CLIENT_IP'], FILTER_VALIDATE_IP
))
$ip = $_SERVER['HTTP_CLIENT_IP'];
}
}
$support = array("country", "countrycode", "state", "region", "city", "location", "address");
"AF" => "Africa",
"AN" => "Antarctica",
"AS" => "Asia",
"EU" => "Europe",
"OC" => "Australia (Oceania)",
"NA" => "North America",
"SA" => "South America"
);
//$ipdat = @json_decode(file_get_contents("http://www.geoplugin.net/json.gp?ip=" . $ip));
$url = "http://www.geoplugin.net/json.gp?ip=" . $ip;
if (@strlen(trim($ipdat->geoplugin_countryCode)) == 2) {
switch ($purpose) {
case "location":
"ip" => $ip,
"city" => @$ipdat->geoplugin_city,
"state" => @$ipdat->geoplugin_regionName,
"country" => @$ipdat->geoplugin_countryName,
"country_code" => @$ipdat->geoplugin_countryCode,
"continent" => @$continents[strtoupper($ipdat->geoplugin_continentCode)],
"continent_code" => @$ipdat->geoplugin_continentCode,
"latitude" => @$ipdat->geoplugin_latitude,
"longitude" => @$ipdat->geoplugin_longitude
);
break;
case "address":
$address = array($ipdat->geoplugin_countryName);
if (@strlen($ipdat->geoplugin_regionName) >= 1)
$address[] = $ipdat->geoplugin_regionName;
if (@strlen($ipdat->geoplugin_city) >= 1)
$address[] = $ipdat->geoplugin_city;
break;
case "city":
$output = @$ipdat->geoplugin_city;
break;
case "state":
$output = @$ipdat->geoplugin_regionName;
break;
case "region":
$output = @$ipdat->geoplugin_regionName;
break;
case "country":
$output = @$ipdat->geoplugin_countryName;
break;
case "countrycode":
$output = @$ipdat->geoplugin_countryCode;
break;
}
}
}
return $output;
}
function is_valid_user_check_by_user_country() {
$access_country_array = get_valid_user_country();
$ip_info = get_ip_info();
$ip_address = get_user_ip_address();
$user_country = $ip_info['country'];
if ($ip_address == '::1') {
return TRUE;
}
if (!empty($ip_address) || $ip_address != NULL) {
if ((!empty($user_country)) || ($user_country != NULL)) {
return TRUE;
}
return FALSE;
}
return FALSE;
}
return FALSE;
}
function is_valid_user_ip() {
$access_ip_address_array = get_valid_user_ip_address();
$ip_address = get_user_ip_address();
return TRUE;
}
return FALSE;
}
function get_valid_user_country() {
$access_country_array = array("bangladesh"); //N.B: provide a full country name in lower case ;
return $access_country_array;
}
function get_valid_user_ip_address() {
$access_ip_address_array = array("202.4.107.210", "180.234.79.190", "103.35.168.22");
return $access_ip_address_array;
}
function get_new_leave_application_count() {
$ci = &get_instance();
$ci->load->model("Leave_application_Model");
get_time_zone();
$is_show_status = FALSE;
$leave_application_by_is_show = $ci->Leave_application_Model->get_leave_application_by_is_show($is_show_status);
return !empty($leave_application_by_is_show) ?
count($leave_application_by_is_show) : 0;
}
function get_employee_image($employee_id) {
$ci = &get_instance();
$ci->load->model("Employee_Model");
$employee = $ci->Employee_Model->get_employee($employee_id);
return !empty($employee->employee_image) ? base_url
($employee->employee_image) : get_default_employee_image
();
}
function get_company_logo() {
$ci = &get_instance();
$ci->load->model("Company_Model");
$company = $ci->Company_Model->get_company();
return !empty($company->company_logo) ? base_url
($company->company_logo) : get_default_company_logo
();
}
function get_default_employee_image() {
return $default_employee_image = base_url('assets/uploads/employee_images/no_employee_image.jpg');
}
function get_default_company_logo() {
return $default_company_logo = base_url('assets/uploads/company_logo/no_company_logo.png');
}
function get_total_start_date($start_date) {
return $start_date = $start_date . ' 00:00:00';
}
function get_total_end_date($end_date) {
return $end_date = $end_date . ' 23:59:59';
}
function get_print_r($expression = NULL) {
echo '<pre>';
echo '</pre>';
}