mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
Statistik AddOn
This commit is contained in:
+69
-30
@@ -35,6 +35,7 @@ class statistik extends basis_db
|
||||
public $php;
|
||||
public $r;
|
||||
public $gruppe;
|
||||
public $publish;
|
||||
public $insertamum;
|
||||
public $insertvon;
|
||||
public $updateamum;
|
||||
@@ -47,6 +48,8 @@ class statistik extends basis_db
|
||||
public $studiensemester_kurzbz;// varchar(16)
|
||||
public $ausbildungssemester;// smallint
|
||||
|
||||
public $anzahl; //Hilfsvariable fuer Group BY Abfragen
|
||||
|
||||
// Daten der Statistik
|
||||
public $data;
|
||||
public $html;
|
||||
@@ -86,6 +89,7 @@ class statistik extends basis_db
|
||||
$this->php = $row->php;
|
||||
$this->r = $row->r;
|
||||
$this->gruppe = $row->gruppe;
|
||||
$this->publish = $row->publish;
|
||||
$this->insertamum = $row->insertamum;
|
||||
$this->insertvon = $row->insertvon;
|
||||
$this->updateamum = $row->updateamum;
|
||||
@@ -129,6 +133,7 @@ class statistik extends basis_db
|
||||
$obj->php = $row->php;
|
||||
$obj->r = $row->r;
|
||||
$obj->gruppe = $row->gruppe;
|
||||
$obj->publish = $row->publish;
|
||||
$obj->insertamum = $row->insertamum;
|
||||
$obj->insertvon = $row->insertvon;
|
||||
$obj->updateamum = $row->updateamum;
|
||||
@@ -146,7 +151,39 @@ class statistik extends basis_db
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Laedt alle Statistik Gruppen, Parameter publish zum Filtern.
|
||||
* @return true wenn ok, sonst false
|
||||
*/
|
||||
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($result = $this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object($result))
|
||||
{
|
||||
$obj = new statistik();
|
||||
|
||||
$obj->gruppe = $row->gruppe;
|
||||
$obj->anzahl = $row->anzahl;
|
||||
|
||||
$this->result[] = $obj;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Speichert einen Statistik Datensatz
|
||||
* @param $new boolean
|
||||
@@ -160,42 +197,44 @@ class statistik extends basis_db
|
||||
if($new)
|
||||
{
|
||||
$qry = 'INSERT INTO public.tbl_statistik(statistik_kurzbz, content_id, bezeichnung, url, sql,
|
||||
php, r, gruppe, insertamum, insertvon, updateamum, updatevon, berechtigung_kurzbz) 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).','.
|
||||
$this->addslashes($this->berechtigung_kurzbz).');';
|
||||
php, r, gruppe, publish, insertamum, insertvon, updateamum, updatevon, 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).','.
|
||||
$this->db_add_param($this->url).','.
|
||||
$this->db_add_param($this->sql).','.
|
||||
$this->db_add_param($this->php).','.
|
||||
$this->db_add_param($this->r).','.
|
||||
$this->db_add_param($this->gruppe).','.
|
||||
$this->db_add_param($this->publish).','.
|
||||
$this->db_add_param($this->insertamum).','.
|
||||
$this->db_add_param($this->insertvon).','.
|
||||
$this->db_add_param($this->updateamum).','.
|
||||
$this->db_add_param($this->updatevon).','.
|
||||
$this->db_add_param($this->berechtigung_kurzbz).');';
|
||||
}
|
||||
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).','.
|
||||
' berechtigung_kurzbz='.$this->addslashes($this->berechtigung_kurzbz).
|
||||
" WHERE statistik_kurzbz='".addslashes($this->statistik_kurzbz_orig)."'";
|
||||
content_id='.$this->db_add_param($this->content_id,FHC_INTEGER).','.
|
||||
' bezeichnung='.$this->db_add_param($this->bezeichnung).','.
|
||||
' statistik_kurzbz='.$this->db_add_param($this->statistik_kurzbz).','.
|
||||
' url='.$this->db_add_param($this->url).','.
|
||||
' sql='.$this->db_add_param($this->sql).','.
|
||||
' php='.$this->db_add_param($this->php).','.
|
||||
' r='.$this->db_add_param($this->r).','.
|
||||
' gruppe='.$this->db_add_param($this->gruppe).','.
|
||||
' publish='.$this->db_add_param($this->publish).','.
|
||||
' insertamum='.$this->db_add_param($this->insertamum).','.
|
||||
' insertvon='.$this->db_add_param($this->insertvon).','.
|
||||
' updateamum='.$this->db_add_param($this->updateamum).','.
|
||||
' updatevon='.$this->db_add_param($this->updatevon).','.
|
||||
' berechtigung_kurzbz='.$this->db_add_param($this->berechtigung_kurzbz).
|
||||
' WHERE statistik_kurzbz='.$this->db_add_param($this->statistik_kurzbz_orig,FHC_STRING,false);
|
||||
}
|
||||
|
||||
//echo $qry;
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -41,6 +41,16 @@ echo '<H2>DB-Updates!</H2>';
|
||||
// *** Pruefung und hinzufuegen der neuen Attribute und Tabellen
|
||||
echo '<H2>Pruefe Tabellen und Attribute!</H2>';
|
||||
|
||||
// **************** Spalte publish Tabelle public.tbl_statistik
|
||||
if(!$result = @$db->db_query("SELECT publish FROM public.tbl_statistik LIMIT 1;"))
|
||||
{
|
||||
$qry = 'ALTER TABLE public.tbl_statistik ADD COLUMN publish boolean DEFAULT false;';
|
||||
if(!$db->db_query($qry))
|
||||
echo '<strong>public.tbl_statistik: '.$db->db_last_error().'</strong><br>';
|
||||
else
|
||||
echo ' public.tbl_statistik: Spalte publish hinzugefuegt!<br>';
|
||||
}
|
||||
|
||||
// **************** Spalte scrumsprint_id Tabelle fue.tbl_projekttask
|
||||
if(!$result = @$db->db_query("SELECT scrumsprint_id FROM fue.tbl_projekttask LIMIT 1;"))
|
||||
{
|
||||
|
||||
@@ -63,6 +63,7 @@ if(!$rechte->isBerechtigt('basis/statistik'))
|
||||
$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'])?$_POST['publish']:die('Publish fehlt'));
|
||||
$new = (isset($_POST['new'])?$_POST['new']:die('New fehlt'));
|
||||
$berechtigung_kurzbz = (isset($_POST['berechtigung_kurzbz'])?$_POST['berechtigung_kurzbz']:die('Berechtigungkurzbz fehlt'));
|
||||
|
||||
@@ -89,6 +90,7 @@ if(!$rechte->isBerechtigt('basis/statistik'))
|
||||
$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;
|
||||
@@ -166,8 +168,8 @@ if(!$rechte->isBerechtigt('basis/statistik'))
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '<tr valign="top">';
|
||||
echo ' <td rowspan="2">SQL</td>';
|
||||
echo ' <td rowspan="2"><textarea name="sql" cols="60" rows="5">'.$statistik->sql.'</textarea></td>';
|
||||
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>';
|
||||
@@ -177,6 +179,11 @@ if(!$rechte->isBerechtigt('basis/statistik'))
|
||||
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="text" name="publish" value="'.$statistik->publish.'"></td>';
|
||||
echo '</tr>';
|
||||
|
||||
echo '<tr>';
|
||||
echo ' <td></td>';
|
||||
@@ -184,10 +191,11 @@ if(!$rechte->isBerechtigt('basis/statistik'))
|
||||
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>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
@@ -90,6 +90,7 @@ echo '<table class="tablesorter" id="myTable">
|
||||
<th>Kurzbz</th>
|
||||
<th>Bezeichnung</th>
|
||||
<th>Gruppe</th>
|
||||
<th>Publish</th>
|
||||
<th>ContentID</th>
|
||||
<th colspan="2">Aktion</th>
|
||||
</tr>
|
||||
@@ -102,6 +103,7 @@ foreach($statistik->result as $row)
|
||||
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->publish,'</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>';
|
||||
@@ -111,4 +113,4 @@ echo '</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>';
|
||||
?>
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user