Code:
<?php
/************************************************************************/
/* NuCalendar */
/* =========================== */
/* */
/* Copyright (c) 2003 by Bill Smith */
/* http://www.vettesofthetropics.com */
/* */
/* Based on Web Calendar */
/* Copyright (c) 2001 by Proverbs, LLC */
/* http://www.proverbs.biz */
/* */
/* 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. */
/************************************************************************/
/*
* ©2001 Proverbs, LLC. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it withthe following stipulations:
* Changes or modifications must retain all Copyright statements, including, but not limited to the Copyright statement
* and Proverbs, LLC homepage link provided at the bottom of this page.
*/
function PrintEventLink($op, $month, $day, $year, $row, $text)
{
return "<a href=modules.php?name=NuCalendar&op=".$op."&month=".$month."&day=".$day."&year=".$year."&eventid=".$row[id].">".$text."</a>";
}
function PrintShortEvent($myrow, $month, $day, $year)
{
return PrintEventLink("ShowEvent", $month, $day, $year, $myrow, $myrow[title]);
}
function PrintEvent($myrow, $month, $day, $year, $printtitlelink = 0)
{
global $bgcolor3, $bgcolor4, $dbi, $user_prefix;
$content = "";
$content .= "<hr>";
$content .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
$content .= "<tr>";
$content .= "<td width=\"150\" valign=\"top\" bgcolor=\"" . $bgcolor4 ."\">"._VIEW_DAY_EVENT."</td>";
$content .= "<td width=\"2%\" bgcolor=\"".$bgcolor4."\"> </td>";
$content .= "<td width=\"80%\" valign=\"top\" bgcolor=\"".$bgcolor4."\">";
if ($printtitlelink) {
$content .= "<b>" . PrintShortEvent($myrow, $month, $day, $year) . "</b>";
} else {
$content .= $myrow[title];
}
$content .= "</td>";
$content .= "</tr><tr>";
$content .= "<td width=\"150\" valign=\"top\" bgcolor=\"".$bgcolor3."\">"._VIEW_DAY_START_TIME."</td>";
$content .= "<td width=\"2%\" bgcolor=\"".$bgcolor3."\"> </td>";
$content .= "<td width=\"80%\" valign=\"top\" bgcolor=\"".$bgcolor3."\">";
$content .= MilitaryTo12Hour($myrow[starttime]);
$content .= "</td></tr><tr>";
$content .= "<td width=\"150\" valign=\"top\" bgcolor=\"".$bgcolor4."\">"._VIEW_DAY_DURATION."</td>";
$content .= "<td width=\"2%\" bgcolor=\"".$bgcolor4."\"> </td>";
$content .= "<td width=\"80%\" valign=\"top\" bgcolor=\"".$bgcolor4."\">";
$content .= MilitaryTo12HourDuration($myrow[duration]) . "</td>";
$content .= "</tr><tr>";
$content .= "<td width=\"150\" valign=\"top\" bgcolor=\"".$bgcolor3."\">"._VIEW_DAY_LOCATION."</td>";
$content .= "<td width=\"2%\" bgcolor=\"".$bgcolor3."\"> </td>";
$content .= "<td width=\"80%\" valign=\"top\" bgcolor=\"".$bgcolor3."\">".$myrow[location]."</td>";
$content .= "</tr>";
if ($printdate == 1) {
$content .= "<tr>";
$content .= "<td width=\"150\" valign=\"top\">"._VIEW_DAY_DATE."</td>";
$content .= "<td width=\"2%\"> </td>";
$content .= "<td width=\"80%\" valign=\"top\">".$myrow[onetime_date]."</td></tr>";
}
$content .= "<tr>";
$content .= "<td width=\"150\" valign=\"top\" bgcolor=\"".$bgcolor4."\">"._VIEW_DAY_CATEGORY."</td>";
$content .= "<td width=\"2%\" bgcolor=\"".$bgcolor4."\"> </td>";
$content .= "<td width=\"80%\" valign=\"top\" bgcolor=\"".$bgcolor4."\">";
$catresult = sql_query("SELECT * FROM ".$user_prefix."_nucal_categories WHERE id=".$myrow[categoryid], $dbi);
if ($catresult) {
$catrow = sql_fetch_array($catresult, $dbi);
$content .= $catrow[title]."<br><br>".$catrow[description];
} else {
$content .= _VIEW_DAY_NO_CAT;
}
$content .= "</td></tr><tr>";
$content .= "<td width=\"150\" valign=\"top\" bgcolor=\"".$bgcolor3."\">"._VIEW_DAY_OTHER_INFO."</td>";
$content .= "<td width=\"2%\" bgcolor=\"".$bgcolor3."\"> </td>";
$content .= "<td width=\"80%\" valign=\"top\" bgcolor=\"".$bgcolor3."\">".$myrow[fulldesc]." </td>";
$content .= "</tr></table>";
return $content;
}
function PrintEventFooter($op, $month, $day, $year, $eventid, $showprintlink, $printop, $linkup)
{
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
echo "<tr>";
echo "<td width=\"17%\">";
PrintSubmitEventLink();
echo "</td>";
echo "<td width=\"17%\"> </td>";
echo "<td width=\"16%\">";
if ($showprintlink == 1) {
echo "<a href=\"#\" onClick=window.open(\"modules.php?name=NuCalendar&op=".$printop."&month=".$month."&day=".$day."&year=".$year."&printing=1&eventid=".$eventid."\",\"ec_window_11190874\",\"width=800,height=600,resizable=yes,scrollbars=1,toolbar=1\")>"._PRINTER_FRIENDLY_VERSION."</a>";
}
echo "</td>";
echo "<td width=\"17%\" align=\"right\">";
echo " </td>";
echo "<td width=\"17%\" align=\"right\">";
echo "<a href=modules.php?name=NuCalendar&op=".$op."&month=".$month."&day=".$day."&year=".$year.">".$linkup."</a>";
echo "</td>";
echo "</tr>";
echo "</table>";
}
function PrintSubmitEventLink()
{
global $user_prefix, $dbi;
$result = sql_query("SELECT * FROM ".$user_prefix."_nucal_options WHERE 1", $dbi);
$row = sql_fetch_array($result, $dbi);
if ($row[allow_user_submitted_events] == 1) {
echo "<a href=modules.php?name=NuCalendar&op=SubmitEvent>"._SUBMIT_EVENT_INFO."</a>";
}
}
function ShowEventForm($formaction, $mydatarow, $eventid, $formsubmitbutton, $onetimeevent = "", $month="", $day="", $year="", $formactiondelete="", $showapproved = 0)
{
if (!isset($month) || $month == "" || $month > 12 || $month < 1)
{
$month = date("m");
}
if (!isset($year) || $year == "" || $year < 1972 || $year > 2036)
{
$year = date("Y");
}
if (!isset($day) || $day == "")
{
$day = date("d");
}
global $user_prefix, $dbi, $AllowableHTML;
?>
<form action="<?php echo $formaction; ?>" method="POST">
<table width="100%" cellspacing=0 border=0 cellpadding=0>
<tr align="left">
<td width="30%"></td>
<td width="10"></td>
<td width="70%"></td>
</tr>
<tr align="left">
<td width="30%"><?php echo _VIEW_DAY_EVENT; ?></td>
<td width="10"></td>
<td width="70%"><input type="text" name="title" value="<?php echo $mydatarow[title]; ?>" size=30></td>
</tr>
<tr align="left">
<td width="30%"><?php echo _VIEW_DAY_LOCATION; ?></td>
<td width="10"></td>
<td width="70%"><input type="text" name="location" value="<?php
echo $mydatarow[location]; ?>" size=30></td>
</tr>
<tr align="left">
<td width="30%" valign="top"><?php echo _VIEW_DAY_OTHER_INFO; ?></td>
<td width="10"></td>
<td width="70%"><textarea rows="7" name="fulldesc" cols="45"><?php echo $mydatarow[fulldesc]; ?></textarea>
<?php
echo "<br><font class=\"content\">"._ALLOWEDHTML."<br>";
while (list($key,) = each($AllowableHTML)) echo " <".$key.">";
?>
</tr>
</td>
<tr align="left">
<td width="30%"><?php echo _VIEW_DAY_START_TIME; ?>:</td>
<td width="10"></td>
<td width="70%"><?php
$hour = MilitaryTimeGetHour($mydatarow[starttime]);
$min = MilitaryTimeGetMinute($mydatarow[starttime]);
$pm = MilitaryTimeIsPM($mydatarow[starttime]);
echo "<select name=\"start_hour\">";
for ($x = 1; $x <= 12; $x++) {
echo "<option value=\"". $x . "\"";
if ($x == $hour) {
echo " selected";
}
if ($x == 12 && $hour == 0)
echo " selected";
echo ">" . $x . "</option>";
}
echo "</select>";
echo ":";
|