mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
Testtool Aktiv und Studienplan
- Studienplan in tbl_ablauf - Aktiv-Attribut bei Frage und Vorschlag - Bezeichnung mehrsprachig in Gebiet - GUI für Ablauf-Pflege inkl. Studienplan - GUI für Gebiete hinzufügen - GUI für Pflege der mehrsprachigen Gebietsbezeichnung - Aktiv/Inaktiv setzen von Fragen und Vorschlägen in GUI - !!! Aktiv-Attribute greifen noch nicht im Testtool selbst !!!
This commit is contained in:
@@ -0,0 +1,324 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006 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: Christian Paminger <christian.paminger@technikum-wien.at>,
|
||||
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at>,
|
||||
* Rudolf Hangl <rudolf.hangl@technikum-wien.at> and
|
||||
* Andreas Moik <moik@technikum-wien.at>.
|
||||
*/
|
||||
/**
|
||||
* Klasse zur Verwaltung der Ablaeufe der Raihungstests
|
||||
*/
|
||||
require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||
|
||||
class ablauf extends basis_db
|
||||
{
|
||||
public $new;
|
||||
public $result = array();
|
||||
|
||||
//Tabellenspalten
|
||||
public $studiengang_kz;
|
||||
public $gebiet_id;
|
||||
public $reihung;
|
||||
public $gewicht;
|
||||
public $ablauf_id;
|
||||
public $insertamum;
|
||||
public $insertvon;
|
||||
public $updateamum;
|
||||
public $updatevon;
|
||||
public $semester;
|
||||
public $ablauf_vorgaben_id;
|
||||
public $studienplan_id;
|
||||
|
||||
/**
|
||||
* Konstruktor
|
||||
* @param $ablauf_id ID des zu ladenden Datensatzes
|
||||
*/
|
||||
public function __construct($ablauf_id=null)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
if(!is_null($ablauf_id))
|
||||
$this->load($ablauf_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt einen Datensatz
|
||||
* @param abschlusspruefung_id ID des zu ladenden Datensatzes
|
||||
*/
|
||||
public function load($ablauf_id)
|
||||
{
|
||||
//id auf Gueltigkeit pruefen
|
||||
if(!is_numeric($ablauf_id))
|
||||
{
|
||||
$this->errormsg = 'ablauf_id muss eine gueltige Zahl sein';
|
||||
return false;
|
||||
}
|
||||
|
||||
//laden des Datensatzes
|
||||
$qry = "SELECT
|
||||
*
|
||||
FROM
|
||||
testtool.tbl_ablauf
|
||||
WHERE ablauf_id=".$this->db_add_param($ablauf_id, FHC_INTEGER, false).";";
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object())
|
||||
{
|
||||
$obj = new ablauf();
|
||||
|
||||
$obj->studiengang_kz = $row->studiengang_kz;
|
||||
$obj->gebiet_id = $row->gebiet_id;
|
||||
$obj->reihung = $row->reihung;
|
||||
$obj->gewicht = $row->gewicht;
|
||||
$obj->ablauf_id = $row->ablauf_id;
|
||||
$obj->semester = $row->semester;
|
||||
$obj->ablauf_vorgaben_id = $row->ablauf_vorgaben_id;
|
||||
$obj->studienplan_id = $row->studienplan_id;
|
||||
$obj->updateamum = $row->updateamum;
|
||||
$obj->updatevon = $row->updatevon;
|
||||
$obj->insertamum = $row->insertamum;
|
||||
$obj->insertvon = $row->insertvon;
|
||||
|
||||
$this->result[] = $obj;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler bei der Datenbankabfrage';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler bei der Datenbankabfrage';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loescht einen Datensatz
|
||||
* @param abschlusspruefung_id ID des zu loeschenden Datensatzes
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
public function delete($ablauf_id)
|
||||
{
|
||||
//abschlusspruefung_id auf Gueltigkeit pruefen
|
||||
if(!is_numeric($ablauf_id))
|
||||
{
|
||||
$this->errormsg = 'ablauf_id muss eine gueltige Zahl sein';
|
||||
return false;
|
||||
}
|
||||
|
||||
$qry = "DELETE FROM testtool.tbl_ablauf
|
||||
WHERE ablauf_id=".$this->db_add_param($ablauf_id, FHC_INTEGER, false).";";
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Loeschen';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prueft die Daten vor dem Speichern
|
||||
*
|
||||
* @return true wenn ok, false wenn Fehler
|
||||
*/
|
||||
protected function validate()
|
||||
{
|
||||
if($this->studiengang_kz=='')
|
||||
{
|
||||
$this->errormsg = 'studiengang_kz muss eingegeben werden';
|
||||
return false;
|
||||
}
|
||||
if($this->gebiet_id=='')
|
||||
{
|
||||
$this->errormsg = 'gebiet_id muss eingetragen werden';
|
||||
return false;
|
||||
}
|
||||
if($this->reihung=='')
|
||||
{
|
||||
$this->errormsg = 'reihung muss eingetragen werden';
|
||||
return false;
|
||||
}
|
||||
if($this->gewicht=='')
|
||||
{
|
||||
$this->errormsg = 'gewicht muss eingetragen werden';
|
||||
return false;
|
||||
}
|
||||
if($this->semester=='')
|
||||
{
|
||||
$this->errormsg = 'semester muss eingetragen werden';
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Speichert den aktuellen Datensatz
|
||||
* Wenn $neu auf true gesetzt ist wird ein neuer Datensatz angelegt
|
||||
* andernfalls wird der Datensatz mit der ID in $akte_id aktualisiert
|
||||
* @return true wenn ok, false im Fehlerfall
|
||||
*/
|
||||
public function save($new=null)
|
||||
{
|
||||
if(!$this->validate())
|
||||
return false;
|
||||
if($new==null)
|
||||
$new = $this->new;
|
||||
|
||||
if($new)
|
||||
{
|
||||
//Neuen Datensatz anlegen
|
||||
$qry = "BEGIN;INSERT INTO testtool.tbl_ablauf (studiengang_kz, gebiet_id, reihung,
|
||||
gewicht, semester, ablauf_vorgaben_id, studienplan_id,
|
||||
updateamum, updatevon, insertamum, insertvon) VALUES (".
|
||||
$this->db_add_param($this->studiengang_kz, FHC_INTEGER).', '.
|
||||
$this->db_add_param($this->gebiet_id, FHC_INTEGER).', '.
|
||||
$this->db_add_param($this->reihung, FHC_INTEGER).', '.
|
||||
$this->db_add_param($this->gewicht, FHC_INTEGER).', '.
|
||||
$this->db_add_param($this->semester, FHC_INTEGER).', '.
|
||||
$this->db_add_param($this->ablauf_vorgaben_id, FHC_INTEGER).', '.
|
||||
$this->db_add_param($this->studienplan_id).', '.
|
||||
$this->db_add_param($this->updateamum).', '.
|
||||
$this->db_add_param($this->updatevon).', '.
|
||||
$this->db_add_param($this->insertamum).', '.
|
||||
$this->db_add_param($this->insertvon).');';
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//Bestehenden Datensatz aktualisieren
|
||||
$qry= "UPDATE testtool.tbl_ablauf SET".
|
||||
" studiengang_kz=".$this->db_add_param($this->studiengang_kz, FHC_INTEGER).",".
|
||||
" gebiet_id=".$this->db_add_param($this->gebiet_id, FHC_INTEGER).",".
|
||||
" reihung=".$this->db_add_param($this->reihung, FHC_INTEGER).",".
|
||||
" gewicht=".$this->db_add_param($this->gewicht, FHC_INTEGER).",".
|
||||
" semester=".$this->db_add_param($this->semester, FHC_INTEGER).",".
|
||||
" ablauf_vorgaben_id=".$this->db_add_param($this->ablauf_vorgaben_id, FHC_INTEGER).",".
|
||||
" studienplan_id=".$this->db_add_param($this->studienplan_id).",".
|
||||
" updateamum=".$this->db_add_param($this->updateamum).",".
|
||||
" updatevon=".$this->db_add_param($this->updatevon).
|
||||
" WHERE ablauf_id=".$this->db_add_param($this->ablauf_id, FHC_INTEGER);
|
||||
}
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
if($new)
|
||||
{
|
||||
$qry = "SELECT currval('testtool.tbl_ablauf_ablauf_id_seq') as id";
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object())
|
||||
{
|
||||
$this->ablauf_id = $row->id;
|
||||
$this->db_query('COMMIT;');
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Auslesen der Sequence';
|
||||
$this->db_query('ROLLBACK');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Auslesen der Sequence';
|
||||
$this->db_query('ROLLBACK');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Speichern des Datensatzes';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt die zugehoerigen Gebiete zum angegebenen Studiengang (gegebenfalls auch Studiengang)
|
||||
* @param $studiengang_kz Studiengang
|
||||
* @return boolean true wenn ok sonst false
|
||||
*/
|
||||
public function getAblaufGebiete($studiengang_kz, $studienplan_id=null) {
|
||||
$qry = "SELECT * FROM testtool.tbl_ablauf WHERE studiengang_kz=".$studiengang_kz;
|
||||
if (!is_null($studienplan_id))
|
||||
$qry .= " AND studienplan_id=".$studienplan_id;
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$obj = new stdClass();
|
||||
|
||||
$obj->gebiet_id = $row->gebiet_id;
|
||||
$obj->reihung = $row->reihung;
|
||||
$obj->gewicht = $row->gewicht;
|
||||
$obj->semester = $row->semester;
|
||||
$obj->studienplan_id = $row->studienplan_id;
|
||||
|
||||
$this->result[]= $obj;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Leadt die ablauf_id zu einer Kombination aus Studiengang und Gebiet
|
||||
* @param $studiengang_kz Studiengang
|
||||
* @param $gebiet_id Gebiet
|
||||
* @return boolean true wenn ok sonst false
|
||||
*/
|
||||
public function getAblaufId($studiengang_kz, $gebiet_id)
|
||||
{
|
||||
$qry = "SELECT
|
||||
*
|
||||
FROM
|
||||
testtool.tbl_ablauf
|
||||
WHERE studiengang_kz=".$studiengang_kz." AND gebiet_id=".$gebiet_id.";";
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object())
|
||||
{
|
||||
$this->result[] = $row->ablauf_id;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler bei der Datenbankabfrage';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
+79
-11
@@ -36,6 +36,7 @@ class frage extends basis_db
|
||||
public $demo;
|
||||
public $level;
|
||||
public $kategorie_kurzbz;
|
||||
public $aktiv;
|
||||
|
||||
public $sprache;
|
||||
public $audio;
|
||||
@@ -80,7 +81,7 @@ class frage extends basis_db
|
||||
return false;
|
||||
}
|
||||
|
||||
$qry = "SELECT * FROM testtool.tbl_frage WHERE frage_id=".$this->db_add_param($frage_id, FHC_INTEGER);
|
||||
$qry = "SELECT * FROM testtool.tbl_frage LEFT OUTER JOIN testtool.tbl_frage_sprache USING (frage_id) WHERE frage_id=".$this->db_add_param($frage_id, FHC_INTEGER);
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
@@ -96,6 +97,8 @@ class frage extends basis_db
|
||||
$this->insertamum = $row->insertamum;
|
||||
$this->insertvon = $row->insertvon;
|
||||
$this->level = $row->level;
|
||||
$this->aktiv = $row->aktiv;
|
||||
$this->bild = $row->bild;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -137,7 +140,7 @@ class frage extends basis_db
|
||||
if($this->new) //Wenn new true ist dann ein INSERT absetzen ansonsten ein UPDATE
|
||||
{
|
||||
$qry = 'BEGIN;INSERT INTO testtool.tbl_frage (kategorie_kurzbz, gebiet_id, level, nummer, demo,
|
||||
insertamum, insertvon, updateamum, updatevon) VALUES('.
|
||||
insertamum, insertvon, aktiv, updateamum, updatevon) VALUES('.
|
||||
$this->db_add_param($this->kategorie_kurzbz).','.
|
||||
$this->db_add_param($this->gebiet_id, FHC_INTEGER).','.
|
||||
$this->db_add_param($this->level).','.
|
||||
@@ -145,6 +148,7 @@ class frage extends basis_db
|
||||
$this->db_add_param($this->demo, FHC_BOOLEAN).','.
|
||||
$this->db_add_param($this->insertamum).','.
|
||||
$this->db_add_param($this->insertvon).','.
|
||||
$this->db_add_param($this->aktiv, FHC_BOOLEAN).','.
|
||||
'null,null);';
|
||||
}
|
||||
else
|
||||
@@ -156,7 +160,8 @@ class frage extends basis_db
|
||||
' nummer='.$this->db_add_param($this->nummer).','.
|
||||
' demo='.$this->db_add_param($this->demo, FHC_BOOLEAN).','.
|
||||
' updateamum='.$this->db_add_param($this->updateamum).','.
|
||||
' updatevon='.$this->db_add_param($this->updatevon).
|
||||
' updatevon='.$this->db_add_param($this->updatevon).','.
|
||||
' aktiv='.$this->db_add_param($this->aktiv, FHC_BOOLEAN).
|
||||
" WHERE frage_id=".$this->db_add_param($this->frage_id, FHC_INTEGER, false).";";
|
||||
}
|
||||
|
||||
@@ -222,12 +227,12 @@ class frage extends basis_db
|
||||
else
|
||||
{
|
||||
$qry = 'UPDATE testtool.tbl_frage_sprache SET'.
|
||||
' text='.$this->db_add_param($this->text).','.
|
||||
' bild='.$this->db_add_param($this->bild).','.
|
||||
' audio='.$this->db_add_param($this->audio).','.
|
||||
' updateamum='.$this->db_add_param($this->updateamum).','.
|
||||
' updatevon='.$this->db_add_param($this->updatevon).
|
||||
" WHERE frage_id=".$this->db_add_param($this->frage_id, FHC_INTEGER, false)." AND sprache=".$this->db_add_param($this->sprache).";";
|
||||
' text='.$this->db_add_param($this->text).','.
|
||||
' bild='.$this->db_add_param($this->bild).','.
|
||||
' audio='.$this->db_add_param($this->audio).','.
|
||||
' updateamum='.$this->db_add_param($this->updateamum).','.
|
||||
' updatevon='.$this->db_add_param($this->updatevon).
|
||||
" WHERE frage_id=".$this->db_add_param($this->frage_id, FHC_INTEGER, false)." AND sprache=".$this->db_add_param($this->sprache).";";
|
||||
}
|
||||
|
||||
if($this->db_query($qry))
|
||||
@@ -265,6 +270,7 @@ class frage extends basis_db
|
||||
$obj->level = $row->level;
|
||||
$obj->nummer = $row->nummer;
|
||||
$obj->demo = $this->db_parse_bool($row->demo);
|
||||
$obj->aktiv = $this->db_parse_bool($row->aktiv); //TODO
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
@@ -281,7 +287,7 @@ class frage extends basis_db
|
||||
/**
|
||||
* Liefert die Fragen eines Gebietes
|
||||
*
|
||||
* @param $gebiet_id
|
||||
* @param integer $gebiet_id
|
||||
* @return true wenn ok, sonst false
|
||||
*/
|
||||
public function getFragenGebiet($gebiet_id)
|
||||
@@ -301,6 +307,7 @@ class frage extends basis_db
|
||||
$obj->level = $row->level;
|
||||
$obj->nummer = $row->nummer;
|
||||
$obj->demo = $this->db_parse_bool($row->demo);
|
||||
$obj->aktiv = $this->db_parse_bool($row->aktiv);
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
@@ -346,7 +353,7 @@ class frage extends basis_db
|
||||
if(!is_null($frage_id))
|
||||
$qry.=" AND tbl_pruefling_frage.nummer>(SELECT nummer FROM testtool.tbl_pruefling_frage WHERE pruefling_id=".$this->db_add_param($pruefling_id, FHC_INTEGER)." AND frage_id=".$this->db_add_param($frage_id, FHC_INTEGER)." LIMIT 1)";
|
||||
elseif(is_null($frage_id) && $levelgebiet)
|
||||
$qry.=" AND tbl_pruefling_frage.endtime is null ";
|
||||
$qry.=" AND tbl_pruefling_frage.endtime is null";
|
||||
|
||||
$qry.="ORDER BY tbl_pruefling_frage.nummer ASC LIMIT 1";
|
||||
}
|
||||
@@ -391,6 +398,7 @@ class frage extends basis_db
|
||||
$this->level = $row->level;
|
||||
$this->demo = $this->db_parse_bool($row->demo);
|
||||
$this->nummer = $row->nummer;
|
||||
$this->aktiv = $this->db_parse_bool($row->aktiv);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -535,6 +543,7 @@ class frage extends basis_db
|
||||
tbl_frage.gebiet_id=".$this->db_add_param($gebiet_id, FHC_INTEGER)." AND
|
||||
tbl_pruefling_frage.pruefling_id=".$this->db_add_param($pruefling_id, FHC_INTEGER)."
|
||||
ORDER BY nummer DESC LIMIT 1;";
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object())
|
||||
@@ -819,5 +828,64 @@ class frage extends basis_db
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt die Nummer der naechsten Frage zurueck (nicht fuer den test sondern fuer die testtool-administrationsseite)
|
||||
*
|
||||
* @param $frage_nummer Nummer der aktuellen Frage
|
||||
* @param $gebiet_id Gebiet der Fragen
|
||||
* @param $aktiv true wenn nur aktiv, false wenn nur inaktiv, null wenn beides
|
||||
*/
|
||||
public function getNextFrageNummer($frage_nummer, $gebiet_id, $aktiv=null)
|
||||
{
|
||||
$erg = '';
|
||||
$qry = "SELECT nummer FROM testtool.tbl_frage
|
||||
WHERE gebiet_id=".$this->db_add_param($gebiet_id, FHC_INTEGER)."
|
||||
AND nummer>".$this->db_add_param($frage_nummer, FHC_INTEGER);
|
||||
|
||||
if (!is_null($aktiv) && $aktiv)
|
||||
$qry .= " AND aktiv";
|
||||
if (!is_null($aktiv) && !$aktiv)
|
||||
$qry .= " AND NOT aktiv";
|
||||
|
||||
$qry .= " ORDER BY nummer ASC LIMIT 1"; //Es wird immer nur ein Maximum geben, deswegen kein max()
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object())
|
||||
{
|
||||
$erg .= $row->nummer;
|
||||
}
|
||||
return $erg;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt die letzte (hoechste) Nummer eines Gebiets zurueck
|
||||
*
|
||||
* @param integer $gebiet_id Gebiet der Fragen
|
||||
* @return integer $number Nummer der letzten Frage des Gebiets, wenn gefunden, sonst false
|
||||
*/
|
||||
public function getMaxNummer($gebiet_id)
|
||||
{
|
||||
$number = '';
|
||||
$qry = "SELECT nummer FROM testtool.tbl_frage
|
||||
WHERE gebiet_id=".$this->db_add_param($gebiet_id, FHC_INTEGER)." ORDER BY nummer DESC LIMIT 1";
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object())
|
||||
{
|
||||
$number = $row->nummer;
|
||||
}
|
||||
return $number;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
+60
-39
@@ -72,7 +72,9 @@ class gebiet extends basis_db
|
||||
*/
|
||||
public function load($gebiet_id)
|
||||
{
|
||||
$qry = "SELECT * FROM testtool.tbl_gebiet WHERE gebiet_id=".$this->db_add_param($gebiet_id, FHC_INTEGER);
|
||||
$sprache = new sprache();
|
||||
$bezeichnung_mehrsprachig = $sprache->getSprachQuery('bezeichnung_mehrsprachig');
|
||||
$qry = "SELECT *,$bezeichnung_mehrsprachig FROM testtool.tbl_gebiet WHERE gebiet_id=".$this->db_add_param($gebiet_id, FHC_INTEGER);
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
@@ -81,6 +83,7 @@ class gebiet extends basis_db
|
||||
$this->gebiet_id = $row->gebiet_id;
|
||||
$this->kurzbz = $row->kurzbz;
|
||||
$this->bezeichnung = $row->bezeichnung;
|
||||
$this->bezeichnung_mehrsprachig = $sprache->parseSprachResult('bezeichnung_mehrsprachig', $row);
|
||||
$this->beschreibung = $row->beschreibung;
|
||||
$this->zeit = $row->zeit;
|
||||
$this->multipleresponse = $this->db_parse_bool($row->multipleresponse);
|
||||
@@ -193,47 +196,65 @@ class gebiet extends basis_db
|
||||
{
|
||||
$qry = 'BEGIN;INSERT INTO testtool.tbl_gebiet (kurzbz, bezeichnung, beschreibung, zeit, multipleresponse,
|
||||
kategorien, maxfragen, zufallfrage, zufallvorschlag, level_start, level_sprung_auf, level_sprung_ab,
|
||||
levelgleichverteilung, maxpunkte, antwortenprozeile, insertamum, insertvon , updateamum, updatevon) VALUES('.
|
||||
$this->db_add_param($this->kurzbz).','.
|
||||
$this->db_add_param($this->bezeichnung).','.
|
||||
$this->db_add_param($this->beschreibung).','.
|
||||
$this->db_add_param($this->zeit).','.
|
||||
$this->db_add_param($this->multipleresponse, FHC_BOOLEAN).','.
|
||||
$this->db_add_param($this->kategorien, FHC_BOOLEAN).','.
|
||||
$this->db_add_param($this->maxfragen).','.
|
||||
$this->db_add_param($this->zufallfrage, FHC_BOOLEAN).','.
|
||||
$this->db_add_param($this->zufallvorschlag, FHC_BOOLEAN).','.
|
||||
$this->db_add_param($this->level_start).','.
|
||||
$this->db_add_param($this->level_sprung_auf).','.
|
||||
$this->db_add_param($this->level_sprung_ab).','.
|
||||
$this->db_add_param($this->levelgleichverteilung, FHC_BOOLEAN).','.
|
||||
$this->db_add_param($this->maxpunkte).','.
|
||||
$this->db_add_param($this->antwortenprozeile).','.
|
||||
$this->db_add_param($this->insertamum).','.
|
||||
$this->db_add_param($this->insertvon).
|
||||
',null, null);';
|
||||
levelgleichverteilung, maxpunkte, antwortenprozeile, ';
|
||||
|
||||
foreach($this->bezeichnung_mehrsprachig as $key=>$value)
|
||||
{
|
||||
$idx = sprache::$index_arr[$key];
|
||||
$qry.=" bezeichnung_mehrsprachig[$idx],";
|
||||
}
|
||||
|
||||
$qry.='insertamum, insertvon , updateamum, updatevon) VALUES('.
|
||||
|
||||
$this->db_add_param($this->kurzbz).','.
|
||||
$this->db_add_param($this->bezeichnung).','.
|
||||
$this->db_add_param($this->beschreibung).','.
|
||||
$this->db_add_param($this->zeit).','.
|
||||
$this->db_add_param($this->multipleresponse, FHC_BOOLEAN).','.
|
||||
$this->db_add_param($this->kategorien, FHC_BOOLEAN).','.
|
||||
$this->db_add_param($this->maxfragen).','.
|
||||
$this->db_add_param($this->zufallfrage, FHC_BOOLEAN).','.
|
||||
$this->db_add_param($this->zufallvorschlag, FHC_BOOLEAN).','.
|
||||
$this->db_add_param($this->level_start).','.
|
||||
$this->db_add_param($this->level_sprung_auf).','.
|
||||
$this->db_add_param($this->level_sprung_ab).','.
|
||||
$this->db_add_param($this->levelgleichverteilung, FHC_BOOLEAN).','.
|
||||
$this->db_add_param($this->maxpunkte).','.
|
||||
$this->db_add_param($this->antwortenprozeile).',';
|
||||
foreach($this->bezeichnung_mehrsprachig as $key=>$value)
|
||||
$qry.=$this->db_add_param($value).',';
|
||||
|
||||
$qry .= $this->db_add_param($this->insertamum).','.
|
||||
$this->db_add_param($this->insertvon).
|
||||
',null, null);';
|
||||
}
|
||||
else
|
||||
{
|
||||
$qry = 'UPDATE testtool.tbl_gebiet SET'.
|
||||
' kurzbz='.$this->db_add_param($this->kurzbz).','.
|
||||
' bezeichnung='.$this->db_add_param($this->bezeichnung).','.
|
||||
' beschreibung='.$this->db_add_param($this->beschreibung).','.
|
||||
' zeit='.$this->db_add_param($this->zeit).','.
|
||||
' multipleresponse='.$this->db_add_param($this->multipleresponse, FHC_BOOLEAN).','.
|
||||
' kategorien='.$this->db_add_param($this->kategorien, FHC_BOOLEAN).','.
|
||||
' maxfragen='.$this->db_add_param($this->maxfragen).','.
|
||||
' zufallfrage='.$this->db_add_param($this->zufallfrage, FHC_BOOLEAN).','.
|
||||
' zufallvorschlag='.$this->db_add_param($this->zufallvorschlag, FHC_BOOLEAN).','.
|
||||
' level_start='.$this->db_add_param($this->level_start).','.
|
||||
' level_sprung_auf='.$this->db_add_param($this->level_sprung_auf).','.
|
||||
' level_sprung_ab='.$this->db_add_param($this->level_sprung_ab).','.
|
||||
' levelgleichverteilung='.$this->db_add_param($this->levelgleichverteilung, FHC_BOOLEAN).','.
|
||||
' maxpunkte='.$this->db_add_param($this->maxpunkte).','.
|
||||
' antwortenprozeile='.$this->db_add_param($this->antwortenprozeile).','.
|
||||
' updateamum='.$this->db_add_param($this->updateamum).','.
|
||||
' updatevon='.$this->db_add_param($this->updatevon).
|
||||
" WHERE gebiet_id=".$this->db_add_param($this->gebiet_id, FHC_INTEGER, false).";";
|
||||
' kurzbz='.$this->db_add_param($this->kurzbz).','.
|
||||
' bezeichnung='.$this->db_add_param($this->bezeichnung).','.
|
||||
' beschreibung='.$this->db_add_param($this->beschreibung).','.
|
||||
' zeit='.$this->db_add_param($this->zeit).','.
|
||||
' multipleresponse='.$this->db_add_param($this->multipleresponse, FHC_BOOLEAN).','.
|
||||
' kategorien='.$this->db_add_param($this->kategorien, FHC_BOOLEAN).','.
|
||||
' maxfragen='.$this->db_add_param($this->maxfragen).','.
|
||||
' zufallfrage='.$this->db_add_param($this->zufallfrage, FHC_BOOLEAN).','.
|
||||
' zufallvorschlag='.$this->db_add_param($this->zufallvorschlag, FHC_BOOLEAN).','.
|
||||
' level_start='.$this->db_add_param($this->level_start).','.
|
||||
' level_sprung_auf='.$this->db_add_param($this->level_sprung_auf).','.
|
||||
' level_sprung_ab='.$this->db_add_param($this->level_sprung_ab).','.
|
||||
' levelgleichverteilung='.$this->db_add_param($this->levelgleichverteilung, FHC_BOOLEAN).','.
|
||||
' maxpunkte='.$this->db_add_param($this->maxpunkte).','.
|
||||
' antwortenprozeile='.$this->db_add_param($this->antwortenprozeile).','.
|
||||
' updateamum='.$this->db_add_param($this->updateamum).','.
|
||||
' updatevon='.$this->db_add_param($this->updatevon).',';
|
||||
foreach($this->bezeichnung_mehrsprachig as $key=>$value)
|
||||
{
|
||||
$idx = sprache::$index_arr[$key];
|
||||
$qry .= " bezeichnung_mehrsprachig[$idx]=".$this->db_add_param($value).",";
|
||||
}
|
||||
$qry = mb_substr($qry,0,-1);
|
||||
$qry .= ' WHERE gebiet_id='.$this->db_add_param($this->gebiet_id, FHC_INTEGER, false).';';
|
||||
}
|
||||
|
||||
if($this->db_query($qry))
|
||||
@@ -241,7 +262,7 @@ class gebiet extends basis_db
|
||||
//aktuelle ID aus der Sequence holen
|
||||
if($new)
|
||||
{
|
||||
$qry='SELECT currval("testtool.tbl_gebiet_gebiet_id_seq") as id;';
|
||||
$qry="SELECT currval('testtool.tbl_gebiet_gebiet_id_seq') as id;";
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object())
|
||||
|
||||
@@ -32,6 +32,7 @@ class vorschlag extends basis_db
|
||||
public $frage_id;
|
||||
public $nummer;
|
||||
public $punkte;
|
||||
public $aktiv;
|
||||
|
||||
public $text;
|
||||
public $bild;
|
||||
@@ -75,6 +76,7 @@ class vorschlag extends basis_db
|
||||
$this->frage_id = $row->frage_id;
|
||||
$this->punkte = $row->punkte;
|
||||
$this->nummer = $row->nummer;
|
||||
$this->aktiv = $this->db_parse_bool($row->aktiv);
|
||||
$this->loadVorschlagSprache($vorschlag_id, $sprache);
|
||||
return true;
|
||||
}
|
||||
@@ -142,14 +144,15 @@ class vorschlag extends basis_db
|
||||
|
||||
if($this->new) //Wenn new true ist dann ein INSERT absetzen ansonsten ein UPDATE
|
||||
{
|
||||
$qry = 'BEGIN;INSERT INTO testtool.tbl_vorschlag (frage_id, nummer, punkte, insertamum, insertvon, updateamum, updatevon) VALUES('.
|
||||
$qry = 'BEGIN;INSERT INTO testtool.tbl_vorschlag (frage_id, nummer, punkte, insertamum, insertvon, updateamum, updatevon, aktiv) VALUES('.
|
||||
$this->db_add_param($this->frage_id, FHC_INTEGER).','.
|
||||
$this->db_add_param($this->nummer).','.
|
||||
$this->db_add_param($this->punkte).','.
|
||||
$this->db_add_param($this->insertamum).','.
|
||||
$this->db_add_param($this->insertvon).','.
|
||||
$this->db_add_param($this->updateamum).','.
|
||||
$this->db_add_param($this->updatevon).');';
|
||||
$this->db_add_param($this->updatevon).','.
|
||||
$this->db_add_param($this->aktiv, FHC_BOOLEAN).');';
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -158,7 +161,8 @@ class vorschlag extends basis_db
|
||||
' nummer='.$this->db_add_param($this->nummer).','.
|
||||
' punkte='.$this->db_add_param($this->punkte).','.
|
||||
' updateamum='.$this->db_add_param($this->updateamum).','.
|
||||
' updatevon='.$this->db_add_param($this->updatevon).
|
||||
' updatevon='.$this->db_add_param($this->updatevon).','.
|
||||
' aktiv='.$this->db_add_param($this->aktiv, FHC_BOOLEAN).
|
||||
" WHERE vorschlag_id=".$this->db_add_param($this->vorschlag_id, FHC_INTEGER, false).";";
|
||||
}
|
||||
|
||||
@@ -275,10 +279,9 @@ class vorschlag extends basis_db
|
||||
/**
|
||||
* Laedt die Vorschlaege zu einer Frage
|
||||
*
|
||||
* @param $frage_id
|
||||
* @param $sprache
|
||||
* @param $random Wenn true, dann werden die Vorschlaege in zufaelliger
|
||||
* Reihenfolge geladen, sonst nach nummer sortiert
|
||||
* @param integer $frage_id
|
||||
* @param string $sprache
|
||||
* @param boolean $random Wenn true, dann werden die Vorschlaege in zufaelliger Reihenfolge geladen, sonst nach nummer sortiert
|
||||
*/
|
||||
public function getVorschlag($frage_id, $sprache, $random)
|
||||
{
|
||||
@@ -287,7 +290,6 @@ class vorschlag extends basis_db
|
||||
$qry.=" ORDER BY random()";
|
||||
else
|
||||
$qry.=" ORDER BY nummer";
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object($result))
|
||||
|
||||
Reference in New Issue
Block a user