Documentation TYPO3 par Ameos

calendar.inc

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *  
00005 *  (c) 1999-2004 Kasper Skaarhoj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is 
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 * 
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license 
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 * 
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00038 $content="";
00039 
00040 // *************************************
00041 // *** getting configuration values:
00042 // *************************************
00043 
00044                 // getting configuration values:
00045         $config["pid_list"] = trim($this->stdWrap($conf["pid_list"],$conf["pid_list."]));
00046         $config["pid_list"] = $config[pid_list] ? $config["pid_list"] : $GLOBALS["TSFE"]->id;
00047 
00048         $config["recursive"] = $this->stdWrap($conf["recursive"],$conf["recursive."]);
00049 
00050         $config["font"] = $this->stdWrap($conf["fontFace"],$conf["fontFace."]);
00051         $config["font"] = $config["font"] ? $config["font"] : "verdana";
00052 
00053                 // If the current record should be displayed.
00054         $config["displayCurrentRecord"] = $conf["displayCurrentRecord"];
00055 
00056         
00057         $templateCode = $this->fileResource($conf["templateFile"]);
00058 
00059                 // Fetching catagories:
00060         $categories = Array();
00061         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_calender_cat', '1=1'.$this->enableFields('tt_calender_cat'));
00062         while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))       {
00063                 $categories[$row['uid']] = $row['title'];
00064         }       
00065 
00066         
00067                 // making query:
00068         $selectConf = Array();
00069         if ($config[recursive]) {               // get pid-list if recursivity is enabled
00070                 $pid_list_arr = explode(",",$config[pid_list]);
00071                 $orig_pids = $config[pid_list];
00072                 $config[pid_list]="";
00073                 while(list(,$val)=each($pid_list_arr))  {
00074                         $config[pid_list].=$this->getTreeList($val,intval($config["recursive"]));
00075                 }
00076                 $config[pid_list].=$orig_pids;
00077         }
00078         $selectConf["pidInList"] = $config[pid_list];
00079         $selectConf["orderBy"] = "date,time";
00080         $selectConf["where"] = "type=0";
00081         if (intval($conf["maxAge"]))    {
00082                 $selectConf["where"].= " AND date>".(time()-(3600*24*intval($conf["maxAge"])));
00083         }
00084 
00085                 // performing query:
00086         $res = $this->exec_getQuery("tt_calender",$selectConf);
00087         
00088                 // traversing the data.
00089         $tableRows = "";
00090         $day_base = mktime (0,0,0,date("m"),date("d"),date("Y"));
00091 
00092                 // config af template:
00093         $tConf["template"] ="HTML";
00094         $tConf["template."]["value"] = $templateCode;
00095         
00096         while($config["displayCurrentRecord"] || $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))    {
00097                 if ($config["displayCurrentRecord"])    {$row = $this->data;}
00098                         // Insering date header:                        
00099                 $tConf["workOnSubpart"] = "DATE_HEADER";
00100                 $tConf["marks."] = Array ();
00101                 $tConf["marks."]["DATE"]="HTML";
00102                 $tConf["marks."]["DATE."]["value"]=date("d/m Y",$row[date]);
00103                 $tConf["marks."]["HEADER"]="HTML";
00104                 $tConf["marks."]["HEADER."]["value"]=$row[title];
00105                 $tConf["marks."]["FONT"]="HTML";
00106                 $tConf["marks."]["FONT."]["value"]=$config[font];
00107                 $tableRows.=$this->TEMPLATE($tConf);
00108 
00109                 
00110                 $parts = explode(chr(10)."---".chr(10), str_replace(chr(13),"",$row[note]));
00111                 while(list(,$pcon)=each($parts))        {
00112                         $pcon=trim($pcon);
00113                         $pcon_arr=split(chr(10),$pcon,2);
00114                         $theTime = "";
00115 
00116                         $hP=explode(" ",$pcon_arr[0],2);
00117                         if (ereg("[^0-9,.:;-]",$hP[0])) {
00118                                 $title = trim($pcon_arr[0]);
00119                         } else {
00120                                 $title = trim($hP[1]);
00121                                 $theTime = trim($hP[0]);
00122                         }
00123                         if ($conf["parseFunc."]) {
00124                                 $title = $this->parseFunc($title,$conf["parseFunc."]);
00125                                 $pcon_arr[1] = $this->parseFunc($pcon_arr[1],$conf["parseFunc."]);
00126                         }
00127                         $theContent = "<b>".$title."</b><BR>".nl2br($pcon_arr[1]);
00128 
00129                                 // Insering date header:                        
00130                         $tConf["workOnSubpart"] = "DATE_CONTENT";
00131                         $tConf["marks."] = Array ();
00132                         $tConf["marks."]["TIME"]="HTML";
00133                         $tConf["marks."]["TIME."]["value"]= $theTime;
00134                         $tConf["marks."]["CONTENT"]="HTML";
00135                         $tConf["marks."]["CONTENT."]["value"]=$theContent;
00136                         $tConf["marks."]["FONT"]="HTML";
00137                         $tConf["marks."]["FONT."]["value"]=$config[font];
00138                         $tableRows.=$this->TEMPLATE($tConf);
00139         
00140                 }
00141 
00142                 $this->lastChanged($row[tstamp]);
00143 
00144                 if ($config["displayCurrentRecord"])    {break;}        // Must exit forcibly or we'll have an eternal loop.
00145         }
00146 
00147         $tConf["workOnSubpart"] = "TEMPLATE_CALENDAR";
00148         $tConf["marks."] = Array ();
00149         $tConf["subparts."] = Array ();
00150         $tConf["subparts."]["TABLE_CONTENT"]="HTML";
00151         $tConf["subparts."]["TABLE_CONTENT."]["value"]= $tableRows;
00152 
00153 
00154         $content = $this->TEMPLATE($tConf);
00155 
00156 
00157 $RESTORE_OLD_DATA = 1;          // secures a restore of the original ->data-array
00158 
00159 ?>


Généré par Le spécialiste TYPO3 avec  doxygen 1.4.6