From c98fa5c6d43893766da6dc909966e5e53f52c240 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Tue, 5 Nov 2013 10:38:49 +0000 Subject: [PATCH] Speichern der Studienordnung hinzugefuegt --- include/akadgrad.class.php | 33 ++++++++++++- include/studienordnung.class.php | 2 +- soap/fhcomplete.php | 49 ++++++++++++++++++- vilesci/lehre/studienordnung.inc.php | 19 +++++++- vilesci/lehre/studienordnung.js | 72 +++++++++++++++++++++++++++- 5 files changed, 169 insertions(+), 6 deletions(-) diff --git a/include/akadgrad.class.php b/include/akadgrad.class.php index 3210e91fd..ddfd3cfdd 100644 --- a/include/akadgrad.class.php +++ b/include/akadgrad.class.php @@ -84,5 +84,36 @@ class akadgrad extends basis_db return false; } } + + /** + * Laedt alle Eintraege + */ + public function getAll() + { + //laden des Datensatzes + $qry = "SELECT * FROM lehre.tbl_akadgrad"; + + if($this->db_query($qry)) + { + while($row = $this->db_fetch_object()) + { + $obj = new akadgrad(); + + $obj->akadgrad_id = $row->akadgrad_id; + $obj->akadgrad_kurzbz = $row->akadgrad_kurzbz; + $obj->studiengang_kz = $row->studiengang_kz; + $obj->titel = $row->titel; + $obj->geschlecht = $row->geschlecht; + + $this->result[] = $obj; + } + return true; + } + else + { + $this->errormsg = 'Fehler bei der Datenbankabfrage'; + return false; + } + } } -?> \ No newline at end of file +?> diff --git a/include/studienordnung.class.php b/include/studienordnung.class.php index ede7eb6f4..cc86b1e51 100644 --- a/include/studienordnung.class.php +++ b/include/studienordnung.class.php @@ -200,7 +200,7 @@ class studienordnung extends basis_db protected function validate() { //Zahlenfelder pruefen - if(!is_numeric($this->studiengang_kz) && $this->studiengang_kz!=='') + if(!is_numeric($this->studiengang_kz) && $this->studiengang_kz!='') { $this->errormsg='studiengang_kz enthaelt ungueltige Zeichen'; return false; diff --git a/soap/fhcomplete.php b/soap/fhcomplete.php index 81335c295..3ea8d8dfe 100644 --- a/soap/fhcomplete.php +++ b/soap/fhcomplete.php @@ -59,7 +59,54 @@ if(!$wsrecht->isUserAuthorized($uid, $method)) // Funktion aufrufen $obj = new $class(); -if(call_user_func_array(array($obj, $method), $parameter)) +$error=false; + + +// Bei Save Funktionen werden alle Parameter zugewiesen +if(mb_stristr($method,'save')) +{ + $loaddata=json_decode($_REQUEST['loaddata'], true); + $savedata=json_decode($_REQUEST['savedata'], true); + + if(isset($loaddata['method'])) + { + if(!$wsrecht->isUserAuthorized($uid, $loaddata['method'])) + die('keine Berechtigung'); + + // Bearbeiten + $loadparameter=array(); + for($i=0;$i<20;$i++) + { + $name = 'parameter_'.$i; + if(isset($loaddata[$name])) + $loadparameter[]=$loaddata[$name]; + else + break; + } + + if(!call_user_func_array(array($obj, $loaddata['method']), $loadparameter)) + { + $error=true; + } + } + else + { + // Neu + $obj->insertvon = $uid; + $obj->insertamum = date('Y-m-d H:i:s'); + } + + if(!$error) + { + // Attribute zuweisen zum Speichern + foreach($savedata as $key=>$value) + { + $obj->$key=$value; + } + } +} + +if(!$error && call_user_func_array(array($obj, $method), $parameter)) { $data['result']=$obj->cleanResult(); $data['error']='false'; diff --git a/vilesci/lehre/studienordnung.inc.php b/vilesci/lehre/studienordnung.inc.php index d6adef6d3..d443eca3d 100644 --- a/vilesci/lehre/studienordnung.inc.php +++ b/vilesci/lehre/studienordnung.inc.php @@ -29,7 +29,7 @@ require_once('../../include/functions.inc.php'); require_once('../../include/studiensemester.class.php'); require_once('../../include/organisationsform.class.php'); require_once('../../include/sprache.class.php'); - +require_once('../../include/akadgrad.class.php'); $uid = get_uid(); $db = new basis_db(); @@ -54,6 +54,7 @@ switch($method) die('Studiengang ist ungültig'); echo ' + @@ -78,7 +79,7 @@ switch($method) - + + + diff --git a/vilesci/lehre/studienordnung.js b/vilesci/lehre/studienordnung.js index c8522e0b0..4453f3ed4 100644 --- a/vilesci/lehre/studienordnung.js +++ b/vilesci/lehre/studienordnung.js @@ -25,7 +25,12 @@ var lehrveranstaltungen=''; function loadError(xhr, textStatus, errorThrown) { - alert('Fehler beim Laden der Daten. ErrorNr:'+xhr.status); + if(xhr.status==200) + { + alert('Fehler:'+xhr.responseText); + } + else + alert('Fehler beim Laden der Daten. ErrorNr:'+xhr.status); } function drawHeader(text) @@ -211,3 +216,68 @@ function neuerStudienplan() $("#data").load('studienordnung.inc.php?method=neuerStudienplan&studiengang_kz='+studiengang_kz); } +function saveStudienordnung() +{ + bezeichnung = $("#bezeichnung").val(); + version = $("#version").val(); + gueltigvon = $("#gueltigvon option:selected").val(); + gueltigbis = $("#gueltigbis option:selected").val(); + ects = $("#ects").val(); + studiengangbezeichnung = $("#studiengangbezeichnung").val(); + studiengangbezeichnungenglisch = $("#studiengangbezeichnungenglisch").val(); + studiengangkurzbzlang = $("#studiengangkurzbzlang").val(); + studienordnung_id = $("#studienordnung_id").val(); + akadgrad_id = $("#akadgrad_id").val(); + + if(studienordnung_id!='') + { + loaddata = { + "method": "loadStudienordnung", + "parameter_0": studienordnung_id + }; + } + else + loaddata={}; + + savedata = { + "bezeichnung": bezeichnung, + "version":version, + "gueltigvon":gueltigvon, + "gueltigbis":gueltigbis, + "ects":ects, + "studiengangbezeichnung":studiengangbezeichnung, + "studiengangbezeichnungenglisch":studiengangbezeichnungenglisch, + "studiengangkurzbzlang":studiengangkurzbzlang, + "akadgrad_id":akadgrad_id, + "studiengang_kz":studiengang_kz + }; + + + $.ajax( + { + dataType: "json", + url: "../../soap/fhcomplete.php", + type: "POST", + data: { + "typ": "json", + "class": "studienordnung", + "method": "save", + "loaddata": JSON.stringify(loaddata), + "savedata": JSON.stringify(savedata), + }, + success: StudienordnungSaved, + error: loadError + }); +} +function StudienordnungSaved() +{ + if(data.error=='true') + { + alert('Fehler:'+data.errormsg); + } + else + { + loadStudienordnung(); + } +} +
Bezeichnung:
Gültig bis:Kurzbezeichnung des Studiengangs:
Akademischer Grad + +