Jump to content

display and edit events using fullcalendar event calendar


mythri

Recommended Posts

Hello ,

 

I am trying to display my planned events in calendar using full calendar json, jquery. But its not getting displayed, but its getting inserted. I am not very good at jquery or json. please somebody help me in this...

 

here is my code

 

in my calendar.php (display page)

 

<div class="span8">
                       <div class="w-box w-box-green">
                            <div class="w-box-header"></div>
                            <div class="w-box-content">
                                <div id='calendar_json'></div>
                            </div>
                            <div class="w-box-footer">
                                <p class="f-text">JSON events fetched from a script</p>
                            </div>
                        </div>
                    </div>  
                </div>

and in my calendar.js

 

 jsonEvents: function() {
            if($('#calendar_json').length) {
                $('#calendar_json').fullCalendar({
                    header: {
                        left: 'month,agendaWeek,agendaDay',
                        center: 'title',
                        right: 'prev,next'
                    },
                    buttonText: {
                        prev: '<i class="icon-chevron-left icon-white cal_prev" />',
                        next: '<i class="icon-chevron-right icon-white cal_next" />'
                    },
                    editable: true,
                    firstDay: 1, // 0 - Sunday, 1 - Monday
                    events: "php_helpers/json-events.php",
                    eventDrop: function(event, delta) {
                        alert(event.title + ' was moved ' + delta + ' days\n' +
                            '(should probably update your database)');
                    }
                });
            }

json-events.php

 

 

include("connect.php");
$year = date('Y');
$month = date('m');


//$db=public_db_connect();
$year = date('Y');
$month = date('m');


$command = "SELECT * FROM planner";


$result = mysql_query($command) or die (mysql_error());


while ($row = mysql_fetch_array($result)) {
echo "hi";
    //$start = date("D, j M Y G:i:s T", strtotime($row['start']));
    //$end = date("D, j M Y G:i:s T", strtotime($row['end_time'])); 
$start = date("Y-m-d", strtotime($row['from_time']));
//$start = "$year-$month-20";
    $myid =  $row['plan_id'];
$eventsArray['plan_id'] =  (int)trim($myid); 
    //$eventsArray['title'] = $row['title'];  
$title = $row['company']; 
//$title = $row['title']; 
//echo $title;
$eventsArray['company'] = $title; 
    $eventsArray['from_time'] = $start;
$eventsArray['to_time'] = $start;
    $eventsArray['url'] = "edit_calendar.php?calendarid=".$row['plan_id'];
    // $eventsArray['end'] = $end;
    // $eventsArray['allDay'] = false;
    $events[] = $eventsArray;
}


echo json_encode($events);

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.