link do meu exemplo
http://scriptcase.scantec.pt/v8/app/ServiceWEBXX/calendar/
Codigo
http://jquerylabs.com/wdcalendar-jquery-plugin-html/
download código
http://sourceforge.net/projects/jqeventcalendar/
Criar uma aplicação blank
$dbhost=substr([sc_glo_servidor],0,strpos([sc_glo_servidor],":"));
$dbuser=[sc_glo_usuario];
$dbpsw =sc_decode([sc_glo_senha]);
$dbname=[sc_glo_banco];
//$dbname=‘XXXXXXXXX’;
//$user=‘XXXXXXXX’;
$user=isset($_SESSION[‘nm_session’][‘user’][‘login’])?$_SESSION[‘nm_session’][‘user’][‘login’]:"";
?>
My Calendar
<script src="../_lib/wdCalendar/src/jquery.js" type="text/javascript"></script>
<script src="../_lib/wdCalendar/src/Plugins/Common.js" type="text/javascript"></script>
<!--<script src="../_lib/wdCalendar/src/Plugins/datepicker_lang_US.js" type="text/javascript"></script>-->
<script src="../_lib/wdCalendar/src/Plugins/datepicker_lang_PT.js" type="text/javascript"></script>
<script src="../_lib/wdCalendar/src/Plugins/jquery.datepicker.js" type="text/javascript"></script>
<script src="../_lib/wdCalendar/src/Plugins/jquery.alert.js" type="text/javascript"></script>
<script src="../_lib/wdCalendar/src/Plugins/jquery.ifrmdailog.js" defer="defer" type="text/javascript"></script>
<!--<script src="src/Plugins/wdCalendar_lang_US.js" type="text/javascript"></script>-->
<script src="../_lib/wdCalendar/src/Plugins/wdCalendar_lang_PT.js" type="text/javascript"></script>
<script src="../_lib/wdCalendar/src/Plugins/jquery.calendar.js" type="text/javascript"></script>
<!--<script src="src/Plugins/common_lang_US.js" type="text/javascript"></script>-->
<script src="../_lib/wdCalendar/src/Plugins/common_lang_PT.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
updateLang();
var view="week";
var DATA_FEED_URL = "../_lib/wdCalendar/php/datafeed.php";
var op = {
view: view,
theme:0,
showday: new Date(),
EditCmdhandler:Edit,
DeleteCmdhandler:Delete,
ViewCmdhandler:View,
onWeekOrMonthToDay:wtd,
onBeforeRequestData: cal_beforerequest,
onAfterRequestData: cal_afterrequest,
onRequestDataError: cal_onerror,
autoload:true,
url: DATA_FEED_URL + "?method=list&db=<?php echo $dbname;?>&User=<?php echo $user;?>",
quickAddUrl: DATA_FEED_URL + "?method=add&db=<?php echo $dbname;?>&User=<?php echo $user;?>",
quickUpdateUrl: DATA_FEED_URL + "?method=update&db=<?php echo $dbname;?>&User=<?php echo $user;?>",
quickDeleteUrl: DATA_FEED_URL + "?method=remove&db=<?php echo $dbname;?>&User=<?php echo $user;?>",
extParam: [{name:"db", value: "<?php echo $dbname;?>"},{name:"User", value: "<?php echo $user;?>"},{name:"DateFormat", value: i18n.xgcalendar.dateformat.fulldayvalue}]
};
var $dv = $("#calhead");
var _MH = document.documentElement.clientHeight;
var dvH = $dv.height() + 2;
op.height = _MH - dvH;
op.eventItems =[];
var p = $("#gridcontainer").bcalendar(op).BcalGetOp();
if (p && p.datestrshow) {
$("#txtdatetimeshow").text(p.datestrshow);
}
$("#caltoolbar").noSelect();
$("#hdtxtshow").datepicker({ picker: "#txtdatetimeshow", showtarget: $("#txtdatetimeshow"),
onReturn:function(r){
var p = $("#gridcontainer").gotoDate(r).BcalGetOp();
if (p && p.datestrshow) {
$("#txtdatetimeshow").text(p.datestrshow);
}
}
});
function cal_beforerequest(type) {
// var t="Loading data...";
var t = i18n.common.index.loading_data;
switch(type)
{
case 1:
// t="Loading data...";
t = i18n.common.index.loading_data;
break;
case 2:
case 3:
case 4:
//t="The request is being processed ...";
t = i18n.common.index.request_processed;
break;
}
$("#errorpannel").hide();
$("#loadingpannel").html(t).show();
removeDrag();
}
function cal_afterrequest(type) {
switch(type){
case 1:
$("#loadingpannel").hide();
break;
case 2:
case 3:
case 4:
// $("#loadingpannel").html("Success!");
$("#loadingpannel").html(i18n.common.index.success);
window.setTimeout(function(){ $("#loadingpannel").hide();},2000);
break;
}
removeDrag();
}
function cal_onerror(type,data) {
$("#gridcontainer").reload();
$("#errorpannel").show();
}
function Edit(data) {
// console.log(data);
var eurl="../_lib/wdCalendar/php/edit.php?id={0}&start={2}&end={3}&isallday={4}&title={1}&db=<?php echo $dbname;?>";
if(data && data[0] != -1) {
var url = StrFormat(eurl,data);
// OpenModelWindow(url,{ width: 600, height: 400, caption:"Manage The Calendar",onclose:function(){
OpenModelWindow(url,{ width: 600, height: 400, caption: i18n.common.index.edit_caption,onclose:function(){
$("#gridcontainer").reload();
}});
}
}
function View(data) {
// console.log(data);
var str = "";
$.each(data, function(i, item){
switch (i) {
case 1:
str += "<b>" + i18n.common.index.view_subject + "</b> " + item + "\n";
break;
case 2:
str += "<b>" + i18n.common.index.view_from + "</b> " + item.toLocaleString() + "\n";
break;
case 3:
str += "<b>" + i18n.common.index.view_to + "</b> " + item.toLocaleString() + "\n";
break;
case 9:
str += "<b>" + i18n.common.index.view_local + "</b> " + item + "\n";
break;
case 11:
str += "<b>" + i18n.common.index.view_notes + "</b> " + item + "\n";
break;
case 13:
str += "<b>" + i18n.common.index.view_user + "</b> " + item + "\n";
break;
default:
break;
}
// str += "[" + i + "]: " + item + "\n";
});
// alert(str);
$.alerts.okButton= i18n.common.index.ok;
// $.alerts.cancelButton="Cancel";
// hiAlert(str, "Detalhes");
hiAlert(str, i18n.common.index.view_title);
}
function Delete(data,callback) {
$.alerts.okButton=i18n.common.index.ok;
$.alerts.cancelButton=i18n.common.index.cancel;
if (data[0] != -1) {
hiConfirm(i18n.common.index.delete_question, 'Confirm',function(r){ r && callback(0);});
}
}
function wtd(p) {
if (p && p.datestrshow) {
$("#txtdatetimeshow").text(p.datestrshow);
}
$("#caltoolbar div.fcurrent").each(function() {
$(this).removeClass("fcurrent");
})
$("#showdaybtn").addClass("fcurrent");
removeDrag();
}
//to show day view
$("#showdaybtn").click(function(e) {
//document.location.href="#day";
$("#caltoolbar div.fcurrent").each(function() {
$(this).removeClass("fcurrent");
})
$(this).addClass("fcurrent");
var p = $("#gridcontainer").swtichView("day").BcalGetOp();
if (p && p.datestrshow) {
$("#txtdatetimeshow").text(p.datestrshow);
}
removeDrag();
});
//to show week view
$("#showweekbtn").click(function(e) {
//document.location.href="#week";
$("#caltoolbar div.fcurrent").each(function() {
$(this).removeClass("fcurrent");
})
$(this).addClass("fcurrent");
var p = $("#gridcontainer").swtichView("week").BcalGetOp();
if (p && p.datestrshow) {
$("#txtdatetimeshow").text(p.datestrshow);
}
removeDrag();
});
//to show month view
$("#showmonthbtn").click(function(e) {
//document.location.href="#month";
$("#caltoolbar div.fcurrent").each(function() {
$(this).removeClass("fcurrent");
})
$(this).addClass("fcurrent");
var p = $("#gridcontainer").swtichView("month").BcalGetOp();
if (p && p.datestrshow) {
$("#txtdatetimeshow").text(p.datestrshow);
}
removeDrag();
});
$("#showreflashbtn").click(function(e){
$("#gridcontainer").reload();
removeDrag();
});
//Add a new event
$("#faddbtn").click(function(e) {
var url ="../_lib/wdCalendar/php/edit.php?db=<?php echo $dbname;?>&User=<?php echo $user;?>";
OpenModelWindow(url,{ width: 500, height: 400, caption: "Create New Calendar"});
});
//Add a new event timesheet
$("#faddbtnt").click(function(e) {
var url ="../form_agenda/form_agenda.php";
OpenModelWindow(url,{ width: 600, height: 500, caption: "Create New timesheet"});
});
//go to today
$("#showtodaybtn").click(function(e) {
var p = $("#gridcontainer").gotoDate().BcalGetOp();
if (p && p.datestrshow) {
$("#txtdatetimeshow").text(p.datestrshow);
}
removeDrag();
});
//previous date range
$("#sfprevbtn").click(function(e) {
var p = $("#gridcontainer").previousRange().BcalGetOp();
if (p && p.datestrshow) {
$("#txtdatetimeshow").text(p.datestrshow);
}
removeDrag();
});
//next date range
$("#sfnextbtn").click(function(e) {
var p = $("#gridcontainer").nextRange().BcalGetOp();
if (p && p.datestrshow) {
$("#txtdatetimeshow").text(p.datestrshow);
}
removeDrag();
});
removeDrag();
function removeDrag() {
$("div[id=bbit_cal_event_-1]").each(function(){
$(this).removeClass("drag");
if (!$(this).hasClass("cal_-1")) {
$(this).addClass("cal_-1");
}
// $(this).unbind("click");
$(this).find(".rb-m").css('background','#87a96b');
$(this).find(".rb-i").children().each(function(){
if($(this).hasClass("cic cic-tmr")) {
$(this).remove();
}
})
});
}
function updateLang() {
$("#calendar_title").html(i18n.common.index.calendar_title);
$("#loadingpannel").html(i18n.common.index.loadingpannel);
$("#errorpannel").html(i18n.common.index.errorpannel);
$("#span_new_event").html(i18n.common.index.span_new_event);
$("#span_today").html(i18n.common.index.span_today);
$("#span_day").html(i18n.common.index.span_day);
$("#span_week").html(i18n.common.index.span_week);
$("#span_month").html(i18n.common.index.span_month);
$("#span_refresh").html(i18n.common.index.span_refresh);
$("#txtdatetimeshow").html(i18n.common.index.txtdatetimeshow);
}
});
</script>
My Calendar
Loading data...
Sorry, could not load your data, please try again later
<?php