Statistik Modul - Erstversion

This commit is contained in:
Andreas Österreicher
2011-03-22 09:06:32 +00:00
parent 22091c6d1c
commit cc88c030f1
12 changed files with 1189 additions and 5 deletions
+216
View File
@@ -0,0 +1,216 @@
<?php
/* Copyright (C) 2010 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> and
* Karl Burkhart <karl.burkhart@technikum-wien.at>.
*/
require_once('basis_db.class.php');
class content extends basis_db
{
public $new; // boolean
public $result = array(); // studiensemester Objekt
//Tabellenspalten
public $content_id;
public $template_kurzbz;
public $titel;
public $updateamum;
public $updatevon;
public $insertamum;
public $insertvon;
public $oe_kurzbz;
public $contentsprache_id;
public $sprache;
public $version;
public $sichtbar;
public $content;
public $reviewvon;
public $reviewamum;
/**
* Konstruktor
*
*/
public function __construct()
{
parent::__construct();
}
public function getContent($content_id, $sprache='German', $version=null, $sichtbar=true)
{
if(!is_numeric($content_id))
{
$this->errormsg='ContentID ist ungueltig';
return false;
}
$qry = "SELECT
*,
tbl_contentsprache.insertamum, tbl_contentsprache.insertvon,
tbl_contentsprache.updateamum, tbl_contentsprache.updatevon
FROM
campus.tbl_content
JOIN campus.tbl_contentsprache USING(content_id)
WHERE
tbl_content.content_id='".addslashes($content_id)."'
AND tbl_contentsprache.sprache='".addslashes($sprache)."'";
if($sichtbar)
$qry.=" AND sichtbar=true";
if(!is_null($version))
$qry.=" AND tbl_contentsprache.version='".addslashes($version)."'";
$qry.=" ORDER BY version LIMIT 1";
if($result = $this->db_query($qry))
{
if($row = $this->db_fetch_object($result))
{
$this->content_id = $row->content_id;
$this->titel = $row->titel;
$this->template_kurzbz = $row->template_kurzbz;
$this->sprache = $row->sprache;
$this->contentsprache_id = $row->contentsprache_id;
$this->version = $row->version;
$this->sichtbar = ($row->sichtbar=='t'?true:false);
$this->content = $row->content;
$this->reviewvon = $row->reviewvon;
$this->reviewamum = $row->reviewamum;
$this->updateamum = $row->updateamum;
$this->updatevon = $row->updatevon;
$this->insertamum = $row->insertamum;
$this->insertvon = $row->insertvon;
return true;
}
else
{
$this->errormsg='Dieser Eintrag wurde nicht gefunden';
return false;
}
}
else
{
$this->errormsg = 'Fehler beim Laden des Contents';
return false;
}
}
/**
* Prueft ob der Zugriff auf den Content eingeschraenkt ist auf
* eine bestimmte Benutzergruppe
*
* @param $content_id
* @return true wenn eingeschraenkt sonst false
*/
public function islocked($content_id)
{
if(!is_numeric($content_id))
{
$this->errormsg = 'ContentID ist ungueltig';
return false;
}
$qry = "SELECT count(*) as anzahl FROM campus.tbl_contentgruppe WHERE content_id='".addslashes($content_id)."'";
if($result = $this->db_query($qry))
{
if($row = $this->db_fetch_object($result))
{
if($row->anzahl>0)
return true;
else
return false;
}
else
{
$this->errormsg = 'Fehler beim Laden der Daten';
return false;
}
}
else
{
$this->errormsg='Fehler beim Laden der Daten';
return false;
}
}
/**
* Prueft ob ein User die Berechtigung fuer das Anzeigen des Contents besitzt
*
* @param $content_id ID des Contents
* @param $uid User der versucht auf den Content zuzugreifen
*/
public function berechtigt($content_id, $uid)
{
if(!is_numeric($content_id))
{
$this->errormsg = 'ContentID ist ungueltig';
return false;
}
$qry = "SELECT
1
FROM
campus.tbl_contentgruppe
JOIN public.vw_gruppen USING(gruppe_kurzbz)
WHERE
tbl_contentgruppe.content_id='".addslashes($content_id)."'
AND vw_gruppen.uid='".addslashes($uid)."'";
if($result = $this->db_query($qry))
{
if($this->db_num_rows($result)>0)
return true;
else
return false;
}
else
{
$this->errormsg = 'Fehler beim Laden der Daten';
return false;
}
}
public function getMenueArray($content_id)
{
$arr = array();
if(!is_numeric($content_id))
{
$this->errormsg='ContentID ist ungueltig';
return false;
}
$qry = "SELECT
tbl_contentchild.content_id,
tbl_contentchild.child_content_id,
tbl_content.titel
FROM
campus.tbl_contentchild
JOIN campus.tbl_content ON(tbl_contentchild.child_content_id=tbl_content.content_id)
WHERE
tbl_contentchild.content_id='".addslashes($content_id)."'";
if($result = $this->db_query($qry))
{
while($row = $this->db_fetch_object($result))
{
$arr[$row->titel]=array('name'=>$row->titel, 'link'=>APP_ROOT.'content.php?content_id='.$row->child_content_id, 'target'=>'main');
$arr[$row->titel]=array_merge($arr[$row->titel],$this->getMenueArray($row->child_content_id));
}
}
return $arr;
}
}
?>
+17
View File
@@ -812,4 +812,21 @@ function check_filename($filename)
else
return true;
}
/**
* Startet eine HTTP-Basic-Authentifizierung und prueft das Passwort gegen LDAP
* @return uid wenn erfolgreich. Fehlermeldung und Scriptabbruch bei fehlerhafter Auth.
*/
function manual_basic_auth()
{
if(!(isset($_SERVER['PHP_AUTH_USER']) && checkldapuser($_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW'])))
{
header('WWW-Authenticate: Basic realm="Technikum-Wien"');
header('HTTP/1.0 401 Unauthorized');
echo "Ihre Zugangsdaten sind ungueltig!";
exit;
}
else
return $_SERVER['PHP_AUTH_USER'];
}
?>
+222 -3
View File
@@ -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
+77
View File
@@ -0,0 +1,77 @@
<?php
/* Copyright (C) 2010 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> and
* Karl Burkhart <karl.burkhart@technikum-wien.at>.
*/
require_once('basis_db.class.php');
class template extends basis_db
{
public $new;
public $result = array();
public $template_kurzbz;
public $bezeichnung;
public $xsd;
public $xslt_xhtml;
public $xslfo_pdf;
/**
* Konstruktor
*
*/
public function __construct()
{
parent::__construct();
}
public function load($template_kurzbz)
{
$qry = "SELECT
*
FROM
campus.tbl_template
WHERE
tbl_template.template_kurzbz='".addslashes($template_kurzbz)."'";
if($result = $this->db_query($qry))
{
if($row = $this->db_fetch_object($result))
{
$this->template_kurzbz = $row->template_kurzbz;
$this->bezeichnung = $row->bezeichnung;
$this->xsd = $row->xsd;
$this->xslt_xhtml = $row->xslt_xhtml;
$this->xslfo_pdf = $row->xslfo_pdf;
return true;
}
else
{
$this->errormsg='Dieser Eintrag wurde nicht gefunden';
return false;
}
}
else
{
$this->errormsg = 'Fehler beim Laden des Templates';
return false;
}
}
}
?>
+9 -2
View File
@@ -160,6 +160,7 @@ $menu=array
'Ort'=>array('name'=>'Ort (Raum)', 'link'=>'stammdaten/raum_frameset.html', 'target'=>'main','permissions'=>array('basis/ort')),
'Firmen'=>array('name'=>'Firmen', 'link'=>'stammdaten/firma_frameset.html', 'target'=>'main','permissions'=>array('basis/firma')),
'Organisationseinheiten'=>array('name'=>'Organisationseinheiten', 'link'=>'stammdaten/organisationseinheiten.php', 'target'=>'main','permissions'=>array('basis/organisationseinheit')),
'Statistik'=>array('name'=>'Statistik', 'link'=>'stammdaten/statistik_frameset.html', 'target'=>'main','permissions'=>array('basis/statistik')),
'ImExport'=>array
(
'name'=>'ImExport','permissions'=>array('admin'),
@@ -191,6 +192,7 @@ $menu=array
(
'name'=>'Auswertung', 'opener'=>'true', 'hide'=>'true', 'permissions'=>array('admin','lv-plan','support'), 'image'=>'statistic.png',
'link'=>'left.php?categorie=Auswertung', 'target'=>'nav',
/*
'Raumauslastung'=>array('name'=>'Raumauslastung...', 'link'=>'lehre/raumauslastung.php', 'target'=>'main'),
'Verplanungsuebersicht'=>array('name'=>'Verplanungsübersicht...', 'link'=>'lehre/check/verplanungsuebersicht.php', 'target'=>'main'),
'Zeitwünsche'=>array('name'=>'Zeitwünsche', 'link'=>'lehre/zeitwuensche.php', 'target'=>'main'),
@@ -206,8 +208,7 @@ $menu=array
'Lektorenstatistik'=>array('name'=>'Lektorenstatistik', 'link'=>'https://vilesci.technikum-wien.at/content/statistik/lektorenstatistik.php', 'target'=>'main'),
'Mitarbeiterstatistik'=>array('name'=>'Mitarbeiterstatistik', 'link'=>'https://vilesci.technikum-wien.at/content/statistik/mitarbeiterstatistik.php', 'target'=>'main'),
'Stromanalyse'=>array('name'=>'Stromanalyse...', 'link'=>'https://vilesci.technikum-wien.at/content/statistik/bama_stromanalyse.php', 'target'=>'main'),
*/
),
'Inventar'=> array
(
@@ -251,4 +252,10 @@ $menu=array
)
);
require_once(dirname(__FILE__).'/../statistik.class.php');
$statistik = new statistik();
$statistik = $statistik->getMenueArray(1);
$menu['Auswertung']=array_merge($menu['Auswertung'],$statistik);
//var_dump($menu['Auswertung']);
?>