Page 1 of 1

Updating calendar

Posted: Thu Oct 04, 2012 6:48 pm
by shile
i was trying to make a script that will process sms message and if its content is with a specific month,day and time to update it to my calendar appointment and set it to occupied...this is how i started,i need help for the rest...i would appreciate any help guys...

Code: Select all

<?php
$webhook_secret = 'mysecret';

if ($_POST['secret'] !== $webhook_secret)
{
header('HTTP/1.1 403 Forbidden');
echo "Invalid webhook secret";
}
else
{
if ($_POST['event'] == 'incoming_message')
{
$content = $_POST['content'];
$from_number = $_POST['from_number'];
$phone_id = $_POST['phone_id'];
if($_POST['content']== 'October-4-2012-1700'){
=>i need here the code to now update the calendar appointment at october 4,2012,17:00 and set it to occupied<=
=>the code for incoming sms message is working i just need the rest for updating<=
}

}
}
This is a picture of the calendar.

Image

Re: Updating calendar with sms message

Posted: Thu Oct 04, 2012 9:36 pm
by Christopher
First look at PHP's DateTime class (http://us2.php.net/manual/en/book.datetime.php). Specifically the createFromFormat() method. That will make the date from $_POST useful. Then you can get the year, month, day, hour and minute to set in the calendar database.

Re: Updating calendar with sms message

Posted: Fri Oct 05, 2012 1:37 pm
by shile
this method requires php version 5.3 but my version on joomla is 5.2...but nevermind i will update it,but what to do next when i format my content to a date,how to set it to my calendar?

Re: Updating calendar with sms message

Posted: Fri Oct 05, 2012 6:24 pm
by Christopher
shile wrote:this method requires php version 5.3 but my version on joomla is 5.2...
Then use date_parse().

Re: Updating calendar

Posted: Sun Oct 07, 2012 6:18 am
by shile
i figured it out how to use the string in the content and format it to date,but now i need to use that information and update my calendar...any help guys or maybe you christopher?i need this to work...

Re: Updating calendar

Posted: Sun Oct 07, 2012 10:11 pm
by Christopher
Are you asking how to implement a calendar in Joomla?

Re: Updating calendar

Posted: Mon Oct 08, 2012 6:16 am
by shile
no,you misunderstood me apparently...i already implemented calendar in joomla,now i need to use the information in a string and throught a php script set for the specific date and time that the appointment is occupied as shown in the picture...

Re: Updating calendar

Posted: Mon Oct 08, 2012 9:36 am
by Christopher
shile wrote:i need to use the information in a string and throught a php script set for the specific date and time that the appointment is occupied as shown in the picture...
So the script will be given a date and time. You want the script to find if that appointment is occupied in the calendar data table? Or to set the appointment as occupied?

Re: Updating calendar

Posted: Mon Oct 08, 2012 11:43 am
by shile
i want to set the appointment as occupied...