I'm using fullcalendar library for calendar view,
<div id="calendar">
<?PHP
include("Calendar.php");
?>
</div>
i managed to connect my fullcalendar to sql db using source code I got from internet which is Calendar.php
$sql = "SELECT id, title, start, end, color FROM tbl_calendar ";
$req = $bdd->prepare($sql);
$req->execute();
$events = $req->fetchAll();
, but how can i auto refresh my calendar?. the following is my code
$('#calendar').fullCalendar({
header: {
left: 'prev,next ',
center: 'title',
right: 'today'
},
editable: true,
eventLimit: true, // allow "more" link when too many events
selectable: true,
selectHelper: true,
select: function(start, end) {
$('#ModalAdd #start').val(moment(start).format('YYYY-MM-DD HH:mm:ss'));
$('#ModalAdd #end').val(moment(end).format('YYYY-MM-DD HH:mm:ss'));
$('#ModalAdd').modal('show');
},
eventRender: function(event, element) {
element.bind('dblclick', function() {
$('#ModalEdit #id').val(event.id);
$('#ModalEdit #title').val(event.title);
$('#ModalEdit #color').val(event.color);
$('#ModalEdit').modal('show');
});
},
eventDrop: function(event, delta, revertFunc) { // si changement de position
edit(event);
},
eventResize: function(event,dayDelta,minuteDelta,revertFunc) { // si changement de longueur
edit(event);
},
events: [
<?php foreach($events as $event):
$start = explode(" ", $event['start']);
$end = explode(" ", $event['end']);
if($start[1] == '00:00:00'){
$start = $start[0];
}else{
$start = $event['start'];
}
if($end[1] == '00:00:00'){
$end = $end[0];
}else{
$end = $event['end'];
}
?>
{
id: '<?php echo $event['id']; ?>',
title: '<?php echo $event['title']; ?>',
start: '<?php echo $start; ?>',
end: '<?php echo $end; ?>',
color: '<?php echo $event['color']; ?>',
},
<?php endforeach; ?>
]
});
i tried to use several functions such as
`setInterval(function(){
$('#calendar').fullCalendar( 'removeEventSource', "Fetch.php" )
$('#calendar').fullCalendar( 'addEventSource', "Fetch.php" )
$("#calendar").fullCalendar( 'refetchEvents' )
}, 1000);`
but it doesn't refresh calendar but the calendar is keep blinking.
any solutions?
Related
I had posted : passsing data to https by JSON using JSONP ,and tried to change the highchart by call back to JSONP but still I don't get any result. Could any one tell me what is the problem (perhaps I think the way, which I callback is wrong.)?
data.php:
<?php header("content-type: application/json");
$servername = "xxxxxx";
$username = "xxxxxx";
$password = "xxxxxx";
$dbname = "xxxxxx";
$con = mysql_connect($servername,$username,$password,$dbname);
if (!$con) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db("xxxxxxxxxx", $con);
if (isset($_GET["dateparam"])) {
$sql = mysql_query("SELECT timestamp_value, User_Logins FROM foot_traffic WHERE timestamp_value LIKE '".$_GET["dateparam"]."%'");
} else {
$sql = mysql_query("SELECT timestamp_value, User_Logins FROM foot_traffic WHERE timestamp_value LIKE '2013-02-01%'");
}
$result['name'] = 'User_Logins over Time Period';
while($r = mysql_fetch_array($sql)) {
$datetime = $r['timestamp_value'];
$result['category'][] = $datetime;
$result['data'][] = $r['User_Logins'];
}
echo $_GET['callback']. '('. json_encode($result) . ')';
print json_encode($result, JSON_NUMERIC_CHECK);
mysql_close($con);
?>
file.php:
<html>
<head>
<script type="text/javascript">
var hey;
$(document).ready(function() {
hey = {
chart: {
renderTo: 'container1',
type: 'area',
borderColor: "#3366ff",
borderWidth:5,
zoomType : 'x'
},
title: {
text: 'All User_Logins of your All Organizations '
},
subtitle: {
text: ' '
},
credits:{
enabled:false
},
xAxis: {
categories: [],
labels: {
align: 'center',
x: -3,
y: 20,
formatter: function(){
return Highcharts.dateFormat('%l%p',Date.parse(this.value +' UTC'));
}
}
},
yAxis: {
title: {
text: ''
}
},
tooltip: {
backgroundColor: '#FCFFC5',
borderColor: 'black',
borderRadius: 10,
borderWidth: 3
},
// Enable for both axes
tooltip: {
borderWidth: 0,
backgroundColor: "rgba(255,255,255,0)",
borderRadius: 0,
shadow: false,
useHTML: true,
percentageDecimals: 2,
backgroundColor: "rgba(255,255,255,1)",
formatter: function () {
return '<div class="tooltip">' + this.point.name + '<br />' + '<b>' +
Highcharts.numberFormat(this.y).replace(",", " ") + ' Kč [' +
Highcharts.numberFormat(this.percentage, 2) + '%]</b></div>';
}
},
plotOptions: {
line: {
dataLabels: {
enabled: true
},
enableMouseTracking: false
}
},
series: [{
type: 'area',
name: '',
data: []
}]
}
$.getJSON("data.php?callback=?", function(json){
hey.xAxis.categories = json['category'];
hey.series[0].name = json['name'];
hey.series[0].data = json['data'];
chart = new Highcharts.Chart(hey);
});
});
$(function() {
$( "#datepicker" ).datepicker({
dateFormat: "yy-mm-dd",
showOn: "button",
buttonImage: "calendar.gif",
buttonImageOnly: true,
onSelect: function(dateText, inst) {
$.getJSON("data.php?dateparam?callback=?"+dateText, function(json){
hey.xAxis.categories = json['category'];
hey.series[0].name = json['name'];
hey.series[0].data = json['data'];
chart = new Highcharts.Chart(hey);
});
}
});
});
</script>
</head>
<body>
<!--date picker-->
<input type="text" id="datepicker" />
<!-- highchart container-->
<div id="container1" class="analysis" style=" margin: 0 auto">
</div>
</body>
</html>
EDIT
Is it possible to send the json data into this part:
$.each( res, function(key, row)(
{
events: [
{
title: 'All Day Event',
start: //from AJAX row['name'],
backgroundColor: "#f56954", //red
borderColor: "#f56954" //red
},
...
I am trying to add data from MysQL into fullcalendar.
Here is my fullcalendar script:
<script>
(function ($) {
$(document).ready(function() {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
editable: true,
eventLimit: true, // allow "more" link when too many events
events: {
url: 'fullcalendar/get-events.php',
//url: 'fullcalendar/myfeed.php',
error: function() {
$('#script-warning').show();
}
},
loading: function(bool) {
$('#loading').toggle(bool);
}
});
});
})(jQuery);
</script>
Where I get values from get-events.php, and here is the code:
<?php
//Set error reporting on
error_reporting(E_ALL);
ini_set("display_errors", 1);
//Include connection file
require_once('global.php');
//Json and PHP header
header('Content-Type: application/json');
$events = array();
$user = $_SESSION['username'];
$id_logged = $_SESSION['login_id'];
$search_date = "SELECT * FROM appointment WHERE id_logged = :id_logged";
$search_date_stmt = $conn->prepare($search_date);
$search_date_stmt->bindValue(':id_logged', $id_logged);
$search_date_stmt->execute();
$search_date_stmt_fetch = $search_date_stmt->fetchAll();
$search_date_stmt_count = $search_date_stmt->rowCount();
$i = 0;
foreach($search_date_stmt_fetch as $row)
{
$events[$i] = $row;
$i++;
}
echo json_encode($events);
?>
The result is show properly at the XHR:
But I can't see any of them in the calendar:
Build your response like the doc said :
$search_date_stmt_fetch = $search_date_stmt->fetchAll();
$search_date_stmt_count = $search_date_stmt->rowCount();
foreach($search_date_stmt_fetch as $row)
{
$events[] = array(
'start' => $row->your_date_start,
'end' => $row->your_date_end,
'id' => $row->your_id
...);
}
echo json_encode($events);
See the doc to know the properties you need : http://fullcalendar.io/docs/event_data/Event_Object/
i'm having trouble with fullcalendar. im not sure whether it is my php or mysql code. the calendar displays and i can add a new event but the event does not stick to the calendar. the event data does get inserted into the database but again it does not appear on the actual calendar itself.
here is the code i have so far:
index.php
<!DOCTYPE html>
<html>
<head>
<title>FullCalendar</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel='stylesheet' type='text/css' href='css/style.css' />
<link rel='stylesheet' type='text/css' href='css/fullcalendar.css' />
<link rel='stylesheet' type='text/css' href='css/jquery-ui-1.8.11.custom.css' />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script src="js/jquery-ui-1.8.11.custom.min.js"></script>
<script src='js/fullcalendar.min.js'></script>
<script src="js/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript">
$(document).ready(function() {
/* global variables */
var event_start = $('#event_start');
var event_end = $('#event_end');
var event_type = $('#event_type');
var calendar = $('#calendar');
var form = $('#dialog-form');
var event_id = $('#event_id');
var format = "MM/dd/yyyy HH:mm";
/* button to add events */
$('#add_event_button').button().click(function(){
formOpen('add');
});
/** cleaning function form */
function emptyForm() {
event_start.val("");
event_end.val("");
event_type.val("");
event_id.val("");
}
/* opening form types*/
function formOpen(mode) {
if(mode == 'add') {
/* hide button Delete , Edit and display the Add*/
$('#add').show();
$('#edit').hide();
$("#delete").button("option", "disabled", true);
}
else if(mode == 'edit') {
/* hide the Add button , display the Edit and Delete*/
$('#edit').show();
$('#add').hide();
$("#delete").button("option", "disabled", false);
}
form.dialog('open');
}
/* date time picker */
event_start.datetimepicker({hourGrid: 4, minuteGrid: 10, dateFormat: 'mm/dd/yy'});
event_end.datetimepicker({hourGrid: 4, minuteGrid: 10, dateFormat: 'mm/dd/yy'});
/* initialize full calendar */
calendar.fullCalendar({
firstDay: 1,
height: 500,
editable: true,
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
monthNames: ['January','Feburary','March','April','May','June','July','August','September','October','November','December'],
monthNamesShort: ['Jan.','Feb.','Маr','Apr.','May','Jun','Jul','Aug.','Sept.','Oct.','Nov.','Dec.'],
dayNames: ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturdat"],
dayNamesShort: ["Su","Mo","Tu","We","Th","Fr","Sa"],
buttonText: {
prev: " ◄ ",
next: " ► ",
prevYear: " << ",
nextYear: " >> ",
today: "today",
month: "month",
week: "week",
day: "day"
},
/* time format output before the event name*/
timeFormat: 'H:mm',
/* click event handler for a particular day */
dayClick: function(date, allDay, jsEvent, view) {
var newDate = $.fullCalendar.formatDate(date, format);
event_start.val(newDate);
event_end.val(newDate);
formOpen('add');
},
/* handler for event click */
eventClick: function(calEvent, jsEvent, view) {
event_id.val(calEvent.id);
event_type.val(calEvent.title);
event_start.val($.fullCalendar.formatDate(calEvent.start, format));
event_end.val($.fullCalendar.formatDate(calEvent.end, format));
formOpen('edit');
},
/* record source */
eventSources: [{
url: 'ajax.php',
type: 'POST',
data: {
op: 'source'
},
error: function() {
alert('Error connecting to the data source!');
}
}]
});
/* form handler */
form.dialog({
autoOpen: false,
buttons: [{
id: 'add',
text: 'add',
click: function() {
$.ajax({
type: "POST",
url: "ajax.php",
data: {
start: event_start.val(),
end: event_end.val(),
type: event_type.val(),
op: 'add'
},
success: function(id){
calendar.fullCalendar('renderEvent', {
id: id,
title: event_type.val(),
start: event_start.val(),
end: event_end.val(),
allDay: false
});
}
});
emptyForm();
}
},
{ id: 'edit',
text: 'edit',
click: function() {
$.ajax({
type: "POST",
url: "ajax.php",
data: {
id: event_id.val(),
start: event_start.val(),
end: event_end.val(),
type: event_type.val(),
op: 'edit'
},
success: function(id){
calendar.fullCalendar('refetchEvents');
}
});
$(this).dialog('close');
emptyForm();
}
},
{ id: 'cancel',
text: 'cancel',
click: function() {
$(this).dialog('close');
emptyForm();
}
},
{ id: 'delete',
text: 'delete',
click: function() {
$.ajax({
type: "POST",
url: "ajax.php",
data: {
id: event_id.val(),
op: 'delete'
},
success: function(id){
calendar.fullCalendar('removeEvents', id);
}
});
$(this).dialog('close');
emptyForm();
},
disabled: true
}]
});
});
</script>
</head>
<body>
<div id="calendar"></div>
<button id="add_event_button">Add Event</button>
<div id="dialog-form" title="Событие">
<p class="validateTips"></p>
<form>
<p><label for="event_type">type</label>
<input type="text" id="event_type" name="event_type" value=""></p>
<p><label for="event_start">start</label>
<input type="text" name="event_start" id="event_start"/></p>
<p><label for="event_end">end</label>
<input type="text" name="event_end" id="event_end"/></p>
<input type="hidden" name="event_id" id="event_id" value="">
</form>
</div>
</body>
</html>
ajax.php
<?php
$con=mysqli_connect("localhost","root","","fullcalendar");
$start = $_POST['start'];
$end = $_POST['end'];
$type = $_POST['type'];
$op = $_POST['op'];
$id = $_POST['id'];
switch ($op) {
case 'add':
$sql = 'INSERT INTO events (
start,
end,
type)
VALUES
("' . date("Y-m-d H:i:s", strtotime($start)) . '",
"' . date("Y-m-d H:i:s", strtotime($end)) . '",
"' . $type . '")';
if (mysqli_query($GLOBALS["___mysqli_ston"], $sql)) {
echo ((is_null($___mysqli_res = mysqli_insert_id($GLOBALS["___mysqli_ston"]))) ? false : $___mysqli_res);
}
break;
case 'edit':
$sql = 'UPDATE events SET start = "' . date("Y-m-d H:i:s", strtotime($start)) . '",
end = "' . date("Y-m-d H:i:s", strtotime($end)) . '",
type = "' . $type . '"
WHERE id = "' . $id . '"';
if (mysqli_query($GLOBALS["___mysqli_ston"], $sql)) {
echo $id;
}
break;
case 'source':
$sql = 'SELECT * FROM events';
$result = mysqli_query($GLOBALS["___mysqli_ston"], $sql);
$json = Array();
while ($row = mysqli_fetch_assoc($result)) {
$json[] = array(
'id' => $row['id'],
'title' => $row['type'],
'start' => $row['start'],
'end' => $row['end'],
'allDay' => false
);
}
echo json_encode($json);
break;
case 'delete':
$sql = 'DELETE FROM events WHERE id = "' . $id . '"';
if (mysqli_query($GLOBALS["___mysqli_ston"], $sql)) {
echo $id;
}
break;
}
i'd appreciate it if there could be any constructive input or help with this issue.
Hey guys thanks for the help. I had a look at the ajax like charlietfl said and I got a few errors thrown. They were mainly errors about the database connection but seeing as the events are getting inserted to the table it didn't seem correct. I double checked the syntax of the php and mysql and it turns out I was using a few mysql functions that have been depreciated in the newest version of php. It was recommended I changed it to match the PDO or mysqli structure to see if it would work and it did. Thanks for everybody's inputs i really appreciate it.
I am implementing jquery full calendar in my PHP website. when i am clicking on any date of calendar it is giving me a prompt. There is a input field asking for event title. I want to change this input field and want a drop down list in place of input field. Is it possible? This is the calendar that i am using http://fullcalendar.io/
<script>
$(document).ready(function() {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
defaultDate: '<?php echo date("Y-m-d"); ?>',
selectable: true,
selectHelper: true,
select: function(start, end) {
var title = prompt('Please fill schedule title & add fees');
var eventData;
if (title) {
eventData = {
title: title,
url: 'javascript:fee_add("' + title + '","' + start +'");',
start: start,
end: end
};
$('#calendar').fullCalendar('renderEvent', eventData, true); // stick? = true
}
$('#calendar').fullCalendar('unselect');
},
editable: true,
eventLimit: true, // allow "more" link when too many events
events: [
<?php
if($mysql->rowCount($query) > 0)
{
$rows = $mysql->fetchArray($query);
foreach($rows as $row)
{
if($row['date_time'] !='0000-00-00 00:00:00')
{
$date1 = date_create_from_format('Y-m-d H:i:s', $row['date_time']);
$date = date('Y-m-d', $date1->getTimestamp());
$time = date('H:i', $date1->getTimestamp());
$time_hr = date('H:i:s', $date1->getTimestamp());
}
?>
{
title: '<?php echo $row["fee_title"]; ?>',
url: 'javascript:fee_edit(<?php echo $row["id"]; ?>,"<?php echo $row["fee_title"]; ?>","<?php echo $date . " " . $time_hr; ?>");',
start: '<?php echo $date; ?>T<?php echo $time ?>'
},
<?php
}
}
?>
]
});
});
</script>
</div>
<div id='calendar'></div>
This is the code i am implementing and just want dropdown list in place of title
Thanx in advance
Prompt is a built is js component. You shouldn't attempt to override it. Try using a custom dialog/modal. jQuery UI has a great dialog component that would allow you to utilize a select element or any other html you see fit.
I created a calendar with FullCalendar.js and it's working fine on Chrome (v.27) but not working on IE 10 e FF 21.0. Here the code that renders the events:
<?php
$user_selected = (isset($_GET['id'])) ? $_GET['id'] : $_SESSION[$pre_ssn.'userid'];
// [...]
$get_dati_calendar = mysql_query("SELECT * FROM calendario_fonderia WHERE user_id = $user_selected ");
$eventi = '[';
while ($calendar = mysql_fetch_array($get_dati_calendar)) {
$coloring = ($calendar['eur_gr'] != '') ? ", className: 'fc-event-done'" : '';
$dati_cal = ($calendar['eur_gr'] != '') ? $calendar['grammi'].' gr.\n'.$calendar['eur_gr'].' €/gr' : $calendar['grammi'].' gr.' ;
$eventi .= "{ title: '".$dati_cal."', start: new Date('".$calendar['data']."'), allDay: true ".$coloring." },";
}
echo ($eventi != '[') ? substr($eventi, 0, -1)."]\n" : "[]\n";
?>
And this is the full code (with at the end the php renderer):
jQuery(document).ready(function() {
//datepicker
jQuery('#datepicker').datepicker();
// tabbed widget
jQuery('.tabbedwidget').tabs();
function shortAjax(file, mode, dati){
var datiEx = jQuery.ajax({
type: "POST",
url: file+".php",
data: "mode="+mode+"&"+dati,
async: false}).responseText;
return datiEx;
}
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
var eventi_gg = Array();
var calendar = jQuery('#calendar').fullCalendar({
firstDay: 1, // Start with Monday
header: {
left: 'prev,next today',
center: 'title',
right: false
},
buttonText: {
prev: '«',
next: '»',
prevYear: ' << ',
nextYear: ' >> ',
today: 'today'
},
monthNamesShort: [ "Gen", "Feb", "Mar", "Apr", "Mag", "Giu", "Lug", "Ago", "Sett", "Ott", "Nov", "Dic"],
monthNames: [ "Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"],
dayNames : ["Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato", "Domenica"],
dayNamesShort : ["Dom", "Lun", "Mar", "Mer", "Giov", "Ven", "Sab", "Dom"],
allDayText: "GIORNATA",
titleFormat:{month:"MMMM yyyy",week:"d [ yyyy]{ '—'d MMM[ MMM] yyyy}",day:"dddd d MMM yyyy"},
columnFormat:{month:"ddd",week:"dddd d/M",day:"dddd d MMMM"},
buttonText: {
prev: '«',
next: '»',
prevYear: ' << ',
nextYear: ' >> ',
today: 'oggi'
},
selectable: false,
editable: false,
loading: function(bool) {
if (bool) $('#loader_layer').show();
else $('#loader_layer').hide();
},
dayClick: function(start) {
jQuery(this).append("<div style='text-align:center; position:relative; top:50%;' id='load-calendar'><img src='images/loaders/loader10-1.gif' /></div>");
var oggi = date.getFullYear()+'-'+ ('0' + (date.getMonth()+1)).slice(-2)+'-'+('0' + date.getDate()).slice(-2);
data_click = jQuery.fullCalendar.formatDate(start, "yyyy-MM-dd HH:mm:ss");
data_click_short = jQuery.fullCalendar.formatDate(start, "yyyy-MM-dd");
giorno_click = jQuery.fullCalendar.formatDate(start, "dd/MM");
var numEventi = shortAjax("handler_fonderia", "check_event", "data="+data_click_short);
//console.log(data_click_short+'-'+oggi);
//&& data_click_short == oggi
if(numEventi == 0 ){
jQuery.alerts.dialogClass = 'alert-danger';
jQuery.alerts.okButton = 'Prosegui';
var deposito = shortAjax("handler_fonderia", "get_deposito", "id=");
jPrompt('Grammi:', '', 'Aggiunta Grammi al '+giorno_click, function(grammi) {
if(grammi){
grammi = parseFloat(grammi);
//jAlert(grammi+' - '+deposito);/*
if(grammi <= deposito){
jQuery.alerts.okButton = 'Confermo';
jQuery.alerts.cancelButton = 'No, Annulla';
jConfirm('Stai per inserire <b>'+grammi+'</b> grammi per il giorno <b>'+giorno_click+'</b>.<br>Questi dati non possono più essere modificati. Confermi?', 'CONFERMA GRAMMI', function(conferma){
if(conferma){
var creaEvento = shortAjax("handler_fonderia", "add_grammi", "grammi="+grammi+"&data="+data_click+"&day="+data_click_short);
if(creaEvento == "true"){
jQuery('#load-calendar').remove();
var resdeposito = parseFloat(jQuery('#depositoVal').val()-grammi);
var cumdeposito = parseFloat(jQuery('#depositoCum').val());
var totdeposito = parseFloat(cumdeposito+grammi);
jQuery('#totDeposito').val('Deposito: '+resdeposito.toFixed(1)+' gr.');
jQuery('#totVenduto').val('Venduto: '+totdeposito.toFixed(1)+' gr.');
calendar.fullCalendar('renderEvent', {
title: grammi + " gr.",
start: start
}, true);
}
}
});
}else{
jQuery('#load-calendar').remove();
jQuery.alerts.okButton = 'OK';
jAlert('I grammi che vuoi inserire sono superiori al deposito.<br>Richiedere un nuovo deposito o inserire una grammatura inferiore.', 'Errore');
}
}jQuery('#load-calendar').remove();
});
}else if(numEventi == 0 && data_click_short < oggi){
jQuery('#load-calendar').remove();
jQuery.jGrowl("E' possibile inserire i grammi solo nel giorno corrente.", {header: '<span style="color:red; font-size:12px;">Attenzione</span>', life:8000});
}
},
editable: false,
events:
<?php
$get_dati_calendar = mysql_query("SELECT * FROM calendario_fonderia WHERE user_id = $user_selected ");
$eventi = '[';
while ($calendar = mysql_fetch_array($get_dati_calendar)) {
$coloring = ($calendar['eur_gr'] != '') ? ", className: 'fc-event-done'" : '';
$dati_cal = ($calendar['eur_gr'] != '') ? $calendar['grammi'].' gr.\n'.$calendar['eur_gr'].' €/gr' : $calendar['grammi'].' gr.' ;
$eventi .= "{ title: '".$dati_cal."', start: new Date('".$calendar['data']."'), allDay: true ".$coloring." },";
}
echo ($eventi != '[') ? substr($eventi, 0, -1)."]\n" : "[]\n";
?>
});
function effectFadeIn() {
jQuery('#ptDeposito').fadeOut(500).fadeIn(500, effectFadeOut());
}
function effectFadeOut() {
jQuery('#ptDeposito').fadeIn(500).fadeOut(500, effectFadeIn());
}
<?= $effect_on ?>
});
Event gets written on the DB and everything works fine on that side.
Unfortunately I can't give you a link for this. I'll try to JSfiddle it.
EDIT
I tried to see if the problem was the PHP echoing so I tried writing directly the event in JS like this:
events: [{ title : 'A',
start : new Date('2013-07-09 00:00:00'),
allDay : true, className: 'fc-event-done' }]
And it doesn't work, therefore the issue must be something else...
Look firefox error console. $user_selected nis not defined, php sent warning and sql error and break json code. Remember add json headers. And remember:
events:[,className: 'fc-event-done' ...
Is not correct, you need objects not arrays:
events: {className:'foo', etc...
Make an array in while and show with join(',') for correct concatenation.
Try it:
events:
<?php
$user_selected = 1; // ???
$get_dati_calendar = mysql_query("SELECT * FROM calendario_fonderia WHERE user_id = $user_selected ");
$data = array();
while ($calendar = mysql_fetch_array($get_dati_calendar)) {
$data[] = "{
title : '".(($calendar['eur_gr']) ? $calendar['grammi'].' gr.\n'.$calendar['eur_gr'].' €/gr' : $calendar['grammi'].' gr.')."',
start : new Date('".$calendar['data']."'),
allDay : true
".($calendar['eur_gr'] ? ", className: 'fc-event-done'" : "")."
}";
}
echo implode(',' $data);
?>
}
Or change for an array:
echo '['.implode(',' $data).']';
I'v logged in FF console new Date('2013-07-09 00:00:00') and get this error Date {Invalid Date}. If you try convert your date to ISO 8601 format, something like this 2013-07-09T19:10:00-04:00, all should work fine.
UPD: why you try not return response in json format from server side?
Try to load data in this datetime format "yyyy-MM-dd HH:mm:ss" it helps me. I'm using FullCaneldar in ASP.Net MVC C# project...