2013-01-08 1 views
1

나는 jQuery weekcalendar을 사용하여 캘린더에 appoitments를 표시하고 간단한 클릭으로 새 항목을 추가합니다. eventNew 함수에서 약속이 추가 된 userId을 얻으려고합니다. 아무도 이것을 달성하는 방법을 말해 줄 수 있습니까? 새 이벤트를 추가 할 때 jQuery weekcalendar에서 userId 가져 오기

내가 시작과 약속의 종료 날짜 얻을 수 있었다 다음 Wiki에서

eventNew : function(calEvent, $event, FreeBusyManager, calendar) { 
    var isFree = true; 
    $.each(FreeBusyManager.getFreeBusys(calEvent.start, calEvent.end), function() { 
    if (
     this.getStart().getTime() != calEvent.end.getTime() 
     && this.getEnd().getTime() != calEvent.start.getTime() 
     && !this.getOption('free') 
    ){ 
     isFree = false; 
     return false; 
    } 
    }); 

    // add the event to the database 
    console.log('start of new calendar event: ' + calEvent.start); 
    console.log('end of new calendar event: ' + calEvent.end); 
    // how do I get the userId here? 
} 

을, 나는 함수가 getUserId라고하지만이를 구현하는 방법을 모른다 발견했다. 어떤 도움을 주셔서 감사합니다.

편집 : 캘린더는 다중 사용자가 사용할 수 있습니다. 다른 사용자에 대해 이벤트를 설정할 수 있습니다.

+0

? 무엇의 사용자 ID인가? 플러그인 지원이 다른 사용자에게 이벤트를 입력합니까? – ManseUK

+0

예,이 데모를보십시오 (Chrome atm에만 해당). http://www.slinder.ch/admin/admin/calendar/calendar.html – doonot

답변

0

좋아, 알아 냈어. 이 모든 함수가 호출되지만 직접 구현해야합니다. 그래서이 코드는 이벤트의 userId는 설정 : eventNew에서

setEventUserId: function(userId, calEvent, calendar) { 
    console.log('set eventuserid is called'); 
    calEvent.userId = userId; 
    return calEvent; 
}, 

당신은 다음 호출 할 수 userId :

eventNew : function(calEvent, $event, FreeBusyManager, calendar) { 
    var isFree = true; 
    $.each(FreeBusyManager.getFreeBusys(calEvent.start, calEvent.end), function() { 
    if (
     this.getStart().getTime() != calEvent.end.getTime() 
     && this.getEnd().getTime() != calEvent.start.getTime() 
     && !this.getOption('free') 
    ){ 
     isFree = false; 
     return false; 
    } 
    }); 

    // add the event to the database 
    console.log('start of new calendar event: ' + calEvent.start); 
    console.log('end of new calendar event: ' + calEvent.end); 
    console.log('userId of new calendar event: ' + calEvent.userId); 
}, 
정말 사용자 ID는 어디에서 오는 이해 해달라고
관련 문제