/** * 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); }