我必须创建事件跟踪celender,其中我有两个日期,开始日期到结束日期。 我想在网页中显示从开始日期到结束日期的日历。 我找到了这个链接http://www.dreamincode.net/forums/topic/87835-event-tracking-calendar/ 但它按月显示日历。我想创建可以从任何日期到结束日期的日历。
答案 0 :(得分:0)
最后我得到了解决方案。
<section id="select-menu">
<form method="post" action="index.php?action=GUI_calender">
<select name="cycle" class="monthpicker" class="first-div-container">
<?php
$months = Array("Cycle 1", "Cycle 2", "Cycle 3", "Cycle 4", "Cycle 5", "Cycle 6", "Cycle 7", "Cycle 8", "Cycle 9", "Cycle 10", "Cycle 11");
for ($x=1; $x<=count($months); $x++){
echo "<option value=\"$x\"";
if ($x == $cycle){
echo " selected";
}
echo ">".$months[$x-1]."</option>";
}
?>
</select>
<input type="submit" name="submit" class="pickerbutton" value="Go!">
</section>
<?php
echo "<table cellpadding=\"3\" ><tr>\n";
foreach ($days as $day){
echo "<th class=\"dayname\"><strong>$day</strong></th>\n";
}
?>
<section id="header">
Total Days available in Cycle : <?php echo $number_of_days; ?>
</section>
<?php
mysql_connect("127.0.0.1","root","");
mysql_select_db("test");
$dayArray = getdate($start);
$number_of_days += ($dayArray['wday']+1);
for ($count=0; $count<$number_of_days; $count++){
$dayArray = getdate($start);
if (($count % 7) == 0){
if (!in_array($dayArray['mon'],$months_in_cycle)){
break;
} else {
echo "</tr><tr>\n";
}
}
if ($count < $firstDayArray['wday'] || !in_array($dayArray['mon'],$months_in_cycle)){
echo "<td> </td>\n";
} else {
$month = $dayArray['mon'];
$total_calender = $obj_calender->total_calender($dayArray["mday"],$month,$current_year);
echo "<td class=\"event\" valign=\"top\">".$dayArray["mday"]."<br/>";
if ($total_calender > 0) {
$calender_detail = $obj_calender->get_calender_detail($dayArray["mday"],$month`enter code here`,$current_year);
foreach($calender_detail as $calender)
{
$event_title=$calender['mt_title'];
$id=$calender['mt_id'];
$event_shortdesc=$calender['mt_desc'];
$eventtime=$calender['fmt_date'];
$eventduration=$calender['mt_duration'];
echo "<label class=\"eventcontent\"><a href='#' title=\"$event_title \n Event Desc : $event_shortdesc\n Event Time : $eventtime \n Event Duration : $eventduration\">#".$id."</a><lable><br>";
}
// mysql_free_result($chkEvent_res);
} else {
$event_title = "";
}
echo "</td>\n";
$start += ADAY;
}
}
echo "</tr></table>";
?>
</form>
</div>