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

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

Action: Scheduler


{{scheduler}}


/actions/scheduler.php

<?php
// Scheduler Version 1.1f - Jan 7, 2005 - bad word function call
// The original parts of this script were developed by G. Michael Bowen And Mark Kasper for a SSHRC research project using wikka wiki.
// As far as it is possible to tell (because the code exists all over the web), we provide credit to the original calendar code for the
// to Marcus Kazmierczak and released at www.blazonry.com, although this script builds considerably on that code.
// Code additions copyright GMBowen & Mark Kasper, 2004. Released to public domain under GPL. Modify, improve, change as you wish.
// There are two complementary actions. dayschedule.php allows anyone to designate an owner & date to see their schedule (see line 140)
// and the should be placed on a page named "DaySchedule". The other action, monthschedule.php, is a
// larger version of the dayschedule action which shows entries for an entire month on one page.
?>
<div align="center">
<P><TABLE BORDER=0>
   <TR>
      <TD>
         <P>
<?php
$month
= (!isset($_GET['month'])) ? date("n",mktime()) : $_GET['month'];   
$year = (!isset($_GET['year'])) ? date("Y",mktime()) : $_GET['year'];
$today = (!isset($_GET['day'])) ? date("d",mktime()) : $_GET['day'];

$site_base = $this->GetConfigValue("base_url");
$thispage=$this->GetPageTag();

// badword array for replacing badwords (not initialized as currently using added function in wakka.php)
//$badwords = Array ('/motherfucker/i', '/cunt/i', '/fuck/i', '/cocksucker/i', '/bitch/i', '/son of a bitch/i', '/asshole/i', '/shit/i', '/fag/i', '/wank/i', '/dick/i', '/pussy/i', '/bastard/i', '/molester/i', '/molezter/i', '/cock/i');
//$changeto = '****';

// gets username
$username = $this->GetUserName();

// kasper
//  NOTE VERY IMPORTANT,  if the table is totally empty the function will not work, you
//                        must add one in maually, for this function to work
//                        I could add it in the code but very messy, will come up with better way.

$dayschedule = $_POST['dayscheduleX'];

// include_once("./scripts/badwordfunction.php");
// $dayschedule = BadWordFunction($dayschedule);
$dayschedule = addslashes($dayschedule);  // for single quotes to work


// replace above function call with line below if wakka.php doesn't have a bad word function code in it
//$dayschedule = preg_replace($badwords, $changeto, $dayschedule);

$query = "select * from ".$this->config['table_prefix']."scheduler";
$result = mysql_query($query);

if (
$_POST['save']){
    
// Kasper added to delete the empty schedule
  
$del = "delete from ".$this->config['table_prefix']."scheduler where dayschedule = ''";
  
$delresult = mysql_query($del);
  
$up = 0;
    while (
$row = mysql_fetch_object($result))
    {     
        if(
$row->user == $username && $row->month == $month && $row->day == $today && $row->year == $year)
        {
         
$up = 1;     
         
$ro = $row->id;     
        }                   
    }

    if(
$up == 1)
    {         
        
$query = "UPDATE ".$this->config['table_prefix']."scheduler SET dayschedule='$dayschedule' WHERE user='$username' AND id='$ro'";
        
$result = mysql_query($query);
    }else{     
        
$query = "INSERT into ".$this->config['table_prefix']."scheduler (user,dayschedule,month,day,year) VALUES ('$username','$dayschedule','$month','$today','$year')";
        
$result = mysql_query($query);             
    }
}

// end kasper
?>

<table BGCOLOR="#DDccbb">
    <tr>
        <td valign="top">
<?php
    
/*== get what weekday the first is on ==*/
    
$tmpd = getdate(mktime(0,0,0,$month,1,$year));
    
$monthname = $tmpd["month"];
    
$firstwday= $tmpd["wday"];
    
$lastday = mk_getLastDayofMonth($month,$year);
?>
<table cellpadding="2" cellspacing="0" border="1">
    <tr BGCOLOR="#ffffff">
        <td colspan="7">
            <table cellpadding="0" cellspacing="0" border="0" width="100%">
                <tr  BGCOLOR="#ffffff">
                    <td width="20"><a href="<?php echo $this->href("", "", "month="); echo (($month-1)<1) ? 12 : $month-1 ; ?>&amp;year=<?php echo (($month-1)<1) ? $year-1 : $year ; ?>">&lt;&lt;&lt;</a></td>
                    <td align="center"><font size="2"><?php echo "$monthname $year"; ?></font></td>
                    <td width="20"><a href="<?php echo $this->href("", "", "month="); echo (($month+1)>12) ? 1 : $month+1 ; ?>&amp;year=<?php echo (($month+1)>12) ? $year+1 : $year ; ?>">&gt;&gt;&gt;</a></td>
                </tr>
            </table>
      </td>
    </tr>
    <tr BGCOLOR="#DDccbb">
        <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
    $day
