datepicker filter

This commit is contained in:
Robert Hofer
2014-12-15 11:32:15 +00:00
parent 9c67036474
commit 096250102a
3 changed files with 245 additions and 239 deletions
+17 -9
View File
@@ -1,7 +1,7 @@
<?php
/*
* filter.class.php
*
*
* Copyright 2014 fhcomplete.org
*
* This program is free software; you can redistribute it and/or modify
@@ -21,6 +21,7 @@
*
*
* Authors: Christian Paminger <pam@technikum-wien.at
* Robert Hofer <robert.hofer@technikum-wien.at>
*/
require_once(dirname(__FILE__).'/basis_db.class.php');
@@ -178,14 +179,21 @@ class filter extends basis_db
$html.="\n\t\t\t";
switch ($filter->type)
{
case 'select':
$html.='<select id="' . $filter->kurzbz . '" class="form-control" name="'.$filter->kurzbz.'[]" ';
$html.=$filter->htmlattr;
$html.=' >';
$this->loadValues($filter->sql, $filter->valuename, $filter->showvalue);
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</select>";
case 'select':
$html.='<select id="' . $filter->kurzbz . '" class="form-control" name="'.$filter->kurzbz.'[]" ';
$html.=$filter->htmlattr;
$html.=' >';
$this->loadValues($filter->sql, $filter->valuename, $filter->showvalue);
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</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;
}
+123 -124
View File
@@ -1,124 +1,123 @@
<?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/filter.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>Report - '.$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, scrollbars=yes\');">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 = $statistik->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>
';
// Filter parsen
$fltr=new filter();
$fltr->loadAll();
echo '<tr>';
foreach($vars as $var)
{
if ($fltr->isFilter($var))
echo "<td>$var</td><td>".$fltr->getHtmlWidget($var)."</td>\n";
else
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>';
?>
<?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 <karl.burkhart@technikum-wien.at>
* Robert Hofer <robert.hofer@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/filter.class.php');
require_once('../../include/functions.inc.php');
$statistik_kurzbz = filter_input(INPUT_GET, 'statistik_kurzbz');
$statistik = new statistik();
if(!$statistik->load($statistik_kurzbz))
{
die($statistik->errormsg);
}
?>
<!DOCTYPE html>
<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"/>
<link rel="stylesheet" href="../../include/css/jquery-ui.1.11.2.min.css" />
<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>
<script>
$(function() {
$.datepicker.setDefaults({dateFormat: "yy-mm-dd"});
});
</script>
</head>
<body>
<h2>Report - <?php echo $statistik->bezeichnung ?></h2>
<?php
//Beschreibung zu der Statistik anzeigen
if($statistik->content_id): ?>
<a href="#" onclick="window.open('../../cms/content.php?content_id=<?php echo $statistik->content_id ?>', 'Beschreibung', 'width=600,height=600, scrollbars=yes');">
Beschreibung anzeigen
</a><br><br>
<?php endif;
$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 = $statistik->parseVars($variablenstring); ?>
<script type="text/javascript">
function doit()
{
<?php if($statistik->url): ?>
var action='<?php echo $action ?>';
<?php foreach ($vars as $var): ?>
action = action.replace('$<?php echo $var ?>', document.getElementById('<?php echo $var ?>').value);
<?php endforeach; ?>
parent.detail_statistik.location.href=action;
return false;
<?php else: ?>
return true;
<?php endif; ?>
}
</script>
<form action="<?php echo $action ?>" method="POST" target="detail_statistik" onsubmit="return doit();">
<table>
<?php
// Filter parsen
$fltr=new filter();
$fltr->loadAll(); ?>
<tr>
<?php foreach($vars as $var):
if ($fltr->isFilter($var)): ?>
<td><?php echo $var ?></td><td><?php echo $fltr->getHtmlWidget($var) ?></td>
<?php else: ?>
<td><?php echo $var ?></td><td><input type="text" id="<?php echo $var ?>" name="<?php echo $var ?>" value=""></td>
<?php endif;
endforeach; ?>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Anzeigen"></td>
</tr>
</table>
</form>
</body>
</html>
+105 -106
View File
@@ -1,106 +1,105 @@
<?php
/* Copyright (C) 2011 fhcomplete.org
*
* 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/functions.inc.php');
require_once('../../include/statistik.class.php');
require_once('../../include/benutzerberechtigung.class.php');
$uid = get_uid();
if(!isset($_GET['statistik_kurzbz']))
die('Statistik_kurzbz Parameter fehlt');
$statistik_kurzbz = $_GET['statistik_kurzbz'];
if (isset($_GET['outputformat']))
$outputformat=$_GET['outputformat'];
else
$outputformat='html';
$html='';
$csv='';
$html.='<!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);
if($statistik->berechtigung_kurzbz!='')
{
$rechte = new benutzerberechtigung();
$rechte->getBerechtigungen($uid);
if(!$rechte->isBerechtigt($statistik->berechtigung_kurzbz))
die('Sie haben keine Berechtigung für diese Seite');
}
$html.= '<h2>Statistik - '.$statistik->bezeichnung.'</h2>';
if ($statistik->loadData())
{
$html.=$statistik->getHtmlTable('myTable','tablesorter');
$csv=$statistik->getCSV();
$json=$statistik->getJSON();
}
else
echo $statistik->error_msg;
switch ($outputformat)
{
case 'html':
echo $html;
break;
case 'csv':
header("Content-type: text/csv");
header("Content-Disposition: attachment; filename=data.csv");
header("Pragma: no-cache");
header("Expires: 0");
echo $csv;
break;
case 'json':
header("Content-type: application/json");
header("Content-Disposition: attachment; filename=data.json");
header("Pragma: no-cache");
header("Expires: 0");
//$array= array_map("str_getcsv",explode("\n", $csv));
echo $json;
}
?>
<?php
/* Copyright (C) 2011 fhcomplete.org
*
* 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/functions.inc.php');
require_once('../../include/statistik.class.php');
require_once('../../include/benutzerberechtigung.class.php');
$statistik_kurzbz = filter_input(INPUT_GET, 'statistik_kurzbz');
$outputformat = filter_input(INPUT_GET, 'outputformat');
$statistik = new statistik();
if(!$statistik->load($statistik_kurzbz))
{
die($statistik->errormsg);
}
if (!isset($outputformat))
{
$outputformat='html';
}
if($statistik->berechtigung_kurzbz != '')
{
$uid = get_uid();
$rechte = new benutzerberechtigung();
$rechte->getBerechtigungen($uid);
if(!$rechte->isBerechtigt($statistik->berechtigung_kurzbz))
{
die('Sie haben keine Berechtigung für diese Seite');
}
}
if ($statistik->loadData())
{
$csv = $statistik->getCSV();
$json = $statistik->getJSON();
}
else
{
echo $statistik->error_msg;
return;
}
switch ($outputformat)
{
case 'csv':
header("Content-type: text/csv");
header("Content-Disposition: attachment; filename=data.csv");
header("Pragma: no-cache");
header("Expires: 0");
echo $csv;
return;
case 'json':
header("Content-type: application/json");
header("Content-Disposition: attachment; filename=data.json");
header("Pragma: no-cache");
header("Expires: 0");
//$array= array_map("str_getcsv",explode("\n", $csv));
echo $json;
return;
}
?>
<!DOCTYPE html>
<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">
$(function() {
$("#myTable").tablesorter({
widgets: ['zebra']
});
});
</script>
</head>
<body>
<h2>Statistik - <?php echo $statistik->bezeichnung ?></h2>
<?php echo $statistik->getHtmlTable('myTable', 'tablesorter'); ?>
</body>
</html>