2 Kalenderblöcke zusammenführen

Begonnen von , 19 Juni 2002, 22:48:56

⏪ vorheriges - nächstes ⏩

0 Mitglieder und 1 Gast betrachten dieses Thema.

Möchte gern die 2 folgenden Kalenderblöcke in einem haben. Wer kann mir da helfen?


1. Scrollblock block-Calendar_list.php


<?php
/************************************************************************/
/* NukeCalendar v1.0.1                                                  */
/* ===================                                                  */
/*  PHP-Nuke Calendar Module for PHP-Nuke v5.5  (http://phpnuke.org)    */
/*  Copyright (c) 2002 by Andi (info@shiba-design.de)                   */
/*  http://www.shiba-design.de                                          */
/* -------------------------------------------------------------------- */
/* Nuke Calendar is based on EventCalendar 2.0                          */
/*  Copyright (c) 2001 Originally by Rob Sutton                         */
/*  http://smart.xnettech.net (Nuke Site)                               */
/*  Development continued by Aleks A.-Lessmann                          */
/* Prefix and minor bugfixes by fsz dESIGN & maaX dESIGN                */
/*  http://www.fsz-design.de  http://www.maax-design.de                 */
/* Included some ideas and changes by:                                  */
/*  flobee, Frank Gerlach and Kicks                                     */
/* -------------------------------------------------------------------- */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 or a newer version.   */
/************************************************************************/
#global $PHP_SELF; echo $PHP_SELF;
global $currentlang, $language, $lang, $prefix, $dbi, $locale, $bgcolor1,$bgcolor2,$bgcolor3,$bgcolor4,$bgcolor5,$textcolor1,$textcolor2;

######  Einstellungen fuer den Block  ###################################################
$module_name = "Kalender";  // CHANGE THIS IF YOU CHANGE THE CALENDAR-MODULES FOLDER NAME
#########################################################################################
$sort = "asc";                                                # Sortierung der Liste:  asc =aufsteigend / desc =absteigend
$scrolling = 1;                                         # Eintraege scrollen
$scrolldirection = "up" ;        # Richtung des Scrollens: up / down
$scrollheight = 100 ;                        # Hoehe des scrollenden Bereichs
$eventwidth = 250        ;                                # Breite des einzelnen Events bei scrolling
$scrolldelay = 350 ;                        # Scrollgeschwindigkeit: grosser Wert = langsamer / kleiner Wert = schneller
$listcount = 7 ;                                         # count of entries in the List-Block
$listEnddate = 1 ;                                # display the ending Date in List-View: 0=nein / 1=ja
$listStarttime = 1 ;                        # display the starting Time in List-View: 0=nein / 1=ja
$listEndtime = 0 ;                                # display the ending Time in List-View: 0=nein / 1=ja
$showNewlink = 0 ;                                # Link Event vorschlagen anzeigen: 0=nein / 1=ja
$showLegend = 0 ;                                        # Farblegende anzeigen: 0=nein / 1=ja
$reddot=1;                                                                # rote Ereignisse anzeigen 0=nein / 1=ja
$greendot=1;                                                        # gruene Ereignisse anzeigen 0=nein / 1=ja
$bluedot=1;                                                                # blaue Ereignisse anzeigen 0=nein / 1=ja
$whitedot=1;                                                        # weisse Ereignisse anzeigen 0=nein / 1=ja
$yellowdot=1;                                                        # gelbe Ereignisse anzeigen 0=nein / 1=ja
######### Definition der Farben und Rahmen ###############################################################
$listbgcolor1 = $bgcolor1;                                        # Hintergrund erste Zeile  ( "" fuer Transparent  )
$listtxtcolor1 = $textcolor1;                                # Text erste Zeile
$listbgcolor2 = $bgcolor2;                                        # Hintergrund naechste Zeile
$listtxtcolor2 = $textcolor2;                                # Text naechste Zeile
$listbordercolor = "";                                                        # Rahmenfarbe um Liste
$scrollbgcolor = "";                                                                # Hintergrundfarbe des Marquee-Tags (Zwischenraum Scrollinhalte)
$listtableborder = 0;                                                                # html Rahmen um Liste
$listtablecellspacing = 1;                                        # abstand zwischen Events (auch Rahmenbreite)
$listtablecellpadding = 2;                            # this will make the Events lines larger or smaller depending on value
$barcolordefault = "g" ;                   # Standard Ereignis-Kategoriefarbe erlaubt: g, r, w, b, y
# path to the calendarimages  !!! no slash behind the path !!!!
$imagepath = "images/kalender";

###### Ende der Einstellungen, ab hier nichts veraendern !! ###############################################
if (isset($currentlang)) {$xlang = $currentlang;}
elseif (isset($lang)) {$xlang = $lang;}
else {$xlang = $language;}
if (file_exists("language/kalender/lang-$xlang.php")) {
        include("language/kalender/lang-$xlang.php");
        }
else {
        include("language/kalender/lang-english.php");
        }
setlocale ("LC_TIME", _CALLOCALE);
$agent = strtolower(getenv(HTTP_USER_AGENT));
if (!ereg("msie", $agent) && !ereg("explorer", $agent)) {$scrolling=0;}
if ($reddot){ $arrwhere[] = "barcolor='r'";        }
if ($greendot){ $arrwhere[] = "barcolor='g'";        }
if ($bluedot){ $arrwhere[] = "barcolor='b'";        }
if ($whitedot){ $arrwhere[] = "barcolor='w'";        }
if ($yellowdot){ $arrwhere[] = "barcolor='y'";        }
$whereoption = implode (" or ", $arrwhere);
$d = (int)Date("d"); $m = (int)Date("m"); $y = (int)Date("Y");
$qrydate = "$y-$m-$d";
$qry="SELECT count(eid) FROM ".$prefix."_events WHERE (eventDate>= '$qrydate' or endDate>= '$qrydate') and ($whereoption)";
list($icount) = sql_fetch_row(sql_query($qry, $dbi), $dbi);
if ($icount>$listcount) $icount=$listcount;
$content.="<center>";
if (!$scrolling){
        $content.="<hr size=\"1\" color=\"$listbgcolor2\" width=\"96%\" noshade>";
        }
if ($icount) {
        $imgprops= "align=\"absmiddle\" hspace=\"1\" vspace=\"2\" width=\"9\" height=\"9\" border=\"0\" alt=\"\"";
        if ($scrolling) {
                $content.="<marquee behavior='scroll' direction='$scrolldirection' height='$scrollheight' hspace='0' vspace='5' loop='' scrolldelay='$scrolldelay' onmouseover='this.stop()' onmouseout='this.start()'>";
                }
        $content.="<table cellspacing=\"$listtablecellspacing\" cellpadding=\"$listtablecellpadding\" bgcolor=\"$listbordercolor\" bordercolor=\"$listbordercolor\" border=\"$listtableborder\" width=\"96%\">";
        $qry="SELECT eid, aid, title, hometext, time, topic, informant, year(eventDate), month(eventDate), dayofmonth(eventDate), hour(startTime), minute(startTime), year(endDate), month(endDate), dayofmonth(endDate), hour(endTime), minute(endTime), alldayevent, barcolor FROM ".$prefix."_events WHERE (eventDate>= '$qrydate' or endDate>= '$qrydate') and ($whereoption) order by eventDate $sort, endDate $sort limit 0,$icount";
        $result=sql_query($qry, $dbi);
        $i = 0;
        while(list($eid, $postadmin, $subject, $hometext, $datePosted, $topic, $informant, $y1, $m1, $d1, $h1, $mi1, $y2, $m2, $d2, $h2, $mi2, $alldayevent, $barcolor) = sql_fetch_row($result, $dbi)) {
                if (!$barcolor || (!ereg ($barcolor, "grwby"))) $barcolor=$barcolordefault;
                $dateStart = strftime(_CALSHORTDATEFORMAT, mktime(0, 0, 0, $m1, $d1, $y1));
                if ($listStarttime) {$fontstyle="tiny";}
                else {$fontstyle="content";}
                if ($listStarttime && !$alldayevent) {
                        $dateStart.= " ".strftime(_CALTIMEFORMAT, mktime($h1, $mi1, 0, $m1, $d1, $y1));
                        }
                if ($listEnddate) {
                        $dateEnd = strftime(_CALSHORTDATEFORMAT, mktime(0, 0, 0, $m2, $d2, $y2));
                        }
                else {
                        $dateEnd = "";
                        }
                if ($listEndtime && !$alldayevent) {
                        $dateEnd.= " ".strftime(_CALTIMEFORMAT, mktime($h2, $mi2, 0, $m2, $d2, $y2));
                        }
                if ($i==0) { $bgcolornew=$listbgcolor1; $txtcolornew=$listtxtcolor1; $i=1; }
                else { $bgcolornew=$listbgcolor2; $txtcolornew=$listtxtcolor2; $i=0; }
                if ($hometext && !$scrolling){
                        $alttext=strip_tags($hometext);
                        }
                $content.="<tr bgcolor=\"$bgcolornew\">
                <td valign=\"top\"><img src=\"$imagepath/ball$barcolor.gif\" $imgprops></td>
                <td><div title=\"$alttext\"><font class=\"tiny\" color=\"$txtcolornew\">$dateStart - $dateEnd<br>
                <a href=\"modules.php?name=$module_name&file=index&type=view&eid=$eid\">$subject</a></font></div></td></tr>";
                }
        sql_free_result($result);
        if ($scrolling) {
                $content.="</table></marquee>";
                }
        else {
                $content.="</table>";
                }
        }
else {
        $content.= _CAL0EVENTSBLOCK."<br>";
        }
if ($i==1) { $bgcolornew=$listbgcolor2;}
else { $bgcolornew=$listbgcolor1;}
if (!$scrolling){
        $content.="<hr size=\"1\" color=\"$bgcolornew\" width=\"96%\" noshade>";
        }
$content.="</center><font class=\"tiny\">";
if ($showNewlink) {
        $content.="<a href=\"modules.php?name=$module_name&file=submit\"><img src=\"$imagepath/sign.gif\" alt=\""._CALSUBMITEVENT."\" width=\"16\" height=\"16\" border=\"0\" align=\"absmiddle\" hspace=\"5\" vspace=\"4\">"._CALSUBMITEVENT."</a>";
        }
if ($showLegend) {
        $imgprops= "align=\"absmiddle\" hspace=\"6\" vspace=\"3\" width=\"9\" height=\"9\" border=\"0\" alt=\"\"";
        $link = "modules.php?name=$module_name&file=index&type=list";
        if ($reddot) $content.="<a href=\"$link&col=g\"><img src=\"$imagepath/ballg.gif\" $imgprops>"._CALdotcolorgreen."</a> ";
        if ($greendot) $content.="<a href=\"$link&col=r\"><img src=\"$imagepath/ballr.gif\" $imgprops>"._CALdotcolorred."</a> ";
        if ($bluedot) $content.="<a href=\"$link&col=b\"><img src=\"$imagepath/ballb.gif\" $imgprops>"._CALdotcolorblue."</a> ";
        if ($whitedot) $content.="<a href=\"$link&col=w\"><img src=\"$imagepath/ballw.gif\" $imgprops>"._CALdotcolorwhite."</a> ";
        if ($yellowdot) $content.="<a href=\"$link&col=y\"><img src=\"$imagepath/bally.gif\" $imgprops>"._CALdotcoloryellow."</a><!-- nukeCalendar © by shiba-design.de -->";
        }
$content.="</font>";
setlocale ("LC_TIME", $locale);
if (!$icount) {$icount="";}
$blockfiletitle = _marctitle;

?>



2. Klanderblock block-Calendar.php


<?php
/********************************************************/
/* Event Calendar                                       */
/* Version 1.5, see history.txt for details             */
/* Originally by Rob Sutton                             */
/* Development continued by                             */
/*    Aleks A.-Lessmann (aleks@lessmann-consulting.com) */
/*                                                      */
/* This program is opensource so you can do whatever    */
/* you want with it. However, I'm happy about any       */
/* clever idea or nifty change you might have or have   */
/* done, send them to                                   */
/* calendar-module@lessmann-consulting.com              */
/* Any new versions can be found at                     */
/* http://www.lessmann-consulting.com first             */
/********************************************************/

if (eregi("block-Sample_Block.php",$PHP_SELF)) {
    Header("Location: index.php");
    die();
}

$module_name = "Kalender";
$Date = Date("m/d/Y");
$Date_Array = explode("/", $Date);

/**** Specific front display variables */
/*EDIT THESE TO SPECIFY COLORS BELOW*/

$todaycolor = "#000000";
$daycolor = "#000000";
$daybackground = "#FFe699";
$todaybackground = "#FF5555";

$content = "";

/*No need to edit below here now */
global $currentlang;
include("modules/$module_name/language/lang-$currentlang.php");
if (isset($newlang))
   {
        include("modules/$module_name/language/lang-$newlang.php");
        $language = $newlang;
   } elseif (isset($lang))
   {
    include("modules/$module_name/language/lang-$lang.php");
    $language = $lang;
   } else
   {
    include("modules/$module_name/language/lang-english.php");
   }

$eventsresult = mysql_query("SELECT eid,title,startTime,endTime,alldayevent,barcolor FROM nuke_events WHERE (eventDate <= '$Date_Array[2]-$Date_Array[0]-$Date_Array[1]' AND endDate >= '$Date_Array[2]-$Date_Array[0]-$Date_Array[1]') ORDER BY alldayevent,startTime, endTime ASC");
if (mysql_num_rows($eventsresult) == 0)
        {
        $content .= "<center><font class=\"content\">"._CALNOEVENTS."</font></center>";
        }
 else
        {
         while(list($eid, $title,$startTime,$endTime,$alldayevent,$barcolor) = mysql_fetch_row($eventsresult))
         {
         if ($barcolor == "r") $barcolorchar="r";
         elseif ($barcolor == "g") $barcolorchar="g";
         elseif ($barcolor == "b") $barcolorchar="b";
         elseif ($barcolor == "y") $barcolorchar="y";
         else $barcolorchar="w";
         $content .= "<img src=\"images/ball$barcolorchar.gif\" border=0> <a href=\"modules.php?name=$module_name&file=index&type=view&eid=$eid\">$title</a><br>";
         }
        }

// this is going to be changed to a switch ASAP
function getMonthName2($Date)
   {
   $month = Date("m",$Date);
   if ($month == "01")
   {
     $monthname = _CALJAN;
   } elseif ($month == "02")
   {
      $monthname = _CALFEB;
   } elseif ($month == "03")
   {
     $monthname = _CALMAR;
   } elseif ($month == "04")
   {
     $monthname = _CALAPR;
   } elseif ($month == "05")
   {
     $monthname = _CALMAY;
   } elseif ($month == "06")
   {
    $monthname = _CALJUN;
   } elseif ($month == "07")
   {
     $monthname = _CALJUL;
   } elseif ($month == "08")
   {
     $monthname = _CALAUG;
   } elseif ($month == "09")
   {
     $monthname = _CALSEP;
   } elseif ($month == "10")
   {
      $monthname = _CALOCT;
   } elseif ($month == "11")
   {
     $monthname = _CALNOV;
   } elseif ($month == "12")
   {
      $monthname = _CALDEC;
   }
   return $monthname;
}

/**** Get the Day (Integer) for the first day in the month */
$First_Day_of_Month_Date = mktime("", "", "", $Date_Array[0], 1, $Date_Array[2]);
$Date = $First_Day_of_Month_Date;

$Day_of_First_Week = Date("w",$First_Day_of_Month_Date);

 /**** Find the last day of the month */
$Month = Date("m",$Date);
$day = 27;
do {
     $End_of_Month_Date = mktime("", "", "", $Date_Array[0], $day, $Date_Array[2]);
     $Test_Month = Date("m",$End_of_Month_Date);
     $day += 1;
   } while ( $Month == $Test_Month );
$Last_Day = $day - 2;

 /**** Get todays date */
$Today_d = Date("d");
$Today_m = Date("m");
$Today_y = Date("Y");

/**** Build Month */
$content .= "\n<center><TABLE border=0 cellspacing=1 cellpadding=2>";
$content .= "\n<TR>\n\t<TH colspan=7><FONT class=\"tiny\"><a
href=\"modules.php?name=$module_name&file=index&Date=$Date_Array[0]/1/$Date_Array[2]&type=month\">";
$content .= getMonthName2($Date)." ".$Today_y;
$content .= "</a></FONT></TH>\n</TR>";

/**** Previous Greyed month days */
$content .= "\n<TR>";
if ($Day_of_First_Week != 0)
$content .= "\n\t<TD colspan=$Day_of_First_Week><font class=\"content\"> </font></TD>";
$day_of_week = $Day_of_First_Week + 1;
 /**** Build Current Month */
for ($day = 1 ; $day <= $Last_Day ; $day++)
   {
   if ($day_of_week == 1)
   {
   $content .= "\n<TR>";
   }
        $result = mysql_query("SELECT eid,title,eventDate,endDate,startTime,endTime,barcolor FROM nuke_events WHERE (eventDate <= '$Date_Array[2]-$Date_Array[0]-$day' AND endDate >= '$Date_Array[2]-$Date_Array[0]-$day');");
        if ($day == $Today_d)
$content .= "\n\t<TD align=center bgcolor=$todaybackground><b><a href=\"modules.php?name=$module_name&file=index&Date=$Date_Array[0]/$day/$Date_Array[2]&type=day\"><FONT FACE=verdana size=\"1\" color=$todaycolor>$day</font></a></b>";
        else
$content .= "\n\t<TD align=center bgcolor=$daybackground><a href=\"modules.php?name=$module_name&file=index&Date=$Date_Array[0]/$day/$Date_Array[2]&type=day\"><FONT FACE=verdana size=\"1\" color=$daycolor>$day</font></a>";
        if (mysql_num_rows($result) == 0)
$content .= "<br>";
        elseif (mysql_num_rows($result) >= 4)
$content .= "<br>";
        elseif (mysql_num_rows($result) >= 3)
$content .= "<br>";
        elseif (mysql_num_rows($result) >= 2)
$content .= "<br>";
        else
$content .= "<br>"; $content .= "</TD>";
        if ($day_of_week == 7)
        {
        $day_of_week = 0;
        $content .= "\n</TR>";
        }

        $day_of_week += 1;
}

/**** Next Greyed month days */
$day = 1;
if ($day_of_week != 1)
   {
    $tmp = 8 - $day_of_week;
    $content .= "<TD colspan=$tmp><font class\"tiny\">.</TD>";
   }
$content .= "\n</TR>\n</TABLE>";

?>



Wer kann mir sagen wie ich zu erst den scroll und gleich hinterher den Kalender zu einem Block zusammen schraube?

Andi

Hübsche Idee,

da ich sowieso gerade am Bugfixen vom Kalender bin, werde ich so einen Block gleich mit reinbasteln.

Dauert aber noch a bisserl ;)
schön´s Grüssle, Andi

JensWagenknecht

Ganz einfach.
include den 2. Block ( oder umgedreht).

Und mache aus dem block den DU rein haben willst eine Function draus.
Und dann schreibe unter den ersten Block die Funktion.
Natürlich abgesetzt vielleicht mit einem Opentable() und CloseTable() und einem <br> dazwischen.

Sichere die Dateien vorher und probiere ein bischen, Du wirst sehen, in 5 Minuten bist Du ein Profi.

Jens

Jens

Joschau

includen ist vielleicht nicht die beste Idee, da dann die Variablen überschrieben werden dürften...

Danke euch.
werde das mit dem includen mal pobieren.

@ Andi

Wäre aber schön wenn du da ne bessere Lössung findest!
Danke im voraus.
Werde öfters mal deine Seite besuchen.

JensWagenknecht

Also, bei includen werden die Variablen nicht überschrieben.

Und als Funktion einbinden, ist eine sa<ubere Lösung.
Wen man Progammiert wird ohnehin bei größeren Sachen alles auf mehrere Dateien
verteilt.

Andi

@all

Heute Abend kommt das Update zum Kalendermodul in den Download.
Dieser Block ist dann dabei:P
schön´s Grüssle, Andi