Home Forums Porto Admin Template Page: Calender

This topic contains 1 reply, has 2 voices, and was last updated by  Support2 1 week ago. This post has been viewed 37 times

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #10028982

    mjejun
    Participant

    Hi,

    I wanted to use Page: Calendar – https://snag.gy/ji0NwW.jpg

    Questions:

    1. How do I set the values for 1? Where do I set the name; ie 4AM Meeting etc?
    2. When user drag the button and tag the calendar, is it possible for us to pull the value and save in the database? How may I achieve that?


    #10028989

    Support2
    Keymaster

    Hello,

    1) On the file “js/examples/examples.calendar.js”:

    2) Still on the file “js/examples/examples.calendar.js” you can do an AJAX request to send the information to your database. Use the “drop” method callback:

    drop: function(date, allDay) { // this function is called when something is dropped
    	var $externalEvent = $(this);
    	// retrieve the dropped element's stored Event Object
    	var originalEventObject = $externalEvent.data('eventObject');
    
    	// we need to copy it, so that multiple events don't have a reference to the same object
    	var copiedEventObject = $.extend({}, originalEventObject);
    
    	// assign it the date that was reported
    	copiedEventObject.start = date;
    	copiedEventObject.allDay = allDay;
    	copiedEventObject.className = $externalEvent.attr('data-event-class');
    
    	// render the event on the calendar
    	// the last true argument determines if the event "sticks" (http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/)
    	$('#calendar').fullCalendar('renderEvent', copiedEventObject, true);
    
    	// is the "remove after drop" checkbox checked?
    	if ($('#RemoveAfterDrop').is(':checked')) {
    		// if so, remove the element from the "Draggable Events" list
    		$(this).remove();
    	}
    
    	// AJAX TO ADD THE INFORMATION ON DATABASE
    	$.ajax({
    		url: 'path/to/file/example.php',
    		type: 'post',
    		data: {
    			param1: 'value1' // on the php file get this value with $_POST['param1'],
    			param2: 'value2' // on the php file get this value with $_POST['param2']
    		},
    	})
    	.done(function() {
    		console.log("success");
    	})
    	.fail(function() {
    		console.log("error");
    	})
    	.always(function() {
    		console.log("complete");
    	});
    
    },

    Hope it helps.

    Kind Regards,

    Rodrigo.


    • This reply was modified 1 week ago by  Support2.
Viewing 2 posts - 1 through 2 (of 2 total)