Advertisement
nizamsys

View

Oct 20th, 2014
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.63 KB | None | 0 0
  1.                                     <?php foreach($events->result() as $entry):
  2.                                           $jsonevents = array(
  3.                                             'id' => $entry->eventID,
  4.                                             'title' => $entry->eventTitle,
  5.                                             'start' => $entry->startDate,
  6.                                             'allDay' => false,
  7.                                             'end' => $entry->endDate
  8.                                         );
  9.                                         echo json_encode($jsonevents);
  10.                                        
  11.                                        
  12.                                     endforeach; ?>
  13.  
  14. <script type="text/javascript">
  15.    
  16. //Fullcalendar        
  17.        
  18.         $('#calendar').fullCalendar({
  19.                 firstDay:'1',
  20.                 weekMode:'liquid',
  21.                 aspectRatio: '1.5',
  22.                 theme:true,
  23.                 selectable:true,
  24.                 editable:true,
  25.                 draggable:true,
  26.                 droppable:true,
  27.                 timeFormat:'H:mm',
  28.                 axisFormat:'H:mm',
  29.                 columnFormat:{
  30.                     month: 'ddd',    // Mon
  31.                     week: 'ddd dS', // Mon 9/7
  32.                     day: 'dddd dS MMMM'  // Monday 9/7
  33.                 },
  34.                 titleFormat:{
  35.                     month: 'MMMM yyyy',                             // September 2009
  36.                     week: "MMM d[ yyyy]{ 'to'[ MMM] d, yyyy}", // Sep 7 - 13 2009
  37.                     day: 'ddd, MMMM d, yyyy'                  // Tuesday, Sep 8, 2009
  38.                 },
  39.                 allDayText:'All Day',
  40.                 header:{
  41.                     left:   'prev title next, today',
  42.                     center: '',
  43.                     right:  'agendaWeek,agendaDay,month'
  44.                     },
  45.                
  46.                 eventSources: [
  47.  
  48.                         // your event source
  49.            
  50.                     {
  51.                           url: 'http://ravecity.tv/feed/json',
  52.                           className:'calendar_magenta'
  53.                         },
  54.                         {
  55.                             url: 'http://www.google.com/calendar/feeds/usa__en@holiday.calendar.google.com/public/basic',
  56.                             className: 'calendar_navy'
  57.                         }
  58.                
  59.                
  60.                     ],
  61.                
  62.                 drop: function(date, allDay) { // this function is called when something is dropped
  63.            
  64.                 // retrieve the dropped element's stored Event Object
  65.                 var originalEventObject = $(this).data('eventObject');
  66.                
  67.                 // we need to copy it, so that multiple events don't have a reference to the same object
  68.                 var copiedEventObject = $.extend({}, originalEventObject);
  69.                
  70.                 // assign it the date that was reported
  71.                 copiedEventObject.start = date;
  72.                 copiedEventObject.allDay = allDay;
  73.                
  74.                 // render the event on the calendar
  75.                 // the last `true` argument determines if the event "sticks" (http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/)
  76.                 $('#calendar').fullCalendar('renderEvent', copiedEventObject, true);
  77.                
  78.                 // is the "remove after drop" checkbox checked?
  79.                 if ($('#drop-remove').is(':checked')) {
  80.                     // if so, remove the element from the "Draggable Events" list
  81.                     $(this).remove();
  82.                 }
  83.                
  84.             }
  85.                
  86.             });
  87.        
  88.         $('ul#calendar_drag_list li a').each(function() {
  89.        
  90.             // create an Event Object (http://arshaw.com/fullcalendar/docs/event_data/Event_Object/)
  91.             // it doesn't need to have a start or end
  92.             var eventObject = {
  93.                 title: $.trim($(this).text()), // use the element's text as the event title
  94.                 className: 'calendar_black'
  95.             };
  96.            
  97.             // store the Event Object in the DOM element so we can get to it later
  98.             $(this).data('eventObject', eventObject);
  99.            
  100.             // make the event draggable using jQuery UI
  101.             $(this).draggable({
  102.                 zIndex: 999,
  103.                 revert: true,      // will cause the event to go back to its
  104.                 revertDuration: 5  //  original position after the drag
  105.             });
  106.            
  107.         });
  108.  
  109. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement