oSystem=&$oSystem; $this->msTPLPath=CURRDIR."apps/calendar/tpl/"; $this->gsInit(); } function gasGetDaten() { } function msGetCurrent() { return CDateTime::msGetMonat($this->InitMonat)." ".$this->InitJahr; } function gsGetNextDatum() { $lMonat=$this->InitMonat; $lJahr=$this->InitJahr; $lMonat++; if($lMonat>12) { $lMonat=1; $lJahr=$this->InitJahr+1; } $sValue="x.".$lMonat.".".$lJahr; $sURL=$this->oSystem->oSiteNavi->gsGetURL("Calendar",array(),"calendar")."?Value=".$sValue."&Target=".$this->msTarget; $sShow=CDateTime::msGetMonat($lMonat)." ".$lJahr; $sButton=$this->oSystem->oUI->gsGetAnchor("",$sURL,$sShow); return $sButton; } function gsGetPrevDatum() { $lMonat=$this->InitMonat; $lJahr=$this->InitJahr; $lMonat--; if($lMonat<1) { $lMonat=12; $lJahr=$this->InitJahr-1; } $sValue="x.".$lMonat.".".$lJahr; if($this->bPast===false && mktime(12,12,12,$lMonat,1,$lJahr)oSystem->oSiteNavi->gsGetURL("Calendar",array(),"calendar")."?Value=".$sValue."&Target=".$this->msTarget; $sShow=CDateTime::msGetMonat($lMonat)." ".$lJahr; $sButton=$this->oSystem->oUI->gsGetAnchor("",$sURL,$sShow); return $sButton; } function gasGetTage() { $bCheck=true; if($this->InitTag=="x") { $bCheck=false; } $lDatum=mktime(12,12,12,$this->InitMonat,1,$this->InitJahr); $lAnzahlTage=date("t",$lDatum); for($i=1;$i<=$lAnzahlTage;$i++) { $lTimeStamp=mktime(12,12,12,$this->InitMonat,$i,$this->InitJahr); $lDayOfWeek=$this->setOneToSeven(date("w",$lTimeStamp)); $sKey=$this->gsGetArrayKey($lDayOfWeek); $asPush[$sKey]=$i; if($_SESSION["calendar"]["currents"]==date("dmY",$lTimeStamp)) { $asPush[$sKey."BG"]="#00EE00"; } $asPush[$sKey."DA"]=date("d.m.Y",$lTimeStamp); if($lDayOfWeek==7) { $asReturn[]=$this->correct($asPush); $asPush=array();; } } if(sizeof($asPush)>0) $asReturn[]=$this->correct($asPush); return $asReturn; // } function setOneToSeven($lTag) { if($lTag==0) return 7; return $lTag; } function correct($asPush) { if(!isset($asPush["MO"])) {$asPush["MO"]="";$asPush["MODA"]="";} if(!isset($asPush["DI"])) {$asPush["DI"]="";$asPush["DIDA"]="";} if(!isset($asPush["MI"])) {$asPush["MI"]="";$asPush["MIDA"]="";} if(!isset($asPush["DO"])) {$asPush["DO"]="";$asPush["DODA"]="";} if(!isset($asPush["FR"])) {$asPush["FR"]="";$asPush["FRDA"]="";} if(!isset($asPush["SA"])) {$asPush["SA"]="";$asPush["SADA"]="";} if(!isset($asPush["SO"])) {$asPush["SO"]="";$asPush["SODA"]="";} if(!isset($asPush["MOBG"])) {$asPush["MOBG"]="white";} if(!isset($asPush["DIBG"])) {$asPush["DIBG"]="white";} if(!isset($asPush["MIBG"])) {$asPush["MIBG"]="white";} if(!isset($asPush["DOBG"])) {$asPush["DOBG"]="white";} if(!isset($asPush["FRBG"])) {$asPush["FRBG"]="white";} if(!isset($asPush["SABG"])) {$asPush["SABG"]="white";} if(!isset($asPush["SOBG"])) {$asPush["SOBG"]="white";} return $asPush; } function gsGetArrayKey($lTag) { switch($lTag) { case 1: return "MO"; case 2: return "DI"; case 3: return "MI"; case 4: return "DO"; case 5: return "FR"; case 6: return "SA"; case 7: return "SO"; } } function gsRender($sClass,$asParams) { $sClass=strtolower($sClass); switch($sClass) { default: $this->bPast=false; break; case "past": $this->bPast=true; break; } if($sTarget=$this->oSystem->oClientData->gvGetVariable("Target",false)) { $this->msTarget=$sTarget; $oTPL=$this->oSystem->goGetTPLParser($this->msTPLPath."calendar.tpl"); $oTPL->gbSetValue("TARGETID",$this->msTarget); $oTPL->gbSetValue("CURRENT",$this->msGetCurrent()); $oTPL->gbSetValue("NEXT",$this->gsGetNextDatum()); $oTPL->gbSetValue("PREV",$this->gsGetPrevDatum()); $oTPL->gbSetValue("CLOSE",$this->oSystem->oUI->gsGetAnchor("javascript:self.close()","#","Kalender schließen")); $oTPL->gbSetBlock("daten",$this->gasGetTage()); return $oTPL->gsParse(); } return "okx "; } function gsInit() { $this->InitTag=date("d"); $this->InitMonat=date("m"); $this->InitJahr=date("Y"); if($sCurrentDatum=$this->oSystem->oClientData->gvGetVariable("Value",false)) { $asCurrentDatum=explode(".",$sCurrentDatum); if(sizeof($asCurrentDatum)==3) { $this->InitTag=$asCurrentDatum[0]; $this->InitMonat=$asCurrentDatum[1]; $this->InitJahr=$asCurrentDatum[2]; if($this->InitTag!="x") { $_SESSION["calendar"]["currents"]=date("dmY",mktime(12,12,12,$this->InitMonat,$this->InitTag,$this->InitJahr)); } } } } }