#native_company# #native_desc#
#native_cta#

Easy Calendar Applications Page 5

By Mark Musone
on July 30, 2000

Note, one thing we are doing is allowing people to add events by clicking on and day
in the calendar. If there is an event scheduled, it prints out the title, and by clicking
on the title, it displays all of the events information.
to display an events information, we use the same technique as the above, but just pull up the
events for that one day, and print out all information.
viewevent.php3 consists of:

<?php

$stream=mcal_open("{/mstore}","musone","hi");

$events=mcal_list_events($stream,$year,$month,$day,$year,$month,$day);

for($x=0$x<count($events); $x++) {

    
$event=mcal_fetch_event($stream,$events[$x]);

    
$start=$event->start;

    
$end=$event->end;

    echo 
"Event: $event->id<br>";

    echo 
"Start: ";

    echo 
"$start->year";

    echo 
"$start->month";

    echo 
"$start->mday";

    echo 
"$start->hour";

    echo 
"$start->min";

    echo 
"$start->sec <br>";

    echo "End:";

    echo 
"$end->year";

    echo 
"$end->month";

    echo 
"$end->mday";

    echo 
"$end->hour";

    echo 
"$end->min";

    echo 
"$end->sec <br>";

    echo "Title: $event->title <br>";

    echo 
"Category: $event->category <br>";

    echo 
"Description: $event->description <br>";

}

?>

<a href="index.php3?month=<?php echo $month?>&year=<?php echo $year?>">Back</a>

To add an event, it’s just as simple, first we print out a form, addevent.php3:

<form action="addeventaction.php3">

<center>Adding event for <?php echo $month?>/<?php echo $day?>/<?php echo $year?></center><br>

Title:<input type="text" name="title"><br>

Category:<input type="text" name="category"><br>

Description<br>

<textarea cols=40 rows=10 name="description"></textarea><br>

<input type="hidden" name="year" value="<?php echo $year?>">

<input type="hidden" name="month" value="<?php echo $month?>">

<input type="hidden" name="day" value="<?php echo $day?>">

<input type="submit">

To do the actual adding of the event after the form is submitted,
we use a couple of new functions.
Every calendar stream has an internal event structure. This event
structure is used for storing and retreiving events.
So we simply set the internal event structure with the proper
information using the mcal_event_set functions.