модуль Calendar

Alex2003

Новичок
модуль Calendar

Вопрос:

Прога юзает функции модуля.(JDDayOfWeek, например)
У меня дома - все ОК. На работе - не подключен модуль...

Вижу два решения:
1 - прикомпилить модуль (Без понятия как сделать)
2 - написать аналоги всех фанкций самому (то же самое)

Кто поможет? Или есть свой вариант?
 

123av

Новичок
calendar.php
------------------------
<html>
<head>
<title></title>
<base target="main">
<STYLE type = "text/css">
select { FONT-FAMILY: Verdana;}
input { FONT-FAMILY: Verdana;}
</style>
</head>
<body topmargin="10" leftmargin="0" marginheight="10" marginwidth="0" bgcolor="#FFFFFF" link="#0000FF" vlink="#0000FF" alink="#0000FF">
<?
include "../config.php";

if (!$action || $action == "qj") {
?>
<table border=0 cellpadding=5 cellspacing=1 bgcolor="#CCCCCC" align=center width=350>
<?
if (!$year) $year = date("Y");
if (!$month) $month = date("n");


$fd = mktime (0,0,0,$month,1,$year);
$cm = mktime (0,0,0,$month,1,$year);
$cd = mktime (0,0,0,date("n"),date("d"),date("Y"));
$i = 1;

?>
<tr>
<td colspan=7 bgcolor="#CCCCCC" align=center><font face="<? echo $font_face;?>" size="2"><A HREF="calendar.php">Calendar</A></font> : <font face="<? echo $font_face;?>" size="2"><? echo (date("F, Y",$cm))?></font></td>
</tr>
<tr>
<td width=50 bgcolor="#F4F4F4" align=center><font face="<? echo $font_face;?>" size="2">Sun</font></td>
<td width=50 bgcolor="#F4F4F4" align=center><font face="<? echo $font_face;?>" size="2">Mon</font></td>
<td width=50 bgcolor="#F4F4F4" align=center><font face="<? echo $font_face;?>" size="2">Tue</font></td>
<td width=50 bgcolor="#F4F4F4" align=center><font face="<? echo $font_face;?>" size="2">Wed</font></td>
<td width=50 bgcolor="#F4F4F4" align=center><font face="<? echo $font_face;?>" size="2">Thu</font></td>
<td width=50 bgcolor="#F4F4F4" align=center><font face="<? echo $font_face;?>" size="2">Fri</font></td>
<td width=50 bgcolor="#F4F4F4" align=center><font face="<? echo $font_face;?>" size="2">Sat</font></td>
</tr>
<?

while (date("n",$fd) == date("n",$cm)) {

if ($i == 1) echo "<tr>";

if (date("D",$cm) == "Sun" && date("n",$fd) == date("n",$cm)) {
echo "<td";
if ($cd > ($cm - 86400) && $cd < ($cm + 86400)) {echo " bgcolor=\"#FFECEC\"";} else {echo " bgcolor=\"white\"";}
echo " align=\"center\"><A HREF=\"calendar.php?action=view&dt=".$cm."\"><font face=\"$font_face\" size=\"2\">".(date ("j",$cm)."</font></A></td>");
$cm = $cm + 86400;$i++;
} else {echo "<td align=\"center\" bgcolor=\"white\">&nbsp;</td>";}

if (date("D",$cm) == "Mon" && date("n",$fd) == date("n",$cm)) {
echo "<td";
if ($cd > ($cm - 86400) && $cd < ($cm + 86400)) {echo " bgcolor=\"#FFECEC\"";} else {echo " bgcolor=\"white\"";}
echo " align=\"center\"><A HREF=\"calendar.php?action=view&dt=".$cm."\"><font face=\"$font_face\" size=\"2\">".(date ("j",$cm)."</font></A></td>");
$cm = $cm + 86400;$i++;
} else {echo "<td align=\"center\" bgcolor=\"white\">&nbsp;</td>";}

if (date("D",$cm) == "Tue" && date("n",$fd) == date("n",$cm)) {
echo "<td";
if ($cd > ($cm - 86400) && $cd < ($cm + 86400)) {echo " bgcolor=\"#FFECEC\"";} else {echo " bgcolor=\"white\"";}
echo " align=\"center\"><A HREF=\"calendar.php?action=view&dt=".$cm."\"><font face=\"$font_face\" size=\"2\">".(date ("j",$cm)."</font></A></td>");
$cm = $cm + 86400;$i++;
} else {echo "<td align=\"center\" bgcolor=\"white\">&nbsp;</td>";}

if (date("D",$cm) == "Wed" && date("n",$fd) == date("n",$cm)) {
echo "<td";
if ($cd > ($cm - 86400) && $cd < ($cm + 86400)) {echo " bgcolor=\"#FFECEC\"";} else {echo " bgcolor=\"white\"";}
echo " align=\"center\"><A HREF=\"calendar.php?action=view&dt=".$cm."\"><font face=\"$font_face\" size=\"2\">".(date ("j",$cm)."</font></A></td>");
$cm = $cm + 86400;$i++;
} else {echo "<td align=\"center\" bgcolor=\"white\">&nbsp;</td>";}

if (date("D",$cm) == "Thu" && date("n",$fd) == date("n",$cm)) {
echo "<td";
if ($cd > ($cm - 86400) && $cd < ($cm + 86400)) {echo " bgcolor=\"#FFECEC\"";} else {echo " bgcolor=\"white\"";}
echo " align=\"center\"><A HREF=\"calendar.php?action=view&dt=".$cm."\"><font face=\"$font_face\" size=\"2\">".(date ("j",$cm)."</font></A></td>");
$cm = $cm + 86400;$i++;
} else {echo "<td align=\"center\" bgcolor=\"white\">&nbsp;</td>";}

if (date("D",$cm) == "Fri" && date("n",$fd) == date("n",$cm)) {
echo "<td";
if ($cd > ($cm - 86400) && $cd < ($cm + 86400)) {echo " bgcolor=\"#FFECEC\"";} else {echo " bgcolor=\"white\"";}
echo " align=\"center\"><A HREF=\"calendar.php?action=view&dt=".$cm."\"><font face=\"$font_face\" size=\"2\">".(date ("j",$cm)."</font></A></td>");
$cm = $cm + 86400;$i++;
} else {echo "<td align=\"center\" bgcolor=\"white\">&nbsp;</td>";}

if (date("D",$cm) == "Sat" && date("n",$fd) == date("n",$cm)) {
echo "<td";
if ($cd > ($cm - 86400) && $cd < ($cm + 86400)) {echo " bgcolor=\"#FFECEC\"";} else {echo " bgcolor=\"white\"";}
echo " align=\"center\"><A HREF=\"calendar.php?action=view&dt=".$cm."\"><font face=\"$font_face\" size=\"2\">".(date ("j",$cm)."</font></A></td>");
$cm = $cm + 86400;$i++;
} else {echo "<td align=\"center\" bgcolor=\"white\">&nbsp;</td>";}

if ($i = 8) echo "</tr>";
}
?>
<tr>
<td colspan=7 bgcolor="#F4F4F4" align=center>
<form action="calendar.php" method="post">
<table border=0 cellpadding=3 cellspacing=0>
<tr>
<td>
<font face="<? echo $font_face;?>" size="2"><B>Quick Jump : </B></font>
</td>
<td>
<select name=year>
<?
$uy = date("Y") + 10;
for ($fyear = date("Y"); $fyear <= $uy; $fyear++) {
echo "<option ";
if ($year == $fyear) echo "selected";
echo ">".$fyear;
}
?></option>
</select>
</td>
<td>
<select name=month>
<?
for ($fm = 1; $fm <= 12; $fm++) {
echo "<option ";
if ($month == $fm) echo "selected";
echo ">".$fm;
}
?></option>
</select>
</td>
<td>
<input type="submit" name="submit" value="Go!">
<input type="hidden" name="action" value="qj">
</td>
</tr>
</table>
</form>
</td>
</tr>
<tr>
<td colspan=7 bgcolor="white" align=center><font face="<? echo $font_face;?>" size="1"> Click on Date to View/Insert Schedules</font></td>
</tr>
<tr>
<td colspan=7 bgcolor="white" align=center><font face="<? echo $font_face;?>" size="1">
<?
$nd = $cd + 86400;
$SQL = "Select ID from calendar where job_date between $cd and $nd";
$query = mysql_query($SQL,$db);
$rows = mysql_num_rows($query);
if ($rows > 0) { echo "You have <font color=red>".$rows."</font> schedule jobs for today";} else { echo "You have 0 schedule jobs for today.";}
echo " / ";
$SQL = "Select ID from calendar";
$query = mysql_query($SQL,$db);
$rows = mysql_num_rows($query);
if ($rows > 0) { echo "Total ".$rows." schedule jobs";} else { echo "Total 0 schedule jobs";}

?>
</font></td>
</tr>
</table>
<?
}

