first commit
This commit is contained in:
22
admin/class/smarty_plugins/function.find_module.php
Normal file
22
admin/class/smarty_plugins/function.find_module.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty plugin.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty {find_module} plugin.
|
||||
*
|
||||
* Type: function<br>
|
||||
* Name: url<br>
|
||||
* Purpose: finding module
|
||||
*
|
||||
* @param array $params parameters
|
||||
* @param Smarty_Internal_Template $smarty
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function smarty_function_find_module($params, &$smarty)
|
||||
{
|
||||
return findModule($params['name']);
|
||||
}
|
||||
29
admin/class/smarty_plugins/function.find_right.php
Normal file
29
admin/class/smarty_plugins/function.find_right.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty plugin.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty {find_right} plugin.
|
||||
*
|
||||
* Type: function<br>
|
||||
* Name: url<br>
|
||||
* Purpose: finding rights
|
||||
*
|
||||
* @param array $params parameters
|
||||
* @param Smarty_Internal_Template $smarty
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function smarty_function_find_right($params, &$smarty)
|
||||
{
|
||||
$var = null;
|
||||
$name = '';
|
||||
extract($params);
|
||||
if (empty($name)) {
|
||||
throw new InvalidArgumentException('find_right: \'name\' parameter empty');
|
||||
}
|
||||
|
||||
return findRight($name, $var);
|
||||
}
|
||||
27
admin/class/smarty_plugins/function.get_named_vats.php
Normal file
27
admin/class/smarty_plugins/function.get_named_vats.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use KupShop\KupShopBundle\Util\Compat\ServiceContainer;
|
||||
use KupShop\OrderingBundle\Util\Order\OrderInfo;
|
||||
|
||||
/**
|
||||
* Smarty plugin.
|
||||
*/
|
||||
function smarty_function_get_named_vats($params, &$smarty)
|
||||
{
|
||||
if (!isset($params['vats'])) {
|
||||
throw new InvalidArgumentException('Parameter \'vats\' is required!');
|
||||
}
|
||||
if (!is_array($params['vats'])) {
|
||||
throw new InvalidArgumentException('Parameter \'vats\' must be of type array!');
|
||||
}
|
||||
|
||||
$orderInfo = ServiceContainer::getService(OrderInfo::class);
|
||||
|
||||
$namedVats = $orderInfo->getNamedVats($params['vats']);
|
||||
|
||||
if (!empty($params['assign'])) {
|
||||
$smarty->assign($params['assign'], $namedVats);
|
||||
} else {
|
||||
return $namedVats;
|
||||
}
|
||||
}
|
||||
28
admin/class/smarty_plugins/function.get_statuses.php
Normal file
28
admin/class/smarty_plugins/function.get_statuses.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty plugin.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty {get_statuses} plugin.
|
||||
*
|
||||
* Type: function<br>
|
||||
* Name: url<br>
|
||||
* Purpose: get statuses
|
||||
*
|
||||
* @param array $params parameters
|
||||
* @param Smarty_Internal_Template $smarty
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function smarty_function_get_statuses($params, &$smarty)
|
||||
{
|
||||
$statuses = getStatuses($params['name']);
|
||||
|
||||
if (!empty($params['assign'])) {
|
||||
$smarty->assign($params['assign'], $statuses);
|
||||
} else {
|
||||
return $statuses;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty plugin.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty {get_statuses} plugin.
|
||||
*
|
||||
* Type: function<br>
|
||||
* Name: url<br>
|
||||
* Purpose: get statuses
|
||||
*
|
||||
* @param array $params parameters
|
||||
* @param Smarty_Internal_Template $smarty
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function smarty_function_get_today_selled_items($params, &$smarty)
|
||||
{
|
||||
$last_item = end($params['items']);
|
||||
|
||||
if (empty($last_item['date'])) {
|
||||
return $params['items'];
|
||||
}
|
||||
|
||||
$last_datetime = (new DateTime($last_item['date']))->modify('-1 hours');
|
||||
|
||||
$items = [];
|
||||
foreach ($params['items'] as $item) {
|
||||
$datetime = new DateTime($item['date']);
|
||||
if ($last_datetime < $datetime) {
|
||||
$items[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($items)) {
|
||||
return $params['items'];
|
||||
}
|
||||
|
||||
if (!empty($params['assign'])) {
|
||||
$smarty->assign($params['assign'], $items);
|
||||
} else {
|
||||
return $items;
|
||||
}
|
||||
}
|
||||
23
admin/class/smarty_plugins/function.get_user.php
Normal file
23
admin/class/smarty_plugins/function.get_user.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty plugin.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty {get_user} plugin.
|
||||
*
|
||||
* Type: function<br>
|
||||
* Name: get_user<br>
|
||||
* Purpose: get User ID
|
||||
*
|
||||
* @return number
|
||||
*/
|
||||
function smarty_function_get_user($params, &$smarty)
|
||||
{
|
||||
if (!empty($GLOBALS['adminID'])) {
|
||||
return $GLOBALS['adminID'];
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
function smarty_function_helpscout_beacon_identity()
|
||||
{
|
||||
$admin = getAdminUser();
|
||||
|
||||
return json_encode([
|
||||
'name' => $admin['name'] ?? $admin['login'],
|
||||
'email' => $admin['email'],
|
||||
'company' => getShopUniqueName(),
|
||||
'signature' => hash_hmac(
|
||||
'sha256',
|
||||
$admin['email'],
|
||||
'MjodsaAdWfVlVXSiOnas0qgE7CQzbRrdjTEEXLR0RUY='
|
||||
),
|
||||
]);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
function smarty_function_insert_autocomplete_form($params, $smarty)
|
||||
{
|
||||
static $instance = 0;
|
||||
|
||||
$defaults = [
|
||||
'instance' => $instance,
|
||||
];
|
||||
|
||||
$params = array_merge($defaults, $params);
|
||||
|
||||
$requiredParams = ['type', 'searchInput', 'inputName', 'items'];
|
||||
foreach ($requiredParams as $requiredParam) {
|
||||
if (!array_key_exists($requiredParam, $params)) {
|
||||
throw new InvalidArgumentException(
|
||||
sprintf('Missing required parameter "%s"', $requiredParam)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
echo $smarty->_subTemplateRender('autocomplete-form/'.$params['type'].'.tpl', $smarty->cache_id, $smarty->compile_id, 0, null, $params, 0, false);
|
||||
|
||||
$instance++;
|
||||
}
|
||||
118
admin/class/smarty_plugins/function.insert_calendar.php
Normal file
118
admin/class/smarty_plugins/function.insert_calendar.php
Normal file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty plugin.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty {insert_calendar} plugin.
|
||||
*
|
||||
* Type: function<br>
|
||||
* Name: url<br>
|
||||
* Purpose: insert calendar to field
|
||||
*
|
||||
* @param array $params parameters
|
||||
* @param Smarty_Internal_Template $template template object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function smarty_function_insert_calendar($params, $template)
|
||||
{
|
||||
$selector = null;
|
||||
$format = 'date';
|
||||
$figureFormat = true;
|
||||
$czechformat = '';
|
||||
$used = false;
|
||||
|
||||
extract($params);
|
||||
|
||||
if (empty($selector)) {
|
||||
throw new InvalidArgumentException('insert_calendar: \'selector\' parameter empty');
|
||||
}
|
||||
|
||||
echo openCalenderButton($selector, $format, $figureFormat, $czechformat, $used);
|
||||
}
|
||||
|
||||
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
|
||||
function openCalenderButton($selector, $dateFormat, $figureFormat = true, $czechformat = null, $param_used = false)
|
||||
{
|
||||
global $cfg;
|
||||
|
||||
static $used = false;
|
||||
|
||||
$used = $used || $param_used;
|
||||
|
||||
/*$format = "dd-mm-yy";
|
||||
$timeFormat = "";
|
||||
|
||||
if ($dateFormat == 'datetime')
|
||||
$timeFormat = "hh:mm:ss";
|
||||
*/
|
||||
|
||||
// if (!empty($czechformat)){
|
||||
$format = calendarDateFormat();
|
||||
$timeFormat = '';
|
||||
if ($dateFormat == 'datetime') {
|
||||
$timeFormat = calendarTimeFormat();
|
||||
}
|
||||
// }
|
||||
|
||||
$ret = "<script>
|
||||
$(function(){
|
||||
openCalenderIFrame('{$selector}', '{$format}', '{$timeFormat}');
|
||||
});
|
||||
</script>";
|
||||
|
||||
if (!$used) {
|
||||
$used = true;
|
||||
$ret .= '<script src="./static/js/jquery.datetimepicker.js"></script>';
|
||||
$ret .= '<script src="./static/js/jquery-ui.datepicker-cs.js"></script>';
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function calendarDateFormat()
|
||||
{
|
||||
$dbcfg = Settings::getDefault();
|
||||
|
||||
switch ($dbcfg['date_format']) {
|
||||
case '%e.%c.%y':
|
||||
return 'd.m.y';
|
||||
break;
|
||||
case '%d.%m.%Y':
|
||||
return 'dd.mm.yy';
|
||||
break;
|
||||
case '%d/%m/%Y':
|
||||
return 'dd/mm/yy';
|
||||
break;
|
||||
case '%d/%m/%y':
|
||||
return 'dd/mm/y';
|
||||
break;
|
||||
case '%e.%c.%Y':
|
||||
default:
|
||||
return 'd.m.yy';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function calendarTimeFormat()
|
||||
{
|
||||
$dbcfg = Settings::getDefault();
|
||||
|
||||
switch ($dbcfg['time_format']) {
|
||||
case '%k:%i:%s':
|
||||
return 'h:mm:ss';
|
||||
break;
|
||||
case '%H:%i':
|
||||
return 'hh:mm';
|
||||
break;
|
||||
case '%k:%i':
|
||||
return 'h:mm';
|
||||
break;
|
||||
case '%H:%i:%s':
|
||||
default:
|
||||
return 'hh:mm:ss';
|
||||
break;
|
||||
}
|
||||
}
|
||||
59
admin/class/smarty_plugins/function.insert_file_browse.php
Normal file
59
admin/class/smarty_plugins/function.insert_file_browse.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* Smarty plugin.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty {insert_file_browse} plugin.
|
||||
*
|
||||
* Type: function<br>
|
||||
* Name: url<br>
|
||||
* Purpose: insert file browser
|
||||
*
|
||||
* @param array $params parameters
|
||||
* @param Smarty_Internal_Template $template template object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function smarty_function_insert_file_browse($params, $template)
|
||||
{
|
||||
static $inserted = false;
|
||||
if (!$inserted) {
|
||||
?>
|
||||
<script src="/web/bundles/cksourceckfinder/ckfinder/ckfinder.js"></script>
|
||||
<script type="application/javascript">
|
||||
CKFinder.config({connectorPath: '/ckfinder/connector'});
|
||||
CKFinder.basePath = '/web/bundles/cksourceckfinder/ckfinder/';
|
||||
//############### BROWSE FILES #####################//
|
||||
$(document).on('click', '[data-file-browse]', function () {
|
||||
var $input = $(this).closest('.input-group').find('input');
|
||||
if (!$input)
|
||||
return true;
|
||||
|
||||
CKFinder.popup({
|
||||
language: 'cs',
|
||||
resourceType: 'Soubory',
|
||||
chooseFiles: true,
|
||||
width: 800,
|
||||
height: 600,
|
||||
onInit: function (finder) {
|
||||
finder.config.resourceType = 'Soubory';
|
||||
finder.on('files:choose', function (evt) {
|
||||
var file = evt.data.files.first();
|
||||
$input.val(decodeURIComponent(file.getUrl()));
|
||||
$input.change();
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
$inserted = true;
|
||||
} ?>
|
||||
<a class="btn btn-primary btn-sm" data-file-browse href="#" title="<?php echo getTextString('products', 'findFile'); ?>">
|
||||
<span class="glyphicon glyphicon-folder-open"></span>
|
||||
</a>
|
||||
<?php
|
||||
}
|
||||
45
admin/class/smarty_plugins/function.insert_llm_button.php
Normal file
45
admin/class/smarty_plugins/function.insert_llm_button.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty plugin.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty {insert_llm_button} plugin.
|
||||
*
|
||||
* Purpose: Insert llm button
|
||||
*
|
||||
* @param array $params parameters
|
||||
* @param Smarty_Internal_Template $smarty template object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function smarty_function_insert_llm_button($params, $smarty)
|
||||
{
|
||||
if (!findModule(Modules::LLM)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$textObjectUtil = \KupShop\KupShopBundle\Util\Compat\ServiceContainer::getService(\KupShop\LLMBundle\Util\TextObjectUtil::class);
|
||||
|
||||
$params['actions'] = [];
|
||||
|
||||
foreach ($textObjectUtil->getObjectLabelPrompts($params['type']) as $id => $prompt) {
|
||||
$json = [
|
||||
'entityType' => $params['entityType'] ?? substr(getVal('s'), 0, -4),
|
||||
'entityId' => $params['entityId'] ?? getVal('ID'),
|
||||
'target' => $params['target'],
|
||||
'promptId' => $id,
|
||||
'objectLabel' => $params['type'] ?? '',
|
||||
'title' => $prompt->getTitle(),
|
||||
];
|
||||
|
||||
$params['actions'][] = [
|
||||
'id' => $id,
|
||||
'title' => $prompt->getTitle(),
|
||||
'json' => $json,
|
||||
];
|
||||
}
|
||||
|
||||
echo $smarty->_subTemplateRender('llm/text-dropdown.tpl', $smarty->cache_id, $smarty->compile_id, 0, null, $params, 0, false);
|
||||
}
|
||||
37
admin/class/smarty_plugins/function.insert_wysiwyg.php
Normal file
37
admin/class/smarty_plugins/function.insert_wysiwyg.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty plugin.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty {insert_wysiwyg} plugin.
|
||||
*
|
||||
* Type: function<br>
|
||||
* Name: url<br>
|
||||
* Purpose: insert wysiwyg editor
|
||||
*
|
||||
* @param array $params parameters
|
||||
* @param Smarty_Internal_Template $smarty template object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function smarty_function_insert_wysiwyg($params, $smarty)
|
||||
{
|
||||
static $index = 0;
|
||||
|
||||
$defaults = [
|
||||
'type' => 'BasicTable',
|
||||
'index' => $index,
|
||||
];
|
||||
|
||||
$params = array_merge($defaults, $params);
|
||||
|
||||
if (empty($params['target'])) {
|
||||
throw new InvalidArgumentException('insert_wysiwyg: \'target\' parameter empty');
|
||||
}
|
||||
|
||||
echo $smarty->_subTemplateRender('utils/wysiwyg.tpl', $smarty->cache_id, $smarty->compile_id, 0, null, $params, 0, false);
|
||||
|
||||
$index++;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
function smarty_function_print_delivery_settings($params, &$smarty)
|
||||
{
|
||||
if (!empty($params['template'])) {
|
||||
$_smarty_tpl_vars = $smarty->tpl_vars;
|
||||
echo $smarty->_subTemplateRender($params['template'], $smarty->cache_id, $smarty->compile_id, 0, null, $params, 0, false);
|
||||
$smarty->tpl_vars = $_smarty_tpl_vars;
|
||||
}
|
||||
|
||||
if (!empty($params['assign'])) {
|
||||
$smarty->assign($params['assign'], $params);
|
||||
}
|
||||
}
|
||||
52
admin/class/smarty_plugins/function.print_select.php
Normal file
52
admin/class/smarty_plugins/function.print_select.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* Smarty plugin.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty {print_select} plugin.
|
||||
*
|
||||
* Type: function<br>
|
||||
* Name: url<br>
|
||||
* Purpose: print select
|
||||
*
|
||||
* @param array $params parameters
|
||||
* @param Smarty_Internal_Template $smarty
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function smarty_function_print_select($params, &$smarty)
|
||||
{
|
||||
$name = '';
|
||||
$var = [];
|
||||
$selected = '';
|
||||
$param = '';
|
||||
$class = 'selecter';
|
||||
$keep_value = false;
|
||||
|
||||
extract($params);
|
||||
|
||||
if (!is_array($selected)) {
|
||||
$selected = [$selected => true];
|
||||
}
|
||||
|
||||
if ($keep_value) {
|
||||
foreach ($selected as $key => $value) {
|
||||
if (!array_key_exists($key, $var)) {
|
||||
$var[$key] = $key;
|
||||
}
|
||||
}
|
||||
} ?>
|
||||
<select class="<?php echo $class; ?>" data-filter-type="<?php echo (strpos($param, 'multiple') !== false) ? 'multiselect' : 'select'; ?>" name="<?php echo $name; ?>" <?php echo $param; ?>>
|
||||
<?php
|
||||
foreach ($var as $index => $value) {
|
||||
?>
|
||||
<option value="<?php echo $index; ?>"
|
||||
<?php echo (isset($selected[$index]) && ($selected[$index] || $selected[$index] == '0')) ? 'selected' : ''; ?>>
|
||||
<?php echo $value; ?>
|
||||
</option>
|
||||
<?php
|
||||
} ?>
|
||||
</select>
|
||||
<?php
|
||||
}
|
||||
71
admin/class/smarty_plugins/function.print_toggle.php
Normal file
71
admin/class/smarty_plugins/function.print_toggle.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty plugin.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty {print_toggle} plugin.
|
||||
*
|
||||
* Type: function<br>
|
||||
* Name: url<br>
|
||||
* Purpose: print toggle with hidden button for get Y/N value
|
||||
*
|
||||
* @param array $params parameters
|
||||
* @param Smarty_Internal_Template $smarty
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function smarty_function_print_toggle($params, &$smarty)
|
||||
{
|
||||
$name = null;
|
||||
$nameRaw = null;
|
||||
$disabled = null;
|
||||
$class = '';
|
||||
$attrs = '';
|
||||
$value = null;
|
||||
$numeric = false;
|
||||
$onOff = false;
|
||||
|
||||
extract($params);
|
||||
|
||||
if (empty($name) && empty($nameRaw)) {
|
||||
throw new InvalidArgumentException('print_toggle: \'name\' parameter empty');
|
||||
}
|
||||
|
||||
if (is_null($value)) {
|
||||
$data = $smarty->getTemplateVars('body');
|
||||
|
||||
if (!empty($data['data'])) {
|
||||
$data = $data['data'];
|
||||
}
|
||||
|
||||
$value = getVal($name, $data);
|
||||
}
|
||||
|
||||
$class .= ' toggle';
|
||||
|
||||
if ($disabled) {
|
||||
$attrs .= ' disabled ';
|
||||
}
|
||||
|
||||
if ($value == 'Y' || $value == '1') {
|
||||
$attrs .= 'checked="checked" ';
|
||||
}
|
||||
|
||||
$attrName = $name ? "data[{$name}]" : $nameRaw;
|
||||
|
||||
if ($onOff) {
|
||||
$valueTrue = 'ON';
|
||||
$valueFalse = 'OFF';
|
||||
} else {
|
||||
$valueTrue = $numeric ? 1 : 'Y';
|
||||
$valueFalse = $numeric ? 0 : 'N';
|
||||
}
|
||||
|
||||
$ret = "<input type='hidden' name='{$attrName}' value='{$valueFalse}'/>
|
||||
<label class='{$class}'><input name='{$attrName}' type='checkbox' {$attrs} value='{$valueTrue}'/>
|
||||
<span class=\"handle\"></span></label>";
|
||||
|
||||
return $ret;
|
||||
}
|
||||
19
admin/class/smarty_plugins/modifier.format_datee.php
Normal file
19
admin/class/smarty_plugins/modifier.format_datee.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty plugin.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty {format_date} function plugin.
|
||||
*/
|
||||
function smarty_modifier_format_date($string, $value = null)
|
||||
{
|
||||
if (empty($string)) {
|
||||
return '';
|
||||
} else {
|
||||
$datetime = new DateTime($string);
|
||||
}
|
||||
|
||||
return $datetime->format(Settings::getDateFormat());
|
||||
}
|
||||
25
admin/class/smarty_plugins/modifier.format_datetime.php
Normal file
25
admin/class/smarty_plugins/modifier.format_datetime.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty plugin.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty {format_datetime} function plugin.
|
||||
*/
|
||||
function smarty_modifier_format_datetime($string, $value = null)
|
||||
{
|
||||
if ($string == '-0001-11-30') {
|
||||
return '00-00-0000';
|
||||
} elseif ($string instanceof \DateTime) {
|
||||
$datetime = $string;
|
||||
} elseif (empty($string)) {
|
||||
return '';
|
||||
} else {
|
||||
$datetime = new DateTime($string);
|
||||
}
|
||||
|
||||
$format = Settings::getDateFormat().' '.Settings::getTimeFormat();
|
||||
|
||||
return $datetime->format($format);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Smarty plugin.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smarty {format_editable_price} function plugin.
|
||||
*
|
||||
* @param Decimal $decimal - value to format
|
||||
* @param null $precision - how many decimal places to use. Use negative numbers to pretty print rounded values (strip trailing zeros)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function smarty_modifier_format_editable_price(Decimal $decimal, $precision = null)
|
||||
{
|
||||
return $decimal->printFloatValue($precision ?: 2);
|
||||
}
|
||||
Reference in New Issue
Block a user