Ressource auf Complex Type geändert

This commit is contained in:
Karl Burkhart
2011-10-21 11:27:44 +00:00
parent 22d1cd7aa0
commit 715c213cd0
6 changed files with 142 additions and 104 deletions
+13 -9
View File
@@ -200,15 +200,19 @@ function saveRessource()
// SOAP-Action // SOAP-Action
var soapBody = new SOAPObject("saveRessource"); var soapBody = new SOAPObject("saveRessource");
soapBody.appendChild(new SOAPObject("ressource_id")).val(ressource_id); //soapBody.appendChild(new SOAPObject("username")).val('joe');
soapBody.appendChild(new SOAPObject("bezeichnung")).val(bezeichnung); //soapBody.appendChild(new SOAPObject("passwort")).val('waschl');
soapBody.appendChild(new SOAPObject("beschreibung")).val(beschreibung);
soapBody.appendChild(new SOAPObject("mitarbeiter_uid")).val(mitarbeiter_uid); var ressource = new SOAPObject("ressource");
soapBody.appendChild(new SOAPObject("student_uid")).val(student_uid); ressource.appendChild(new SOAPObject("ressource_id")).val(ressource_id);
soapBody.appendChild(new SOAPObject("betriebsmittel_id")).val(betriebsmittel_id); ressource.appendChild(new SOAPObject("bezeichnung")).val(bezeichnung);
soapBody.appendChild(new SOAPObject("firma_id")).val(firma_id); ressource.appendChild(new SOAPObject("beschreibung")).val(beschreibung);
soapBody.appendChild(new SOAPObject("user")).val(getUsername()); ressource.appendChild(new SOAPObject("mitarbeiter_uid")).val(mitarbeiter_uid);
ressource.appendChild(new SOAPObject("student_uid")).val(student_uid);
ressource.appendChild(new SOAPObject("betriebsmittel_id")).val(betriebsmittel_id);
ressource.appendChild(new SOAPObject("firma_id")).val(firma_id);
soapBody.appendChild(ressource);
if(mitarbeiter_uid == '' && student_uid =='' && betriebsmittel_id =='' && firma_id =='') if(mitarbeiter_uid == '' && student_uid =='' && betriebsmittel_id =='' && firma_id =='')
{ {
alert('ungueltige ID'); alert('ungueltige ID');
+16 -9
View File
@@ -349,21 +349,28 @@ echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
//debug(id); //debug(id);
var soapBody = new SOAPObject("saveProjektRessource"); var soapBody = new SOAPObject("saveProjektRessource");
soapBody.appendChild(new SOAPObject("projekt_ressource_id")).val(''); //soapBody.appendChild(new SOAPObject("username")).val('joe');
//soapBody.appendChild(new SOAPObject("passwort")).val('waschl');
var projektRessource = new SOAPObject("projektRessource");
projektRessource.appendChild(new SOAPObject("projekt_ressource_id")).val('');
if(projekt_kurzbz != '') if(projekt_kurzbz != '')
{ {
soapBody.appendChild(new SOAPObject("projektphase_id")).val(''); projektRessource.appendChild(new SOAPObject("projektphase_id")).val('');
soapBody.appendChild(new SOAPObject("projekt_kurzbz")).val(projekt_kurzbz); projektRessource.appendChild(new SOAPObject("projekt_kurzbz")).val(projekt_kurzbz);
}else if(projektphase_id != '') }else if(projektphase_id != '')
{ {
soapBody.appendChild(new SOAPObject("projektphase_id")).val(projektphase_id); projektRessource.appendChild(new SOAPObject("projektphase_id")).val(projektphase_id);
soapBody.appendChild(new SOAPObject("projekt_kurzbz")).val(''); projektRessource.appendChild(new SOAPObject("projekt_kurzbz")).val('');
} }
soapBody.appendChild(new SOAPObject("ressource_id")).val(id); projektRessource.appendChild(new SOAPObject("ressource_id")).val(id);
soapBody.appendChild(new SOAPObject("funktion_kurzbz")).val(''); projektRessource.appendChild(new SOAPObject("funktion_kurzbz")).val('');
soapBody.appendChild(new SOAPObject("beschreibung")).val(''); projektRessource.appendChild(new SOAPObject("beschreibung")).val('');
soapBody.appendChild(projektRessource);
var sr = new SOAPRequest("saveProjektRessource",soapBody); var sr = new SOAPRequest("saveProjektRessource",soapBody);
SOAPClient.Proxy="<?php echo APP_ROOT;?>soap/ressource_projekt.soap.php?"+gettimestamp(); SOAPClient.Proxy="<?php echo APP_ROOT;?>soap/ressource_projekt.soap.php?"+gettimestamp();
+31 -25
View File
@@ -28,6 +28,8 @@ require_once('../config/vilesci.config.inc.php');
require_once('../include/basis_db.class.php'); require_once('../include/basis_db.class.php');
require_once('../include/ressource.class.php'); require_once('../include/ressource.class.php');
require_once('../include/datum.class.php'); require_once('../include/datum.class.php');
require_once('../include/benutzerberechtigung.class.php');
require_once('../include/functions.inc.php');
$SOAPServer = new SoapServer(APP_ROOT."/soap/ressource.wsdl.php?".microtime()); $SOAPServer = new SoapServer(APP_ROOT."/soap/ressource.wsdl.php?".microtime());
$SOAPServer->addFunction("saveRessource"); $SOAPServer->addFunction("saveRessource");
@@ -39,41 +41,45 @@ ini_set("soap.wsdl_cache_enabled", "0");
/** /**
* *
* Speichert die Ressource * Speichert die Ressource
* @param unknown_type $ressource_id * @param $username
* @param unknown_type $bezeichnung * @param $passwort
* @param unknown_type $beschreibung * @param $ressource
* @param unknown_type $mitarbeiter_uid
* @param unknown_type $student_uid
* @param unknown_type $betriebsmittel_id
* @param unknown_type $firma_id
* @param unknown_type $user
*/ */
function saveRessource($ressource_id, $bezeichnung, $beschreibung, $mitarbeiter_uid, $student_uid, $betriebsmittel_id, $firma_id, $user) function saveRessource($username, $passwort, $ressource)
{ {
$ressource = new ressource(); if(!$user = check_user($username, $passwort))
return new SoapFault("Server", "Invalid Credentials");
$rechte = new benutzerberechtigung();
$rechte->getBerechtigungen($user);
if(!$rechte->isBerechtigt('planner', null, 'sui'))
return new SoapFault("Server", "Sie haben keine Berechtigung zum Speichern von Ressourcen.");
$ressourceNew = new ressource();
if($ressource_id!='') if($ressource_id!='')
{ {
$ressource->load($ressource_id); $ressourceNew->load($ressource->ressource_id);
$ressource->new = false; $ressourceNew->new = false;
} }
else else
{ {
$ressource->new = true; $ressourceNew->new = true;
$ressource->insertvon = $user; $ressourceNew->insertvon = $user;
} }
$ressource->ressource_id=$ressource_id; $ressourceNew->ressource_id=$ressource->ressource_id;
$ressource->bezeichnung=$bezeichnung; $ressourceNew->bezeichnung=$ressource->bezeichnung;
$ressource->beschreibung=$beschreibung; $ressourceNew->beschreibung=$ressource->beschreibung;
$ressource->mitarbeiter_uid = $mitarbeiter_uid; $ressourceNew->mitarbeiter_uid = $ressource->mitarbeiter_uid;
$ressource->student_uid = $student_uid; $ressourceNew->student_uid = $ressource->student_uid;
$ressource->betriebsmittel_id = $betriebsmittel_id; $ressourceNew->betriebsmittel_id = $ressource->betriebsmittel_id;
$ressource->firma_id = $firma_id; $ressourceNew->firma_id = $ressource->firma_id;
$ressource->updatevon = $user; $ressourceNew->updatevon = $user;
if($ressource->save()) if($ressourceNew->save())
return $ressource->ressource_id; return $ressourceNew->ressource_id;
else else
return new SoapFault("Server", $ressource->errormsg); return new SoapFault("Server", $ressourceNew->errormsg);
} }
?> ?>
+41 -34
View File
@@ -5,51 +5,58 @@ echo "<?xml version='1.0' encoding='utf-8' ?>";
?> ?>
<wsdl:definitions name="Ressource" <wsdl:definitions name="Ressource"
targetNamespace="http://localhost/soap/" targetNamespace="http://www.technikum-wien.at/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://localhost/soap/" xmlns:tns="http://www.technikum-wien.at/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsd1="http://localhost/soap/ressource.xsd" xmlns:xsd1="http://localhost/soap/ressource.xsd"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<wsdl:message name="SaveRessourceRequest"> <wsdl:message name="SaveRessourceRequest">
<wsdl:part name="ressource_id" type="xsd:int"></wsdl:part> <wsdl:part name="username" type="xsd:string" minOccurs="0"></wsdl:part>
<wsdl:part name="bezeichnung" type="xsd:string"></wsdl:part> <wsdl:part name="passwort" type="xsd:string" minOccurs="0"></wsdl:part>
<wsdl:part name="beschreibung" type="xsd:string"></wsdl:part> <wsdl:part name="ressource" type="tns:ressource"></wsdl:part>
<wsdl:part name="mitarbeiter_uid" type="xsd:string"></wsdl:part> </wsdl:message>
<wsdl:part name="student_uid" type="xsd:string"></wsdl:part>
<wsdl:part name="betriebsmittel_id" type="xsd:int"></wsdl:part> <xsd:complexType name="ressource">
<wsdl:part name="firma_id" type="xsd:int"></wsdl:part> <xsd:all>
<wsdl:part name="user" type="xsd:string"></wsdl:part> <wsdl:part name="ressource_id" type="xsd:int"></wsdl:part>
</wsdl:message> <wsdl:part name="bezeichnung" type="xsd:string"></wsdl:part>
<wsdl:part name="beschreibung" type="xsd:string"></wsdl:part>
<wsdl:part name="mitarbeiter_uid" type="xsd:string"></wsdl:part>
<wsdl:part name="student_uid" type="xsd:string"></wsdl:part>
<wsdl:part name="betriebsmittel_id" type="xsd:int"></wsdl:part>
<wsdl:part name="firma_id" type="xsd:int"></wsdl:part>
</xsd:all>
</xsd:complexType>
<wsdl:message name="SaveRessourceResponse"> <wsdl:message name="SaveRessourceResponse">
<wsdl:part name="message" type="xsd:string"></wsdl:part> <wsdl:part name="message" type="xsd:string"></wsdl:part>
</wsdl:message> </wsdl:message>
<wsdl:portType name="ConfigPortType" > <wsdl:portType name="ConfigPortType" >
<wsdl:operation name="saveRessource"> <wsdl:operation name="saveRessource">
<wsdl:input message="tns:SaveRessourceRequest"></wsdl:input> <wsdl:input message="tns:SaveRessourceRequest"></wsdl:input>
<wsdl:output message="tns:SaveRessourceResponse"></wsdl:output> <wsdl:output message="tns:SaveRessourceResponse"></wsdl:output>
</wsdl:operation> </wsdl:operation>
</wsdl:portType> </wsdl:portType>
<wsdl:binding name="ConfigBinding" type="tns:ConfigPortType"> <wsdl:binding name="ConfigBinding" type="tns:ConfigPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" /> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="saveRessource"> <wsdl:operation name="saveRessource">
<soap:operation soapAction="<?php echo APP_ROOT."soap/saveRessource";?>" /> <soap:operation soapAction="<?php echo APP_ROOT."soap/saveRessource";?>" />
<wsdl:input> <wsdl:input>
<soap:body use="encoded" namespace="http://localhost/soap/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> <soap:body use="encoded" namespace="http://localhost/soap/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</wsdl:input> </wsdl:input>
<wsdl:output> <wsdl:output>
<soap:body use="encoded" namespace="http://localhost/soap/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> <soap:body use="encoded" namespace="http://localhost/soap/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</wsdl:output> </wsdl:output>
</wsdl:operation> </wsdl:operation>
</wsdl:binding> </wsdl:binding>
<wsdl:service name="Ressource"> <wsdl:service name="Ressource">
<wsdl:port name="ConfigWebservicePort" binding="tns:ConfigBinding"> <wsdl:port name="ConfigWebservicePort" binding="tns:ConfigBinding">
<soap:address location="<?php echo APP_ROOT."soap/ressource.soap.php";?>"/> <soap:address location="<?php echo APP_ROOT."soap/ressource.soap.php";?>"/>
</wsdl:port> </wsdl:port>
</wsdl:service> </wsdl:service>
</wsdl:definitions> </wsdl:definitions>
+23 -17
View File
@@ -28,6 +28,8 @@ require_once('../config/vilesci.config.inc.php');
require_once('../include/basis_db.class.php'); require_once('../include/basis_db.class.php');
require_once('../include/ressource.class.php'); require_once('../include/ressource.class.php');
require_once('../include/datum.class.php'); require_once('../include/datum.class.php');
require_once('../include/functions.inc.php');
require_once('../include/benutzerberechtigung.class.php');
$SOAPServer = new SoapServer(APP_ROOT."/soap/ressource_projekt.wsdl.php?".microtime()); $SOAPServer = new SoapServer(APP_ROOT."/soap/ressource_projekt.wsdl.php?".microtime());
$SOAPServer->addFunction("saveProjektRessource"); $SOAPServer->addFunction("saveProjektRessource");
@@ -39,33 +41,37 @@ ini_set("soap.wsdl_cache_enabled", "0");
/** /**
* *
* Speichert in der Zwischentabelle Ressource - Projekt * Speichert in der Zwischentabelle Ressource - Projekt
* @param $projekt_ressource_id * @param $username
* @param $projektphase_id * @param $passwort
* @param $projekt_kurzbz * @param $projektRessource
* @param $ressource_id
* @param $funktion_kurzbz
* @param $beschreibung
* @param $user
*/ */
function saveProjektRessource($username, $passwort, $projektRessource)
function saveProjektRessource($projekt_ressource_id, $projektphase_id, $projekt_kurzbz, $ressource_id, $funktion_kurzbz, $beschreibung)
{ {
if(!$user = check_user($username, $passwort))
return new SoapFault("Server", "Invalid Credentials");
$rechte = new benutzerberechtigung();
$rechte->getBerechtigungen($user);
if(!$rechte->isBerechtigt('planner', null, 'sui'))
return new SoapFault("Server", "Sie haben keine Berechtigung zum Speichern von Projekten.");
$ressource = new ressource(); $ressource = new ressource();
if($projekt_ressource_id!='') if($projektRessource->projekt_ressource_id!='')
{ {
$ressource->loadProjektRessource($projekt_ressource_id); $ressource->loadProjektRessource($projektRessource->projekt_ressource_id);
$ressource->new = false; $ressource->new = false;
} }
else else
{ {
$ressource->new = true; $ressource->new = true;
} }
$ressource->projekt_ressource_id=$projekt_ressource_id; $ressource->projekt_ressource_id=$projektRessource->projekt_ressource_id;
$ressource->projektphase_id=$projektphase_id; $ressource->projektphase_id=$projektRessource->projektphase_id;
$ressource->projekt_kurzbz=$projekt_kurzbz; $ressource->projekt_kurzbz=$projektRessource->projekt_kurzbz;
$ressource->ressource_id = $ressource_id; $ressource->ressource_id = $projektRessource->ressource_id;
$ressource->funktion_kurzbz = $funktion_kurzbz; $ressource->funktion_kurzbz = $projektRessource->funktion_kurzbz;
$ressource->beschreibung = $beschreibung; $ressource->beschreibung = $projektRessource->beschreibung;
if($ressource->saveProjektRessource()) if($ressource->saveProjektRessource())
+18 -10
View File
@@ -5,21 +5,29 @@ echo "<?xml version='1.0' encoding='utf-8' ?>";
?> ?>
<wsdl:definitions name="ProjektRessource" <wsdl:definitions name="ProjektRessource"
targetNamespace="http://localhost/soap/" targetNamespace="http://www.technikum-wien.at/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://localhost/soap/" xmlns:tns="http://www.technikum-wien.at/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsd1="http://localhost/soap/projektressource.xsd" xmlns:xsd1="http://localhost/soap/projektressource.xsd"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<wsdl:message name="SaveProjektRessourceRequest"> <wsdl:message name="SaveProjektRessourceRequest">
<wsdl:part name="projekt_ressource_id" type="xsd:int"></wsdl:part> <wsdl:part name="username" type="xsd:string" minOccurs="0"></wsdl:part>
<wsdl:part name="projektphase_id" type="xsd:int"></wsdl:part> <wsdl:part name="passwort" type="xsd:string" minOccurs="0"></wsdl:part>
<wsdl:part name="projekt_kurzbz" type="xsd:string"></wsdl:part> <wsdl:part name="projektRessource" type="tns:projektRessource"></wsdl:part>
<wsdl:part name="ressource_id" type="xsd:int"></wsdl:part> </wsdl:message>
<wsdl:part name="funktion_kurzbz" type="xsd:string"></wsdl:part>
<wsdl:part name="beschreibung" type="xsd:string"></wsdl:part> <xsd:complexType name="projektRessource">
</wsdl:message> <xsd:all>
<wsdl:part name="projekt_ressource_id" type="xsd:int"></wsdl:part>
<wsdl:part name="projektphase_id" type="xsd:int"></wsdl:part>
<wsdl:part name="projekt_kurzbz" type="xsd:string"></wsdl:part>
<wsdl:part name="ressource_id" type="xsd:int"></wsdl:part>
<wsdl:part name="funktion_kurzbz" type="xsd:string"></wsdl:part>
<wsdl:part name="beschreibung" type="xsd:string"></wsdl:part>
</xsd:all>
</xsd:complexType>
<wsdl:message name="SaveProjektRessourceResponse"> <wsdl:message name="SaveProjektRessourceResponse">
<wsdl:part name="message" type="xsd:string"></wsdl:part> <wsdl:part name="message" type="xsd:string"></wsdl:part>