mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-04 20:39:28 +00:00
Raum/Ort Soap Service
This commit is contained in:
@@ -183,5 +183,51 @@ class ortraumtyp extends basis_db
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt die Raumtypen eines Ortes
|
||||
*
|
||||
* @param $ort_kurzbz
|
||||
* @return boolean
|
||||
*/
|
||||
public function getRaumtypen($ort_kurzbz)
|
||||
{
|
||||
if($ort_kurzbz=='')
|
||||
{
|
||||
$this->errormsg = 'Kein gültiger Schlüssel vorhanden';
|
||||
return false;
|
||||
}
|
||||
|
||||
$qry = "SELECT
|
||||
*
|
||||
FROM
|
||||
public.tbl_ortraumtyp
|
||||
JOIN public.tbl_raumtyp USING(raumtyp_kurzbz)
|
||||
WHERE
|
||||
ort_kurzbz=".$this->db_add_param($ort_kurzbz);
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object())
|
||||
{
|
||||
$obj = new ortraumtyp();
|
||||
|
||||
$obj->ort_kurzbz = $row->ort_kurzbz;
|
||||
$obj->hierarchie = $row->hierarchie;
|
||||
$obj->raumtyp_kurzbz = $row->raumtyp_kurzbz;
|
||||
$obj->beschreibung = $row->beschreibung;
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -63,7 +63,7 @@ class webservicerecht extends basis_db
|
||||
foreach ($berechtigung->berechtigungen as $recht)
|
||||
{
|
||||
// ist berechtigung noch gültig
|
||||
if($recht->start < date('Y-m-d') && $recht->ende > date('Y-m-d'))
|
||||
if(($recht->start < date('Y-m-d') || $recht->start=='') && ($recht->ende > date('Y-m-d') || $recht->ende==''))
|
||||
$berechtigungArray[] = $recht->berechtigung_kurzbz;
|
||||
}
|
||||
|
||||
|
||||
Executable
+226
@@ -0,0 +1,226 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012 FH Technikum-Wien
|
||||
*
|
||||
* 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 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors: Andreas Oesterreicher <oesi@technikum-wien.at>.
|
||||
*/
|
||||
/**
|
||||
* Webservice fuer Ort/Raum
|
||||
*
|
||||
*/
|
||||
require_once('../config/vilesci.config.inc.php');
|
||||
require_once('../include/basis_db.class.php');
|
||||
require_once('../include/functions.inc.php');
|
||||
require_once('../include/webservicerecht.class.php');
|
||||
require_once('../include/ort.class.php');
|
||||
require_once('../include/ortraumtyp.class.php');
|
||||
|
||||
ini_set("soap.wsdl_cache_enabled", "0");
|
||||
|
||||
$SOAPServer = new SoapServer(APP_ROOT."/soap/ort.wsdl.php?".microtime(true));
|
||||
$SOAPServer->addFunction("getOrtFromKurzbz");
|
||||
$SOAPServer->addFunction("getRaeume");
|
||||
$SOAPServer->addFunction("searchRaum");
|
||||
$SOAPServer->handle();
|
||||
|
||||
/**
|
||||
*
|
||||
* Funktion getOrtFromKurzbz liefert einen Ort zurück
|
||||
* @param ort_kurzbz - ort_kurzbz
|
||||
* @param authentifizierung - Array mit Username und Passwort
|
||||
*
|
||||
* Berechtigung:
|
||||
INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/ort','getOrtFromKurzbz','bezeichnung');
|
||||
INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/ort','getOrtFromKurzbz','stockwerk');
|
||||
INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/ort','getOrtFromKurzbz','sitzplaetze');
|
||||
INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/ort','getOrtFromKurzbz','raumtyp');
|
||||
|
||||
*/
|
||||
function getOrtFromKurzbz($ort_kurzbz, $authentifizierung)
|
||||
{
|
||||
if($ort_kurzbz == '')
|
||||
return new SOAPFault("Server", "ort_kurzbz must be set");
|
||||
|
||||
$user = $authentifizierung->username;
|
||||
$passwort = $authentifizierung->passwort;
|
||||
|
||||
// User authentifizieren
|
||||
if(!check_user($user, $passwort))
|
||||
return new SoapFault("Server", "Invalid Credentials");
|
||||
|
||||
// darf user überhaupt was von Methode sehen
|
||||
$recht = new webservicerecht();
|
||||
if(!$recht->isUserAuthorized($user, 'getOrtFromKurzbz'))
|
||||
return new SoapFault("Server", "No permission");
|
||||
|
||||
// Daten für Lehrveranstaltung
|
||||
$ort = new ort();
|
||||
if(!$ort->load($ort_kurzbz))
|
||||
return new SoapFault("Server", "Error loading Data");
|
||||
|
||||
class foo{};
|
||||
|
||||
$raumtyp = new ortraumtyp();
|
||||
$raumtyp->getRaumtypen($ort_kurzbz);
|
||||
$raumtyp_arr = array();
|
||||
|
||||
foreach($raumtyp->result as $row)
|
||||
{
|
||||
$rt = new foo();
|
||||
$rt->beschreibung = $row->beschreibung;
|
||||
$rt->raumtyp_kurzbz = $row->raumtyp_kurzbz;
|
||||
$rt->hierarchie = $row->hierarchie;
|
||||
|
||||
$raumtyp_arr[] = $rt;
|
||||
}
|
||||
|
||||
$OrtObject = new foo();
|
||||
$OrtObject->bezeichnung = $ort->bezeichnung;
|
||||
$OrtObject->stockwerk = $ort->stockwerk;
|
||||
$OrtObject->sitzplaetze = $ort->max_person;
|
||||
$OrtObject->raumtyp= $raumtyp_arr;
|
||||
|
||||
// lösche alle Attribute für die user keine Berechtigung hat
|
||||
$OrtObject = $recht->clearResponse($user, 'getOrtFromKurzbz', $OrtObject);
|
||||
|
||||
return $OrtObject;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Funktion getRaeume liefert alle aktiven reservierbaren Orte zurück
|
||||
* @param authentifizierung - Array mit Username und Passwort
|
||||
*
|
||||
* Berechtigung:
|
||||
INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/ort','getRaeume','ort_kurzbz');
|
||||
INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/ort','getRaeume','bezeichnung');
|
||||
INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/ort','getRaeume','planbezeichnung');
|
||||
INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/ort','getRaeume','sitzplaetze');
|
||||
INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/ort','getRaeume','aktiv');
|
||||
INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/ort','getRaeume','lehre');
|
||||
INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/ort','getRaeume','reservieren');
|
||||
INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/ort','getRaeume','stockwerk');
|
||||
*/
|
||||
function getRaeume($authentifizierung)
|
||||
{
|
||||
$user = $authentifizierung->username;
|
||||
$passwort = $authentifizierung->passwort;
|
||||
|
||||
// User authentifizieren
|
||||
if(!check_user($user, $passwort))
|
||||
return new SoapFault("Server", "Invalid Credentials");
|
||||
|
||||
// darf user überhaupt was von Methode sehen
|
||||
$recht = new webservicerecht();
|
||||
if(!$recht->isUserAuthorized($user, 'getRaeume'))
|
||||
return new SoapFault("Server", "No permission");
|
||||
|
||||
// Daten für Lehrveranstaltung
|
||||
$ort = new ort();
|
||||
if(!$ort->getAll())
|
||||
return new SoapFault("Server", "Error loading Data");
|
||||
|
||||
$return = array();
|
||||
class foo{};
|
||||
foreach($ort->result as $row)
|
||||
{
|
||||
if($row->aktiv && $row->lehre)
|
||||
{
|
||||
$OrtObject = new foo();
|
||||
$OrtObject->ort_kurzbz = $row->ort_kurzbz;
|
||||
$OrtObject->bezeichnung = $row->bezeichnung;
|
||||
$OrtObject->planbezeichnung = $row->planbezeichnung;
|
||||
$OrtObject->sitzplaetze = $row->max_person;
|
||||
$OrtObject->aktiv = $row->aktiv;
|
||||
$OrtObject->lehre = $row->lehre;
|
||||
$OrtObject->reservieren = $row->reservieren;
|
||||
$OrtObject->stockwerk = $row->stockwerk;
|
||||
|
||||
// lösche alle Attribute für die user keine Berechtigung hat
|
||||
$return[] = $recht->clearResponse($user, 'getRaeume', $OrtObject);
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Funktion searchRaum Sucht einen Raum
|
||||
*
|
||||
* @param date $datum
|
||||
* @param time $zeit_von
|
||||
* @param time $zeit_bis
|
||||
* @param string $raumtyp
|
||||
* @param integer $anzpersonen
|
||||
* @param boolean $reservierung
|
||||
* @param authentifizierung - Array mit Username und Passwort
|
||||
*
|
||||
* Berechtigung:
|
||||
INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/ort','searchRaum','ort_kurzbz');
|
||||
INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/ort','searchRaum','bezeichnung');
|
||||
INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/ort','searchRaum','planbezeichnung');
|
||||
INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/ort','searchRaum','sitzplaetze');
|
||||
INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/ort','searchRaum','aktiv');
|
||||
INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/ort','searchRaum','lehre');
|
||||
INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/ort','searchRaum','reservieren');
|
||||
INSERT INTO system.tbl_webservicerecht(berechtigung_kurzbz, methode, attribut) VALUES('soap/ort','searchRaum','stockwerk');
|
||||
*/
|
||||
function searchRaum($datum, $zeit_von, $zeit_bis, $raumtyp=null, $anzpersonen=null, $reservierung=true, $authentifizierung)
|
||||
{
|
||||
$user = $authentifizierung->username;
|
||||
$passwort = $authentifizierung->passwort;
|
||||
|
||||
// User authentifizieren
|
||||
if(!check_user($user, $passwort))
|
||||
return new SoapFault("Server", "Invalid Credentials");
|
||||
|
||||
// darf user überhaupt was von Methode sehen
|
||||
$recht = new webservicerecht();
|
||||
if(!$recht->isUserAuthorized($user, 'searchRaum'))
|
||||
return new SoapFault("Server", "No permission");
|
||||
|
||||
// Daten für Lehrveranstaltung
|
||||
$ort = new ort();
|
||||
if(!$ort->search($datum, $zeit_von, $zeit_bis, $raumtyp, $anzpersonen, $reservierung))
|
||||
return new SoapFault("Server", "Error loading Data");
|
||||
|
||||
$return = array();
|
||||
class foo{};
|
||||
foreach($ort->result as $row)
|
||||
{
|
||||
if($row->aktiv && $row->lehre)
|
||||
{
|
||||
$OrtObject = new foo();
|
||||
$OrtObject->ort_kurzbz = $row->ort_kurzbz;
|
||||
$OrtObject->bezeichnung = $row->bezeichnung;
|
||||
$OrtObject->planbezeichnung = $row->planbezeichnung;
|
||||
$OrtObject->sitzplaetze = $row->max_person;
|
||||
$OrtObject->aktiv = $row->aktiv;
|
||||
$OrtObject->lehre = $row->lehre;
|
||||
$OrtObject->reservieren = $row->reservieren;
|
||||
$OrtObject->stockwerk = $row->stockwerk;
|
||||
|
||||
// lösche alle Attribute für die user keine Berechtigung hat
|
||||
$return[] = $recht->clearResponse($user, 'searchRaum', $OrtObject);
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
?>
|
||||
Executable
+141
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
require_once('../config/vilesci.config.inc.php');
|
||||
header("Content-type: text/xml");
|
||||
echo "<?xml version='1.0' encoding='utf-8' ?>";
|
||||
?>
|
||||
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
|
||||
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
|
||||
xmlns:tns="http://technikum-wien.at"
|
||||
xmlns:s="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
|
||||
targetNamespace="http://technikum-wien.at"
|
||||
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
|
||||
|
||||
<wsdl:message name="GetOrtFromKurzbzRequest">
|
||||
<wsdl:part minOccurs="1" maxOccurs="1" name="ort_kurzbz" type="s:string"/>
|
||||
<wsdl:part minOccurs="0" maxOccurs="1" name="authentifizierung" type="tns:GetAuthentifizierung"/>
|
||||
</wsdl:message>
|
||||
|
||||
<wsdl:message name="GetOrtFromKurzbzResponse">
|
||||
<wsdl:part minOccurs="0" maxOccurs="1" name="GetLehrveranstaltungFromId" type="tns:GetOrtFromKurzbz"/>
|
||||
</wsdl:message>
|
||||
|
||||
<wsdl:message name="GetOrtFromKurzbz">
|
||||
<wsdl:part minOccurs="0" maxOccurs="1" name="bezeichnung" type="s:string"/>
|
||||
<wsdl:part minOccurs="0" maxOccurs="1" name="stockwerk" type="s:string"/>
|
||||
<wsdl:part minOccurs="0" maxOccurs="1" name="sitzplaetze" type="s:string"/>
|
||||
<wsdl:part minOccurs="0" maxOccurs="1" name="raumtyp" type="tns:ArrayOfRaumtyp"/>
|
||||
</wsdl:message>
|
||||
|
||||
<s:complexType name="GetAuthentifizierung">
|
||||
<s:sequence>
|
||||
<s:element minOccurs="0" maxOccurs="1" name="username" type="s:string"/>
|
||||
<s:element minOccurs="0" maxOccurs="1" name="passwort" type="s:string"/>
|
||||
</s:sequence>
|
||||
</s:complexType>
|
||||
|
||||
<s:complexType name="ArrayOfRaumtyp">
|
||||
<s:sequence>
|
||||
<s:element minOccurs="0" maxOccurs="unbounded" name="RaumtypItem" type="tns:ArrayOfRaumtypItem"/>
|
||||
</s:sequence>
|
||||
</s:complexType>
|
||||
|
||||
<s:complexType name="ArrayOfRaumtypItem">
|
||||
<s:sequence>
|
||||
<s:element minOccurs="0" maxOccurs="1" name="raumtyp_kurzbz" type="s:string"/>
|
||||
<s:element minOccurs="0" maxOccurs="1" name="beschreibung" type="s:string"/>
|
||||
<s:element minOccurs="0" maxOccurs="1" name="hierarchie" type="s:string"/>
|
||||
</s:sequence>
|
||||
</s:complexType>
|
||||
|
||||
<wsdl:message name="GetRaeumeRequest">
|
||||
<wsdl:part minOccurs="0" maxOccurs="1" name="authentifizierung" type="tns:GetAuthentifizierung"/>
|
||||
</wsdl:message>
|
||||
|
||||
<wsdl:message name="GetRaeumeResponse">
|
||||
<wsdl:part minOccurs="0" maxOccurs="1" name="Raeume" type="tns:ArrayOfRaeume"/>
|
||||
</wsdl:message>
|
||||
|
||||
<s:complexType name="ArrayOfRaeume">
|
||||
<s:sequence>
|
||||
<s:element minOccurs="0" maxOccurs="unbounded" name="RaumtypItem" type="tns:Raum"/>
|
||||
</s:sequence>
|
||||
</s:complexType>
|
||||
|
||||
<wsdl:message name="Raum">
|
||||
<wsdl:part minOccurs="0" maxOccurs="1" name="ort_kurzbz" type="s:string"/>
|
||||
<wsdl:part minOccurs="0" maxOccurs="1" name="bezeichnung" type="s:string"/>
|
||||
<wsdl:part minOccurs="0" maxOccurs="1" name="planbezeichnung" type="s:string"/>
|
||||
<wsdl:part minOccurs="0" maxOccurs="1" name="sitzplaetze" type="s:string"/>
|
||||
<wsdl:part minOccurs="0" maxOccurs="1" name="aktiv" type="s:boolean"/>
|
||||
<wsdl:part minOccurs="0" maxOccurs="1" name="lehre" type="s:boolean"/>
|
||||
<wsdl:part minOccurs="0" maxOccurs="1" name="reservieren" type="s:boolean"/>
|
||||
<wsdl:part minOccurs="0" maxOccurs="1" name="stockwerk" type="s:string"/>
|
||||
</wsdl:message>
|
||||
|
||||
<wsdl:message name="SearchRaumRequest">
|
||||
<wsdl:part minOccurs="1" maxOccurs="1" name="datum" type="s:string"/>
|
||||
<wsdl:part minOccurs="1" maxOccurs="1" name="von_zeit" type="s:string"/>
|
||||
<wsdl:part minOccurs="1" maxOccurs="1" name="bis_zeit" type="s:string"/>
|
||||
<wsdl:part minOccurs="0" maxOccurs="1" name="raumtyp" type="s:string"/>
|
||||
<wsdl:part minOccurs="0" maxOccurs="1" name="anzahl_personen" type="s:string"/>
|
||||
<wsdl:part minOccurs="0" maxOccurs="1" name="reservierung" type="s:string"/>
|
||||
<wsdl:part minOccurs="0" maxOccurs="1" name="authentifizierung" type="tns:GetAuthentifizierung"/>
|
||||
</wsdl:message>
|
||||
|
||||
<wsdl:message name="SearchRaumResponse">
|
||||
<wsdl:part minOccurs="0" maxOccurs="1" name="Raeume" type="tns:ArrayOfRaeume"/>
|
||||
</wsdl:message>
|
||||
|
||||
<wsdl:portType name="ConfigPortType">
|
||||
<wsdl:operation name="getOrtFromKurzbz">
|
||||
<wsdl:input message="tns:GetOrtFromKurzbzRequest"/>
|
||||
<wsdl:output message="tns:GetOrtFromKurzbzResponse"/>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="getRaeume">
|
||||
<wsdl:input message="tns:GetRaeumeRequest"/>
|
||||
<wsdl:output message="tns:GetRaeumeResponse"/>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="searchRaum">
|
||||
<wsdl:input message="tns:SearchRaumRequest"/>
|
||||
<wsdl:output message="tns:SearchRaumResponse"/>
|
||||
</wsdl:operation>
|
||||
</wsdl:portType>
|
||||
|
||||
<wsdl:binding name="ConfigBinding" type="tns:ConfigPortType">
|
||||
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
|
||||
<wsdl:operation name="getOrtFromKurzbz">
|
||||
<soap:operation soapAction="<?php echo APP_ROOT."soap/getOrtFromKurzbz";?>" />
|
||||
<wsdl:input>
|
||||
<soap:body use="encoded" namespace="http://technikum-wien.at" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<soap:body use="encoded" namespace="http://technikum-wien.at" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="getRaeume">
|
||||
<soap:operation soapAction="<?php echo APP_ROOT."soap/getRaeume";?>" />
|
||||
<wsdl:input>
|
||||
<soap:body use="encoded" namespace="http://technikum-wien.at" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<soap:body use="encoded" namespace="http://technikum-wien.at" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="searchRaum">
|
||||
<soap:operation soapAction="<?php echo APP_ROOT."soap/searchRaum";?>" />
|
||||
<wsdl:input>
|
||||
<soap:body use="encoded" namespace="http://technikum-wien.at" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<soap:body use="encoded" namespace="http://technikum-wien.at" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
</wsdl:binding>
|
||||
|
||||
<wsdl:service name="Ort">
|
||||
<wsdl:port name="ConfigWebservicePort" binding="tns:ConfigBinding">
|
||||
<soap:address location="<?php echo APP_ROOT."soap/ort.soap.php?".microtime();?>"/>
|
||||
</wsdl:port>
|
||||
</wsdl:service>
|
||||
</wsdl:definitions>
|
||||
Executable
+353
@@ -0,0 +1,353 @@
|
||||
<?php
|
||||
require_once('../config/vilesci.config.inc.php');
|
||||
require_once('../include/functions.inc.php');
|
||||
|
||||
$method = (isset($_GET['method'])?$_GET['method']:'getOrtFromKurzbz');
|
||||
|
||||
$getuid = get_uid();
|
||||
if(!check_lektor($getuid))
|
||||
die('Sie haben keine Berechtigung für diese Seite');
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<script type="text/javascript" src="../include/js/jqSOAPClient.js"></script>
|
||||
<script type="text/javascript" src="../include/js/jquery.js"></script>
|
||||
<script type="text/javascript" src="../include/js/jqXMLUtils.js"></script>
|
||||
<title>SOAP TestClient für Orte</title>
|
||||
</head>
|
||||
<body>
|
||||
<a href ="<?php echo $_SERVER['PHP_SELF'].'?method=getOrtFromKurzbz'?>">getOrtFromKurzbz</a><br>
|
||||
<a href ="<?php echo $_SERVER['PHP_SELF'].'?method=getRaeume'?>">getRaeume</a><br>
|
||||
<a href ="<?php echo $_SERVER['PHP_SELF'].'?method=searchRaum'?>">searchRaum</a><br>
|
||||
<a href ="<?php echo APP_ROOT.'soap/ort.wsdl.php'?>">Show WSDL </a><br><br>
|
||||
|
||||
<?php
|
||||
if($method=='getOrtFromKurzbz')
|
||||
{
|
||||
echo'
|
||||
<form action="'.$_SERVER["PHP_SELF"].'?method=getOrtFromKurzbz" method="post">
|
||||
<table border="0" cellpadding="5" cellspacing="0" bgcolor="#E0E0E0">
|
||||
<tr>
|
||||
<td align="right">Username:</td>
|
||||
<td><input id="username" name="username" type="text" size="30" maxlength="255" value="'.(isset($_REQUEST['username']) ? $_REQUEST['username'] : "").'"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Passwort:</td>
|
||||
<td><input id="passwort" name="passwort" type="password" size="30" maxlength="255" value="'.(isset($_REQUEST['passwort']) ? $_REQUEST['passwort'] : "").'"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Ort_Kurzbz:</td>
|
||||
<td><input id="ort_kurzbz" name="ort_kurzbz" type="text" size="30" maxlength="10" value="'.(isset($_REQUEST['ort_kurzbz']) ? $_REQUEST['ort_kurzbz'] : "").'"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right"></td>
|
||||
<td>
|
||||
<input type="submit" value="Absenden (PHP)" name="submit">
|
||||
<input type="button" onclick="sendSoap();" value="Absenden (JS)">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>';
|
||||
echo '
|
||||
<script type="text/javascript">
|
||||
function gettimestamp()
|
||||
{
|
||||
var now = new Date();
|
||||
var ret = now.getHours()*60*60*60;
|
||||
ret = ret + now.getMinutes()*60*60;
|
||||
ret = ret + now.getSeconds()*60;
|
||||
ret = ret + now.getMilliseconds();
|
||||
return ret;
|
||||
}
|
||||
function sendSoap()
|
||||
{
|
||||
user = document.getElementById("username").value;
|
||||
passwort = document.getElementById("passwort").value;
|
||||
ort_kurzbz = document.getElementById("ort_kurzbz").value;
|
||||
|
||||
var soapBody = new SOAPObject("getOrtFromKurzbz");
|
||||
var authentifizierung = new SOAPObject("authentifizierung");
|
||||
authentifizierung.appendChild(new SOAPObject("username")).val(user);
|
||||
authentifizierung.appendChild(new SOAPObject("passwort")).val(passwort);
|
||||
|
||||
soapBody.appendChild(new SOAPObject("ort_kurzbz")).val(ort_kurzbz);
|
||||
soapBody.appendChild(authentifizierung);
|
||||
|
||||
var sr = new SOAPRequest("getOrtFromKurzbz",soapBody);
|
||||
SOAPClient.Proxy="'.APP_ROOT.'/soap/ort.soap.php?"+gettimestamp();
|
||||
|
||||
SOAPClient.SendRequest(sr, clb_save);
|
||||
}
|
||||
|
||||
function clb_save(respObj)
|
||||
{
|
||||
try
|
||||
{
|
||||
//var msg = respObj.Body[0].getOrtFromKurzbzResponse[0].message[0].Text;
|
||||
data = JSON.stringify(respObj.Body[0]);
|
||||
//data=data.replace(/[[{]/g,"<br>[{");
|
||||
//data=data.replace(/[}]}]]/g,"}]}]<br>");
|
||||
|
||||
document.getElementById("output").innerHTML="<pre>"+data+"<pre";
|
||||
|
||||
alert("ok");
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
alert(e);
|
||||
var fehler = respObj.Body[0].Fault[0].faultstring[0].Text;
|
||||
alert("Fehler: "+fehler);
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
';
|
||||
}
|
||||
elseif($method=='getRaeume')
|
||||
{
|
||||
echo'
|
||||
<form action="'.$_SERVER["PHP_SELF"].'?method=getRaeume" method="post">
|
||||
<table border="0" cellpadding="5" cellspacing="0" bgcolor="#E0E0E0">
|
||||
<tr>
|
||||
<td align="right">Username:</td>
|
||||
<td><input id="username" name="username" type="text" size="30" maxlength="255" value="'.(isset($_REQUEST['username']) ? $_REQUEST['username'] : "").'"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Passwort:</td>
|
||||
<td><input id="passwort" name="passwort" type="password" size="30" maxlength="255" value="'.(isset($_REQUEST['passwort']) ? $_REQUEST['passwort'] : "").'"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right"></td>
|
||||
<td>
|
||||
<input type="submit" value="Absenden (PHP)" name="submit">
|
||||
<input type="button" onclick="sendSoap();" value="Absenden (JS)">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>';
|
||||
echo '
|
||||
<script type="text/javascript">
|
||||
function gettimestamp()
|
||||
{
|
||||
var now = new Date();
|
||||
var ret = now.getHours()*60*60*60;
|
||||
ret = ret + now.getMinutes()*60*60;
|
||||
ret = ret + now.getSeconds()*60;
|
||||
ret = ret + now.getMilliseconds();
|
||||
return ret;
|
||||
}
|
||||
function sendSoap()
|
||||
{
|
||||
user = document.getElementById("username").value;
|
||||
passwort = document.getElementById("passwort").value;
|
||||
|
||||
var soapBody = new SOAPObject("getRaeume");
|
||||
var authentifizierung = new SOAPObject("authentifizierung");
|
||||
authentifizierung.appendChild(new SOAPObject("username")).val(user);
|
||||
authentifizierung.appendChild(new SOAPObject("passwort")).val(passwort);
|
||||
|
||||
soapBody.appendChild(authentifizierung);
|
||||
|
||||
var sr = new SOAPRequest("getRaeume",soapBody);
|
||||
SOAPClient.Proxy="'.APP_ROOT.'/soap/ort.soap.php?"+gettimestamp();
|
||||
|
||||
SOAPClient.SendRequest(sr, clb_save);
|
||||
}
|
||||
|
||||
function clb_save(respObj)
|
||||
{
|
||||
try
|
||||
{
|
||||
//var msg = respObj.Body[0].getRaeumeResponse[0].message[0].Text;
|
||||
data = JSON.stringify(respObj.Body[0]);
|
||||
document.getElementById("output").innerHTML="<pre>"+data+"<pre";
|
||||
alert("ok");
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
alert(e);
|
||||
var fehler = respObj.Body[0].Fault[0].faultstring[0].Text;
|
||||
alert("Fehler: "+fehler);
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
';
|
||||
}
|
||||
elseif($method=='searchRaum')
|
||||
{
|
||||
echo'
|
||||
<form action="'.$_SERVER["PHP_SELF"].'?method=searchRaum" method="post">
|
||||
<table border="0" cellpadding="5" cellspacing="0" bgcolor="#E0E0E0">
|
||||
<tr>
|
||||
<td align="right">Datum:</td>
|
||||
<td><input id="datum" name="datum" type="text" size="30" maxlength="255" value="'.(isset($_REQUEST['datum']) ? $_REQUEST['datum'] : "").'"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Zeit-Von:</td>
|
||||
<td><input id="zeit_von" name="zeit_von" type="text" size="30" maxlength="255" value="'.(isset($_REQUEST['zeit_von']) ? $_REQUEST['zeit_von'] : "").'"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Zeit-Bis:</td>
|
||||
<td><input id="zeit_bis" name="zeit_bis" type="text" size="30" maxlength="255" value="'.(isset($_REQUEST['zeit_bis']) ? $_REQUEST['zeit_bis'] : "").'"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Raumtyp:</td>
|
||||
<td><input id="raumtyp" name="raumtyp" type="text" size="30" maxlength="255" value="'.(isset($_REQUEST['raumtyp']) ? $_REQUEST['raumtyp'] : "").'"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Anzahl Personen</td>
|
||||
<td><input id="anzahl_personen" name="anzahl_personen" type="text" size="30" maxlength="255" value="'.(isset($_REQUEST['anzahl_personen']) ? $_REQUEST['anzahl_personen'] : "").'"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Reservierung</td>
|
||||
<td><input id="reservierung" name="reservierung" type="checkbox" size="30" maxlength="255" '.(isset($_REQUEST['reservierung']) ? 'checked' : "").'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Username:</td>
|
||||
<td><input id="username" name="username" type="text" size="30" maxlength="255" value="'.(isset($_REQUEST['username']) ? $_REQUEST['username'] : "").'"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Passwort:</td>
|
||||
<td><input id="passwort" name="passwort" type="password" size="30" maxlength="255" value="'.(isset($_REQUEST['passwort']) ? $_REQUEST['passwort'] : "").'"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right"></td>
|
||||
<td>
|
||||
<input type="submit" value="Absenden (PHP)" name="submit">
|
||||
<input type="button" onclick="sendSoap();" value="Absenden (JS)">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>';
|
||||
echo '
|
||||
<script type="text/javascript">
|
||||
function gettimestamp()
|
||||
{
|
||||
var now = new Date();
|
||||
var ret = now.getHours()*60*60*60;
|
||||
ret = ret + now.getMinutes()*60*60;
|
||||
ret = ret + now.getSeconds()*60;
|
||||
ret = ret + now.getMilliseconds();
|
||||
return ret;
|
||||
}
|
||||
function sendSoap()
|
||||
{
|
||||
user = document.getElementById("username").value;
|
||||
passwort = document.getElementById("passwort").value;
|
||||
datum = document.getElementById("datum").value;
|
||||
zeit_von = document.getElementById("zeit_von").value;
|
||||
zeit_bis = document.getElementById("zeit_bis").value;
|
||||
raumtyp = document.getElementById("raumtyp").value;
|
||||
anzahl_personen = document.getElementById("anzahl_personen").value;
|
||||
reservierung = document.getElementById("reservierung").checked;
|
||||
|
||||
|
||||
var soapBody = new SOAPObject("searchRaum");
|
||||
var authentifizierung = new SOAPObject("authentifizierung");
|
||||
authentifizierung.appendChild(new SOAPObject("username")).val(user);
|
||||
authentifizierung.appendChild(new SOAPObject("passwort")).val(passwort);
|
||||
|
||||
soapBody.appendChild(new SOAPObject("datum")).val(datum);
|
||||
soapBody.appendChild(new SOAPObject("zeit_von")).val(zeit_von);
|
||||
soapBody.appendChild(new SOAPObject("zeit_bis")).val(zeit_bis);
|
||||
soapBody.appendChild(new SOAPObject("raumtyp")).val(raumtyp);
|
||||
soapBody.appendChild(new SOAPObject("anzahl_personen")).val(anzahl_personen);
|
||||
soapBody.appendChild(new SOAPObject("reservierung")).val(reservierung);
|
||||
soapBody.appendChild(authentifizierung);
|
||||
|
||||
var sr = new SOAPRequest("searchRaum",soapBody);
|
||||
SOAPClient.Proxy="'.APP_ROOT.'/soap/ort.soap.php?"+gettimestamp();
|
||||
|
||||
SOAPClient.SendRequest(sr, clb_save);
|
||||
}
|
||||
|
||||
function clb_save(respObj)
|
||||
{
|
||||
try
|
||||
{
|
||||
data = JSON.stringify(respObj.Body[0]);
|
||||
document.getElementById("output").innerHTML="<pre>"+data+"<pre";
|
||||
alert("ok");
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
alert(e);
|
||||
var fehler = respObj.Body[0].Fault[0].faultstring[0].Text;
|
||||
alert("Fehler: "+fehler);
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
';
|
||||
}
|
||||
|
||||
echo '<div id="output">';
|
||||
class foo {};
|
||||
|
||||
if(isset($_REQUEST['submit']) && $_GET['method']=='getOrtFromKurzbz')
|
||||
{
|
||||
$client = new SoapClient(APP_ROOT."/soap/ort.wsdl.php?".microtime(true));
|
||||
|
||||
try
|
||||
{
|
||||
$authentifizierung = new foo();
|
||||
$authentifizierung->username=$_REQUEST['username'];
|
||||
$authentifizierung->passwort=$_REQUEST['passwort'];
|
||||
$response = $client->getOrtFromKurzbz($_REQUEST['ort_kurzbz'], $authentifizierung);
|
||||
|
||||
var_dump($response);
|
||||
}
|
||||
catch(SoapFault $fault)
|
||||
{
|
||||
echo "SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
if(isset($_REQUEST['submit']) && $_GET['method']=='getRaeume')
|
||||
{
|
||||
$client = new SoapClient(APP_ROOT."/soap/ort.wsdl.php?".microtime(true));
|
||||
|
||||
try
|
||||
{
|
||||
$authentifizierung = new foo();
|
||||
$authentifizierung->username=$_REQUEST['username'];
|
||||
$authentifizierung->passwort=$_REQUEST['passwort'];
|
||||
$response = $client->getRaeume($authentifizierung);
|
||||
|
||||
var_dump($response);
|
||||
}
|
||||
catch(SoapFault $fault)
|
||||
{
|
||||
echo "SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
if(isset($_REQUEST['submit']) && $_GET['method']=='searchRaum')
|
||||
{
|
||||
$client = new SoapClient(APP_ROOT."/soap/ort.wsdl.php?".microtime(true));
|
||||
|
||||
try
|
||||
{
|
||||
$authentifizierung = new foo();
|
||||
$authentifizierung->username=$_REQUEST['username'];
|
||||
$authentifizierung->passwort=$_REQUEST['passwort'];
|
||||
$response = $client->searchRaum($_REQUEST['datum'],$_REQUEST['zeit_von'],$_REQUEST['zeit_bis'],$_REQUEST['raumtyp'],$_REQUEST['anzahl_personen'],isset($_REQUEST['reservierung']),$authentifizierung);
|
||||
|
||||
var_dump($response);
|
||||
}
|
||||
catch(SoapFault $fault)
|
||||
{
|
||||
echo "SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
echo '</div>';
|
||||
?>
|
||||
Reference in New Issue
Block a user