mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
Statistik Modul - Erstversion
This commit is contained in:
+222
-3
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007 Technikum-Wien
|
||||
/* Copyright (C) 2011 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
|
||||
@@ -17,14 +17,29 @@
|
||||
*
|
||||
* Authors: Christian Paminger <christian.paminger@technikum-wien.at>,
|
||||
* Andreas Oesterreicher <andreas.oesterreicher@technikum-wien.at>
|
||||
* Karl Burkhart <burkhart@technikum-wien.at>.
|
||||
*/
|
||||
require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||
|
||||
class statistik extends basis_db
|
||||
{
|
||||
public $new; // boolean
|
||||
public $statistik_obj=array();// Statistik Objekt
|
||||
public $new;
|
||||
public $statistik_obj=array();
|
||||
public $result=array();
|
||||
|
||||
public $statistik_kurzbz;
|
||||
public $content_id;
|
||||
public $bezeichnung;
|
||||
public $url;
|
||||
public $sql;
|
||||
public $php;
|
||||
public $r;
|
||||
public $gruppe;
|
||||
public $insertamum;
|
||||
public $insertvon;
|
||||
public $updateamum;
|
||||
public $udpatevon;
|
||||
|
||||
public $studiengang_kz; // integer
|
||||
public $prestudent_id; // integer
|
||||
public $geschlecht; // char(1)
|
||||
@@ -39,6 +54,210 @@ class statistik extends basis_db
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt eine Statistik
|
||||
* @param $statistik_kurzbz
|
||||
*/
|
||||
public function load($statistik_kurzbz)
|
||||
{
|
||||
$qry = "SELECT
|
||||
*
|
||||
FROM
|
||||
public.tbl_statistik
|
||||
WHERE
|
||||
statistik_kurzbz='".addslashes($statistik_kurzbz)."'";
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
if($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$this->statistik_kurzbz = $row->statistik_kurzbz;
|
||||
$this->content_id = $row->content_id;
|
||||
$this->bezeichnung = $row->bezeichnung;
|
||||
$this->url = $row->url;
|
||||
$this->sql = $row->sql;
|
||||
$this->php = $row->php;
|
||||
$this->r = $row->r;
|
||||
$this->gruppe = $row->gruppe;
|
||||
$this->insertamum = $row->insertamum;
|
||||
$this->insertvon = $row->insertvon;
|
||||
$this->updateamum = $row->updateamum;
|
||||
$this->udpatevon = $row->updatevon;
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Dieser Eintrag wurde nicht gefunden';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt alle Statistiken
|
||||
* @return true wenn ok, sonst false
|
||||
*/
|
||||
public function getAll()
|
||||
{
|
||||
$qry = 'SELECT * FROM public.tbl_statistik';
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$obj = new statistik();
|
||||
|
||||
$obj->statistik_kurzbz = $row->statistik_kurzbz;
|
||||
$obj->content_id = $row->content_id;
|
||||
$obj->bezeichnung = $row->bezeichnung;
|
||||
$obj->url = $row->url;
|
||||
$obj->sql = $row->sql;
|
||||
$obj->php = $row->php;
|
||||
$obj->r = $row->r;
|
||||
$obj->gruppe = $row->gruppe;
|
||||
$obj->insertamum = $row->insertamum;
|
||||
$obj->insertvon = $row->insertvon;
|
||||
$obj->updateamum = $row->updateamum;
|
||||
$obj->udpatevon = $row->updatevon;
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Speichert einen Statistik Datensatz
|
||||
* @param $new boolean
|
||||
* @return boolean true wenn ok false im Fehlerfalls
|
||||
*/
|
||||
public function save($new=null)
|
||||
{
|
||||
if(is_null($new))
|
||||
$new = $this->new;
|
||||
|
||||
if($new)
|
||||
{
|
||||
$qry = 'INSERT INTO public.tbl_statistik(statistik_kurzbz, content_id, bezeichnung, url, sql,
|
||||
php, r, gruppe, insertamum, insertvon, updateamum, updatevon) VALUES('.
|
||||
$this->addslashes($this->statistik_kurzbz).','.
|
||||
$this->addslashes($this->content_id).','.
|
||||
$this->addslashes($this->bezeichnung).','.
|
||||
$this->addslashes($this->url).','.
|
||||
$this->addslashes($this->sql).','.
|
||||
$this->addslashes($this->php).','.
|
||||
$this->addslashes($this->r).','.
|
||||
$this->addslashes($this->gruppe).','.
|
||||
$this->addslashes($this->insertamum).','.
|
||||
$this->addslashes($this->insertvon).','.
|
||||
$this->addslashes($this->updateamum).','.
|
||||
$this->addslashes($this->updatevon).');';
|
||||
}
|
||||
else
|
||||
{
|
||||
if($this->statistik_kurzbz_orig=='')
|
||||
$this->statistik_kurzbz_orig=$this->statistik_kurzbz;
|
||||
$qry = 'UPDATE public.tbl_statistik SET
|
||||
content_id='.$this->addslashes($this->content_id).','.
|
||||
' bezeichnung='.$this->addslashes($this->bezeichnung).','.
|
||||
' statistik_kurzbz='.$this->addslashes($this->statistik_kurzbz).','.
|
||||
' url='.$this->addslashes($this->url).','.
|
||||
' sql='.$this->addslashes($this->sql).','.
|
||||
' php='.$this->addslashes($this->php).','.
|
||||
' r='.$this->addslashes($this->r).','.
|
||||
' gruppe='.$this->addslashes($this->gruppe).','.
|
||||
' insertamum='.$this->addslashes($this->insertamum).','.
|
||||
' insertvon='.$this->addslashes($this->insertvon).','.
|
||||
' updateamum='.$this->addslashes($this->updateamum).','.
|
||||
' updatevon='.$this->addslashes($this->updatevon).
|
||||
" WHERE statistik_kurzbz='".addslashes($this->statistik_kurzbz_orig)."'";
|
||||
}
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg='Fehler beim Speichern der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Liefert ein Array mit den Menueeintraegen der Statistiken
|
||||
* Mit dem Returnwert dieser Funktion wird die entsprechende Stelle im
|
||||
* Menue ueberschrieben
|
||||
* @return Array fuer Menue
|
||||
*/
|
||||
public function getMenueArray()
|
||||
{
|
||||
$arr = array();
|
||||
|
||||
$qry = "SELECT
|
||||
*
|
||||
FROM
|
||||
public.tbl_statistik
|
||||
ORDER BY gruppe, bezeichnung, statistik_kurzbz";
|
||||
|
||||
if($result = $this->db_query($qry))
|
||||
{
|
||||
$lastgruppe='';
|
||||
while($row = $this->db_fetch_object($result))
|
||||
{
|
||||
if($row->gruppe!='' && $row->gruppe!=$lastgruppe)
|
||||
{
|
||||
$arr[$row->gruppe]=array('name'=>$row->gruppe);
|
||||
$lastgruppe=$row->gruppe;
|
||||
}
|
||||
if($row->gruppe!='')
|
||||
{
|
||||
$arr[$row->gruppe][$row->statistik_kurzbz]=array('name'=>$row->bezeichnung, 'link'=>APP_ROOT.'vilesci/statistik/statistik_frameset.php?statistik_kurzbz='.$row->statistik_kurzbz, 'target'=>'main');
|
||||
}
|
||||
else
|
||||
{
|
||||
$arr[$row->statistik_kurzbz]=array('name'=>$row->bezeichnung, 'link'=>APP_ROOT.'vilesci/statistik/statistik_frameset.php?statistik_kurzbz='.$row->statistik_kurzbz, 'target'=>'main');
|
||||
}
|
||||
}
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loescht einen Eintrag
|
||||
*
|
||||
* @param $statistik_kurzbz
|
||||
* @return true wenn ok, sonst false
|
||||
*/
|
||||
public function delete($statistik_kurzbz)
|
||||
{
|
||||
$qry = "DELETE FROM public.tbl_statistik WHERE statistik_kurzbz='".addslashes($statistik_kurzbz)."';";
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg='Fehler beim Löschen des Eintrages';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Laedt bestimmte PreStudenten
|
||||
* @param studiengang_kz KZ des Studienganges der zu Laden ist
|
||||
|
||||
Reference in New Issue
Block a user