= 1;
    
$wday = $firstwday;
    
$firstweek = true;

    
/*== loop through all the days of the month ==*/
    
while ( $day <= $lastday)
    {
        
/*== set up blank days for first week ==*/
        
if ($firstweek) {
            print
"    <tr  BGCOLOR=\"#ffffff\">";
            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 BGCOLOR=\"#ffffff\">\n"; }

         
/*== check for event ==*/
         
print "        <td>";
        if(
$day<10) {
            if(
$month<10) {
                
$tag = "$year:0$month:0$day";
            } else {
                
$tag = "$year:$month:0$day";
            }
        } else {
            if(
$month<10) {
                
$tag = "$year:0$month:$day";
            } else {
                
$tag = "$year:$month:$day";
            }
        }
       
        
$todaydate = date("Y:m:d",mktime());
        if(
$tag==$todaydate)
        {
            
$font1 = "<font color=\"#FF0000\"><b>";
            
$font2 = "</b></font>";
        }
        else
        {
            
$font1 = "";
            
$font2 = "";
        }
        print
"<a href=".$site_base.$thispage."&day=$day&month=$month&year=$year>$font1$day$font2</a>";
        print
"</td>\n";

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

        
$wday++;
        
$wday = $wday % 7;
        
$day++;
    }
?>
    </tr>
</table>

        </td>
    </tr>
</table>

<?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;
}
?>
<!-- Comment line below out if you don't want to link to the formatted schedule page-->
<center><a href=<? echo $site_base; ?>DaySchedule&amp;<? echo "month=".$month."&amp;day=".$today."&amp;year=".$year; ?>><small>Tagesansicht</small></a>
&nbsp;|&nbsp;
<a href=<? echo $site_base; ?>MonthSchedule&amp;<? echo "month=".$month."&amp;day=".$today."&amp;year=".$year; ?>><small>Monatskalender</small></a></center>
      </TD>
      <TD WIDTH=500>
    <P>

<?php
if ($user = $this->GetUser())
{
  
$dayschedule = str_replace("\n", ",", $_POST['dayschedule']);

    
// title over textarea box
  
$printowner = $username."'s Termine und Aufgaben f&uuml;r ";
  
$dayschedule = $this->LoadSingle("SELECT dayschedule FROM ".$this->config["table_prefix"]."scheduler WHERE user='".$username."' AND day='".$today."' AND month='".$month."' AND year='".$year."'");
// replaced a comma with XXZXX below....I don't know what the purpose of the code is...
  
$dayschedule = str_replace("XXZXX", "\n", $dayschedule[dayschedule]);   
  
$output = str_replace(",", " ", $dayschedule[dayschedule]);
?>
         <br><a href="<?php echo $this->href("", "", "day="); echo (($today-1)<1) ? $lastday : $today-1 ; ?>&amp;year=<?php echo $year; ?>&amp;month=<?php echo $month; ?>">&lt;&lt;</a>
        <b><? echo "$printowner$monthname $today, $year:"; ?></b>
        <a href="<?php echo $this->href("", "", "day="); echo (($today+1)>$lastday) ? 1 : $today+1 ; ?>&amp;year=<?php echo $year; ?>&amp;month=<?php echo $month; ?>">&gt;&gt;</a>
           <form action="" method="post">
               <textarea cols="65" rows="12" name="dayscheduleX"><?php echo $dayschedule; ?></textarea>
               <input type="submit" value="Submit" />
               <input type="hidden" name="save" value="true" />
        </form>   
<?
}
else
{
echo
"<em>Der Kalender funktioniert nur bei angemeldeten Nutzern.</em>";
}
?>
</P>
      </TD>
   </TR>
</TABLE>
</div>

Documentation

How can I use this Calendar for group events?


Note:
By default only events of the (one) logged in person respectivly his actual account will be shown.


work around:
Share an account. Eg. "Group XY Account?" which will be used for event accord only.


Login: Group XY Account?
Password: onepasswordforallgroupmembers


To Do


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