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
var soapBody = new SOAPObject("saveRessource");
soapBody.appendChild(new SOAPObject("ressource_id")).val(ressource_id);
soapBody.appendChild(new SOAPObject("bezeichnung")).val(bezeichnung);
soapBody.appendChild(new SOAPObject("beschreibung")).val(beschreibung);
soapBody.appendChild(new SOAPObject("mitarbeiter_uid")).val(mitarbeiter_uid);
soapBody.appendChild(new SOAPObject("student_uid")).val(student_uid);
soapBody.appendChild(new SOAPObject("betriebsmittel_id")).val(betriebsmittel_id);
soapBody.appendChild(new SOAPObject("firma_id")).val(firma_id);
soapBody.appendChild(new SOAPObject("user")).val(getUsername());
//soapBody.appendChild(new SOAPObject("username")).val('joe');
//soapBody.appendChild(new SOAPObject("passwort")).val('waschl');
var ressource = new SOAPObject("ressource");
ressource.appendChild(new SOAPObject("ressource_id")).val(ressource_id);
ressource.appendChild(new SOAPObject("bezeichnung")).val(bezeichnung);
ressource.appendChild(new SOAPObject("beschreibung")).val(beschreibung);
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 =='')
{
alert('ungueltige ID');
+16 -9
View File
@@ -349,21 +349,28 @@ echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
//debug(id);
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 != '')
{
soapBody.appendChild(new SOAPObject("projektphase_id")).val('');
soapBody.appendChild(new SOAPObject("projekt_kurzbz")).val(projekt_kurzbz);
projektRessource.appendChild(new SOAPObject("projektphase_id")).val('');
projektRessource.appendChild(new SOAPObject("projekt_kurzbz")).val(projekt_kurzbz);
}else if(projektphase_id != '')
{
soapBody.appendChild(new SOAPObject("projektphase_id")).val(projektphase_id);
soapBody.appendChild(new SOAPObject("projekt_kurzbz")).val('');
projektRessource.appendChild(new SOAPObject("projektphase_id")).val(projektphase_id);
projektRessource.appendChild(new SOAPObject("projekt_kurzbz")).val('');
}
soapBody.appendChild(new SOAPObject("ressource_id")).val(id);
soapBody.appendChild(new SOAPObject("funktion_kurzbz")).val('');
soapBody.appendChild(new SOAPObject("beschreibung")).val('');
projektRessource.appendChild(new SOAPObject("ressource_id")).val(id);
projektRessource.appendChild(new SOAPObject("funktion_kurzbz")).val('');
projektRessource.appendChild(new SOAPObject("beschreibung")).val('');
soapBody.appendChild(projektRessource);
var sr = new SOAPRequest("saveProjektRessource",soapBody);
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/ressource.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->addFunction("saveRessource");
@@ -39,41 +41,45 @@ ini_set("soap.wsdl_cache_enabled", "0");
/**
*
* Speichert die Ressource
* @param unknown_type $ressource_id
* @param unknown_type $bezeichnung
* @param unknown_type $beschreibung
* @param unknown_type $mitarbeiter_uid
* @param unknown_type $student_uid
* @param unknown_type $betriebsmittel_id
* @param unknown_type $firma_id
* @param unknown_type $user
* @param $username
* @param $passwort
* @param $ressource
*/
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!='')
{
$ressource->load($ressource_id);
$ressource->new = false;
$ressourceNew->load($ressource->ressource_id);
$ressourceNew->new = false;
}
else
{
$ressource->new = true;
$ressource->insertvon = $user;
$ressourceNew->new = true;
$ressourceNew->insertvon = $user;
}
$ressource->ressource_id=$ressource_id;
$ressource->bezeichnung=$bezeichnung;
$ressource->beschreibung=$beschreibung;
$ressource->mitarbeiter_uid = $mitarbeiter_uid;
$ressource->student_uid = $student_uid;
$ressource->betriebsmittel_id = $betriebsmittel_id;
$ressource->firma_id = $firma_id;
$ressource->updatevon = $user;
$ressourceNew->ressource_id=$ressource->ressource_id;
$ressourceNew->bezeichnung=$ressource->bezeichnung;
$ressourceNew->beschreibung=$ressource->beschreibung;
$ressourceNew->mitarbeiter_uid = $ressource->mitarbeiter_uid;
$ressourceNew->student_uid = $ressource->student_uid;
$ressourceNew->betriebsmittel_id = $ressource->betriebsmittel_id;
$ressourceNew->firma_id = $ressource->firma_id;
$ressourceNew->updatevon = $user;
if($ressource->save())
return $ressource->ressource_id;
if($ressourceNew->save())
return $ressourceNew->ressource_id;
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"
targetNamespace="http://localhost/soap/"
targetNamespace="http://www.technikum-wien.at/soap/"
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:xsd1="http://localhost/soap/ressource.xsd"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<wsdl:message name="SaveRessourceRequest">
<wsdl:part name="ressource_id" type="xsd:int"></wsdl:part>
<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>
<wsdl:part name="user" type="xsd:string"></wsdl:part>
</wsdl:message>
<wsdl:part name="username" type="xsd:string" minOccurs="0"></wsdl:part>
<wsdl:part name="passwort" type="xsd:string" minOccurs="0"></wsdl:part>
<wsdl:part name="ressource" type="tns:ressource"></wsdl:part>
</wsdl:message>
<xsd:complexType name="ressource">
<xsd:all>
<wsdl:part name="ressource_id" type="xsd:int"></wsdl:part>
<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:part name="message" type="xsd:string"></wsdl:part>
</wsdl:message>
<wsdl:portType name="ConfigPortType" >
<wsdl:operation name="saveRessource">
<wsdl:input message="tns:SaveRessourceRequest"></wsdl:input>
<wsdl:output message="tns:SaveRessourceResponse"></wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:portType name="ConfigPortType" >
<wsdl:operation name="saveRessource">
<wsdl:input message="tns:SaveRessourceRequest"></wsdl:input>
<wsdl:output message="tns:SaveRessourceResponse"></wsdl:output>
</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="saveRessource">
<soap:operation soapAction="<?php echo APP_ROOT."soap/saveRessource";?>" />
<wsdl:input>
<soap:body use="encoded" namespace="http://localhost/soap/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</wsdl:input>
<wsdl:output>
<soap:body use="encoded" namespace="http://localhost/soap/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="ConfigBinding" type="tns:ConfigPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="saveRessource">
<soap:operation soapAction="<?php echo APP_ROOT."soap/saveRessource";?>" />
<wsdl:input>
<soap:body use="encoded" namespace="http://localhost/soap/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</wsdl:input>
<wsdl:output>
<soap:body use="encoded" namespace="http://localhost/soap/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Ressource">
<wsdl:port name="ConfigWebservicePort" binding="tns:ConfigBinding">
<soap:address location="<?php echo APP_ROOT."soap/ressource.soap.php";?>"/>
</wsdl:port>
</wsdl:service>
<wsdl:service name="Ressource">
<wsdl:port name="ConfigWebservicePort" binding="tns:ConfigBinding">
<soap:address location="<?php echo APP_ROOT."soap/ressource.soap.php";?>"/>
</wsdl:port>
</wsdl:service>
</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/ressource.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->addFunction("saveProjektRessource");
@@ -39,33 +41,37 @@ ini_set("soap.wsdl_cache_enabled", "0");
/**
*
* Speichert in der Zwischentabelle Ressource - Projekt
* @param $projekt_ressource_id
* @param $projektphase_id
* @param $projekt_kurzbz
* @param $ressource_id
* @param $funktion_kurzbz
* @param $beschreibung
* @param $user
* @param $username
* @param $passwort
* @param $projektRessource
*/
function saveProjektRessource($projekt_ressource_id, $projektphase_id, $projekt_kurzbz, $ressource_id, $funktion_kurzbz, $beschreibung)
function saveProjektRessource($username, $passwort, $projektRessource)
{
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();
if($projekt_ressource_id!='')
if($projektRessource->projekt_ressource_id!='')
{
$ressource->loadProjektRessource($projekt_ressource_id);
$ressource->loadProjektRessource($projektRessource->projekt_ressource_id);
$ressource->new = false;
}
else
{
$ressource->new = true;
}
$ressource->projekt_ressource_id=$projekt_ressource_id;
$ressource->projektphase_id=$projektphase_id;
$ressource->projekt_kurzbz=$projekt_kurzbz;
$ressource->ressource_id = $ressource_id;
$ressource->funktion_kurzbz = $funktion_kurzbz;
$ressource->beschreibung = $beschreibung;
$ressource->projekt_ressource_id=$projektRessource->projekt_ressource_id;
$ressource->projektphase_id=$projektRessource->projektphase_id;
$ressource->projekt_kurzbz=$projektRessource->projekt_kurzbz;
$ressource->ressource_id = $projektRessource->ressource_id;
$ressource->funktion_kurzbz = $projektRessource->funktion_kurzbz;
$ressource->beschreibung = $projektRessource->beschreibung;
if($ressource->saveProjektRessource())
+18 -10
View File
@@ -5,21 +5,29 @@ echo "<?xml version='1.0' encoding='utf-8' ?>";
?>
<wsdl:definitions name="ProjektRessource"
targetNamespace="http://localhost/soap/"
targetNamespace="http://www.technikum-wien.at/soap/"
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:xsd1="http://localhost/soap/projektressource.xsd"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<wsdl:message name="SaveProjektRessourceRequest">
<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>
</wsdl:message>
<wsdl:message name="SaveProjektRessourceRequest">
<wsdl:part name="username" type="xsd:string" minOccurs="0"></wsdl:part>
<wsdl:part name="passwort" type="xsd:string" minOccurs="0"></wsdl:part>
<wsdl:part name="projektRessource" type="tns:projektRessource"></wsdl:part>
</wsdl:message>
<xsd:complexType name="projektRessource">
<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:part name="message" type="xsd:string"></wsdl:part>