<?php include_once($UTIL_DIR . "/events.php"); include_once($UTIL_DIR . "/notify.php"); if($ZEND_DIR != "") include_once($UTIL_DIR . "/googlecalendar.php"); $events = new Events($DATA_DIR . "/calendar.xml"); if(!$date) $date = time() - (date("N", time()) - 1) * 24 * 60 * 60; else $date = $date - (date("N", $date) - 1) * 24 * 60 * 60; //echo $date; if($action=="addentry") { $title = stripslashes($title); $description = stripslashes($description); $time = strtotime($txtdate . " " . $txttimefrom . ":00"); if($time !== FALSE) { $duration = strtotime($txtdate . " " . $txttimeto . ":00") - $time; $eid = time(); $event = new Event($eid, $title, $time, $duration, $description, $current_user->uid); $events->add($event); $events->write(); if($ZEND_DIR != "") googleCalendarEvent($event); if($DOKUWIKI_CALENDAR != "") { $file = $DOKUWIKI_CALENDAR; $fp = fopen($file, "w"); fprintf($fp, "=====DIEs calendar=====\n"); fprintf($fp, "Do not edit this file - it is automatically generated by the ExecutionRoom CMS.\n\n"); fprintf($fp, "====Events====\n"); foreach($events->events as $event) { fprintf($fp, " * %s - %s %s: %s\n", date("j.n.Y G:i", $event->starttime), date("j.n.Y G:i", $event->starttime + $event->duration), $event->title, $event->description); } fclose($fp); } notify("calendar", "New calendar entry:\n" . $title . "\n" . date("r", $time) . "\n" . $description . "\n" . $FORUM_URL . "/?mode=calendar&date=" . $time); ?> <meta http-equiv="refresh" content="0; URL=?mode=calendar&date=<?php echo $time; ?>" /> <?php } else { echo "<div class=\"error\">ERROR: Date is not in the correct format! It was NOT posted. Please try again.</div>\n"; } } if($action=="edit") { /* $event = $events->getEvent($eid); $event->duration += 2000; $events->write(); */ } ?> <p style="text-align: center;"> <a href="?mode=calendar&date=<?php echo $date - 7 * 24 * 60 * 60 ?>">[<]</a> <a href="?mode=calendar&date=<?php echo $date - 31 * 24 * 60 * 60 ?>">[<<]</a> <?php echo date("F Y", $date); ?> <a href="?mode=calendar&date=<?php echo $date + 31 * 24 * 60 * 60 ?>">[>>]</a> <a href="?mode=calendar&date=<?php echo $date + 7 * 24 * 60 * 60 ?>">[>]</a><br/> <a href="?mode=calendar">[Today]</a><br/> </p> <?php if($client_is_mobile_device) { for($day = 0; $day < 7; $day++) { echo " <div class=\"mobilecalentry\">\n"; echo " <div class=\"mobilecalheader\">\n"; $t = $date + $day * 24 * 60 * 60; echo " " . date("l j/n", $t) . "\n"; ?> <a style="text-decoration: none;" href="?mode=calendar&date=<?php echo $date; ?>&adddate=<?php echo $t; ?>&action=add">[+]</a> <?php echo " </div>\n"; $t = strtotime(date("F j Y", $date + $day * 24 * 60 * 60)); echo " <div class=\"mobilecalcontent\""; if($t == strtotime(date("F j Y", time()))) echo " style=\"background: #113;\""; elseif($day > 4) echo " style=\"background: #311;\""; echo ">\n"; $events->show($t, $t + 24 * 60 * 60); echo " </div>\n"; echo " </div>\n"; } } else { ?> <table class="week"> <tr class="day"> <?php for($day = 0; $day < 7; $day++) { echo " <td class=\"header\">\n"; $t = $date + $day * 24 * 60 * 60; echo " " . date("l j/n", $t) . "\n"; echo " </td>\n"; } ?> </tr> <tr class="day"> <?php for($day = 0; $day < 7; $day++) { $t = strtotime(date("F j Y", $date + $day * 24 * 60 * 60)); echo " <td class=\"content\""; if($t == strtotime(date("F j Y", time()))) echo " style=\"background: #113;\""; elseif($day > 4) echo " style=\"background: #311;\""; echo ">\n"; ?> <a class="button" href="?mode=calendar&date=<?php echo $date; ?>&adddate=<?php echo $t; ?>&action=add">Add</a> <?php $events->show($t, $t + 24 * 60 * 60); echo " </td>\n"; } ?> </tr> </table> <?php } ?> <?php if($adddate != "") { ?> <form method="post" action="?mode=calendar&action=addentry"> Title: <input name="title" value=""><br/> Desription: <textarea name="description"></textarea><br/> Date: <input name="txtdate" value="<?php echo date("F j Y", $adddate); ?>"><br/> From-Time: <input name="txttimefrom" value="17:00"><br/> To-Time: <input name="txttimeto" value="20:00"><br/> <br/> <button type="submit">Add</button> </form> <?php } ?>