24 require_once(
"../config.php");
25 require_once(
"../inc/user.class.php");
26 require_once(
"../inc/tools.php");
27 require_once(
"../inc/check_login.php");
30 require_once(
"../inc/db.class.php");
31 require_once(
"../inc/config.class.php");
33 require_once(
"../inc/poll.class.php");
34 require_once(
"../inc/messages.class.php");
35 require_once(
"../inc/html.class.php");
36 require_once(
"../inc/chart.class.php");
37 $db=
new db( DB_USER, DB_PASS, DB_DATABASE, DB_HOST );
44 $qarr = explode(
"&",$_SERVER[
'QUERY_STRING']);
47 $order_passed =
false;
49 foreach( $qarr as $q ){
50 if( (substr($q,0,5) ==
"sort=") ){
51 if( ($sort_passed ===
false) ){
52 $qarr_n[] =
"sort=$sort";
58 }
else if( ($q ==
"asc") OR ($q ==
"desc") ){
59 if( ($order_passed ===
false) ){
71 $url = $_SERVER[
'SCRIPT_NAME' ].
"?";
72 $url .= implode(
"&",$qarr_n);
74 if( strpos($url,
"sort") ===
false ){
75 $url .=
"&sort=$sort";
77 if( (strpos($url,
"asc") ===
false) AND (strpos($url,
"desc") ===
false) ){
86 if( isset($_GET[
"sort"]) ){
87 $sort = $_GET[
"sort"];
91 if( isset($_GET[
"asc"]) ){
93 }
else if( isset($_GET[
"desc"]) ){
100 if( $order ==
"desc" ){
102 }
else if( $order ==
"asc" ){
106 $order_icons = array(
107 "asc" =>
"<img src='".APP_ROOT.
"/icons/16/sort-down.png' alt='' style='vertical-align:middle'/>" ,
108 "desc" =>
"<img src='".APP_ROOT.
"/icons/16/sort-up.png' alt='' style='vertical-align:middle'/>" ,
111 $res =
$db->export_result($poll->ID,$sort,$order);
112 if(
sizeof($res) > 0 ){
113 echo
"<table class='result_table'>";
119 foreach( array_keys($res[0]) as $name ){
120 if( ($sort == $name) ){
122 $icon = $order_icons[$order2];
130 if( ! in_array($name, array(
"user",
"name",
"group",
"Datum") ) ){
131 $wid = $poll->get_widget_by_name($name);
133 echo
"<th class='$css'> <a href='$url'>$icon {$wid->dispName}";
135 echo
"<br/> <span style='font-size:80%;font-variant:italic'>({$name})</span>";
139 echo
"<th class='$css'> <a href='$url'>$icon {$name}</a> </th>";
143 echo
"<th class='$css'> <a href='$url'>$icon {$name}</a> </th>";
150 foreach( $res as $row ){
152 echo
"<tr class='line$evenodd'>";
154 echo
"<td> <input type='checkbox' name='selection[{$row["user"]}]'/> </td>";
157 foreach( array_keys($row) as $name){
158 $hh = htmlspecialchars($row[$name],ENT_QUOTES,
"UTF-8",
true);
159 echo
"<td>{$hh}</td>";
171 if ( (isset($_GET[
"pollID"])) AND
172 (is_numeric($_GET[
"pollID"])) AND
173 ($_GET[
"pollID"] !=
"")
177 if (!$poll->load_from_id(
$db, intval($_GET[
"pollID"]) ) ){
178 die(
"Umfrage existiert nicht.");
182 header(
"Location: index.php");
187 if( (intval($_SESSION[
"user"]->ID) !== intval($poll->owner) ) AND
188 ( !in_array(
"{$_SESSION["user"]->ID}",explode(
",",SUPER_ADMIN) )) ){
189 die(
"Umfrage Bearbeiten nicht erlaubt.");
196 $db->garbage_collect_result_table($poll);
197 if( isset($_GET[
"view_csv"]) ){
198 $poll->handle_export_edit(
$db,
false);
200 }
else if (isset($_GET[
"dl_csv"])){
201 $poll->handle_export_edit(
$db,
true);
204 }
else if(isset($_GET[
"view_html"]) ){
205 $edit =
"show html results";
206 }
else if(isset($_GET[
"edit_html"]) ){
207 $edit =
"edit html results";
209 }
else if( isset($_GET[
"view_count"]) ){
210 $edit =
"show count";
211 }
else if( isset($_GET[
"view_charts"]) ){
212 $edit =
"show charts";
224 if( (
$edit ==
"show html results") OR (
$edit ==
"edit html results") ){
227 <title>Umfrage</title>
228 <meta http-equiv="content-type" content="text/html;charset=utf-8" />
229 <meta name="generator" content="Geany 0.21" />
230 <link rel="icon" type="image/png" href="../icons/32/dialog-apply.png">
231 <link href="../JS/jquery/css/smoothness/jquery-ui-1.10.0.custom" rel="stylesheet">
232 <script src="../JS/jquery/jquery-1.9.0.js"></script>
233 <script src="../JS/jquery/jquery-ui-1.10.0.custom.js"></script>
234 <link href="'.APP_ROOT.
'/CSS/style.css" rel="stylesheet" type="text/css">
235 <link href="'.APP_ROOT.
'/CSS/menu_nav.css" rel="stylesheet" type="text/css">
236 <link href="'.APP_ROOT.
'/CSS/backend.css" rel="stylesheet" type="text/css">
237 <link href="'.APP_ROOT.
'/CSS/messages.css" rel="stylesheet" type="text/css">
240 <div class="content" style="width:80% !important" >
247 if( (
$edit ==
"show html results") OR (
$edit ==
"edit html results") ){
248 $timeout = $poll->get_timeout_string();
249 if($poll->anonymous ==
true){
252 $anon =
"Nicht anonym";
254 if( $poll->is_public ===
true){
255 $anon =
"Öffentlich";
257 echo
"<table class='table_2' style='width:500px'>";
258 echo
"<tr> <th>Eigenschaft</th> <th>Wert</th></tr>";
259 echo
"<tr> <td>Name</td> <td>{$poll->name}</td></tr>";
260 echo
"<tr> <td>Typ</td> <td>{$polltype_human_readable[$poll->type]}</td></tr>";
261 echo
"<tr> <td>aktueller Status</td> <td>{$status_human_readable[$poll->status]}</td></tr>";
262 echo
"<tr> <td>Endet am</td> <td>$timeout</td></tr>";
263 echo
"<tr> <td>Anonymität</td> <td>$anon</td></tr>";
265 echo
"<p><a href='edit.php?pollID={$poll->ID}'>zurück</a> zu den Umfrageeinstellungen</p>";
269 if(
$edit ==
"show html results"){
270 echo
"<div style='width:100%;height:600px;overflow:scroll'>";
274 }
else if(
$edit ==
"edit html results"){
276 echo
"<form action='results.show.handle.php' method='POST'>";
277 echo
"<div style='width:100%;height:600px;overflow:scroll'>";
280 echo
"<input type='hidden' name='pollID' value='{$poll->ID}'/>";
283 if($poll->anonymous ==
false){
284 echo
"<span style='margin-left:2em'> </span>ausgewählte Elemente <input type='submit' name='save_results' value='Löschen'/>";
285 echo
"<span style='margin-left:2em'> </span>Auswahl <input type='reset' value='Zurücksetzen'/>";
287 echo
"<span style='margin-left:2em'> </span><b>alles</b> <input type='submit' name='rm_all' value='Löschen'/>";
291 }
else if (
$edit ==
"show count"){
292 $poll->load_widget_result_count(
$db);
294 foreach($poll->widget_list as
$widget){
296 echo
"<li>{$widget->dispName} <span style='color:red'>{$widget->get_data("count
")}</span>";
298 if( $widget instanceof
matrix ){
299 foreach($widget->widget_list as $question){
300 echo
"<li>{$question->dispName}";
302 foreach( $widget->option_list as $opt){
303 echo
"<li>{$opt->value} <span style='color:red'>{$question->get_data('count_'.$opt->ID)}</span></li>";
309 foreach($widget->option_list as $option){
310 echo
"<li>{$option->dispName} <span style='color:red'>{$option->get_data("count
")}</span></li>";
315 $true = $widget->get_config(
"true"); $false = $widget->get_config(
"false");
316 echo
"<li>{$widget->dispName} - $true <span style='color:red'>{$widget->get_data("count_true
")}</span></li>";
317 echo
"<li>{$widget->dispName} - $false <span style='color:red'>{$widget->get_data("count_false
")}</span></li>";
319 echo
"<li>{$widget->dispName} <span style='color:red'>{$widget->get_data("count
")}</span></li>";
326 echo
"<p><a href='edit.php?pollID={$poll->ID}'>zurück</a> zu den Umfrageeinstellungen</p>";
327 $poll->load_widget_result_count(
$db);
328 echo
'<script src="../JS/Chart.js"></script>';
329 foreach( $poll->widget_list as $widget ){
331 $widget->chart_display();
336 echo
"<p><a href='edit.php?pollID={$poll->ID}'>zurück</a> zu den Umfrageeinstellungen</p>";