-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from nguyenanhung/develop
Add Money Helper
- Loading branch information
Showing
7 changed files
with
50 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
/** | ||
* Project codeigniter-basic-helper | ||
* Created by PhpStorm | ||
* User: 713uk13m <[email protected]> | ||
* Copyright: 713uk13m <[email protected]> | ||
* Date: 15/02/2023 | ||
* Time: 00:40 | ||
*/ | ||
if (!function_exists('money_number_format')) { | ||
function money_number_format($input, $showCents = true, $locale = null) | ||
{ | ||
if (function_exists('numfmt_create') && function_exists('numfmt_format_currency') && function_exists('locale_get_default')) { | ||
setlocale(LC_MONETARY, $locale ? : locale_get_default()); | ||
$numberOfDecimalPlaces = $showCents ? 2 : 0; | ||
$formatter = numfmt_create('en_US', NumberFormatter::CURRENCY); | ||
$formatter->setAttribute(NumberFormatter::FRACTION_DIGITS, $numberOfDecimalPlaces); | ||
|
||
return numfmt_format_currency($formatter, $input, trim(localeconv()['int_curr_symbol'])); | ||
} | ||
|
||
return $input; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,8 +19,8 @@ | |
*/ | ||
class BaseHelper | ||
{ | ||
const VERSION = '1.1.9.2'; | ||
const LAST_MODIFIED = '2023-02-14'; | ||
const VERSION = '1.2.0'; | ||
const LAST_MODIFIED = '2023-02-15'; | ||
const AUTHOR_NAME = 'Hung Nguyen'; | ||
const AUTHOR_EMAIL = '[email protected]'; | ||
const PROJECT_NAME = 'CodeIgniter - Basic Helper'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,84 +10,22 @@ | |
|
||
namespace nguyenanhung\CodeIgniter\BasicHelper; | ||
|
||
/** | ||
* Class ChartRender | ||
* | ||
* @package nguyenanhung\CodeIgniter\BasicHelper | ||
* @author 713uk13m <[email protected]> | ||
* @copyright 713uk13m <[email protected]> | ||
*/ | ||
use nguyenanhung\Libraries\Basic\Miscellaneous\Miscellaneous; | ||
|
||
class ChartRender extends BaseHelper | ||
{ | ||
/** | ||
* Function get_data_chart | ||
* | ||
* @param $item_list | ||
* @param $valueGet | ||
* @param $total | ||
* | ||
* @return string | ||
* @author : 713uk13m <[email protected]> | ||
* @copyright: 713uk13m <[email protected]> | ||
* @time : 09/11/2021 26:39 | ||
*/ | ||
public function get_data_chart($item_list, $valueGet, $total) | ||
protected function misc() | ||
{ | ||
$dataChart = ''; | ||
if (count($item_list) > 0) { | ||
$dataChart .= '['; | ||
foreach ($item_list as $key => $value) { | ||
$dataChart .= '{' . '"country" : ' . '"' . $value->$valueGet . '", '; | ||
$dataChart .= '"visits" : ' . $value->sl . ', '; | ||
$dataChart .= '"color" : ' . '"#FF9E01"'; | ||
if ($key === count($item_list) - 1) { | ||
$dataChart .= '}'; | ||
} else { | ||
$dataChart .= '}, '; | ||
} | ||
} | ||
if ($total) { | ||
$dataChart .= ', {"country" : "Total", "visits" : ' . $total . ', "color" : "#0D52D1" }'; | ||
} | ||
$dataChart .= ']'; | ||
} else { | ||
$dataChart = '[]'; | ||
} | ||
return new Miscellaneous(); | ||
} | ||
|
||
return $dataChart; | ||
public function get_data_chart($item_list, $valueGet, $total) | ||
{ | ||
return $this->misc()->metronic_get_data_chart($item_list, $valueGet, $total); | ||
} | ||
|
||
/** | ||
* Function get_data_chart_report | ||
* | ||
* @param $item_list | ||
* @param $valueGet | ||
* | ||
* @return string | ||
* @author : 713uk13m <[email protected]> | ||
* @copyright: 713uk13m <[email protected]> | ||
* @time : 09/11/2021 26:43 | ||
*/ | ||
public function get_data_chart_report($item_list, $valueGet) | ||
{ | ||
$dataChart = ''; | ||
if (count($item_list) > 0) { | ||
$dataChart .= '['; | ||
foreach ($item_list as $key => $value) { | ||
$dataChart .= '{' . '"country" : ' . '"' . date('d-m-Y', strtotime($value->date)) . '", '; | ||
$dataChart .= '"visits" : ' . $value->$valueGet . ', '; | ||
$dataChart .= '"color" : ' . '"#FF9E01"'; | ||
if ($key === count($item_list) - 1) { | ||
$dataChart .= '}'; | ||
} else { | ||
$dataChart .= '}, '; | ||
} | ||
} | ||
$dataChart .= ']'; | ||
} else { | ||
$dataChart = '[]'; | ||
} | ||
|
||
return $dataChart; | ||
return $this->misc()->metronic_get_data_chart_report($item_list, $valueGet); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,9 +17,9 @@ | |
* @author 713uk13m <[email protected]> | ||
* @copyright 713uk13m <[email protected]> | ||
*/ | ||
class SimpleCurl extends BaseHelper | ||
final class SimpleCurl extends BaseHelper | ||
{ | ||
protected $userAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36'; | ||
protected $userAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36'; | ||
protected $url; | ||
protected $data; | ||
protected $followLocation; | ||
|
@@ -36,21 +36,21 @@ class SimpleCurl extends BaseHelper | |
protected $json; | ||
protected $post; | ||
protected $postFields; | ||
protected $referer = ""; | ||
protected $referer = ""; | ||
protected $session; | ||
protected $webpage; | ||
protected $headers; | ||
protected $headerOut; | ||
protected $includeHeader; | ||
protected $noBody; | ||
protected $status; | ||
protected $isError = false; | ||
protected $isError = false; | ||
protected $error; | ||
protected $binaryTransfer; | ||
protected $userOptions; | ||
protected $authentication = 0; | ||
protected $authUsername = ''; | ||
protected $authPassword = ''; | ||
protected $authUsername = ''; | ||
protected $authPassword = ''; | ||
|
||
/** | ||
* SimpleCurl constructor. | ||
|