WackoWiki: Вам запрещён доступDev/PatchesHacks/SimpleCalendar ...

Home Page | Изменения | Новые Комменты | Пользователи | Каталог | Регистрация | Вход:  Пароль:  

Action: SimpleCalendar


I thought that some of you might find this calendar a useful little action. I can't claim to have written it, just modified an open source calendar script I found so it works in Wikka. I've “borrowed” code (and a graphic actually) from wacko wiki to use in my implementation of http://wikkawiki.org (thanks for all your work on it Jason) and thought I'd try and give a little something back to the wakka/wikka/wacko community. — Mike B?


<?php 
    $m 
= (!isset($_GET['m'])) ? date("n",mktime()) : $_GET['m'];    // if $m $y do not yet exist, then it gets them from the server
    
$y = (!isset($_GET['y'])) ? date("Y",mktime()) : $_GET['y'];
$wikipagename=$this->GetPageTag();
?>
<div align="center">
<table bgcolor="<?php echo $style['tablebg']; ?>">
    <tr>
        <td valign="top">
<?php
    
/*== get what weekday the first is on ==*/
    
$tmpd getdate(mktime(0,0,0,$m,1,$y));
    
$month $tmpd["month"]; 
    
$firstwday$tmpd["wday"];

    
$lastday mk_getLastDayofMonth($m,$y);
?>
<table cellpadding=2 cellspacing=0 border=1>
    <tr>
        <td colspan=7 bgcolor="<?php echo $style['tablebg']; ?>">
               <table cellpadding=0 cellspacing=0 border=0 width="100%">
                <tr>
                    <td width="20"><a href="wakka.php?wakka=<?php echo $wikipagename?>&m=<?php echo (($m-1)<1) ? 12 $m-?>&y=<?php echo (($m-1)<1) ? $y-$y ?>">&lt;&lt;</a></td>
                    <td bgcolor="<?php echo $style['tablebg']; ?>" align="center"><font size=2>
                        <?php echo "$month $y"?>
                        </font></td>
                    <td width="20"><a href="wakka.php?wakka=<?php echo $wikipagename?>&m=<?php echo (($m+1)>12) ? $m+?>&y=<?php echo (($m+1)>12) ? $y+$y ?>">&gt;&gt;</a></td>
                </tr>
            </table></td>
    </tr>
    <tr>
        <td width=22>Su</td>
        <td width=22>Mo</td>
        <td width=22>Tu</td>
        <td width=22>We</td>
        <td width=22>Th</td>
        <td width=22>Fr</td>
        <td width=22>Sa</td>
    </tr>
    <?php
    $d 
1;
    
$wday $firstwday;
    
$firstweek true;

    
/*== loop through all the days of the month ==*/
    
while ( $d <= $lastday
    {

        
/*== set up blank days for first week ==*/
        
if ($firstweek) {
            print 
"<tr>";
            for (
$i=1$i<=$firstwday$i++) 
            { print 
"<td><font size=2>&nbsp;</font></td>"; }
            
$firstweek false;
        }

        
/*== Sunday start week with <tr> ==*/
        
if ($wday==0) { print "<tr>"; }

        
/*== check for event ==*/
        
print "<td>";
            if(
$d<10) {
                if(
$m<10) {
                    
$tag "$y:0$m:0$d";
                } else {
                    
$tag "$y:$m:0$d";
                }
            } else {
                if(
$m<10) {
                    
$tag "$y:0$m:$d";
                } else {
                    
$tag "$y:$m:$d";
                }
            }
        
        
$heute date("Y:m:d",mktime());    // "01" bis "12"
        
if($tag==$heute)
        {
            
$font1 "<font color=\"#FF0000\">";
            
$font2 "</font>";
        }
        else
        {
            
$font1 "";
            
$font2 "";
        }
        print 
"$font1$d$font2";
        print 
"</td>\n";

        
/*== Saturday week with </tr> ==*/
        
if ($wday==6) { print "</tr>\n"; }

        
$wday++;
        
$wday $wday 7;
        
$d++;
    }
?>
</tr>
</table>
<br/><div align="center"></div>
        </td>
    </tr>
</table>
</div>
<?php
/*== get the last day of the month ==*/
function mk_getLastDayofMonth($mon,$year)
{
    for (
$tday=28$tday <= 31$tday++) 
    {
        
$tdate getdate(mktime(0,0,0,$mon,$tday,$year));
        if (
$tdate["mon"] != $mon
        { break; }

    }
    
$tday--;

    return 
$tday;
}
?>


 
Файлов нет. [Показать файлы/форму]
Комментариев нет. [Показать комментарии/форму]
Donate
Время работы: 3.035 s
Использовано памяти: 2.867 Mb