Updating calendar

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
shile
Forum Newbie
Posts: 15
Joined: Thu Oct 04, 2012 6:45 pm

Updating calendar

Post 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
Last edited by shile on Sat Oct 06, 2012 8:11 am, edited 1 time in total.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Updating calendar with sms message

Post 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.
(#10850)
shile
Forum Newbie
Posts: 15
Joined: Thu Oct 04, 2012 6:45 pm

Re: Updating calendar with sms message

Post 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?
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Updating calendar with sms message

Post by Christopher »

shile wrote:this method requires php version 5.3 but my version on joomla is 5.2...
Then use date_parse().
(#10850)
shile
Forum Newbie
Posts: 15
Joined: Thu Oct 04, 2012 6:45 pm

Re: Updating calendar

Post 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...
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Updating calendar

Post by Christopher »

Are you asking how to implement a calendar in Joomla?
(#10850)
shile
Forum Newbie
Posts: 15
Joined: Thu Oct 04, 2012 6:45 pm

Re: Updating calendar

Post 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...
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Updating calendar

Post 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?
(#10850)
shile
Forum Newbie
Posts: 15
Joined: Thu Oct 04, 2012 6:45 pm

Re: Updating calendar

Post by shile »

i want to set the appointment as occupied...
Post Reply