From ed8781a0af8a7da6289df36ab7887af98f5359a0 Mon Sep 17 00:00:00 2001 From: Robert Hofer Date: Tue, 2 Dec 2014 14:13:44 +0000 Subject: [PATCH] statistik_details ueberarbeitet, neue spalte "preferences" --- include/statistik.class.php | 31 ++- vilesci/stammdaten/statistik_details.php | 326 ++++++++++++----------- 2 files changed, 187 insertions(+), 170 deletions(-) diff --git a/include/statistik.class.php b/include/statistik.class.php index e3e072453..daad68d82 100644 --- a/include/statistik.class.php +++ b/include/statistik.class.php @@ -41,6 +41,7 @@ class statistik extends basis_db public $updateamum; public $udpatevon; public $berechtigung_kurzbz; + public $preferences; public $studiengang_kz; // integer public $prestudent_id; // integer @@ -75,7 +76,7 @@ class statistik extends basis_db FROM public.tbl_statistik WHERE - statistik_kurzbz=".$this->db_add_param($statistik_kurzbz); + statistik_kurzbz = " . $this->db_add_param($statistik_kurzbz); if($result = $this->db_query($qry)) { @@ -95,6 +96,8 @@ class statistik extends basis_db $this->updateamum = $row->updateamum; $this->udpatevon = $row->updatevon; $this->berechtigung_kurzbz = $row->berechtigung_kurzbz; + $this->preferences = $row->preferences; + $this->new = false; return true; } @@ -143,6 +146,7 @@ class statistik extends basis_db $obj->updateamum = $row->updateamum; $obj->udpatevon = $row->updatevon; $obj->berechtigung_kurzbz = $row->berechtigung_kurzbz; + $obj->preferences = $row->preferences; $this->result[] = $obj; } @@ -188,6 +192,7 @@ class statistik extends basis_db $obj->updateamum = $row->updateamum; $obj->udpatevon = $row->updatevon; $obj->berechtigung_kurzbz = $row->berechtigung_kurzbz; + $obj->preferences = $row->preferences; $this->result[] = $obj; } @@ -204,15 +209,21 @@ class statistik extends basis_db * Laedt alle Statistik Gruppen, Parameter publish zum Filtern. * @return true wenn ok, sonst false */ - public function getAnzahlGruppe($publish=null) + public function getAnzahlGruppe($publish = null) { $qry = 'SELECT gruppe, count(*) AS anzahl FROM public.tbl_statistik '; - if ($publish==true) - $qry.='WHERE publish '; - elseif ($publish==false) - $qry.='WHERE NOT publish '; - $qry.=' GROUP BY gruppe ORDER BY gruppe;'; - // echo $qry; + + if($publish === true) + { + $qry .= 'WHERE publish '; + } + elseif($publish === false) + { + $qry .= 'WHERE NOT publish '; + } + + $qry .= ' GROUP BY gruppe ORDER BY gruppe;'; + if($result = $this->db_query($qry)) { while($row = $this->db_fetch_object($result)) @@ -246,7 +257,7 @@ class statistik extends basis_db if($new) { $qry = 'INSERT INTO public.tbl_statistik(statistik_kurzbz, content_id, bezeichnung, url, sql, - php, r, gruppe, publish, insertamum, insertvon, updateamum, updatevon, berechtigung_kurzbz) VALUES('. + php, r, gruppe, publish, insertamum, insertvon, updateamum, updatevon, preferences, berechtigung_kurzbz) VALUES('. $this->db_add_param($this->statistik_kurzbz).','. $this->db_add_param($this->content_id,FHC_INTEGER).','. $this->db_add_param($this->bezeichnung).','. @@ -260,6 +271,7 @@ class statistik extends basis_db $this->db_add_param($this->insertvon).','. $this->db_add_param($this->updateamum).','. $this->db_add_param($this->updatevon).','. + $this->db_add_param($this->preferences).','. $this->db_add_param($this->berechtigung_kurzbz).');'; } else @@ -280,6 +292,7 @@ class statistik extends basis_db ' insertvon='.$this->db_add_param($this->insertvon).','. ' updateamum='.$this->db_add_param($this->updateamum).','. ' updatevon='.$this->db_add_param($this->updatevon).','. + ' preferences='.$this->db_add_param($this->preferences).','. ' berechtigung_kurzbz='.$this->db_add_param($this->berechtigung_kurzbz). ' WHERE statistik_kurzbz='.$this->db_add_param($this->statistik_kurzbz_orig,FHC_STRING,false); } diff --git a/vilesci/stammdaten/statistik_details.php b/vilesci/stammdaten/statistik_details.php index cd3ed266f..ee89633dd 100644 --- a/vilesci/stammdaten/statistik_details.php +++ b/vilesci/stammdaten/statistik_details.php @@ -22,180 +22,184 @@ /** * Seite zur Wartung der Statistiken */ -require_once('../../config/vilesci.config.inc.php'); +require_once('../../config/vilesci.config.inc.php'); require_once('../../include/statistik.class.php'); require_once('../../include/benutzerberechtigung.class.php'); require_once('../../include/berechtigung.class.php'); -if (!$db = new basis_db()) +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'); - ?> - - - Statistik - Details - - - - + + + Statistik - Details + + + + -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->publish = $publish; - $statistik->updateamum = date('Y-m-d H:i:s'); - $statistik->updatevon = $user; - $statistik->berechtigung_kurzbz = $berechtigung_kurzbz; - - if($statistik->save()) - { - echo 'Daten erfolgreich gespeichert'; - echo "\n"; - $action='update'; - } - else - { - $action='new'; - echo ''.$statistik->errormsg.''; - } - } + '; - switch($action) - { - case 'new': - echo 'Neu'; - $new = 'true'; - break; - case 'update': - if(!$statistik->load($statistik_kurzbz)) - die($statistik->errormsg); - echo "Bearbeiten - $statistik_kurzbz"; - $new = 'false'; - break; - default: - die('Invalid Action'); - break; - } - echo '
'; - echo ''; - echo ''; - echo ''; - echo ''; - echo ' '; - echo ' '; - echo ' '; - echo ' '; - echo ' '; - echo ''; - echo ''; - echo ' '; - echo ' '; - echo ' '; - echo ' '; - echo ' '; - echo ''; - echo ''; - echo ' '; - echo ' '; - echo ' '; - echo ' '; - echo ' '; - echo ''; - echo ''; - echo ' '; - echo ' '; - echo ' '; - echo ' '; - echo ' '; - echo ''; - echo ''; - echo ' '; - echo ' '; - echo ' '; - echo ''; - echo ''; - echo ' '; - echo ' '; - echo ' '; - echo ''; - - echo ''; - echo ' '; - echo ' '; - echo ' '; - echo ' '; - echo ' '; - echo ''; - echo '
KurzbzGruppe
BezeichnungContentID
URLBerechtigung'; - $berechtigung = new berechtigung(); - $berechtigung->getBerechtigungen(); - echo ''; - // - echo '
SQLR
PHP
Publishpublish?'checked="checked"':'').'>
'; - echo '
'; - - echo ''; -?> - + { + $statistik_kurzbz = filter_input(INPUT_POST, 'statistik_kurzbz'); + $exists = false; + } + + if(isset($_POST['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')); + $publish = (isset($_POST['publish']) ? true : false); + $berechtigung_kurzbz = (isset($_POST['berechtigung_kurzbz']) ? $_POST['berechtigung_kurzbz'] : die('Berechtigungkurzbz fehlt')); + $preferences = (isset($_POST['preferences']) ? $_POST['preferences'] : die('preferences fehlt')); + + if(!$exists) + { + $statistik->insertamum = date('Y-m-d H:i:s'); + $statistik->insertvon = $user; + $statistik->new = true; + } + + $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->publish = $publish; + $statistik->updateamum = date('Y-m-d H:i:s'); + $statistik->updatevon = $user; + $statistik->berechtigung_kurzbz = $berechtigung_kurzbz; + $statistik->preferences = $preferences; + + $success = $statistik->save(); + + if($success): + ?> + Daten erfolgreich gespeichert + + + errormsg ?> + preferences); + + if(empty($preferences)) + { + $statistik->preferences = << +
+
+ new === false): ?> + Bearbeiten - + + Neu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
KurzbzGruppe
BezeichnungContentID
URLBerechtigung + getBerechtigungen(); + ?> + +
SQLR
PHP
Publishpublish ? 'checked="checked"' : '' ?>>
Preferences
+
+
+