I need to implement an add events feature on google agenda through my website. The idea is:
-
User enters the page and views the calendar, such as fullCalendar or another.
-
User clicks the day you want to create the event. Adds the event data to a popup form.
-
When saving, the code should link this event to my gmail account, making it available on google calendar.
I'm trying to assemble the parts of the code. I know there's google calendar documentation, but well it's complicated. Would you like something straight to the point, someone who already did or know how to enlighten this idea?
Part of the code:
<?php
include ('GoogleCalendarWrapper.php');
$gc = new GoogleCalendarWrapper("[email protected]", "senha");
$gc->feed_url = "http://www.google.com/calendar/feeds/untiuro1rs%40group.calendar.google.com/private-6a7151779f99b/basic";
//specify this, if you want to work with not-default calendar (check this: http://code.google.com/apis/gdata/calendar.html#get_feed)
//Função para tratar data que vem com padrão PT-BR pelo jQuery
function formatar_data_contrario($d) {
$d1 = explode("/", $d); return $d1[2]."-".$d1[1]."-".$d1[0];
}
// Receber os dados via POST
$titulo = $_POST['agenda_evento'];
$conteudo = $_POST['agenda_descricao'];
$local = $_POST['agenda_local'];
$dia_inicio = formatar_data_contrario($_POST['agenda_d_inicial']);
$dia_fim = formatar_data_contrario($_POST['agenda_d_final']);
$hora_inicio = $_POST['agenda_h_inicial'].":00";
$hora_fim = $_POST['agenda_h_final'].":00";
$s = array();
$s["title"] = "$titulo";
$s["content"] = "$conteudo";
$s["where"] = "$local";
$s["startDay"] = "$dia_inicio";
$s["startTime"] = "$hora_inicio";
$s["endDay"] = "$dia_fim";
$s["endTime"] = "$hora_fim";
if($gc->add_event($s))
echo "Enviado com sucesso!";
else
echo "Não enviou!";
?>
When I put it this way, the GoogleCalendarWrapper
class is not recognized.