本文整理汇总了PHP中Scheduler::getParser方法的典型用法代码示例。如果您正苦于以下问题:PHP Scheduler::getParser方法的具体用法?PHP Scheduler::getParser怎么用?PHP Scheduler::getParser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scheduler
的用法示例。
在下文中一共展示了Scheduler::getParser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: nextScheduledDate
/**
* nextScheduledDate
*
* @param string $unix_mhdmd Param
* @param string $now Param
*
* @return string
*/
public static function nextScheduledDate($unix_mhdmd, $now = 'now')
{
JLoader::import('extly.scheduler.scheduler');
try {
$cron = Scheduler::getParser($unix_mhdmd);
$cron->setExpression($unix_mhdmd);
$nextDate = $cron->getNextRunDate($now)->getTimestamp();
$nextDate = JFactory::getDate($nextDate);
return $nextDate;
} catch (Exception $e) {
$logger = AutotweetLogger::getInstance();
$logger->log(JLog::ERROR, 'nextScheduledDate: ' . $e->getMessage());
return null;
}
}
示例2: cronjobExpressionControl
/**
* cronjobExpressionControl
*
* @param string $selected Value
* @param string $name The name for the field
* @param string $label Label
* @param string $desc Description
* @param array $idTag Additional HTML attributes for the <select> tag
* @param string $class Class
* @param string $extensionmainjs Module name
*
* @return string HTML
*/
public static function cronjobExpressionControl($selected, $name, $label, $desc, $idTag = null, $class = null, $extensionmainjs = null)
{
static $initialized = false;
if (!$initialized) {
$initialized = true;
if ($extensionmainjs) {
$dependencies = array();
// $dependencies['xtcronjob-expression-field'] = array('backbone');
$file = 'media/lib_extly/js/utils/xtcronjob-expression-field.min';
$paths = array('xtcronjob-expression-field' => $file);
Extly::addAppDependency($extensionmainjs, $dependencies, $paths);
} else {
JHtml::script('lib_extly/utils/xtcronjob-expression-field.js', false, true);
}
}
$blankText = false;
if (empty($selected)) {
$blankText = true;
$selected = '* * * * *';
}
JLoader::import('extly.scheduler.scheduler');
$cronExpression = Scheduler::getParser($selected);
$minute = $cronExpression->getExpression(0);
$hour = $cronExpression->getExpression(1);
$day = $cronExpression->getExpression(2);
$month = $cronExpression->getExpression(3);
$weekday = $cronExpression->getExpression(4);
$controlI = EHtmlSelect::minuteList($minute, $idTag . '_minute', array('class' => 'minute-part'));
$controlH = EHtmlSelect::hourList($hour, $idTag . '_hour', array('class' => 'hour-part'));
$controlD = EHtmlSelect::dayList($day, $idTag . '_day', array('class' => 'day-part'));
$controlM = EHtmlSelect::monthList($month, $idTag . '_month', array('class' => 'month-part'));
$controlW = EHtmlSelect::weekdayList($weekday, $idTag . '_weekday', array('class' => 'weekday-part'));
$controlT = self::textControl($blankText ? '' : $selected, $name, $label, $desc, $idTag, 256, 'unix_mhdmd-part');
$controls = array();
$controls[] = self::genericControl('COM_XTCRONJOB_TASKS_FIELD_MINUTE', 'COM_XTCRONJOB_TASKS_FIELD_MINUTE_DESC', $idTag . '_minute', $controlI);
$controls[] = self::genericControl('COM_XTCRONJOB_TASKS_FIELD_HOUR', 'COM_XTCRONJOB_TASKS_FIELD_HOUR_DESC', $idTag . '_hour', $controlH);
$controls[] = self::genericControl('COM_XTCRONJOB_TASKS_FIELD_DAY', 'COM_XTCRONJOB_TASKS_FIELD_DAY_DESC', $idTag . '_day', $controlD);
$controls[] = self::genericControl('COM_XTCRONJOB_TASKS_FIELD_MONTH', 'COM_XTCRONJOB_TASKS_FIELD_MONTH_DESC', $idTag . '_month', $controlM);
$controls[] = self::genericControl('COM_XTCRONJOB_TASKS_FIELD_WEEKDAY', 'COM_XTCRONJOB_TASKS_FIELD_WEEKDAY_DESC', $idTag . '_weekday', $controlW);
$controls[] = $controlT;
return implode("\n", $controls);
}