Created
June 26, 2012 18:29
-
-
Save tareko/2997764 to your computer and use it in GitHub Desktop.
Trying to get the calendar working
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function startCalendar() { | |
| $.getJSON( | |
| '<?= $this->Html->url(array('controller' => 'shifts', 'action' => 'listShifts.json')); ?>', | |
| {id: $('<?=$userData?>').val()}, | |
| function(json) { | |
| shiftDays = json; | |
| $("#datepicker<?=$calendarId?>").datepicker({ | |
| beforeShowDay: shiftsWorking, | |
| dateFormat: 'yy-mm-dd', | |
| onSelect: calendarSelect | |
| }); | |
| } | |
| ); | |
| } | |
| function shiftsWorking(date) { | |
| for (i = 0; i < shiftDays.shiftList.length; i++) { | |
| console.log(i); | |
| dateDB = new Date(shiftDays.shiftList[i].Shift.date); | |
| if (date.getYear() == dateDB.getYear() | |
| && date.getMonth() == dateDB.getMonth() | |
| && date.getDate() == dateDB.getDate() + 1) { | |
| return [true, shiftDays.shiftList[i].Shift.date + '_day']; | |
| } | |
| } | |
| return [false, '']; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment