php.de

Zurück   php.de > Lösungen durch Skripte > Scriptbörse

Scriptbörse PHP Lösungen für nen schmalen Taler

Antwort
 
LinkBack Themen-Optionen Thema bewerten
Alt 08.12.2010, 11:47  
Neuer Benutzer
 
Benutzerbild von arne.bonn
 
Registriert seit: 08.12.2010
Beiträge: 1
PHP-Kenntnisse:
Anfänger
arne.bonn befindet sich auf einem aufstrebenden Ast
Standard öffentlichen Kalender aus Terminübersicht des HiOrg-Server erzeugen

Terminübersicht für Hilfsorganisationen

Der HiOrg-Server bietet dem öffentlichen Benutzern keine Übersicht im Kalenderformat. Die Integration der Termine ist nur im Listenformat möglich.
Das Skript bietet die Möglichkeit ein umfangreichen Kalender mit Zugriff auf die Details, sowie ein kleinen Kalender für den Webseiten-Teaser (im Menübereich oder als rechter äußerer Frame)

Installationshinweise und Beschreibung steht im PHP-Skript.

PHP-Code:
<?php
    
<?php
    
/*----------------------------------------------------------------------
    Termin-Tabelle aus HiOrg erzeugen
    =================================
    Der Terminkalender wird aus dem öffenlichen Bereich des HiOrg erzeugt.
    Nicht öffentlich angezeigte Termine können somit nicht wiedergegeben werden !

    Kalender-Parameter: 
        datum=tt.mm.jjjj    ohne Angabe wird das aktuelle Datum genutzt)
        mini=125        Minikalender Breite (z.B. rechten Frame)
                    ohne Angabe kein Minikalender
        zeilen=5        Minikalender Anzahl Zeilen
        link=www.link.de    Minikalender Link für Kalendereinträg (z.B. auf großen Kalender)
        (Parameter aus Hiorg-Konfiguration werden durchgereicht)
        ov=xxxx            Ortsverband (ohne Angabe = xxxx)
        monate=12        Anzahl der sichtbaren Monate
        typ=einsatz        Sichtbarer Typ
        gruppe=128        Sichtbare Gruppe
        filter=Blutspende    Sichtbar nur Termine mit Inhalt Blutspende

    Installation:
        1. Das PHP-Skript auf den eigenen Server kopieren (z.B: unter dem Namen kalender.php)
        2. Im gleichen Server-Verzeichniss das Verzeichniss "Snoopy" anlegen 
        3. Die Snoopy-Klasse in dieses Verzeichniss kopieren (Download unter http://m-software.de/snoopy-php)
        4. Anpassung der Variablen. Im Besonderen sollte $defaultov angegeben werden

    Was bringt die Zukunft?
        Ehrlich zugegeben, habe ich die Farben an meine Bedürftnisse angepass und zur Zeit keine Lust das alles in Styles oder Variablen zu verpacken. Kann mich auch nicht so richtig an Style Sheets gewöhnen, erstrecht weil hier soviele zusammenspielen.
    
    Versions- und Lizenzhinweise
        Ich bediene mich folgender Module
        1. Table Extractor "Creative Commons License, Copyright Jack Sleight - www.reallyshiny.com"
            Damit wird die Webabfrage der öffentlichen Terminliste in ein Array verpackt
            Die erste Arrayzeile enthält den Verweis auf den Farben-Style (col1, col2, ...).
            Dazu musste ich den Table Extractor im Bereich "case '<tr>':" anpassen (function prepareArray() )
        2. Snoopy-Klasse "GNU LESSER GENERAL PUBLIC LICENSE v2.1, Copyright(c) 1999,2000 ispi "
            Damit wird die Webseite der öffentlichen Terminliste (HiOrg) abgefragt. Funktioniert auch wenn nicht alle PHP-Aufrufe vom Server erlaubt sind. fopen oder andere direkte PHP-Aufrufe werden auf vielen Servern verboten.

    Versionshistorie:
    18.11.10 ASR: v1.0 Erstellung
    19.11.10 ASR: v1.4 Umformatiert; Farben hinzu; 12 Monate Vergangenheit und Zukunft
    19.11.10 ASR: v1.5 Aufruf um ov, monate, ...  erweitert
    19.11.10 ASR: v1.6 Navigation verschlüsselt übertragen
    19.11.10 ASR: v1.7 Zugriff für Ortsverband beschränken
    23.11.10 ASR: v2.0 Umstellung auf Snoopy anstatt fopen
    24.11.10 ASR: v2.1 Minikalender
    24.11.10 ASR: v2.2 diverse Verbesserungen
    08.12.10 ASR: v2.3 Anpassung zur Veröffentlichung des Skriptes
    ----------------------------------------------------------------------*/
        // Standard Ortsverband-Kürzel (Dieser wird bei keiner Angabe automatisch genommen)
    
$defaultov "xxx";
        
// Link zur HiOrg Seite des öffentlichen Kalenders
    
$url "http://www.hiorg-server.de/termine.php?iframe=1" ;
        
// Überschrift in Browser-Titelzeile (zum Ausblenden die Zeile auskommentieren)
    
$browserheader "Browserzeile des Ortverbandes Musterstadt";
        
// Überschrift des Kalenders (zum Ausblenden die Zeile auskommentieren)
    
$sideheader "Seitenkopf des Ortverbandes Musterstadt";
        
// Style Hiorg-Server
    
$hiorgCss="https://www.hiorg-server.de/hiorg.css";
        
// Javascript Hiorg-Server
    
$hiorgScript="https://www.hiorg-server.de/hiorg.js";
        
// Privater HiOrg-Style (Angabe aus den Einstellungen der Benutzeroptionen im HiOrg-Server)
    
$hiorgCssPrivate="http://.../hiorgserver.css";
        
// Tooltipbox wird angezeigt wenn der Mauszeiger auf dem Datumseintrag ist. 
        // Keine oder falsche Angabe führt zur Anzeige einer Titelzeile zu jedem Link
    
$tooltipJavascript="http://www.dlrg.de/global/skripte/terminscript/typo3/funktionen/wz_tooltip/wz_tooltip.js";
        
// Link zur Seite wenn auf ein Termin im Minikalender geklickt wird
    
$defaultMiniurl "" ;
        
// Zulässige Seiten (Hier stehn die Ortsverbandskürzel welche von diesem Skript verarbeitet werden dürfen)
    
$allowedOrtsverband=array("ov01","ov02"$defaultov);
        
// Versionhinweis. Wäre Nett wenn es nicht verändert würde. Im Prinzip ist es mir jedoch völlig egal. 
        // (Wird nicht im Minikalender angezeigt)
    
$version "(c) arne.bonn bei googlemail.com<br>08.12.10/v2.3";
        
// Unterschrift, Lizenzhinweise etc. (Wird nicht im Minikalender angezeigt)
    
$disclaimer "Diese Software unterliegt der Open-Source-Lizenzvereinbarungen<br>Der Autor &uuml;bernimmt keine Haftung f&uuml;r die Verwendung und der m&ouml;glich enstehenden Sch&auml;den bez&uuml;glich dieser Software. \n";
        
// Intergration der Snoopy-Klasser (Download unter http://m-software.de/snoopy-php)
    
include "Snoopy/Snoopy.class.php";






    
/*----------------------------------------------------------------------
    Programmcode
    ----------------------------------------------------------------------*/

    
$sMonat=array("Januar","Februar","M&auml;rz","April","Mai","Juni",
        
"Juli","August","September","Oktober","November","Dezember");
    
/*----------------------------------------------------------------------
    Seitenhilfe
    ----------------------------------------------------------------------*/
    
$sHilfe="
    <h1>Hilfe</h1>
    <h2>Beschreibung</h2>
    Die Anwendung kalender.php greift auf die vorhanden &ouml;ffentlichen Kalender des HiOrg-Servers zu. Die Termine werden als Tabelle dargestellt.<br>
    <h2>Aufrufparameter</h2>
    <h3>Angezeigter Monat</h3>
    <b><code>datum=1.1.2010</code></b><br>
    Der anzuzeigende Startmonat im Format tt.mm.jjjj angeben. Bei keiner Eingabe wird automatisch der aktuelle Monat verwendet.

    <h3>Seitenkopf</h3>
    <b><code>header=Hier ist die Titelzeile</code></b><br>
    Dieser Eintrag wird als Titelzeile im Browser verwendet. Den Eintrag am Ende der Argumente setzen wenn Leerzeichen verwendet werden

    <h3>Anzahl der dargestellten Monate</h3>
    <b><code>monate=12</code></b><br>
    Es werden die anzahl der Monate gesehen von Heute in die Zukunft und Vergangenheit angezeigt. Standardwert ist 12 Monate.

    <h3>Filter</h3>
    <b><code>filter=Filtertext</code></b><br>
    Es werden nur Termine angezeigt deren Titelzeile den Filtertext enthalten

    <h3>Gruppe</h3>
    <b><code>gruppe=Gruppencode</code></b><br>
    Den Gruppencode aus der Beschreibung des HiOrg-Servers entnehmen.

    <h3>Typ</h3>
    <b><code>typ=Gruppencode</code></b><br>
    Den Typ aus der Beschreibung des HiOrg-Servers entnehmen.

    <h3>Ortsverband</h3>
    <b><code>ov=Ortsverband-Code</code></b><br>
    Den Ortsverbandcode des HiOrg-Servers &uuml;bernehmen. Der Ortsverband muss in der Variable <b><code>allowedOrtsverband</code></b> aufgef&uuml;hrt sein.

    <h3>Minikalender</h3>
    <b><code>mini=125</code></b><br>
    Die Breite des Minikalenders wird hier angegeben. Ohne Angabe wird der \"normale\" Kalender angezeigt<br>
    
    <b><code>zeilen=5</code></b><br>
    Anzahl der Zeilen im Minikalender. Der aktuelle Monat wird immer vollst&auml;ndig angezeigt.

    <b><code>link=www.link.de</code></b><br>
    Link f&uuml;r Kalendereintr&auml;g (z.B. auf großen Kalender)

    <h2>Fehler</h2>
    <h3>Fehler der Parameter ov=... ist nicht zul&auml;ssig</h3>
    Um ein Missbrauch der Anwendung f&uuml;r andere Ortsverb&auml;nde zu verhindern, ist die Nutzung auf bestimmte Orsverb&auml;nde in der Anwendung hinterlegt. 
    Bitte informieren Sie den Systemadministrator.<br><br><br>
    " 
$version;

    
/*----------------------------------------------------------------------
    Übergabe-Parameter auslesen
    ----------------------------------------------------------------------*/

    // --- Verschlüsselter Parameter übersetzen ----------------------------
    
if (isset($_GET['send'])) {
        
$sendlink trim($_GET['send']);
        
$sendlink base64_decode($sendlink);
        
$sendlink explode("?",$sendlink);
        
$buf explode("&",$sendlink[1]);
        foreach(
$buf as $key)
        {    
            
$bufvar=explode("=",$key);
            switch (
$bufvar[0]){
                case 
"monate":
                    
$issetMonate trim($bufvar[1]);
                    break;
                case 
"header":
                    
$browserheader trim($bufvar[1]);
                    break;
                case 
"filter":
                    
$issetFilter trim($bufvar[1]);
                    break;
                case 
"gruppe":
                    
$issetGruppe trim($bufvar[1]);
                    break;
                case 
"typ":
                    
$issetTyp trim($bufvar[1]);
                    break;
                case 
"ov":
                    
$issetOrtsverband trim($bufvar[1]);
                    break;
                case 
"datum":
                    
$issetDatum trim($bufvar[1]);
                    break;
                case 
"mini":
                    
$issetMinikalender trim($bufvar[1]);
                    break;
                case 
"zeilen":
                    
$issetMinizeilen trim($bufvar[1]);
                    break;
                case 
"link":
                    
$issetMinilink trim($bufvar[1]);
                    break;
                case 
"kategorie":
                    
$issetKategorie trim($bufvar[1]);
                    break;
                    
                default: 
                    
print_r("Wert >" $bufvar[0] . "< : >" $bufvar[1] . "<<br>\n");
            }
        }
        
    };
    
    
$postUrl "";
    
$postPastUrl "";

    
// --- Filter nach Zeilenfarbe (Kategorie) -----------------------------

    
if(isset($_GET['kategorie'])) {
        
$issetKategorie trim($_GET['kategorie']);
    };
    if(
$issetKategorie){
        
$arrayKategorie explode(",",$issetKategorie);
    };

    
// --- Minikalender Link für Kalendereinträge --------------------------
    
if (isset($_GET['link'])) {
        
$issetMinilink trim($_GET['link']);
    };
    if(!
$issetMinilink)    $issetMinilink=$defaultMiniurl;

    
// --- Minikalender Zeilen lesen ---------------------------------------
    
if (isset($_GET['zeilen'])) {
        
$issetMinizeilen trim($_GET['zeilen']);
    };
    if(!
$issetMinizeilen)    $issetMinizeilen=5;

    
// --- Minikalender aktivieren------------------------------------------
    
if (isset($_GET['mini'])) {
        
$issetMinikalender trim($_GET['mini']);
    };

    
// --- Seitenkopf lesen ------------------------------------------------
    
if (isset($_GET['header'])) {
        
$browserheader trim($_GET['header']);
    };

    
// --- Filter lesen und bearbeiten -------------------------------------
    
if (isset($_GET['filter'])) {
        
$issetFilter trim($_GET['filter']);
    };
    if(
$issetFilter){
        
$postUrl $postUrl "&filter=" $issetFilter;
        
$postPastUrl $postPastUrl "&filter=" $issetFilter;    
    };
    
// --- Gruppe lesen und bearbeiten -------------------------------------
    
if (isset($_GET['gruppe'])) {
        
$issetGruppe trim($_GET['gruppe']);
    };
    if(
$issetGruppe){
        
$postUrl $postUrl "&gruppe=" $issetGruppe;
        
$postPastUrl $postPastUrl "&gruppe=" $issetGruppe;    
    };

    
// --- Type lesen und bearbeiten ---------------------------------------
    
if (isset($_GET['typ'])) {
        
$issetTyp trim($_GET['typ']);
    };
    if(
$issetTyp){
        
$postUrl $postUrl "&typ=" $issetTyp;
        
$postPastUrl $postPastUrl "&typ=" $issetTyp;    
    };

    
// --- Ortsverband lesen und bearbeiten --------------------------------
    
if (isset($_GET['ov'])) {
        
$issetOrtsverband trim($_GET['ov']);
    };

    if(
$issetOrtsverband){
        
$allowed array_search($issetOrtsverband$allowedOrtsverband);
        if(!
is_integer($allowed))
        {
            
print_r("<h1>Fehler: Der Parameter ov=" $issetOrtsverband " ist nicht zul&auml;ssig</h1><br>\n" $sHilfe);
            return;
        };
    }
    else
        
$issetOrtsverband $defaultov;
    

    
// --- Ortsverband lesen und bearbeiten --------------------------------
    
if (isset($_GET['monate'])) {
        
$issetMonate trim($_GET['monate']);
    }
    if(
$issetMonate){
//        print_r("MONATE: ".$issetMonate." <br>\n");
    
}
    else        
        
$issetMonate 12;

    
// --- Ortsverband lesen und bearbeiten --------------------------------
    
if (isset($_GET['datum'])) {
        
$issetDatum trim($_GET['datum']);
    };
    if(
$issetDatum){
        
$issetDateStart strtotime($issetDatum);
    }
    else 
        if (isset(
$_GET['date'])) {
            
$issetDateStart strtotime($_GET['date']);
        }
        else{
            if(
$issetMinikalender)    
                
$issetDateStart mktime(000date('m',time()), date('d',time()),  date('Y',time()));
            else
                
$issetDateStart mktime(000date('m',time()), 1date('Y',time()));
        };

    
/*----------------------------------------------------------------------
    Seitenaufbau initialesieren
    ----------------------------------------------------------------------*/

    
$basenamephp    $_SERVER['PHP_SELF'];

    if(
$issetMinikalender)    
    
$sFormatTabelle "<html><head>
    <meta http-equiv='Content-Type' content='text/html;charset=utf-8' />
        <title> 
            " 
$browserheader "
        </title>
        <style type='text/css'>
            table {
                border=1;
            }
            th {
                text-align:center ; 
                background-color:#08b;
            }
            td.hd {
                text-align:center ; 
                background-color:#efd; 
            }
            td {
                text-align:center ; 
                background-color:#efd; 
                }
            td#grey {
                text-align:center ; 
                background-color:#eee; 
            }
            a {
                font-size: 8pt;
            }
            span.tag, span.tagheute, span.tag_monat  {
                Xborder: 1px solid #666666;
                Xfloat: right;
                Xbackground-color: white;
                font-size: 8pt;
                margin-top: 1px;
            }
            span.tagheute {
                border: 2px solid red;
                color: red;
            }
            span.tag_monat {
                color: grey;
            }
            td.t {
                Xborder: 1px solid #006699;
                text-align: left;
                Xvertical-align: top;
                Xoverflow: hidden;
                Xheight: 70px;
            }
            th.wt {
                font-size: 7pt;
                border: 1px solid #006699;
                color: white;
                background-color:#006699;
            }
            table.kalender {
                border: 2px solid #006699;
                border-collapse: collapse;
                margin-left: 1px;
                table-layout: fixed;
            }
        </style>\n"
;
    else
    
$sFormatTabelle "<html><head>
    <meta http-equiv='Content-Type' content='text/html;charset=utf-8' />
        <title> 
            " 
$browserheader "
        </title>
        <style type='text/css'>
            table {
                border=1;
            }
            th {
                text-align:center ; 
                background-color:#08b;
            }
            td.hd {
                text-align:center ; 
                background-color:#efd; 
            }
            td {
                text-align:center ; 
                background-color:#efd; 
                }
            td#grey {
                text-align:center ; 
                background-color:#eee; 
            }
            a  {
                font-size: 8pt;
            }
            span.tag, span.tagheute, span.tag_monat  {
                border: 1px solid #666666;
                float: right;
                background-color: white;
                font-size: 8pt;
                margin-top: 1px;
            }
            span.tagheute {
                border: 2px solid red;
                color: red;
            }
            span.tag_monat {
                color: grey;
            }
            td.t {
                border: 1px solid #006699;
                text-align: left;
                vertical-align: top;
                overflow: hidden;
                height: 70px;
            }
            th.wt {
                border: 1px solid #006699;
                color: white;
                background-color:#006699;
            }
            table.kalender {
                border: 2px solid #006699;
                border-collapse: collapse;
                margin-left: 1px;
                table-layout: fixed;
            }
        </style>\n"
;

    
$sFormatTabelle $sFormatTabelle ."
        <link href='" 
$hiorgCss "' rel='stylesheet' type='text/css'> 
        <link href='" 
$hiorgCssPrivate "' rel='stylesheet' type='text/css'>
        <script src='" 
$hiorgScript "' type='text/javascript'></script>  
        <script type='text/javascript'>setTimeout('ShowTimeoutWarning();', (25 * 60000) );</script>
    </head>
<BODY>"
;
    
$sFormatTabelle $sFormatTabelle ."        <script type='text/javascript' src='" $tooltipJavascript "'></script>";
    if (
$sideheader <> "")
        
$sFormatTabelle $sFormatTabelle "    <h1> " $sideheader "</h1>";
    
print_r($sFormatTabelle);

    
/*----------------------------------------------------------------------
        Termine aus Webseite in Array kopieren
        ======================================
    ----------------------------------------------------------------------*/
    
$postPastUrl $postPastUrl "&monate=-" $issetMonate "&ov=" $issetOrtsverband;
    
$url_past $url $postPastUrl;
    
$postUrl $postUrl "&monate=" $issetMonate "&ov=" $issetOrtsverband;
    
$url $url $postUrl;

    
$snoopy = new Snoopy;
    
$snoopy->submit($url);
    
$inhalt $snoopy->results;

    
$tbl = new tableExtractor
    
$tbl->source $inhalt;            // Set the HTML Document 
    
$tbl->anchor 'Geplante Termine';    // Set an anchor that is unique and occurs before the Table 
    
$tpl->anchorWithin true;        // To use a unique anchor within the table to be retrieved 
    
$d1 $tbl->extractTable();        // The array

    
$snoopy->submit($url_past);
    
$inhalt $snoopy->results;
    
$tbl = new tableExtractor
    
$tbl->source $inhalt;            // Set the HTML Document 
    
$tbl->anchor 'Geplante Termine';    // Set an anchor that is unique and occurs before the Table 
    
$tpl->anchorWithin true;        // To use a unique anchor within the table to be retrieved 
    
$d2 $tbl->extractTable();        // The array

    
$d array_merge($d1,$d2);
    
/*----------------------------------------------------------------------
        Termin-Tabelle formatieren
        ==========================
    ----------------------------------------------------------------------*/
    
$cellrow=0;
    foreach(
$d as $row) {
        
$cellcol=0;
        foreach(
$row as $cell) {
            switch (
$cellcol) {
                case 
0:
                    
$schedule_color[$cellrow] = trim($cell);
                    break;
                case 
1:
                    
$buf explode(","$cell);
                    
$schedule_day[$cellrow] = trim($buf[0]);
                    
$schedule_date[$cellrow] = strtotime(trim($buf[1]));
                    
$schedule_weekday[$cellrow] = date("w",$schedule_date[$cellrow]);
                    break;
                case 
2:
                    
$buf explode("-"$cell);
                    
$schedule_start[$cellrow] = trim($buf[0]);
                    
$schedule_stop[$cellrow] = trim($buf[1]);
                    break;
                case 
3:
                    
$schedule_where[$cellrow] = $cell;
                    break;
                case 
4:
                    
$schedule_title[$cellrow] = $cell;
                    break;
                case 
5:
                    
$schedule_link[$cellrow] = trim($cell);
                    
$buf explode("a href='"$cell);
                    
$buf explode("'"$buf[1]);
                    
$schedule_href[$cellrow] = str_replace("&amp;","&",trim($buf[0]));
                    
$buf explode("id="$buf[0]);
                    
$buf explode("&"$buf[1]);
                    
$schedule_id[$cellrow] = trim($buf[0]);
                    break;
                default:
                    
print_r("DEFAULT: " $cell "\n");
                    break;
            }
            
$cellcol $cellcol 1;
        }
        
$cellrow $cellrow 1;
    }

    
/*----------------------------------------------------------------------
        Kalender erzeugen
        =================
        ----------------------------------------------------------------------*/
    
$cStart_month date("m",$issetDateStart);
    
$cStart_year date("Y",$issetDateStart);
    
$cStart_weekday date("N",$issetDateStart);

    
$dateCell mktime(000date('m',$issetDateStart),
                
date('d',$issetDateStart)-$cStart_weekday+1date('Y',$issetDateStart)); 
    
$strSchedule "";
    if(!
$issetMinikalender)    {
        
$strSchedule $strSchedule "<table width='100%' border='0'>\n";
        
$strSchedule $strSchedule "    <tr>\n";
        
$strSchedule $strSchedule "        <td style='text-align:left'><h2>";
        
$strSchedule $strSchedule $sMonat[date("n",mktime(000date('m',$issetDateStart),
                        
1date('Y',$issetDateStart)))-1];
        
$strSchedule $strSchedule date(" Y",$issetDateStart);
        
$strSchedule $strSchedule "</h2></td>\n";
        
$strSchedule $strSchedule "        <td style='color:grey;text-align:right;font-size:xx-small'>" $version "</td>\n";
        
$strSchedule $strSchedule "    </tr>\n";
        
$strSchedule $strSchedule "</table>\n";
    };
    if(
$issetMinikalender)    {
        
$strSchedule $strSchedule "<table class='kalender' width='";
        
$strSchedule $strSchedule trim($issetMinikalender);
        
$strSchedule $strSchedule "' border='0' cellspacing='3' cellpadding='5'>\n";
        
$strSchedule $strSchedule "<tr><th class='wt' colspan='7'>";
        
$strSchedule $strSchedule $sMonat[date("n",mktime(000date('m',$issetDateStart),
                    
1date('Y',$issetDateStart)))-1];
        
$strSchedule $strSchedule " " date(" Y",$issetDateStart);
    }
    else
        
$strSchedule $strSchedule "<table class='kalender' width='100%' border='0' cellspacing='3' cellpadding='5'>\n";
    
    
$strSchedule $strSchedule "</th></tr>";
    
$strSchedule $strSchedule "    <tr><th width='14%' class='wt'>Mo</th>\n";
    
$strSchedule $strSchedule "        <th width='14%' class='wt'>Di</th>\n";
    
$strSchedule $strSchedule "        <th width='14%' class='wt'>Mi</th>\n";
    
$strSchedule $strSchedule "        <th width='14%' class='wt'>Do</th>\n";
    
$strSchedule $strSchedule "        <th width='14%' class='wt'>Fr</th>\n";
    
$strSchedule $strSchedule "        <th width='14%' class='wt'>Sa</th>\n";
    
$strSchedule $strSchedule "        <th width='14%' class='wt'>So</th>\n";
    
$strSchedule $strSchedule "    </tr>\n";

    
/*
       --- Alle Tage bis zum Monatsende durchgehen -------------------------
    */
    
$bColA=true;
    
$iZeilenMini=0;
    while(
date("m",$dateCell)<=$cStart_month
        
and date("Y",$dateCell)<=$cStart_year 
        
or date("Y",$dateCell)<$cStart_year
        
or ($issetMinikalender and $iZeilenMini $issetMinizeilen)){
        
$iZeilenMini ++;

        if(
$bColA==true)     {
            
$strSchedule $strSchedule "    <tr class='colA'>\n";
            
$bColA=false;
            if(
$issetMinikalender)    
                
$sColStyle=" style='background-color:#99ccff;'";
            else
                
$sColStyle=" style='background-color:#eee;'";
        }
        else     {
            
$strSchedule $strSchedule "    <tr class='colB'>\n";
            
$bColA=true;
            if(
$issetMinikalender)    
                
$sColStyle=" style='background-color:#99ccff;'";
            else
                
$sColStyle=" style='background-color:#efd;'";
        };

    
/*
       --- Immer Sieben Spalten erzeugen -----------------------------------
    */
        
for($d 0$d 7$d++) {
    
/*
       --- Datumszelle erzeugen START --------------------------------------
    */
            // --- Aktuellen Tag Hervorheben ---------------------------------------
            
if(date("w",$dateCell)==or date("w",$dateCell)==6){
                if(
$issetMinikalender)    
                    
$sColStyle=" style='background-color:#ffff99;'";
                else
                    
$sColStyle=" style='background-color:#ffffdd;'";
            };
            if(
date("d.m.Y",time()) == date("d.m.Y",$dateCell)) {
                
$strSchedule $strSchedule "        <td class='t'" $sColStyle ">";
                
$strSchedule $strSchedule ."<span align='right' class='tagheute'>";
            }
            else
            {    if(
$cStart_month == date("m",$dateCell)) {
                    
$strSchedule $strSchedule "        <td class='t'" .    $sColStyle ">";
                    
$strSchedule $strSchedule ."<span align='right' class='tag'>";
                }    
                else {
                    if(
$issetMinikalender)    
                        
$strSchedule $strSchedule "        <td class='t' style='background-color:white;'>";
                    else
                        
$strSchedule $strSchedule "        <td class='t' style='background-color:grey;'>";
                    
$strSchedule $strSchedule "<span align='right' class='tag_monat'>";
                };
            };
            
// --- Jeden Termin am Tag ausgeben ------------------------------------
            
if($issetMinikalender)    {
                
$sHrefContens "";
                foreach (
$schedule_day as $key => $value) {
                    if(!
strcmp($schedule_date[$key], $dateCell)) {
                        
$sHrefContens $sHrefContens "<li> ";
                        
$sHrefContens $sHrefContens "<b>" $schedule_start[$key] . "</b><br>";
                        
$sHrefContens $sHrefContens $schedule_title[$key] . "<br>";
                        
$sHrefContens $sHrefContens "Ort: " $schedule_where[$key] . "</li>";
                    };
                };
                if(
$sHrefContens) {
                    
$strSchedule $strSchedule "<a href='";
                    
$strSchedule $strSchedule $issetMinilink;
                    
$strSchedule $strSchedule "' target='_blank' ";
                    
$strSchedule $strSchedule " onmouseover=\"Tip('";
                    
$strSchedule $strSchedule "<ul>" $sHrefContens "</ul>',";
    
//                $strSchedule = $strSchedule . "OPACITY, 80, ";    // Durchsichtig
                    
$strSchedule $strSchedule "WIDTH, 150, ";
                    
$strSchedule $strSchedule "OFFSETX, -200, ";
                    
$strSchedule $strSchedule "SHADOW, false, ";
                    
$strSchedule $strSchedule "PADDING, 0,";
                    
$strSchedule $strSchedule "TITLEBGCOLOR, '#0072BC',";
                    
$strSchedule $strSchedule "BORDERCOLOR,'#0072BC',";
                    
$strSchedule $strSchedule "BGCOLOR,'#EBF2F5'";
                    
$strSchedule $strSchedule ")\" onmouseout='UnTip()'";
                    
$strSchedule $strSchedule ">";
                    
$strSchedule $strSchedule "<b>";
                };
                
$strSchedule $strSchedule date('d',$dateCell);
                if(
$sHrefContens
                    
$strSchedule $strSchedule "</b></a>";
                    
$strSchedule $strSchedule '</span><br>';
            }
            else {
                
$strSchedule $strSchedule date('d',$dateCell) ;
                
$strSchedule $strSchedule '</span><br>';
                foreach (
$schedule_day as $key => $value) {
                    if(!
strcmp($schedule_date[$key], $dateCell)) {
                        
$buf explode(" "$schedule_title[$key]);
                        
$strSchedule $strSchedule "<a target='_blank' ";
                        
$strSchedule $strSchedule "class='" $schedule_color[$key] . "' ";
                        
$strSchedule $strSchedule "title='";
                        
$strSchedule $strSchedule $schedule_start[$key];
                        
$strSchedule $strSchedule " | " $schedule_title[$key];
                        
$strSchedule $strSchedule " | " $schedule_where[$key];
                        
$strSchedule $strSchedule "' ";
                        
$strSchedule $strSchedule "href='" $schedule_href[$key] . "' ";
                        
$strSchedule $strSchedule " onmouseover=\"Tip('";
                        
$strSchedule $strSchedule "<ul>";
                        
$strSchedule $strSchedule "<b>" $schedule_title[$key] . "</b><br>";
                        if(
$schedule_stop[$key]==""){
                            
$strSchedule $strSchedule $schedule_start[$key] . " Uhr <br>";
                        }else {
                            
$strSchedule $strSchedule $schedule_start[$key] . " - ";
                            
$strSchedule $strSchedule $schedule_stop[$key] . " Uhr <br>";
                        };
                        
$strSchedule $strSchedule "Ort: " $schedule_where[$key] . "";
                        
$strSchedule $strSchedule "</ul>',";
    
//                    $strSchedule = $strSchedule . "OPACITY, 80, ";    // Durchsichtig
    //                    $strSchedule = $strSchedule . "TITLE, 'Test', ";
                        
$strSchedule $strSchedule "WIDTH, 250, ";
                        
$strSchedule $strSchedule "OFFSETX, 0, ";
                        
$strSchedule $strSchedule "SHADOW, false, ";
                        
$strSchedule $strSchedule "PADDING, 0,";
                        
$strSchedule $strSchedule "TITLEBGCOLOR, '#0072BC',";
                        
$strSchedule $strSchedule "BORDERCOLOR,'#0072BC',";
                        
$strSchedule $strSchedule "BGCOLOR,'#EBF2F5'";
                        
$strSchedule $strSchedule ")\" onmouseout='UnTip()'";
                        
                        
$strSchedule $strSchedule ">";
                        
$strSchedule $strSchedule "<b>" $schedule_start[$key] . "";
                        
$strSchedule $strSchedule "</b> " $buf[0] . "<br>";
                        
$strSchedule $strSchedule "</a>";
                    };
                };
            };

            
$strSchedule $strSchedule "</td>\n";
    
/*
       --- Datumszelle erzeugen ENDE ---------------------------------------
    */
            
$dateCell mktime(000date('m',$dateCell),
                
date('d',$dateCell)+1date('Y',$dateCell));
        };
        
$strSchedule $strSchedule "    </tr>\n";
    };
    
$strSchedule $strSchedule "</table>\n";
    
/*
       --- Vor und Zurück gehen --------------------------------------------
    */
    
if(!$issetMinikalender)    {
        
$strSchedule $strSchedule "<table width='100%' border='0' cellspacing='3' cellpadding='5'>\n";
        
$strSchedule $strSchedule "    <tr>\n";

        
// Rückwärts springen
        
$sendlink "?datum=";
        
$sendlink  $sendlink date("d.m.Y",mktime(000date('m',$issetDateStart)-11date('Y',$issetDateStart)));
        
$sendlink  $sendlink $postUrl ;

        
$strSchedule $strSchedule "        <td width='14%' align='center'><a href=?send='".base64_encode($sendlink)."'><<<br>";
        
$strSchedule $strSchedule $sMonat[date("n",mktime(000date('m',$issetDateStart)-1,
                        
1date('Y',$issetDateStart)))-1];
        
$strSchedule $strSchedule date(" Y",mktime(000date('m',$issetDateStart)-1,
                    
1date('Y',$issetDateStart)));
        
$strSchedule $strSchedule "</a></td>\n";
        
$strSchedule $strSchedule "        <td width='14%' align=''></td>\n";
        
$strSchedule $strSchedule "        <td width='14%' align=''></td>\n";

        
// auf Heute springen
        
$sendlink "?datum=";
        
$sendlink  $sendlink .  date("d.m.Y",mktime(000date('m',time()), 1date('Y',time())));
        
$sendlink  $sendlink $postUrl ;

        
$strSchedule $strSchedule "        <td width='14%' align='center'><a href=?send='".base64_encode($sendlink)."'>";
        
$strSchedule $strSchedule "<br>Heute";
        
$strSchedule $strSchedule "</a></td>\n";
        
$strSchedule $strSchedule "        <td width='14%' align=''></td>\n";
        
$strSchedule $strSchedule "        <td width='14%' align=''></td>\n";

        
// Vorwärts springen
        
$sendlink "?datum=";
        
$sendlink  $sendlink .  date("d.m.Y",mktime(000date('m',$issetDateStart)+11date('Y',$issetDateStart)));    
        
$sendlink  $sendlink $postUrl ;
        
$strSchedule $strSchedule "        <td width='14%' align='center'><a href=?send='".base64_encode($sendlink)."'>>><br>";
        
$strSchedule $strSchedule $sMonat[date("n",mktime(000date('m',$issetDateStart)+1,
                        
1date('Y',$issetDateStart)))-1];
        
$strSchedule $strSchedule date(" Y",mktime(000date('m',$issetDateStart)+1,
                    
1date('Y',$issetDateStart)));
        
$strSchedule $strSchedule "        </a></td>\n";
        
$strSchedule $strSchedule "    </tr>\n";
        
$strSchedule $strSchedule "</table>\n";
        if (
$disclaimer<>"")
            
$strSchedule $strSchedule "<p style='color:grey;font-size=xx-small;text-align:center'>" $disclaimer "</p>";
    };
    
print_r($strSchedule);
    
print_r"</body>");
    
print_r"</html>");

function 
hex2bin($h)
{
    if (!
is_string($h)) return null;
    
$r='';
    for (
$a=0$a<strlen($h); $a+=2) { $r.=chr(hexdec($h{$a}.$h{($a+1)})); }
    return 
$r;
};
/*----------------------------------------------------------------------
        Table Extractor
        ===============
        Table extractor is a php class that can extract almost any table
        from any html document/page, and then convert that html table into
        a php array.
        
        Version 1.3
        Compatibility: PHP 4.4.1 +
        Copyright Jack Sleight - www.reallyshiny.com
        This script is licensed under the Creative Commons License.
    ----------------------------------------------------------------------*/
 
    
class tableExtractor {
    
        var 
$source            NULL;
        var 
$anchor            NULL;
        var 
$anchorWithin    false;
        var 
$headerRow        true;
        var 
$startRow        0;
        var 
$maxRows        0;
        var 
$startCol        0;
        var 
$maxCols        0;
        var 
$stripTags        false;
        var 
$extraCols        = array();
        var 
$rowCount        0;
        var 
$dropRows        NULL;
        
        var 
$cleanHTML        NULL;
        var 
$rawArray        NULL;
        var 
$finalArray        NULL;
        
        function 
extractTable() {
        
            
$this->cleanHTML();
            
$this->prepareArray();
            
            return 
$this->createArray();
            
        }
    
