/** * 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); }
/** * imagePickerControl * * @param string $label Param * @param string $desc Param * @param array $options The key that is selected * @param string $name The name for the field * @param array $attribs Additional HTML attributes for the <select> tag* * @param string $selected The key that is selected * @param string $idTag The name for the field * @param string $extensionmainjs Param * * @return string HTML for the select list. */ public static function imagePickerListControl($label, $desc, $options, $name, $attribs, $selected, $idTag, $extensionmainjs = null) { static $initialized = false; if (!$initialized) { $initialized = true; JHtml::stylesheet('lib_extly/image-picker.css', false, true); if ($extensionmainjs) { $dependencies = array(); if (EXTLY_J25) { $dependencies['image-picker'] = array(DependencyManager::EXTLY_J25_JQUERY); } $file = 'media/lib_extly/js/utils/image-picker.min'; $paths = array('image-picker' => $file); Extly::addAppDependency($extensionmainjs, $dependencies, $paths); } else { JHtml::script('lib_extly/utils/image-picker.min.js', false, true); } } if (!$idTag) { $idTag = self::generateIdTag(); } Extly::addPostRequireScript("jQuery('#{$idTag}').imagepicker({\nshow_label: true,\nselected: function() {\n\tthis.trigger('liszt:updated');\n}\n});"); $base_attrs = array(); $base_attrs['id'] = $idTag; $base_attrs['option.attr'] = 'data-img-src'; $base_attrs['list.translate'] = false; $base_attrs['option.key'] = 'value'; $base_attrs['option.text'] = 'text'; $base_attrs['list.select'] = $selected; $attribs = array_merge($base_attrs, $attribs); $control = self::genericlist($options, $name, $attribs); return EHtml::genericControl($label, $desc, $name, $control); }