mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-25 16:44:28 +00:00
datepicker filter
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* filter.class.php
|
* filter.class.php
|
||||||
*
|
*
|
||||||
* Copyright 2014 fhcomplete.org
|
* Copyright 2014 fhcomplete.org
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Authors: Christian Paminger <[email protected]
|
* Authors: Christian Paminger <[email protected]
|
||||||
|
* Robert Hofer <[email protected]>
|
||||||
*/
|
*/
|
||||||
require_once(dirname(__FILE__).'/basis_db.class.php');
|
require_once(dirname(__FILE__).'/basis_db.class.php');
|
||||||
|
|
||||||
@@ -178,14 +179,21 @@ class filter extends basis_db
|
|||||||
$html.="\n\t\t\t";
|
$html.="\n\t\t\t";
|
||||||
switch ($filter->type)
|
switch ($filter->type)
|
||||||
{
|
{
|
||||||
case 'select':
|
case 'select':
|
||||||
$html.='<select id="' . $filter->kurzbz . '" class="form-control" name="'.$filter->kurzbz.'[]" ';
|
$html.='<select id="' . $filter->kurzbz . '" class="form-control" name="'.$filter->kurzbz.'[]" ';
|
||||||
$html.=$filter->htmlattr;
|
$html.=$filter->htmlattr;
|
||||||
$html.=' >';
|
$html.=' >';
|
||||||
$this->loadValues($filter->sql, $filter->valuename, $filter->showvalue);
|
$this->loadValues($filter->sql, $filter->valuename, $filter->showvalue);
|
||||||
foreach ($this->values as $value)
|
foreach ($this->values as $value)
|
||||||
$html.="\n\t\t\t\t".'<option class="form-control" value="'.$value->value.'">'.$value->text.'</option>';
|
$html.="\n\t\t\t\t".'<option class="form-control" value="'.$value->value.'">'.$value->text.'</option>';
|
||||||
$html.="\n\t\t\t</select>";
|
$html.="\n\t\t\t</select>";
|
||||||
|
break;
|
||||||
|
case 'datepicker':
|
||||||
|
$html .= '<input type="text" id="' . $filter->kurzbz . '" name="' . $filter->kurzbz . '">';
|
||||||
|
$html .= '<script>';
|
||||||
|
$html .= '$("#' . $filter->kurzbz . '").datepicker();';
|
||||||
|
$html .= '</script>';
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|||||||
+123
-124
@@ -1,124 +1,123 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2011 FH Technikum Wien
|
/* Copyright (C) 2011 FH Technikum Wien
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as
|
* it under the terms of the GNU General Public License as
|
||||||
* published by the Free Software Foundation; either version 2 of the
|
* published by the Free Software Foundation; either version 2 of the
|
||||||
* License, or (at your option) any later version.
|
* License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* Authors: Christian Paminger <[email protected]>,
|
* Authors: Christian Paminger <[email protected]>
|
||||||
* Andreas Oesterreicher <[email protected]> and
|
* Andreas Oesterreicher <[email protected]>
|
||||||
* Karl Burkhart <[email protected]>.
|
* Karl Burkhart <[email protected]>
|
||||||
*/
|
* Robert Hofer <[email protected]>
|
||||||
/**
|
*/
|
||||||
* Statistik Uebersichtsseite
|
/**
|
||||||
* - zeigt die Beschreibung einer Statistik ein
|
* Statistik Uebersichtsseite
|
||||||
* - Link zum Starten der Statistik
|
* - zeigt die Beschreibung einer Statistik ein
|
||||||
* - Eventuelle Parametereingabe für die Statistik
|
* - 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('../../config/vilesci.config.inc.php');
|
||||||
require_once('../../include/filter.class.php');
|
require_once('../../include/statistik.class.php');
|
||||||
require_once('../../include/functions.inc.php');
|
require_once('../../include/filter.class.php');
|
||||||
|
require_once('../../include/functions.inc.php');
|
||||||
if(!isset($_GET['statistik_kurzbz']))
|
|
||||||
die('Statistik_kurzbz Parameter fehlt');
|
$statistik_kurzbz = filter_input(INPUT_GET, 'statistik_kurzbz');
|
||||||
|
|
||||||
$statistik_kurzbz = $_GET['statistik_kurzbz'];
|
$statistik = new statistik();
|
||||||
|
|
||||||
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
if(!$statistik->load($statistik_kurzbz))
|
||||||
"http://www.w3.org/TR/html4/loose.dtd">
|
{
|
||||||
<html>
|
die($statistik->errormsg);
|
||||||
<head>
|
}
|
||||||
<title>Statistik</title>
|
?>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<!DOCTYPE html>
|
||||||
<link rel="stylesheet" href="../../skin/fhcomplete.css" type="text/css"/>
|
<html>
|
||||||
<link rel="stylesheet" href="../../skin/vilesci.css" type="text/css"/>
|
<head>
|
||||||
</head>
|
<title>Statistik</title>
|
||||||
<body>';
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<link rel="stylesheet" href="../../skin/fhcomplete.css" type="text/css"/>
|
||||||
$statistik = new statistik();
|
<link rel="stylesheet" href="../../skin/vilesci.css" type="text/css"/>
|
||||||
if(!$statistik->load($statistik_kurzbz))
|
<link rel="stylesheet" href="../../include/css/jquery-ui.1.11.2.min.css" />
|
||||||
die($statistik->errormsg);
|
<script type="text/javascript" src="../../include/js/jquery.min.1.11.1.js"></script>
|
||||||
|
<script type="text/javascript" src="../../include/js/jquery-ui.1.11.2.min.js"></script>
|
||||||
echo '<h2>Report - '.$statistik->bezeichnung.'</h2>';
|
<script>
|
||||||
|
$(function() {
|
||||||
//Beschreibung zu der Statistik anzeigen
|
$.datepicker.setDefaults({dateFormat: "yy-mm-dd"});
|
||||||
if($statistik->content_id!='')
|
});
|
||||||
{
|
</script>
|
||||||
echo "\n",'<a href="#" onclick="window.open(\'../../cms/content.php?content_id='.$statistik->content_id.'\', \'Beschreibung\', \'width=600,height=600, scrollbars=yes\');">Beschreibung anzeigen</a><br><br>';
|
</head>
|
||||||
}
|
<body>
|
||||||
$variablenstring='';
|
|
||||||
$action='';
|
<h2>Report - <?php echo $statistik->bezeichnung ?></h2>
|
||||||
if($statistik->url!='')
|
<?php
|
||||||
{
|
//Beschreibung zu der Statistik anzeigen
|
||||||
$action = $statistik->url;
|
if($statistik->content_id): ?>
|
||||||
$variablenstring = $statistik->url;
|
<a href="#" onclick="window.open('../../cms/content.php?content_id=<?php echo $statistik->content_id ?>', 'Beschreibung', 'width=600,height=600, scrollbars=yes');">
|
||||||
}
|
Beschreibung anzeigen
|
||||||
elseif($statistik->sql!='')
|
</a><br><br>
|
||||||
{
|
<?php endif;
|
||||||
$action = 'statistik_sql.php?statistik_kurzbz='.$statistik_kurzbz;
|
$variablenstring='';
|
||||||
$variablenstring = $statistik->sql;
|
$action='';
|
||||||
}
|
if($statistik->url)
|
||||||
|
{
|
||||||
$vars = $statistik->parseVars($variablenstring);
|
$action = $statistik->url;
|
||||||
//var_dump($vars);
|
$variablenstring = $statistik->url;
|
||||||
echo '
|
}
|
||||||
<script type="text/javascript">
|
elseif($statistik->sql!='')
|
||||||
function doit()
|
{
|
||||||
{';
|
$action = 'statistik_sql.php?statistik_kurzbz='.$statistik_kurzbz;
|
||||||
if($statistik->url!='')
|
$variablenstring = $statistik->sql;
|
||||||
{
|
}
|
||||||
echo 'var action=\''.$action.'\';
|
|
||||||
';
|
$vars = $statistik->parseVars($variablenstring); ?>
|
||||||
|
<script type="text/javascript">
|
||||||
foreach ($vars as $var)
|
function doit()
|
||||||
{
|
{
|
||||||
echo 'action = action.replace(\'$'.$var.'\', document.getElementById(\''.$var.'\').value);';
|
<?php if($statistik->url): ?>
|
||||||
}
|
var action='<?php echo $action ?>';
|
||||||
echo '
|
|
||||||
parent.detail_statistik.location.href=action;
|
<?php foreach ($vars as $var): ?>
|
||||||
return false;';
|
action = action.replace('$<?php echo $var ?>', document.getElementById('<?php echo $var ?>').value);
|
||||||
}
|
<?php endforeach; ?>
|
||||||
else
|
parent.detail_statistik.location.href=action;
|
||||||
echo 'return true;';
|
return false;
|
||||||
echo '
|
<?php else: ?>
|
||||||
}
|
return true;
|
||||||
</script>
|
<?php endif; ?>
|
||||||
<form action="'.$action.'" method="POST" target="detail_statistik" onsubmit="return doit();">
|
}
|
||||||
<table>
|
</script>
|
||||||
';
|
<form action="<?php echo $action ?>" method="POST" target="detail_statistik" onsubmit="return doit();">
|
||||||
// Filter parsen
|
<table>
|
||||||
$fltr=new filter();
|
|
||||||
$fltr->loadAll();
|
<?php
|
||||||
echo '<tr>';
|
// Filter parsen
|
||||||
foreach($vars as $var)
|
$fltr=new filter();
|
||||||
{
|
$fltr->loadAll(); ?>
|
||||||
if ($fltr->isFilter($var))
|
|
||||||
echo "<td>$var</td><td>".$fltr->getHtmlWidget($var)."</td>\n";
|
<tr>
|
||||||
else
|
<?php foreach($vars as $var):
|
||||||
echo "<td>$var</td><td><input type=\"text\" id=\"$var\" name=\"$var\" value=\"\"></td>";
|
if ($fltr->isFilter($var)): ?>
|
||||||
}
|
<td><?php echo $var ?></td><td><?php echo $fltr->getHtmlWidget($var) ?></td>
|
||||||
echo '</tr>';
|
<?php else: ?>
|
||||||
echo '
|
<td><?php echo $var ?></td><td><input type="text" id="<?php echo $var ?>" name="<?php echo $var ?>" value=""></td>
|
||||||
<tr>
|
<?php endif;
|
||||||
<td></td>
|
endforeach; ?>
|
||||||
<td><input type="submit" value="Anzeigen"></td>
|
</tr>
|
||||||
</tr>
|
<tr>
|
||||||
</table>
|
<td></td>
|
||||||
</form>';
|
<td><input type="submit" value="Anzeigen"></td>
|
||||||
|
</tr>
|
||||||
echo '</body>
|
</table>
|
||||||
</html>';
|
</form>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
?>
|
|
||||||
|
|||||||
+105
-106
@@ -1,106 +1,105 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2011 fhcomplete.org
|
/* Copyright (C) 2011 fhcomplete.org
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as
|
* it under the terms of the GNU General Public License as
|
||||||
* published by the Free Software Foundation; either version 2 of the
|
* published by the Free Software Foundation; either version 2 of the
|
||||||
* License, or (at your option) any later version.
|
* License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* Authors: Christian Paminger <[email protected]>,
|
* Authors: Christian Paminger <[email protected]>,
|
||||||
* Andreas Oesterreicher <[email protected]> and
|
* Andreas Oesterreicher <[email protected]> and
|
||||||
* Karl Burkhart <[email protected]>.
|
* Karl Burkhart <[email protected]>.
|
||||||
*/
|
*/
|
||||||
require_once('../../config/vilesci.config.inc.php');
|
require_once('../../config/vilesci.config.inc.php');
|
||||||
require_once('../../include/functions.inc.php');
|
require_once('../../include/functions.inc.php');
|
||||||
require_once('../../include/statistik.class.php');
|
require_once('../../include/statistik.class.php');
|
||||||
require_once('../../include/benutzerberechtigung.class.php');
|
require_once('../../include/benutzerberechtigung.class.php');
|
||||||
|
|
||||||
$uid = get_uid();
|
$statistik_kurzbz = filter_input(INPUT_GET, 'statistik_kurzbz');
|
||||||
|
$outputformat = filter_input(INPUT_GET, 'outputformat');
|
||||||
if(!isset($_GET['statistik_kurzbz']))
|
|
||||||
die('Statistik_kurzbz Parameter fehlt');
|
$statistik = new statistik();
|
||||||
|
if(!$statistik->load($statistik_kurzbz))
|
||||||
$statistik_kurzbz = $_GET['statistik_kurzbz'];
|
{
|
||||||
if (isset($_GET['outputformat']))
|
die($statistik->errormsg);
|
||||||
$outputformat=$_GET['outputformat'];
|
}
|
||||||
else
|
|
||||||
$outputformat='html';
|
if (!isset($outputformat))
|
||||||
|
{
|
||||||
$html='';
|
$outputformat='html';
|
||||||
$csv='';
|
}
|
||||||
$html.='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
|
||||||
"http://www.w3.org/TR/html4/loose.dtd">
|
if($statistik->berechtigung_kurzbz != '')
|
||||||
<html>
|
{
|
||||||
<head>
|
$uid = get_uid();
|
||||||
<title>Statistik</title>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
$rechte = new benutzerberechtigung();
|
||||||
<link rel="stylesheet" href="../../skin/tablesort.css" type="text/css"/>
|
$rechte->getBerechtigungen($uid);
|
||||||
<link rel="stylesheet" href="../../skin/fhcomplete.css" type="text/css"/>
|
|
||||||
<link rel="stylesheet" href="../../skin/vilesci.css" type="text/css"/>
|
if(!$rechte->isBerechtigt($statistik->berechtigung_kurzbz))
|
||||||
<script type="text/javascript" src="../../include/js/jquery.js"></script>
|
{
|
||||||
<script type="text/javascript">
|
die('Sie haben keine Berechtigung für diese Seite');
|
||||||
$(document).ready(function()
|
}
|
||||||
{
|
}
|
||||||
$("#myTable").tablesorter(
|
|
||||||
{
|
if ($statistik->loadData())
|
||||||
widgets: [\'zebra\']
|
{
|
||||||
});
|
$csv = $statistik->getCSV();
|
||||||
});
|
$json = $statistik->getJSON();
|
||||||
|
}
|
||||||
</script>
|
else
|
||||||
</head>
|
{
|
||||||
<body>';
|
echo $statistik->error_msg;
|
||||||
|
return;
|
||||||
$statistik = new statistik();
|
}
|
||||||
if(!$statistik->load($statistik_kurzbz))
|
|
||||||
die($statistik->errormsg);
|
switch ($outputformat)
|
||||||
|
{
|
||||||
if($statistik->berechtigung_kurzbz!='')
|
case 'csv':
|
||||||
{
|
header("Content-type: text/csv");
|
||||||
$rechte = new benutzerberechtigung();
|
header("Content-Disposition: attachment; filename=data.csv");
|
||||||
$rechte->getBerechtigungen($uid);
|
header("Pragma: no-cache");
|
||||||
if(!$rechte->isBerechtigt($statistik->berechtigung_kurzbz))
|
header("Expires: 0");
|
||||||
die('Sie haben keine Berechtigung für diese Seite');
|
echo $csv;
|
||||||
}
|
return;
|
||||||
|
case 'json':
|
||||||
$html.= '<h2>Statistik - '.$statistik->bezeichnung.'</h2>';
|
header("Content-type: application/json");
|
||||||
|
header("Content-Disposition: attachment; filename=data.json");
|
||||||
if ($statistik->loadData())
|
header("Pragma: no-cache");
|
||||||
{
|
header("Expires: 0");
|
||||||
$html.=$statistik->getHtmlTable('myTable','tablesorter');
|
//$array= array_map("str_getcsv",explode("\n", $csv));
|
||||||
$csv=$statistik->getCSV();
|
echo $json;
|
||||||
$json=$statistik->getJSON();
|
return;
|
||||||
}
|
}
|
||||||
else
|
?>
|
||||||
echo $statistik->error_msg;
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
switch ($outputformat)
|
<head>
|
||||||
{
|
<title>Statistik</title>
|
||||||
case 'html':
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
echo $html;
|
<link rel="stylesheet" href="../../skin/tablesort.css" type="text/css"/>
|
||||||
break;
|
<link rel="stylesheet" href="../../skin/fhcomplete.css" type="text/css"/>
|
||||||
case 'csv':
|
<link rel="stylesheet" href="../../skin/vilesci.css" type="text/css"/>
|
||||||
header("Content-type: text/csv");
|
<script type="text/javascript" src="../../include/js/jquery.js"></script>
|
||||||
header("Content-Disposition: attachment; filename=data.csv");
|
<script type="text/javascript">
|
||||||
header("Pragma: no-cache");
|
$(function() {
|
||||||
header("Expires: 0");
|
$("#myTable").tablesorter({
|
||||||
echo $csv;
|
widgets: ['zebra']
|
||||||
break;
|
});
|
||||||
case 'json':
|
});
|
||||||
header("Content-type: application/json");
|
</script>
|
||||||
header("Content-Disposition: attachment; filename=data.json");
|
</head>
|
||||||
header("Pragma: no-cache");
|
<body>
|
||||||
header("Expires: 0");
|
<h2>Statistik - <?php echo $statistik->bezeichnung ?></h2>
|
||||||
//$array= array_map("str_getcsv",explode("\n", $csv));
|
<?php echo $statistik->getHtmlTable('myTable', 'tablesorter'); ?>
|
||||||
echo $json;
|
</body>
|
||||||
}
|
</html>
|
||||||
?>
|
|
||||||
Reference in New Issue
Block a user