        function 
cleanHTML() {
        
            
// php 4 compatibility functions
            
if(!function_exists('stripos')) {
                function 
stripos($haystack,$needle,$offset 0) {
                   return(
strpos(strtolower($haystack),strtolower($needle),$offset));
                }
            }
                        
            
// find unique string that appears before the table you want to extract
            
if ($this->anchorWithin) {
                
/*------------------------------------------------------------
                    With thanks to Khary Sharp for suggesting and writing
                    the anchor within functionality.
                ------------------------------------------------------------*/                
                
$anchorPos stripos($this->source$this->anchor) + strlen($this->anchor);
                
$sourceSnippet strrev(substr($this->source0$anchorPos));
                
$tablePos stripos($sourceSnippetstrrev(("<table"))) + 6;
                
$startSearch strlen($sourceSnippet) - $tablePos;
            }                       
            else {
                
$startSearch stripos($this->source$this->anchor);
            }
        
            
// extract table
            
$startTable stripos($this->source'<table'$startSearch);
            
$endTable stripos($this->source'</table>'$startTable) + 8;
            
$table substr($this->source$startTable$endTable $startTable);
        
            if(!
function_exists('lcase_tags')) {
                function 
lcase_tags($input) {
                    return 
strtolower($input[0]);
                }
            }
            
            
// lowercase all table related tags
            
$table preg_replace_callback('/<(\/?)(table|tr|th|td)/is''lcase_tags'$table);
            
            
// remove all thead and tbody tags
            
$table preg_replace('/<\/?(thead|tbody).*?>/is'''$table);
            
            
// replace th tags with td tags
            
$table preg_replace('/<(\/?)th(.*?)>/is''<$1td$2>'$table);
                                    
            
// clean string
            
$table trim($table);
            
$table str_replace("\r\n"""$table); 
                            
            
$this->cleanHTML $table;
        
        }
        
        function 
prepareArray() {
        
            
// split table into individual elements
            
$pattern '/(<\/?(?:tr|td).*?>)/is';
            
$table preg_split($pattern$this->cleanHTML, -1PREG_SPLIT_DELIM_CAPTURE);    
 
            
// define array for new table
            
$tableCleaned = array();
            
            
// define variables for looping through table
            
$rowCount 0;
            
$colCount 1;
            
$trOpen false;
            
$tdOpen false;
            
            
// loop through table
            
foreach($table as $item) {
            
                
// trim item
                // $item = str_replace(' ', '', $item);
                
$item trim($item);
                
                
// save the item
                
$itemUnedited $item;
                
                
// clean if tag                                    
                
$item preg_replace('/<(\/?)(table|tr|td).*?>/is''<$1$2>'$item);
 
                
// pick item type
                
switch ($item) {
                    
 
                    case 
'<tr>':
                        
// start a new row
                        
$rowCount++;
                        
$colCount 1;
                        
$trOpen true;
                        
// von ASR angepasst. Style-Klasse herausfiltern und Spalte um eins erhöhen
                        
$itemclass preg_replace("/<tr class='/""$1"$itemUnedited);
                        
$itemclass preg_replace("/'>/""$1"$itemclass);
                        
$tableCleaned[$rowCount][$colCount]=$itemclass;
                        
$colCount++;
                        break;
                        
                    case 
'<td>':
                        
// save the td tag for later use
                        
$tdTag $itemUnedited;
                        
$tdOpen true;
                        break;
                        
                    case 
'</td>':
                        
$tdOpen false;
                        break;
                        
                    case 
'</tr>':
                        
$trOpen false;
                        break;
                        
                    default :
                    
                        
// if a TD tag is open
                        
if($tdOpen) {
                        
                            
// check if td tag contained colspan                                            
                            
if(preg_match('/<td [^>]*colspan\s*=\s*(?:\'|")?\s*([0-9]+)[^>]*>/is'$tdTag$matches))
                                
$colspan $matches[1];
                            else
                                
$colspan 1;
                                                    
                            
// check if td tag contained rowspan
                            
if(preg_match('/<td [^>]*rowspan\s*=\s*(?:\'|")?\s*([0-9]+)[^>]*>/is'$tdTag$matches))
                                
$rowspan $matches[1];
                            else
                                
$rowspan 0;
                                
                            
// loop over the colspans
                            
for($c 0$c $colspan$c++) {
                                                    
                                
// if the item data has not already been defined by a rowspan loop, set it
                                
if(!isset($tableCleaned[$rowCount][$colCount]))
                                    
$tableCleaned[$rowCount][$colCount] = $item;
                                else
                                    
$tableCleaned[$rowCount][$colCount 1] = $item;
                                    
                                
// create new rowCount variable for looping through rowspans
                                
$futureRows $rowCount;
                                
                                
// loop through row spans
                                
for($r 1$r $rowspan$r++) {
                                    
$futureRows++;                                    
                                    if(
$colspan 1)
                                        
$tableCleaned[$futureRows][$colCount 1] = $item;
                                    else                    
                                        
$tableCleaned[$futureRows][$colCount] = $item;
                                }
    
                                
// increase column count
                                
$colCount++;
                            
                            }
                            
                            
// sort the row array by the column keys (as inserting rowspans screws up the order)
                            
ksort($tableCleaned[$rowCount]);
                        }
                        break;
                }    
            }
            
// set row count
            
if($this->headerRow)
                
$this->rowCount    count($tableCleaned) - 1;
            else
                
$this->rowCount    count($tableCleaned);
            
            
$this->rawArray $tableCleaned;
            
        }
        
