English 中文(简体)
是否有能为我履行这一基本日历职能的Zentd或j Query图书馆?
原标题:Is there Zend or jQuery libraries that can do this basic calendar function for me?

我有一份日历申请,在该日历申请中,有一个日历的“部门观点”。 没有什么东西只能显示目前选定的月份的天数,而当你点击该月的号码时,它打开了一个新的网页,并将GET的数据发送到这个新网页(显示MySQLInfo等)。

问题在于:这一小小小小小端根本没有做很多事,我努力把它变成泽斯德框架中的一部分。 我们也 j。 我不禁要问,是否有任何内在的法典能够轻易地做我们试图与自己的法典做些什么。

我们的法典(一项程序):

<?php
    /***
      This script file is the left panel calendar (small)
    */

    //Required variables initializion starts (important in the case of create new event, to avoid PHP notices).

    $day    =    "";
    $month    =    "";
    $year    =    "";
    $sel    =    "";
    $what    =    "";
    $page    =    "index.php";
    $param    =    "";
    $index    =    "";
    $functionLast    =    "goLastMonth";
    $functionNext    =    "goNextMonth";
    $sendFunction    =    "sendToForm";

    if(isset($_GET[ index ])) //if index page
    {
        $index    =    $_GET[ index ];
    }
    if(isset($_GET[ type ])) //if sype is set
    {
      $param    =    "&amp;type=".$_GET[ type ];
    }
    if(isset($_GET[ page ])) //if page is set
    {
        $page            =    "calendar.php";
        $param            =     &amp;page=calendar ;
        $functionLast    =    "getLastMonth";
        $functionNext    =    "getNextMonth";
        $sendFunction    =    "sendToTextBox";
    }

    if(!isset($calWidth) && !isset($calHeight)) //cal width /height check
    {
        $calWidth    =    CALENDAR_WIDTH;
        $calHeight    =    CALENDAR_HEIGHT;
    }

    if(isset($_GET["day"])) //if day is set
        $day = $_GET["day"]; //get it

    if(isset($_GET["month"])) //if month is set
        $month = $_GET["month"]; //..

    if(isset($_GET["year"])) //..
        $year = $_GET["year"]; //

    if(isset($_GET["sel"]))
        $sel = $_GET["sel"];

    if(isset($_GET["what"]))
        $what = $_GET["what"];

    if(isset($_GET[ date ]))
    {
        $date    =    $_GET[ date ];
        list($year,$month,$day) = explode("-",$date); //split date into pieces
    }

    if($day == "") $day = date("j");  //if day is blank, get today

    if($month == "") $month = date("m");  //if month is blank, get this month

    if($year == "") $year = date("Y"); //if year is blank, get this year
    //echo $day."-".$month."-".$year;die;
    //echo  <br> ;
    if(!checkdate($month, $day, $year)) { //if not a valida date
      if(isset($_GET["month"]))  { //try to get number of days for this month as this seems the last day of the month. for example if today is 31 of August and you are calling ?month=9&year=2009 it gives you wrong results
        $day = date("t", strtotime($year . "-" . $month . "-01")); //so give you 30.
      }
    }

    $printabledate  = $year."-".$month."-".$day;

    $currentTimeStamp = strtotime("$year-$month-$day");
    $monthName = date("F", $currentTimeStamp);
    $numDays = date("t", $currentTimeStamp);
    $counter = 0;
?>

<br />
<div id="loading1" class="a_loading1">
    <iframe src="<?php echo SITE_URL?>/loading-msg.php" scrolling="no" frameborder="0"  class="markup a_position"></iframe>
</div>

<table  class="mini-cal-table">
    <tr class="tprowbgcolor">
        <td class="arrow" colspan= 1  align="center"><input type= button  class= buttonleft  onclick= <?php echo "$functionLast($month,$year,"$page","$index")"; ?>  onmousedown="this.className= maincalbutton_active_left " onmouseout="this.className= buttonleft " /></td>
        <td class="title" colspan= 5 ><span class= title ><?php echo $monthName . " " . $year; ?></span></td>
        <td class="arrow" colspan= 1  align="center"><input type= button  class= buttonright  onclick= <?php echo "$functionNext($month,$year,"$page","$index")"; ?>  onmousedown="this.className= maincalbutton_active_right " onmouseout="this.className= buttonright " /></td>
    </tr>
    <tr>
        <td class= wd-titles >Su</td>
        <td class= wd-titles >Mo</td>
        <td class= wd-titles >Tu</td>
        <td class= wd-titles >We</td>
        <td class= wd-titles >Th</td>
        <td class= wd-titles >Fr</td>
        <td class= wd-titles >Sa</td>
    </tr>
    <tr>
<?php
    for($i = 1; $i < $numDays+1; $i++, $counter++)
    {
        $timeStamp = strtotime("$year-$month-$i");
        if($i == 1)
        {
        // Workout when the first day of the month is
        $firstDay = date("w", $timeStamp);

        for($j = 0; $j < $firstDay; $j++, $counter++)
        echo "<td>&nbsp;</td>";
        }

        if($counter % 7 == 0) {
          echo "</tr><tr>";
        }

        if(date("w", $timeStamp) == 0) {
          //$class = "class= weekend ";
          $tdclass = "weekend";
        } else {
          if($i == date("d") && $month == date("m") && $year == date("Y")) {
            //$class = "class= today ";
            $tdclass = "today";
          }
          else {
            //$class = "class= normal ";
            $tdclass = "normal";
          }
        }
        $zero = "";
        if($i < 10 )
        {
            $zero = "0";
        }
        $month = round($month);
        if($month < 10)
        {
            $month = "0".$month;
        }
        $date  = $year."-".$month."-".$zero.$i;
?>

<td class="<?php echo $tdclass?>"><?php
    if(!isset($_GET[ page ]))    {
    ?><a href= <?php echo SITE_URL; ?>/agenda.php?date=<?php echo $year; ?>-<?php echo $month; ?>-<?php echo $zero.$i; ?> ><?php echo $i?></a>

<?php }    else    {
?>

<a onclick= <?php echo "$sendFunction($i,"$date",$numDays,"$index","$type")"; ?> ><?php echo $i?></a>

<?php

}
?></td>

<?php
    }
?>
    </tr>
</table>
<script language="javascript" type="text/javascript">
    //<![CDATA[
    function goLastMonth(month,year,page,index) {
    // If the month is January, decrement the year.
      if(month == 1) {
        --year;
        month = 13;
      }

      var url =

      document.location.href = page+"?month="+(month-1)+"&year="+year+"<?php echo $param?>";
    }

    function goNextMonth(month,year,page,index)
    {
        // If the month is December, increment the year.
        if(month == 12)
        {
            ++year;
            month = 0;
        }
        document.location.href = page+"?month="+(month+1)+"&year="+year+"<?php echo $param?>";
    }
    //]]>
</script>
最佳回答

j 质量具有许多良好的日历选择,以下是统一制度的核心部分:

http://jqueryui.com/demos/datepicker/

问题回答

还Zendx支持jqueryuidatepicker, Example





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签