PHP-Code:
<?php
$GLOBALS['TL_USER_CSS'][] = 'files\themes\jquery\pickadate\lib\themes\default.css|static';
$GLOBALS['TL_USER_CSS'][] = 'files\themes\jquery\pickadate\lib\themes\default.date.css|static';
?>
<script src="files\themes\jquery\pickadate\lib\picker.js"></script>
<script src="files\themes\jquery\pickadate\lib\picker.date.js"></script>
<script>
$(document).ready(function(){
$.extend($.fn.pickadate.defaults, {
monthsFull: [ 'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember' ],
monthsShort: [ 'Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez' ],
weekdaysFull: [ 'Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag' ],
weekdaysShort: [ 'So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa' ],
showMonthsShort: true,
showWeekdaysFull: false,
today: 'Heute',
clear: 'Löschen',
close: 'Schließen',
labelMonthNext: 'nächster Monat',
labelMonthPrev: 'vorheriger Monat',
formatSubmit: 'yyyy/mm/dd',
closeOnSelect: true,
closeOnClear: false,
firstDay: 1, //first week day is monday
format: 'dddd, dd. mmmm yyyy',
formatSubmit: 'yyyy/mm/dd',
hiddenName: true,
min: new Date(),
disable: [
<?php
foreach ($this->tbody as $class=>$row) {
foreach ($row as $col) {
if( strpos($col['class'], 'col_first') ) {
$tempData = $col['raw'];
}
else
{
if ( isset($col['raw']) ) { //only if endDate is set
print "{from:[".$this->parseDate('Y,m,d',strtotime('-1 month +1 day',$tempData))."], to:[".$this->parseDate('Y,m,d',strtotime('-1 month -1 day',$col['raw']))."]},\n";
}
else
{
print "[".$this->parseDate('Y,m,d', strtotime('-1 month',$tempData))."],\n";
}
}
}
}
?>
]
})
var from_$input = $('#ctrl_18').pickadate(),
from_picker = from_$input.pickadate('picker')
var to_$input = $('#ctrl_20').pickadate(),
to_picker = to_$input.pickadate('picker')
// Check if there’s a “from” or “to” date to start with.
if ( from_picker.get('value') ) {
to_picker.set('min', from_picker.get('select'))
}
if ( to_picker.get('value') ) {
from_picker.set('max', to_picker.get('select'))
}
// When something is selected, update the “from” and “to” limits.
from_picker.on('set', function(event) {
if ( event.select ) {
to_picker.set('min', from_picker.get('select'))
}
else if ( 'clear' in event ) {
to_picker.set('min', false)
}
})
to_picker.on('set', function(event) {
if ( event.select ) {
from_picker.set('max', to_picker.get('select'))
}
else if ( 'clear' in event ) {
from_picker.set('max', false)
}
})
})
</script>
Lesezeichen