oSystem=&$oSystem; $this->msTPLPath=CURRDIR."apps/einstellungen/verbindungen/tpl/"; $this->mlUserPK=$this->oSystem->oUser->oUserData->UserPK; } function gsRender($asParams) { $oTPL=$this->oSystem->goGetTPLParser($this->msTPLPath."main.tpl"); $oTPL->gbSetValue("menu",$this->gsGetMenu($asParams[0]==""?"Uebersicht":$asParams[0])); $oTPL->gbSetValue("content",$this->msGetContent($asParams)); return $oTPL->gsParse(); } function msGetContent($asParams) { if(is_array($asParams)) $sAction=strtolower(array_shift($asParams)); switch($sAction) { default: case "uebersicht": return $this->msUebersicht($asParams); case "neueverbindung": return $this->msAddVerbdindung($asParams); case "dachverbaende": return $this->msDV($asParams); } } function msUebersicht($asParams) { if(is_array($asParams)) $sAction=strtolower(array_shift($asParams)); switch($sAction) { default: return $this->msViewAll($asParams); case "bearbeiten": return $this->msEdit($asParams); case "speichern": return $this->msUpdate($asParams); } } function msUpdate($asParams) { $lVerbindungsPK=$_SESSION["einstellungen"]["verbindungen"]["VerbindungsPK"]; if($lVerbindungsPK!="") if($asData=$this->oSystem->oClientData->gvGetVariable("__data",false)) { $asInsert["OrgName"]=$this->oSystem->oDB->gsEscapeString($asData["OrgName"]); $asInsert["OrgShort"]=$this->oSystem->oDB->gsEscapeString($asData["OrgShort"]); $asInsert["Universitaet"]=$this->oSystem->oDB->gsEscapeString($asData["Universitaet"]); $asInsert["DachVerband"]=$this->oSystem->oDB->gsEscapeString($asData["DachVerband"]); $asInsert["Strasse"]=$this->oSystem->oDB->gsEscapeString($asData["Strasse"]); $asInsert["Hausnummer"]=$this->oSystem->oDB->gsEscapeString($asData["Hausnummer"]); $asInsert["PLZ"]=$this->oSystem->oDB->gsEscapeString($asData["PLZ"]); $asInsert["Ort"]=$this->oSystem->oDB->gsEscapeString($asData["Ort"]); $asInsert["Bundesland"]=$this->oSystem->oDB->gsEscapeString($asData["Bundesland"]); $asInsert["StaatPK"]=$this->oSystem->oDB->gsEscapeString($asData["StaatPK"]); $asInsert["EMail"]=$this->oSystem->oDB->gsEscapeString($asData["EMail"]); $asInsert["Telefon"]=$this->oSystem->oDB->gsEscapeString($asData["Telefon"]); $asInsert["Fax"]=$this->oSystem->oDB->gsEscapeString($asData["Fax"]); $asInsert["WebSite"]=$this->oSystem->oDB->gsEscapeString($asData["WebSite"]); $asInsert["GruendungsDatum"]=$this->oSystem->oDB->gsEscapeString($asData["GruendungsDatum"]); $asInsert["EintrittsJahr"]=$this->oSystem->oDB->gsEscapeString($asData["EintrittsJahr"]); $asInsert["ModifyDate"]="now()"; $asInsert["Modifier"]=$this->mlUserPK; if($this->oSystem->oDB->goUpdateArray("tdVerbindungen",$asInsert,"VerbindungsPK=".$lVerbindungsPK)) { return "gespeichert"; } } return "fehler"; } function msEdit($asParams) { if($lVerbindungsPK=$this->oSystem->oClientData->gvGetVariable("VerbindungsPK",false)) { $_SESSION["einstellungen"]["verbindungen"]["VerbindungsPK"]=$lVerbindungsPK; if($asV=$this->oSystem->oDB->gasGetRecord("tdVerbindungen","VerbindungsPK=".$lVerbindungsPK)) { $asData=$this->oSystem->oDBStore->gasGetStaatenSelectData($asV["StaatPK"]); $asV["Staat"]=$this->oSystem->oUI->gsGetSelectBox($asData,"__data[StaatPK]",array("class"=>"transpSelect","style"=>"width:150")); $oR=$this->oSystem->oDB->goQuery("SELECT Short as Anzeige,KeyShort as Value,IF('".$asV["DachVerband"]."'=Short,'selected','') as PreSelected FROM tdDachverbaende ORDER BY Short"); $asDV=$oR->gaaGetAllRecords(); $asV["Dachverband"]=$this->oSystem->oUI->gsGetSelectBox($asDV,"__data[DachVerband]",array("class"=>"transpSelect","style"=>"width:150")); return $this->msEditor("Bearbeiten",$asV,$this->oSystem->oSiteNavi->gsGetURL($this->msClass,$this->__addAction(array("Uebersicht","Speichern")))); } } return "GEMEINER"; } function msAddVerbdindung($asParams) { if(is_array($asParams)) $sAction=strtolower(array_shift($asParams)); switch($sAction) { default: return $this->msEditor("Neue Verbindung",$asData=false,$this->oSystem->oSiteNavi->gsGetURL($this->msClass,$this->__addAction(array("NeueVerbindung","Speichern")))); case "speichern": return $this->msSaveV(); } } function msSaveV() { if($asData=$this->oSystem->oClientData->gvGetVariable("__data",false)) { $asInsert["OrgName"]=$this->oSystem->oDB->gsEscapeString($asData["OrgName"]); $asInsert["OrgShort"]=$this->oSystem->oDB->gsEscapeString($asData["OrgShort"]); $asInsert["Universitaet"]=$this->oSystem->oDB->gsEscapeString($asData["Universitaet"]); $asInsert["DachVerband"]=$this->oSystem->oDB->gsEscapeString($asData["DachVerband"]); $asInsert["Strasse"]=$this->oSystem->oDB->gsEscapeString($asData["Strasse"]); $asInsert["Hausnummer"]=$this->oSystem->oDB->gsEscapeString($asData["Hausnummer"]); $asInsert["PLZ"]=$this->oSystem->oDB->gsEscapeString($asData["PLZ"]); $asInsert["Ort"]=$this->oSystem->oDB->gsEscapeString($asData["Ort"]); $asInsert["Bundesland"]=$this->oSystem->oDB->gsEscapeString($asData["Bundesland"]); $asInsert["StaatPK"]=$this->oSystem->oDB->gsEscapeString($asData["StaatPK"]); $asInsert["EMail"]=$this->oSystem->oDB->gsEscapeString($asData["EMail"]); $asInsert["Telefon"]=$this->oSystem->oDB->gsEscapeString($asData["Telefon"]); $asInsert["Fax"]=$this->oSystem->oDB->gsEscapeString($asData["Fax"]); $asInsert["WebSite"]=$this->oSystem->oDB->gsEscapeString($asData["WebSite"]); $asInsert["GruendungsDatum"]=$this->oSystem->oDB->gsEscapeString($asData["GruendungsDatum"]); $asInsert["EintrittsJahr"]=$this->oSystem->oDB->gsEscapeString($asData["EintrittsJahr"]); $asInsert["CreateDate"]="now()"; $asInsert["Creator"]=$this->mlUserPK; if($this->oSystem->oDB->goInsertArray("tdVerbindungen",$asInsert)) { return "gespeichert"; } } return "Fehler"; } function gasGetEmpty() { $asR["OrgName"]=""; $asR["OrgShort"]=""; $asR["Uni"]=""; $asR["Strasse"]=""; $asR["PLZ"]=""; $asR["Ort"]=""; $asData=$this->oSystem->oDBStore->gasGetStaatenSelectData(29); $asR["Staat"]=$this->oSystem->oUI->gsGetSelectBox($asData,"__data[StaatPK]",array("class"=>"transpSelect","style"=>"width:150")); $asR["Universitaet"]=""; $asR["Bundesland"]=""; $asR["Hausnummer"]=""; $asR["WebSite"]=""; $asR["EMail"]=""; $asR["Telefon"]=""; $asR["Fax"]=""; $oR=$this->oSystem->oDB->goQuery("SELECT Short as Anzeige,KeyShort as Value,'' as PreSelected FROM tdDachverbaende ORDER BY Short"); $asDV=$oR->gaaGetAllRecords(); $asR["Dachverband"]=$this->oSystem->oUI->gsGetSelectBox($asDV,"__data[DachVerband]",array("class"=>"transpSelect","style"=>"width:150")); $asR["GruendungsDatum"]=""; $asR["EintrittsJahr"]=""; $asR["Mitglieder"]=""; /* $asR[""]=""; $asR[""]=""; $asR[""]=""; $asR[""]=""; $asR[""]=""; $asR[""]=""; */ return $asR; } function msEditor($sTitle,$asData,$sSaveURL) { $oTPL=$this->oSystem->goGetTPLParser($this->msTPLPath."editor.tpl"); if($asData===false) $asData=$this->gasGetEmpty(); $oTPL->gbSetValArray($asData); $oTPL->gbSetValue("__save__",$sSaveURL); $oTPL->gbSetValue("TITLE",$sTitle); return $oTPL->gsParse(); } function msViewAll($asParams) { if(is_array($asParams)) $sAction=strtolower(array_shift($asParams)); $bRefresh=$sAction=="ds"?true:false; $oViewHandler=$this->oSystem->goGetDBViewSimple("verbindungen",false,false,array("tdVerbindungen.OrgName","tdVerbindungen.PLZ","tdVerbindungen.Ort"),4); $sError="