if ($action == "view") {
?>
<table border=0 cellpadding=5 cellspacing=1 bgcolor="#CCCCCC" align=center width=450>
<tr>
<td colspan=3 align=center>
<font face="<? echo $font_face;?>" size="2"><A HREF="calendar.php">Calendar</A></font> :<font face="<? echo $font_face;?>" size="2">Schedules for : <? echo (date("F, d, Y",$dt)); ?></font>
</td>
</tr>
<tr>
<td width=70 align=center bgcolor="#F4F4F4">
<font face="<? echo $font_face;?>" size="2">Time</font>
</td>
<td width=310 align=center bgcolor="#F4F4F4">
<font face="<? echo $font_face;?>" size="2">Job Notes</font>
</td>
<td width=70 align=center bgcolor="#F4F4F4">
<font face="<? echo $font_face;?>" size="2">Options</font>
</td>
</tr>
<?
$nd = $dt + 86400;
$SQL = "Select * from calendar where job_date between $dt and $nd order by job_date";
$query = mysql_query($SQL,$db);
if (mysql_num_rows($query) > 0) {
while ($rows = mysql_fetch_array($query)) {
echo "<tr>";
echo "<td align=center bgcolor=\"white\"><font face=\"$font_face\" size=\"2\">".date("G:i",$rows[job_date])."</font></td>";
echo "<td align=left bgcolor=\"white\"><font face=\"$font_face\" size=\"2\">".$rows[job_notes]."</font></td>";
echo "<td align=center bgcolor=\"white\"><A HREF=\"calendar.php?action=del&ID=".$rows[ID]."&dt=".$dt."\"><font face=\"$font_face\" size=\"2\">Delete</font></td>";
echo "</tr>";
}
} else {
?>
<tr>
<td colspan=3 align=center bgcolor="white">
<font face="<? echo $font_face;?>" size="2">No Schedules</font>
</td>
</tr>
<?
}
?>
<tr>
<td colspan=3 align=center bgcolor="white">
<font face="<? echo $font_face;?>" size="1"><A HREF="calendar.php?action=delall&dt=<? echo $dt;?>">Clear All</A> / <A HREF="calendar.php?action=add&dt=<? echo $dt?>">Add Schedule</A></font>
</td>
</tr>
</table>
<?
}

