static function load_picker_moo($date_format, $start_day, $field_id, $theme, $validation_type) { $document = JFactory::getDocument(); $month_names = '["' . JText::_('JANUARY') . '","' . JText::_('FEBRUARY') . '","' . JText::_('MARCH') . '","' . JText::_('APRIL') . '","' . JText::_('MAY') . '","' . JText::_('JUNE') . '","' . JText::_('JULY') . '","' . JText::_('AUGUST') . '","' . JText::_('SEPTEMBER') . '","' . JText::_('OCTOBER') . '","' . JText::_('NOVEMBER') . '","' . JText::_('DECEMBER') . '"]'; $day_names = '["' . JText::_('SUNDAY') . '","' . JText::_('MONDAY') . '","' . JText::_('TUESDAY') . '","' . JText::_('WEDNESDAY') . '","' . JText::_('THURSDAY') . '","' . JText::_('FRIDAY') . '","' . JText::_('SATURDAY') . '"]'; $date_format_string = Constant("FCPM_DATE_FORMAT_" . $date_format); $css_path = 'components/com_flexicontactplus/assets/mtcal/themes/' . $theme . '/' . $theme . '.css'; $document->addStyleSheet($css_path); JHtml::_('behavior.framework'); // load MooTools before the date picker $document->addScript('components/com_flexicontactplus/assets/mtcal/mtcal_1.4.js'); // use the direction parameter to enforce dates in the past or future switch ($validation_type) { case VALTYPE_PAST: $direction = ', direction:-.5'; break; case VALTYPE_FUTURE: $direction = ', direction:.5'; break; default: $direction = ''; } $params = "{ classes:['{$theme}'], days:{$day_names}, months:{$month_names}, tweak:{x: -100, y: 25}, offset:{$start_day} {$direction} }"; $js = "\nwindow.addEvent('domready', function() { \n\t\t\tfcp_cal_" . $field_id . " = new Calendar({ " . $field_id . ":'{$date_format_string}' }, {$params}); })"; $document->addScriptDeclaration($js); }
/** * @param $file * @return array|bool */ private function fileInfo($file) { $path = $file[0] === "/" ? Constant('ROOT') . $file : Constant('ROOT') . "/" . $file; if (file_exists($path)) { $data = array('path' => $path, 'last_edit' => filemtime($path), 'file_type' => pathinfo($path, PATHINFO_EXTENSION)); $data['hash'] = hash('sha256', serialize($data)); $data['parsed_files'] = $this->cache->fetch($data['hash'] . "parsed_files"); if ($this->last_modified === false || $data['last_edit'] < $this->last_modified) { $this->last_modified = $data['last_edit']; } return $data; } return false; }