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
+87
View File
@@ -0,0 +1,87 @@
<?php
/* 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
* 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>.
*/
/**
* Laedt den Content und das zugeordnete Template aus der Datenbank und
* zeigt diese an.
*/
require_once('../config/cis.config.inc.php');
require_once('../include/content.class.php');
require_once('../include/template.class.php');
require_once('../include/functions.inc.php');
if(isset($_GET['content_id']))
$content_id = $_GET['content_id'];
else
die('ContentID muss uebergeben werden');
$version = (isset($_GET['version'])?$_GET['version']:null);
if(isset($_SESSION['FHC_SPRACHE']))
{
$sprache=$_SESSION['FHC_SPRACHE'];
}
if(isset($_COOKIE['FHC_SPRACHE']))
{
$cookie_sprache=$_COOKIE['FHC_SPRACHE'];
if(!isset($sprache))
$sprache=$cookie_sprache;
}
if(!isset($sprache))
{
$sprache='German';
}
if(!isset($cookie_sprache) || $cookie_sprache!=$sprache)
{
setcookie('FHC_SPRACHE',$sprache,time()+(3600*24*100));
}
//XML Content laden
$content = new content();
if($content->islocked($content_id))
{
$uid = manual_basic_auth();
if(!$content->berechtigt($content_id, $uid))
die('Sie haben keine Berechtigung fuer diese Seite');
}
if(!$content->getContent($content_id, $sprache, $version))
die($content->errormsg);
$XML = new DOMDocument();
$XML->loadXML($content->content);
//XSLT Vorlage laden
$template = new template();
if(!$template->load($content->template_kurzbz))
die($template->errormsg);
$xsltemplate = new DOMDocument();
$xsltemplate->loadXML($template->xslt_xhtml);
//Transformation
$processor = new XSLTProcessor();
$processor->importStylesheet($xsltemplate);
echo $processor->transformToXML($XML);
?>
+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,13 +17,28 @@
*
* 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
@@ -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']);
?>
+170
View File
@@ -0,0 +1,170 @@
<?php
/* 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
* 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 >
* Karl Burkhart < burkhart@technikum-wien.at >
*/
/**
* Seite zur Wartung der Statistiken
*/
require_once('../../config/vilesci.config.inc.php');
require_once('../../include/statistik.class.php');
require_once('../../include/benutzerberechtigung.class.php');
if (!$db = new basis_db())
die('Es konnte keine Verbindung zum Server aufgebaut werden.');
$user = get_uid();
$rechte = new benutzerberechtigung();
$rechte->getBerechtigungen($user);
if(!$rechte->isBerechtigt('basis/statistik'))
die('Sie haben keine Berechtigung fuer diese Seite');
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Statistik - Details</title>
<link rel="stylesheet" href="../../skin/fhcomplete.css" type="text/css">
<link rel="stylesheet" href="../../skin/vilesci.css" type="text/css">
</head>
<body>
<?php
$action = (isset($_GET['action'])?$_GET['action']:'new');
$statistik_kurzbz = (isset($_REQUEST['statistik_kurzbz'])?$_REQUEST['statistik_kurzbz']:'');
$statistik = new statistik();
if($action=='save')
{
$statistik_kurzbz_orig = (isset($_POST['statistik_kurzbz_orig'])?$_POST['statistik_kurzbz_orig']:die('Statistik_kurzbz_orig fehlt'));
$bezeichnung = (isset($_POST['bezeichnung'])?$_POST['bezeichnung']:die('Bezeichnung fehlt'));
$url = (isset($_POST['url'])?$_POST['url']:die('URL fehlt'));
$sql = (isset($_POST['sql'])?$_POST['sql']:die('SQL fehlt'));
$gruppe = (isset($_POST['gruppe'])?$_POST['gruppe']:die('Gruppe fehlt'));
$content_id = (isset($_POST['content_id'])?$_POST['content_id']:die('ContentID fehlt'));
$php = (isset($_POST['php'])?$_POST['php']:die('PHP fehlt'));
$r = (isset($_POST['r'])?$_POST['r']:die('R fehlt'));
$new = (isset($_POST['new'])?$_POST['new']:die('New fehlt'));
if($new=='true')
{
$statistik->insertamum=date('Y-m-d H:i:s');
$statistik->insertvon = $user;
$statistik->new = true;
}
else
{
if(!$statistik->load($statistik_kurzbz_orig))
die($statistik->errormsg);
$statistik->new=false;
}
$statistik->statistik_kurzbz=$statistik_kurzbz;
$statistik->statistik_kurzbz_orig = $statistik_kurzbz_orig;
$statistik->bezeichnung = $bezeichnung;
$statistik->url = $url;
$statistik->sql = $sql;
$statistik->gruppe = $gruppe;
$statistik->content_id = $content_id;
$statistik->php = $php;
$statistik->r = $r;
$statistik->updateamum = date('Y-m-d H:i:s');
$statistik->updatevon = $user;
if($statistik->save())
{
echo '<span class="ok">Daten erfolgreich gespeichert</span>';
echo "<script type='text/javascript'>\n";
echo " parent.uebersicht_statistik.location.href='statistik_uebersicht.php';";
echo "</script>\n";
$action='update';
}
else
{
$action='new';
echo '<span class="error">'.$statistik->errormsg.'</span>';
}
}
echo '<fieldset>';
switch($action)
{
case 'new':
echo '<legend>Neu</legend>';
$new = 'true';
break;
case 'update':
if(!$statistik->load($statistik_kurzbz))
die($statistik->errormsg);
echo "<legend>Bearbeiten - $statistik_kurzbz</legend>";
$new = 'false';
break;
default:
die('Invalid Action');
break;
}
echo '<form action="'.$_SERVER['PHP_SELF'].'?action=save" method="POST">';
echo '<input type="hidden" name="new" value="'.$new.'">';
echo '<input type="hidden" name="statistik_kurzbz_orig" value="'.$statistik->statistik_kurzbz.'">';
echo '<table>';
echo '<tr>';
echo ' <td>Kurzbz</td>';
echo ' <td><input type="text" name="statistik_kurzbz" size="50" maxlength="64" value="'.$statistik->statistik_kurzbz.'"></td>';
echo ' <td></td>';
echo ' <td>Gruppe</td>';
echo ' <td><input type="text" name="gruppe" value="'.$statistik->gruppe.'"></td>';
echo '</tr>';
echo '<tr>';
echo ' <td>Bezeichnung</td>';
echo ' <td><input type="text" name="bezeichnung" size="80" maxlength="256" value="'.$statistik->bezeichnung.'"></td>';
echo ' <td></td>';
echo ' <td>ContentID</td>';
echo ' <td><input type="text" name="content_id" value="'.$statistik->content_id.'"></td>';
echo '</tr>';
echo '<tr>';
echo ' <td>URL</td>';
echo ' <td><input type="text" name="url" size="80" maxlength="512" value="'.$statistik->url.'"></td>';
echo ' <td></td>';
echo ' <td>PHP</td>';
echo ' <td><input type="text" name="php" value="'.$statistik->php.'"></td>';
echo '</tr>';
echo '<tr valign="top">';
echo ' <td>SQL</td>';
echo ' <td><textarea name="sql" cols="60" rows="5">'.$statistik->sql.'</textarea></td>';
echo ' <td></td>';
echo ' <td>R</td>';
echo ' <td><input type="text" name="r" value="'.$statistik->r.'"></td>';
echo '</tr>';
echo '<tr>';
echo '<tr>';
echo ' <td></td>';
echo ' <td></td>';
echo ' <td></td>';
echo ' <td></td>';
echo ' <td><input type="submit" value="Speichern" name="save"></td>';
echo '</table>';
echo '</form>';
echo '</fieldset>';
?>
</body>
</html>
@@ -0,0 +1,20 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN">
<html lang="de_AT">
<head>
<title>VileSci</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="../../skin/vilesci.css" type="text/css" />
</head>
<frameset rows="60%,*">
<frame src="statistik_uebersicht.php" name="uebersicht_statistik" frameborder="0" />
<frame src="statistik_details.php" name="detail_statistik" frameborder="0" />
<noframes>
<body bgcolor="#FFFFFF">
This application works only with a frames-enabled browser.<br />
</body>
</noframes>
</frameset>
</html>
+114
View File
@@ -0,0 +1,114 @@
<?php
/* 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
* 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 >
* Karl Burkhart < burkhart@technikum-wien.at >
*/
require_once('../../config/vilesci.config.inc.php');
require_once('../../include/statistik.class.php');
require_once('../../include/benutzerberechtigung.class.php');
$user = get_uid();
$rechte = new benutzerberechtigung();
$rechte->getBerechtigungen($user);
if(!$rechte->isBerechtigt('basis/statistik'))
die('Sie haben keine Berechtigung fuer diese Seite');
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Statistik</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../skin/tablesort.css" type="text/css"/>
<link rel="stylesheet" href="../../skin/fhcomplete.css" type="text/css">
<link rel="stylesheet" href="../../skin/vilesci.css" type="text/css">
<script type="text/javascript" src="../../include/js/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$("#myTable").tablesorter(
{
sortList: [[1,0]],
widgets: [\'zebra\']
});
}
);
function confdel()
{
return confirm("Wollen Sie diesen Eintrag wirklich löschen?");
}
</script>
</head>
<body>
<h2>Statistik &Uuml;bersicht</h2>
<div style="text-align:right">
<a href="statistik_details.php?action=new" target="detail_statistik">Neu</a>
</div>';
if(isset($_GET['action']) && $_GET['action']=='delete')
{
if(!$rechte->isBerechtigt('basis/statistik', null, 'suid'))
die('Sie haben keine Berechtigung fuer diese Seite');
if(!isset($_GET['statistik_kurzbz']))
die('Fehlender Parameter Statistik');
$statistik = new statistik();
if($statistik->delete($_GET['statistik_kurzbz']))
echo '<span class="ok">Eintrag wurde erfolgreich gelöscht</span>';
else
echo '<span class="error">'.$statistik->errormsg.'</span>';
}
$statistik = new statistik();
if(!$statistik->getAll())
die($statistik->errormsg);
echo '<table class="tablesorter" id="myTable">
<thead>
<tr>
<th>Kurzbz</th>
<th>Bezeichnung</th>
<th>Gruppe</th>
<th>ContentID</th>
<th colspan="2">Aktion</th>
</tr>
</thead>
<tbody>';
foreach($statistik->result as $row)
{
echo '<tr>';
echo '<td><a href="statistik_details.php?action=update&statistik_kurzbz=',$row->statistik_kurzbz,' " target="detail_statistik">',$row->statistik_kurzbz,'</a></td>';
echo '<td>',$row->bezeichnung,'</td>';
echo '<td>',$row->gruppe,'</td>';
echo '<td>',$row->content_id,'</td>';
echo '<td><a href="statistik_details.php?action=update&statistik_kurzbz=',$row->statistik_kurzbz,' " target="detail_statistik">bearbeiten</a></td>';
echo '<td><a href="statistik_uebersicht.php?action=delete&statistik_kurzbz=',$row->statistik_kurzbz,' " onclick="return confdel()">entfernen</a></td>';
echo '</tr>';
}
echo '</tbody>
</table>
</body>
</html>';
?>
+141
View File
@@ -0,0 +1,141 @@
<?php
/* 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
* 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>.
*/
/**
* Statistik Uebersichtsseite
* - zeigt die Beschreibung einer Statistik ein
* - Link zum Starten der Statistik
* - Eventuelle Parametereingabe für die Statistik
*/
require_once('../../config/vilesci.config.inc.php');
require_once('../../include/statistik.class.php');
require_once('../../include/functions.inc.php');
if(!isset($_GET['statistik_kurzbz']))
die('Statistik_kurzbz Parameter fehlt');
$statistik_kurzbz = $_GET['statistik_kurzbz'];
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Statistik</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../skin/fhcomplete.css" type="text/css"/>
<link rel="stylesheet" href="../../skin/vilesci.css" type="text/css"/>
</head>
<body>';
$statistik = new statistik();
if(!$statistik->load($statistik_kurzbz))
die($statistik->errormsg);
echo '<h2>Statistik - '.$statistik->bezeichnung.'</h2>';
//Beschreibung zu der Statistik anzeigen
if($statistik->content_id!='')
{
echo "\n",'<a href="#" onclick="window.open(\'../../cms/content.php?content_id='.$statistik->content_id.'\', \'Beschreibung\', \'width=600,height=600\');">Beschreibung anzeigen</a><br><br>';
}
$variablenstring='';
$action='';
if($statistik->url!='')
{
$action = $statistik->url;
$variablenstring = $statistik->url;
}
elseif($statistik->sql!='')
{
$action = 'statistik_sql.php?statistik_kurzbz='.$statistik_kurzbz;
$variablenstring = $statistik->sql;
}
$vars = parseVars($variablenstring);
//var_dump($vars);
echo '
<script type="text/javascript">
function doit()
{';
if($statistik->url!='')
{
echo 'var action=\''.$action.'\';
';
foreach ($vars as $var)
{
echo 'action = action.replace(\'$'.$var.'\', document.getElementById(\''.$var.'\').value);';
}
echo '
parent.detail_statistik.location.href=action;
return false;';
}
else
echo 'return true;';
echo '
}
</script>
<form action="'.$action.'" method="POST" target="detail_statistik" onsubmit="return doit();">
<table>
';
foreach($vars as $var)
{
echo '<tr>';
echo "<td>$var</td><td><input type=\"text\" id=\"$var\" name=\"$var\" value=\"\"></td>";
echo '</tr>';
}
echo '
<tr>
<td></td>
<td><input type="submit" value="Anzeigen"></td>
</tr>
</table>
</form>';
echo '</body>
</html>';
/***FUNCTIONS***/
/**
*
* Parst Variablen aus einem String und liefert diese als Array zurueck
* @param $value String mit Variablen
* z.B.: "Select * from tbl_person where person_id<'$person_id'"
* oder "../content/statistik/bewerberstatistik.php?stsem=$StSem&stg_kz=$stg_kz"
*
* @return Array mit den Variablennamen
*/
function parseVars($value)
{
$result = array();
$check = '/\$[0-9A-z]+/';
preg_match_all($check, $value, $result);
$result = $result[0];
for($i=0;$i<count($result);$i++)
{
$result[$i] = mb_str_replace('$','',$result[$i]);
}
return $result;
}
?>
+20
View File
@@ -0,0 +1,20 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN">
<html lang="de_AT">
<head>
<title>VileSci</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="../../skin/vilesci.css" type="text/css" />
</head>
<frameset rows="35%,*">
<frame src="statistik.php?statistik_kurzbz=<?php echo $_GET['statistik_kurzbz'];?>" name="uebersicht_statistik" frameborder="0" />
<frame src="#empty" name="detail_statistik" frameborder="0" />
<noframes>
<body bgcolor="#FFFFFF">
This application works only with a frames-enabled browser.<br />
</body>
</noframes>
</frameset>
</html>
+96
View File
@@ -0,0 +1,96 @@
<?php
/* 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
* 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('../../config/vilesci.config.inc.php');
require_once('../../include/statistik.class.php');
if(!isset($_GET['statistik_kurzbz']))
die('Statistik_kurzbz Parameter fehlt');
$statistik_kurzbz = $_GET['statistik_kurzbz'];
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Statistik</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../skin/tablesort.css" type="text/css"/>
<link rel="stylesheet" href="../../skin/fhcomplete.css" type="text/css"/>
<link rel="stylesheet" href="../../skin/vilesci.css" type="text/css"/>
<script type="text/javascript" src="../../include/js/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$("#myTable").tablesorter(
{
widgets: [\'zebra\']
});
});
</script>
</head>
<body>';
$statistik = new statistik();
if(!$statistik->load($statistik_kurzbz))
die($statistik->errormsg);
echo '<h2>Statistik - '.$statistik->bezeichnung.'</h2>';
if($statistik->sql!='')
{
$sql = $statistik->sql;
foreach($_POST as $name=>$value)
{
$sql = str_replace('$'.$name,addslashes($value),$sql);
}
$db = new basis_db();
if($result = $db->db_query($sql))
{
echo '<table class="tablesorter" id="myTable">';
echo '<thead><tr>';
$anzahl_spalten = $db->db_num_fields($result);
for($spalte=0;$spalte<$anzahl_spalten;$spalte++)
{
echo '<th>'.$db->db_field_name($result,$spalte).'</th>';
}
echo '</tr></thead><tbody>';
while($row = $db->db_fetch_object($result))
{
echo '<tr>';
$anzahl_spalten = $db->db_num_fields($result);
for($spalte=0;$spalte<$anzahl_spalten;$spalte++)
{
$name = $db->db_field_name($result,$spalte);
echo '<td>'.$row->$name.'</td>';
}
echo '</tr>';
}
echo '</tbody></table>';
}
}
else
{
echo 'Zu dieser Statistik gibt es keine SQL Abfrage';
}
?>