        function 
createArray() {
            
            
// define array to store table data
            
$tableData = array();
            
            
// get column headers
            
if($this->headerRow) {
            
                
// trim string
                
$row $this->rawArray[$this->headerRow];
                            
                
// set column names array
                
$columnNames = array();
                
$uniqueNames = array();
                        
                
// loop over column names
                
$colCount 0;
                foreach(
$row as $cell) {
                                
                    
$colCount++;
                    
                    
$cell strip_tags($cell);
                    
$cell trim($cell);
                    
                    
// save name if there is one, otherwise save index
                    
if($cell) {
                    
                        if(isset(
$uniqueNames[$cell])) {
                            
$uniqueNames[$cell]++;
                            
$cell .= ' ('.($uniqueNames[$cell] + 1).')';    
                        }            
                        else {
                            
$uniqueNames[$cell] = 0;
                        }
 
                        
$columnNames[$colCount] = $cell;
                        
                    }                        
                    else
                        
$columnNames[$colCount] = $colCount;
                    
                }
                
                
// remove the headers row from the table
                
unset($this->rawArray[$this->headerRow]);
            
            }
            
            
// remove rows to drop
            
foreach(explode(','$this->dropRows) as $key => $value) {
                unset(
$this->rawArray[$value]);
            }
                                
            
// set the end row
            
if($this->maxRows)
                
$endRow $this->startRow $this->maxRows 1;
            else
                
$endRow count($this->rawArray);
                
            
// loop over row array
            
$rowCount 0;
            
$newRowCount 0;                            
            foreach(
$this->rawArray as $row) {
            
                
$rowCount++;
                
                
// if the row was requested then add it
                
if($rowCount >= $this->startRow && $rowCount <= $endRow) {
                
                    
$newRowCount++;
                                    
                    
// create new array to store data
                    
$tableData[$newRowCount] = array();
                    
                    
//$tableData[$newRowCount]['origRow'] = $rowCount;
                    //$tableData[$newRowCount]['data'] = array();
                    
$tableData[$newRowCount] = array();
                    
                    
// set the end column
                    
if($this->maxCols)
                        
$endCol $this->startCol $this->maxCols 1;
                    else
                        
$endCol count($row);
                    
                    
// loop over cell array
                    
$colCount 0;
                    
$newColCount 0;                                
                    foreach(
$row as $cell) {
                    
                        
$colCount++;
                        
                        
// if the column was requested then add it
                        
if($colCount >= $this->startCol && $colCount <= $endCol) {
                    
                            
$newColCount++;
                            
                            if(
$this->extraCols) {
                                foreach(
$this->extraCols as $extraColumn) {
                                    if(
$extraColumn['column'] == $colCount) {
                                        if(
preg_match($extraColumn['regex'], $cell$matches)) {
                                            if(
is_array($extraColumn['names'])) {
                                                
$this->extraColsCount 0;
                                                foreach(
$extraColumn['names'] as $extraColumnSub) {
                                                    
$this->extraColsCount++;
                                                    
$tableData[$newRowCount][$extraColumnSub] = $matches[$this->extraColsCount];
                                                }                                        
                                            } else {
                                                
$tableData[$newRowCount][$extraColumn['names']] = $matches[1];
                                            }
                                        } else {
                                            
$this->extraColsCount 0;
                                            if(
is_array($extraColumn['names'])) {
                                                
$this->extraColsCount 0;
                                                foreach(
$extraColumn['names'] as $extraColumnSub) {
                                                    
$this->extraColsCount++;
                                                    
$tableData[$newRowCount][$extraColumnSub] = '';
                                                }                                        
                                            } else {
                                                
$tableData[$newRowCount][$extraColumn['names']] = '';
                                            }
                                        }
                                    }
                                }
                            }
                            
                            if(
$this->stripTags)        
                                
$cell strip_tags($cell);
                            
                            
// set the column key as the column number
                            
$colKey $newColCount;
                            
                            
// if there is a table header, use the column name as the key
                            
if($this->headerRow)
                                if(isset(
$columnNames[$colCount]))
                                    
$colKey $columnNames[$colCount];
                            
                            
// add the data to the array
                            //$tableData[$newRowCount]['data'][$colKey] = $cell;
                            
$tableData[$newRowCount][$colKey] = $cell;
                        }
                    }
                }
            }
                    
            
$this->finalArray $tableData;
            return 
$tableData;
        }    
    }
?>

Geändert von arne.bonn (08.12.2010 um 16:58 Uhr).
arne.bonn ist offline   Mit Zitat antworten
Sponsor Mitteilung
PHP Code Flüsterer

Registriert seit: 21.08.2005
Beiträge: 4682
PHP-Kenntnisse:
Fortgeschritten

Antwort


Themen-Optionen
Thema bewerten
Thema bewerten:

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are an
Gehe zu

Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
VisualSVN Server und PHP5 Frederic_S Server, Hosting und Workstations 12 18.11.2010 17:50
Per PHP eine XML Datei erzeugen und lokal auf dem Server speichern Danska PHP Tipps 2009 6 09.08.2009 13:32
Wireshark SSL Handshake debugging-Handshake protokoll mittels PHP + Curl brian johnson Off-Topic Diskussionen 0 06.11.2008 11:54
Mysql startet unter Debian nach Update nicht mehr namlit Server, Hosting und Workstations 4 05.08.2008 15:49
Suche Tipps für Persormance-Steigerung (Geld für Nützliches) Beitragsarchiv 18 16.08.2005 10:57

Besucher kamen über folgende Suchanfragen bei Google auf diese Seite
hiorg server, http. hiorg-server.de, hiorg-server.de, typo3 hiorg, www.starttalbe.de, hiorg termine html, hiorg server kalender, hiorg server typo3, www.mini.hiorg-server.de, hiorg-server typo3, hiorg server kalender abo, öffentlicher kalender übersicht, http://ovfr.hiorg-server.de, kalender eigener server php, www.hiorg-server -mühldorf, kalendereintrag mit skript erzeugen, hiorg server meinungen, hiorgserver scripte kalender, hiorg server stylesheet, termine vom hiorg server auf homepage einbinden mit html code

Alle Zeitangaben in WEZ +2. Es ist jetzt 01:17 Uhr.




Powered by vBulletin® Version 3.7.2 (Deutsch)
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Aprilia-Forum, Aquaristik-Forum, Liebeskummer-Forum, Zierfisch-Forum, Geizkragen-Forum