mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
statistik_details ueberarbeitet, neue spalte "preferences"
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
|
||||
?><!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>
|
||||
<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'));
|
||||
$publish = (isset($_POST['publish'])?true:false);
|
||||
$new = (isset($_POST['new'])?$_POST['new']:die('New fehlt'));
|
||||
$berechtigung_kurzbz = (isset($_POST['berechtigung_kurzbz'])?$_POST['berechtigung_kurzbz']:die('Berechtigungkurzbz 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->publish = $publish;
|
||||
$statistik->updateamum = date('Y-m-d H:i:s');
|
||||
$statistik->updatevon = $user;
|
||||
$statistik->berechtigung_kurzbz = $berechtigung_kurzbz;
|
||||
|
||||
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>';
|
||||
}
|
||||
}
|
||||
<?php
|
||||
$statistik_kurzbz = filter_input(INPUT_GET, 'statistik_kurzbz');
|
||||
$statistik = new statistik();
|
||||
|
||||
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>Berechtigung</td>';
|
||||
echo ' <td>';
|
||||
$berechtigung = new berechtigung();
|
||||
$berechtigung->getBerechtigungen();
|
||||
echo '<select name="berechtigung_kurzbz">';
|
||||
echo '<option value="">-- keine Auswahl --</option>';
|
||||
foreach($berechtigung->result as $row)
|
||||
{
|
||||
if($row->berechtigung_kurzbz==$statistik->berechtigung_kurzbz)
|
||||
$selected='selected';
|
||||
if($statistik_kurzbz)
|
||||
{
|
||||
$exists = $statistik->load($statistik_kurzbz);
|
||||
}
|
||||
else
|
||||
$selected='';
|
||||
echo '<option value="'.$row->berechtigung_kurzbz.'" '.$selected.'>'.$row->berechtigung_kurzbz.'</option>';
|
||||
}
|
||||
echo '</select>';
|
||||
//<input type="text" name="berechtigung_kurzbz" value="'.$statistik->berechtigung_kurzbz.'">
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '<tr valign="top">';
|
||||
echo ' <td rowspan="3">SQL</td>';
|
||||
echo ' <td rowspan="3"><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 valign="top">';
|
||||
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></td>';
|
||||
echo ' <td>Publish</td>';
|
||||
echo ' <td><input type="checkbox" name="publish" '.($statistik->publish?'checked="checked"':'').'></td>';
|
||||
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 '</tr>';
|
||||
echo '</table>';
|
||||
echo '</form>';
|
||||
|
||||
echo '</fieldset>';
|
||||
?>
|
||||
</body>
|
||||
{
|
||||
$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):
|
||||
?>
|
||||
<span class="ok">Daten erfolgreich gespeichert</span>
|
||||
<script type='text/javascript'>
|
||||
parent.uebersicht_statistik.location.href = 'statistik_uebersicht.php';
|
||||
</script>
|
||||
<?php else: ?>
|
||||
<span class="error"><?php echo $statistik->errormsg ?></span>
|
||||
<?php
|
||||
endif;
|
||||
}
|
||||
|
||||
$preferences = trim($statistik->preferences);
|
||||
|
||||
if(empty($preferences))
|
||||
{
|
||||
$statistik->preferences = <<<EOT
|
||||
// Folgendes Objekt wird als "options"-Parameter an den Pivottable übergeben:
|
||||
{
|
||||
rows: [],
|
||||
cols: [],
|
||||
rendererName: "Table",
|
||||
aggregatorName: "Count",
|
||||
vals: []
|
||||
}
|
||||
EOT;
|
||||
}
|
||||
?>
|
||||
<form method="POST">
|
||||
<fieldset>
|
||||
<?php if($statistik->new === false): ?>
|
||||
<legend>Bearbeiten - <?php echo $statistik_kurzbz ?></legend>
|
||||
<?php else: ?>
|
||||
<legend>Neu</legend>
|
||||
<?php endif; ?>
|
||||
<input type="hidden" name="statistik_kurzbz_orig" value="<?php echo $statistik->statistik_kurzbz ?>">
|
||||
<table>
|
||||
<tr>
|
||||
<td>Kurzbz</td>
|
||||
<td><input type="text" name="statistik_kurzbz" size="50" maxlength="64" value="<?php echo $statistik->statistik_kurzbz ?>"></td>
|
||||
<td></td>
|
||||
<td>Gruppe</td>
|
||||
<td><input type="text" name="gruppe" value="<?php echo $statistik->gruppe ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Bezeichnung</td>
|
||||
<td><input type="text" name="bezeichnung" size="80" maxlength="256" value="<?php echo $statistik->bezeichnung ?>"></td>
|
||||
<td></td>
|
||||
<td>ContentID</td>
|
||||
<td><input type="text" name="content_id" value="<?php echo $statistik->content_id ?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>URL</td>
|
||||
<td><input type="text" name="url" size="80" maxlength="512" value="<?php echo $statistik->url ?>"></td>
|
||||
<td></td>
|
||||
<td>Berechtigung</td>
|
||||
<td>
|
||||
<?php
|
||||
$berechtigung = new berechtigung();
|
||||
$berechtigung->getBerechtigungen();
|
||||
?>
|
||||
<select name="berechtigung_kurzbz">
|
||||
<option value="">-- keine Auswahl --</option>
|
||||
<?php foreach($berechtigung->result as $row): ?>
|
||||
<option value="<?php echo $row->berechtigung_kurzbz ?>"
|
||||
<?php echo ($row->berechtigung_kurzbz == $statistik->berechtigung_kurzbz ? 'selected' : '') ?>>
|
||||
<?php echo $row->berechtigung_kurzbz ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td rowspan="3">SQL</td>
|
||||
<td rowspan="3"><textarea name="sql" cols="60" rows="5"><?php echo $statistik->sql ?></textarea></td>
|
||||
<td></td>
|
||||
<td>R</td>
|
||||
<td><input type="text" name="r" value="<?php echo $statistik->r ?>"></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td></td>
|
||||
<td>PHP</td>
|
||||
<td><input type="text" name="php" value="<?php echo $statistik->php ?>"></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td></td>
|
||||
<td>Publish</td>
|
||||
<td><input type="checkbox" name="publish" <?php echo $statistik->publish ? 'checked="checked"' : '' ?>></td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td>Preferences</td>
|
||||
<td><textarea name="preferences" cols="60" rows="5"><?php echo $statistik->preferences ?></textarea></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td><input type="submit" value="Speichern" name="save"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user