Files
grzanieplus.pl/plugins/stTaskSchedulerImportPlugin/lib/helper/stTaskSchedulerImportHelper.php
2025-03-12 17:06:23 +01:00

37 lines
1.0 KiB
PHP

<?php
function st_task_scheduler_import_price_margin_type_select_tag($name, $value)
{
$priceMarginTypes = stPrice::getPriceMarginTypes();
$types = options_for_select($priceMarginTypes, $value);
return select_tag($name, $types);
}
function st_task_scheduler_import_price_margin($name, $value)
{
$content = input_tag($name.'[value]', isset($value['value']) ? $value['value'] : 0, array('size' => 8, 'data-format' => 'decimal'));
$content .= ' ' . st_task_scheduler_import_price_margin_type_select_tag($name.'[type]', isset($value['type']) ? $value['type'] : null);
return $content;
}
function st_task_scheduler_import_select_tag($name, $value, array $options = [])
{
$imports = [];
foreach (stTaskSchedulerImportConfiguration::getAll() as $configuration)
{
if (!$configuration->getParent())
{
$imports[$configuration->getId()] = $configuration->getLabel();
}
}
asort($imports, SORT_NATURAL);
$options['selected'] = $value;
return select_tag($name, $imports, $options);
}