if ($action == "add") {
?>
<form action="calendar.php" method="post">
<table border=0 cellpadding=5 cellspacing=1 bgcolor="#CCCCCC" align=center width=440>
<tr>
<td colspan=2 align=center>
<font face="<? echo $font_face;?>" size="2"><A HREF="calendar.php">Calendar</A></font> :<font face="<? echo $font_face;?>" size="2">Add Schedule for : <? echo (date("F, d, Y",$dt)); ?></font>
</td>
</tr>
<tr>
<td width=70 align=left bgcolor="#F4F4F4">
<font face="<? echo $font_face;?>" size="2">Time:</font><BR>
<font face="<? echo $font_face;?>" size="1">Hour:Min</font>
</td>
<td width=370 align=left bgcolor="#F4F4F4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<select name=hour>
<option>0
<option>1
<option>2
<option>3
<option>4
<option>5
<option>6
<option>7
<option>8
<option>9
<option>10
<option>11
<option>12
<option>13
<option>14
<option>15
<option>16
<option>17
<option>18
<option>19
<option>20
<option>21
<option>22
<option>23</option>
</select>
:
<select name=min>
<option>00
<option>01
<option>02
<option>03
<option>04
<option>05
<option>06
<option>07
<option>08
<option>09
<option>10
<option>11
<option>12
<option>13
<option>14
<option>15
<option>16
<option>17
<option>18
<option>19
<option>20
<option>21
<option>22
<option>23
<option>24
<option>25
<option>26
<option>27
<option>28
<option>29
<option>30
<option>31
<option>32
<option>33
<option>34
<option>35
<option>36
<option>37
<option>38
<option>39
<option>40
<option>41
<option>42
<option>43
<option>44
<option>45
<option>46
<option>47
<option>48
<option>49
<option>50
<option>51
<option>52
<option>53
<option>54
<option>55
<option>56
<option>57
<option>58
<option>59</option>
</select>
</td>
</tr>
<tr>
<td width=70 align=left valign=top bgcolor="#F4F4F4">
<font face="<? echo $font_face;?>" size="2">Job<BR>Description:</font>
</td>
<td width=370 align=left bgcolor="#F4F4F4">
<textarea name="job_notes" rows="10" cols="35"></textarea>
</td>
</tr>
<tr>
<td width=70 align=left valign=top bgcolor="#F4F4F4">
<input type=hidden name=action value="insert">
<input type=hidden name=dt value="<? echo $dt;?>">
<input type=hidden name=year value="<? echo (date("Y",$dt));?>">
<input type=hidden name=month value="<? echo (date("n",$dt));?>">
<input type=hidden name=day value="<? echo (date("j",$dt));?>">
</td>
<td width=370 align=left bgcolor="#F4F4F4">
<input type=submit name=submit value="Insert">
</td>
</tr>
<?
?>
</table>
</form>
<?
}

