*
* http://www.radix.net/~cknudsen *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id$ */
$phpgw_info["flags"] = array("currentapp" => "calendar", "noheader" => True, "nonavbar" => True, "enable_calendar_class" => True, "enable_nextmatchs_class" => True);
include("../header.inc.php");
if($REQUEST_METHOD == "POST") {
}
$cal_info = new calendar_item;
for(reset($HTTP_POST_VARS);$key=key($HTTP_POST_VARS);next($HTTP_POST_VARS)) {
$data = $HTTP_POST_VARS[$key];
$cal_info->set($key,$data);
}
$phpgw->calendar->add($cal_info,$cal_info->id);
// Input time format "2359"
// function add_duration($time, $duration)
// {
// $hour = (int)($time / 10000);
// $min = $time % 100;
// $minutes = $hour * 60 + $min + $duration;
// $h = $minutes / 60;
// $m = $minutes % 60;
// $ret = sprintf ("%d%02d",$h,$m);
// //echo "add_duration ( $time, $duration ) = $ret
";
// return $ret;
// }
// // check to see if two events overlap
// function times_overlap($time1, $duration1, $time2, $duration2)
// {
// //echo "times_overlap ( $time1, $duration1, $time2, $duration2 )
";
// $hour1 = (int) ($time1 / 100);
// $min1 = $time1 % 100;
// $hour2 = (int) ($time2 / 100);
// $min2 = $time2 % 100;
// // convert to minutes since midnight
// $tmins1start = $hour1 * 60 + $min1;
// $tmins1end = $tmins1start + $duration1;
// $tmins2start = $hour2 * 60 + $min2;
// $tmins2end = $tmins2start + $duration2;
// //echo "tmins1start=$tmins1start, tmins1end=$tmins1end, tmins2start="
// // . "$tmins2start, tmins2end=$tmins2end
";
//
// if ($tmins1start >= $tmins2start && $tmins1start <= $tmins2end)
// return true;
// if ($tmins1end >= $tmins2start && $tmins1end <= $tmins2end)
// return true;
// if ($tmins2start >= $tmins1start && $tmins2start <= $tmins1end)
// return true;
// if ($tmins2end >= $tmins1start && $tmins2end <= $tmins1end)
// return true;
// return false;
// }
//
// $phpgw->db->lock(array('webcal_entry','webcal_entry_user','webcal_entry_groups',
// 'webcal_entry_repeats'));
//
// // first check for any schedule conflicts
// if (strlen($hour) > 0) {
// $date = mktime(0,0,0,$month,$day,$year);
// if ($phpgw_info["user"]["preferences"]["common"]["timeformat"] == "12") {
// $hour %= 12;
// if ($ampm == "pm")
// $hour += 12;
// }
//
// $sql = "SELECT webcal_entry_user.cal_login, webcal_entry.cal_time," .
// "webcal_entry.cal_duration, webcal_entry.cal_name, " .
// "webcal_entry.cal_id, webcal_entry.cal_access " .
// "FROM webcal_entry, webcal_entry_user " .
// "WHERE webcal_entry.cal_id = webcal_entry_user.cal_id " .
// "AND webcal_entry.cal_date = " . date("Ymd", $date) . " AND ( ";
//
// for ($i = 0; $i < count($participants); $i++) {
// if ($i) $sql .= " OR ";
// $sql .= " webcal_entry_user.cal_login = '" . $participants[$i] . "'";
// }
// $sql .= " )";
//
// $phpgw->db->query($sql);
// $time1 = sprintf("%d:%02d", $hour, $minute);
// $duration1 = sprintf("%d", $duration);
//
// while ($phpgw->db->next_record()) {
// // see if either event overlaps one another
// if ($phpgw->db->f(4) != $id) {
// $time2 = $phpgw->db->f(1);
// $duration2 = $phpgw->db->f(2);
// if (times_overlap($time1, $duration1, $time2, $duration2)) {
// $overlap .= "