48 lines
1.5 KiB
PHP
48 lines
1.5 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Zwraca kontrolkę wyboru czasu odstępu dla wykonanywanego zadania
|
|
*
|
|
* @param string $name Nazwa pola
|
|
* @param string $value Wartość
|
|
* @param array $options Doddatkowe opcje
|
|
* @return string
|
|
*/
|
|
function st_task_scheluder_time_interval_select_tag(string $name, ?string $value, array $options = []): string
|
|
{
|
|
$default = null;
|
|
|
|
if (isset($options['default_time_interval']))
|
|
{
|
|
$default = $options['default_time_interval'];
|
|
unset($options['default_time_interval']);
|
|
}
|
|
|
|
$timeIntervals = stTaskConfiguration::getTimeIntervals($default);
|
|
|
|
foreach ($timeIntervals as $interval => $label)
|
|
{
|
|
$timeIntervals[$interval] = __($label, null, 'stTaskScheluderBackend');
|
|
}
|
|
|
|
$options['selected'] = $value;
|
|
|
|
return select_tag($name, $timeIntervals, $options);
|
|
}
|
|
|
|
function st_task_scheluder_progress_finished_message()
|
|
{
|
|
$content = content_tag('div', __('Zadania zostały wykonane pomyślnie'), ['class' => 'bs-mb-2']);
|
|
$content .= st_button_to(__('Lista zadań'), stRoutingHelper::generateApplicationUrl('@stTaskScheluderBackend', 'backend'));
|
|
|
|
return $content;
|
|
}
|
|
|
|
function object_st_task_scheluder_time_interval_select_tag(BaseObject $object, string $method, array $options = [], $defaultValue = null)
|
|
{
|
|
$options = _parse_attributes($options);
|
|
$value = _get_object_value($object, $method, $defaultValue);
|
|
$name = _convert_method_to_name($method, $options);
|
|
|
|
return st_task_scheluder_time_interval_select_tag($name, $value, $options);
|
|
} |