if ($action == "insert") {
$job_date = mktime($hour,$min,0,$month,$day,$year);
$SQL = "insert into calendar (job_date, job_notes) values ('$job_date', '$job_notes')";
mysql_query ($SQL,$db);
?>
<center><A HREF="calendar.php?action=view&dt=<? echo $dt;?>"><font face="<? echo $font_face;?>" size="2">Return to Schedules page</font></A></center>
<?
}

if ($action == "del") {
mysql_query ("delete from calendar where ID=$ID",$db);
?>
<center><A HREF="calendar.php?action=view&dt=<? echo $dt;?>"><font face="<? echo $font_face;?>" size="2">Return to Schedules page</font></A></center>
<?
}

if ($action == "delall") {
$nd = $dt + 86400;
mysql_query ("delete from calendar where job_date between $dt and $nd",$db);
?>
<center><A HREF="calendar.php?action=view&dt=<? echo $dt;?>"><font face="<? echo $font_face;?>" size="2">Return to Schedules page</font></A></center>
<?
}

?>
</body>
</html>
--------------------------------
таблица
-------------------------------
CREATE TABLE calendar(
ID int NOT NULL auto_increment,
job_date int NOT NULL default '0',
job_notes text,
PRIMARY KEY (ID)
) TYPE=MyISAM;
-----------------------------
с вас пиво
 

123av

Новичок
// MySQL server hostname
$dbhost = "localhost";

// MySQL server username
$dbuser = "root";

// MySQL server password
$dbpasswd = "";

// MySQL server connect
$db=mysql_connect("$dbhost","$dbuser","$dbpasswd");

// MySQL database name
$db_name="calendar";

mysql_select_db($db_name,$db);
 
Сверху