Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/units/helpers/cron_helper.php
Show First 20 Lines • Show All 121 Lines • ▼ Show 20 Line(s) | |||||
self::COMMON => $this->commonSettings, | self::COMMON => $this->commonSettings, | ||||
self::MINUTE => $this->minuteSettings, | self::MINUTE => $this->minuteSettings, | ||||
self::HOUR => $this->hourSettings, | self::HOUR => $this->hourSettings, | ||||
self::DAY => $this->daySettings, | self::DAY => $this->daySettings, | ||||
self::MONTH => $this->monthSettings, | self::MONTH => $this->monthSettings, | ||||
self::WEEKDAY => $this->weekdaySettings, | self::WEEKDAY => $this->weekdaySettings, | ||||
); | ); | ||||
/** @var Array $ret */ | |||||
$ret = $mapping[$field_type]; | $ret = $mapping[$field_type]; | ||||
/* @var $ret Array */ | |||||
foreach ($ret as $option_key => $option_title) { | foreach ($ret as $option_key => $option_title) { | ||||
$option_title = substr($option_title, 0, 1) == '+' ? substr($option_title, 1) : $this->Application->Phrase($option_title); | $option_title = substr($option_title, 0, 1) == '+' ? substr($option_title, 1) : $this->Application->Phrase($option_title); | ||||
$ret[$option_key] = $option_title; | $ret[$option_key] = $option_title; | ||||
if ( "$option_key" !== '--' ) { | if ( "$option_key" !== '--' ) { | ||||
$ret[$option_key] .= ' (' . $option_key . ')'; | $ret[$option_key] .= ' (' . $option_key . ')'; | ||||
} | } | ||||
} | } | ||||
if ( $field_type == self::MINUTE ) { | if ( $field_type == self::MINUTE ) { | ||||
for ($i = 0; $i <= 59; $i++) { | for ($i = 0; $i <= 59; $i++) { | ||||
$ret[$i] = ':' . str_pad($i, 2, '0', STR_PAD_LEFT) . ' (' . $i . ')'; | $ret[$i] = ':' . str_pad($i, 2, '0', STR_PAD_LEFT) . ' (' . $i . ')'; | ||||
} | } | ||||
} | } | ||||
elseif ( $field_type == self::HOUR ) { | elseif ( $field_type == self::HOUR ) { | ||||
/** @var LanguagesItem $language */ | |||||
$language = $this->Application->recallObject('lang.current'); | $language = $this->Application->recallObject('lang.current'); | ||||
/* @var $language LanguagesItem */ | |||||
$short_time_format = str_replace(':s', '', $language->GetDBField('TimeFormat')); | $short_time_format = str_replace(':s', '', $language->GetDBField('TimeFormat')); | ||||
for ($i = 0; $i <= 23; $i++) { | for ($i = 0; $i <= 23; $i++) { | ||||
$ret[$i] = adodb_date($short_time_format, adodb_mktime($i, 0, 0)) . ' (' . $i . ')'; | $ret[$i] = adodb_date($short_time_format, adodb_mktime($i, 0, 0)) . ' (' . $i . ')'; | ||||
} | } | ||||
} | } | ||||
elseif ( $field_type == self::DAY ) { | elseif ( $field_type == self::DAY ) { | ||||
/** @var kMultiLanguageHelper $ml_helper */ | |||||
$ml_helper = $this->Application->recallObject('kMultiLanguageHelper'); | $ml_helper = $this->Application->recallObject('kMultiLanguageHelper'); | ||||
/* @var $ml_helper kMultiLanguageHelper */ | |||||
$forms = Array ( | $forms = Array ( | ||||
'phrase1' => 'la_NumberSuffixSt', 'phrase2' => 'la_NumberSuffixNd', 'phrase3' => 'la_NumberSuffixRd', | 'phrase1' => 'la_NumberSuffixSt', 'phrase2' => 'la_NumberSuffixNd', 'phrase3' => 'la_NumberSuffixRd', | ||||
'phrase4' => 'la_NumberSuffixTh', 'phrase5' => 'la_NumberSuffixTh' | 'phrase4' => 'la_NumberSuffixTh', 'phrase5' => 'la_NumberSuffixTh' | ||||
); | ); | ||||
for ($i = 1; $i <= 31; $i++) { | for ($i = 1; $i <= 31; $i++) { | ||||
$ret[$i] = $i . $ml_helper->getPluralPhrase($i, $forms) . ' (' . $i . ')'; | $ret[$i] = $i . $ml_helper->getPluralPhrase($i, $forms) . ' (' . $i . ')'; | ||||
▲ Show 20 Lines • Show All 505 Lines • ▼ Show 20 Line(s) | |||||
// set time <current_hour>:00:00 | // set time <current_hour>:00:00 | ||||
$date = strtotime(adodb_date('Y-m-d H:00:00', $date)); | $date = strtotime(adodb_date('Y-m-d H:00:00', $date)); | ||||
} | } | ||||
} | } | ||||
return $date; | return $date; | ||||
} | } | ||||
} | } | ||||
No newline at end of file | No newline at end of file |