26 if($show_poll->anonymous ==
true){
27 print_info(
"Diese Umfrage wird anonym ausgewertet! <br/> Es werden also keine Benutzerdaten gespeichert, die auf die Herkunft (username, voller Name) hinweisen könnten.");
29 echo
'<form method="POST" action="">';
30 $show_poll->display();
31 echo
"<p style='margin-top:2em;'>Die Felder, die mit <span class='required_asterisk'>*</span> markiert sind, sind Plichtfelder.</p>";
33 echo
'<br/><input type="submit" value="Senden" name="poll_submit"/>';
40 $timeout = $poll->get_timeout_string();
41 $new =
"<td style='width:1em;'></td>";
43 if( (in_array($poll->ID,$polls_new)) AND (!in_array($poll->ID,$polls_visited)) ){
44 $new =
"<td style='max-width:1em'> <img src='".APP_ROOT.
"/icons/new.png' style='position:relative;right:2px;width:1.5em;' alt=''/> </td>";
46 if( $poll->anonymous ){
47 $anon =
"<span style='color:#C80D32;font-weight:bold;font-size:70%;line-height:70%;margin-left:.5em;vertical-align:middle'>(anonym)</span>";
50 echo
"<li style='margin:0px;padding:0px;margin-right:1.5em;margin-bottom:.5em;border-top:1px solid #C6C6C6;padding-top:5px'>";
54 echo
"<td> <a href=\"page.php?pID={$poll->ID}\" title='ID{$poll->ID}'> <img src='".APP_ROOT.
"/icons/pollicon/$imgname' style='height:4em;' alt=''/> </a> </td>";
55 echo
"<td style='vertical-align:top'>";
56 echo
"<a href=\"page.php?pID={$poll->ID}\" title='ID{$poll->ID}' style=';color:#759A24;text-decoration:none;font:1.5em/0.9 OFL Sorts Mill Goudy,Georgia,serif;letter-spacing:-1px' > {$poll->name}</a>";
58 echo
"<br/> <span style='font-size:80%;position:relative;top:-2px;color:#505050'>von {$poll->owner_fn}</span>";
59 echo
"<br/> <span style='font-size:80%;position:relative;top:-2px;color:#959595'>bis zum $timeout</span>";
67 $max =
sizeof($pollist);
69 if( $max >= $colors ){
70 for( $a=1 ; $a <= $colors ; ++$a ){
71 $colar[$a] = (int) ($max / $colors);
72 if( $a <= ($max%$colors) ){
77 for(
$i=1;
$i<=$colors;++
$i){
80 for(
$i=1 ;
$i <= $max ; ++
$i ){
81 $index = (int) $colors/$max;
92 require_once(
"config.php");
93 require_once(
"inc/user.class.php");
95 require_once(
"inc/tools.php");
97 session_regenerate_id();
99 require_once(
"inc/check_login.php");
102 require_once(
"inc/db.class.php");
103 require_once(
"inc/config.class.php");
105 require_once(
"inc/poll.class.php");
106 require_once(
"inc/html.class.php");
107 require_once(
"inc/messages.class.php");
108 require_once(
"inc/chart.class.php");
111 $db=
new db( DB_USER, DB_PASS, DB_DATABASE, DB_HOST );
124 if ($p[
"groups"] ==
"*"){
129 $poll_groups = explode(
",",$p[
"groups"]);
132 if( isset($_SESSION[
"projects"]) ){
133 foreach( $_SESSION[
"projects"] as $pr ){
134 $projects[] = $pr[1];
137 foreach($poll_groups as $poll_group){
139 if( ( $poll_group == $_SESSION[
"user"]->group ) OR ( in_array($poll_group,$projects) ) ){
146 if( intval($_SESSION[
"user"]->ID) === intval($p[
"owner"]) ){
153 $p->load_from_id(
$db,$pp);
161 if( (isset($_GET[
"pID"])) AND (is_numeric($_GET[
"pID"])) ){
162 $pID = intval($_GET[
"pID"]);
166 $ppoll->load_values_from_id(
$db,$_SESSION[
"user"]->
name) ;
169 }
else if( (isset($_GET[
"preview"])) AND (is_numeric($_GET[
"preview"])) ){
170 $pID = intval($_GET[
"preview"]);
172 $p->load_from_id(
$db,$pID);
173 if(($p->owner == $_SESSION[
"user"]->ID) OR (in_array($_SESSION[
"user"]->ID,explode(
",",SUPER_ADMIN)))){
178 if( isset($_POST[
"poll_submit"]) ){
179 $ppoll->load_from_id(
$db,$pID);
180 $ppoll->load_values_from_id(
$db,$_SESSION[
"user"]->
name);
181 $page =
"handle poll";
184 if( (
$page ==
"show poll") OR (
$page ==
"preview") OR (
$page ==
"handle poll") ){
185 $ppoll->load_widget_result_count(
$db);
191 if( (
$page ==
"show poll") OR (
$page ==
"handle poll") OR (
$page ==
"preview") ){
192 if( $ppoll->theme !==
"" ){
193 HTML::head(
'<link href="'.APP_ROOT.
'/CSS/Themes/'.$ppoll->theme.
'" rel="stylesheet" type="text/css">' );
207 if (
$page ==
"index"){
215 $other_polls = array();
216 $polls_timeouts = array();
217 $polls_sorted = array();
219 $polls_new = array();
221 $polls_visited =
$db->get_visited_polls_for_user($_SESSION[
"user"]->
name);
223 foreach(
$polls as $poll ){
224 $polls_timeouts[ $poll->ID ] = $poll->get_timeout_timestamp();
227 asort($polls_timeouts);
229 $keys = array_keys($polls_timeouts);
230 foreach(
$keys as $id){
231 if( (
$polls[$id]->get_active_since_timestammp() >= (
$now-1728000)) ){
232 if( isset($polls_copy[$id]) ){
233 $polls_sorted[] = $polls_copy[ $id ];
234 unset($polls_copy[$id]);
235 $polls_new[] =
$polls[$id]->ID;
240 foreach(
$keys as $id){
241 if( isset($polls_copy[$id]) ){
242 $polls_sorted[] = $polls_copy[ $id ];
246 foreach($polls_sorted as $poll){
247 if( ($poll->owner == $_SESSION[
"user"]->ID) ){
249 ($poll->get_timeout_timestamp() >=
$now) ){
254 ($poll->get_timeout_timestamp() >=
$now) ){
255 $other_polls[] = $poll;
262 echo
"<table style='width:100%'><tr>";
264 if(
sizeof($other_polls)>0 ){
266 echo
"<td style='vertical-align:top;width:50%'>";
267 echo
"<h2>Umfragen</h2>";
268 echo
"<ul style='list-style:none;padding:0px'>";
271 foreach($other_polls as $poll){
272 if( $poll->noDisplay ===
false ){
274 while( (isset($colors[
$color]) ) AND ($colors[$color] <= 0) ){
280 $imgname =
"pollicon-color{$color}.png";
292 if(
sizeof($my_polls) >0 ){
294 echo
"<td style='vertical-align:top;width:50%'>";
295 echo
"<h2>Eigene Umfragen</h2>";
296 echo
"<ul style='list-style:none;padding:0px'>";
300 foreach($my_polls as $poll){
301 if( $poll->noDisplay ===
false ){
303 while( (isset($colors[
$color]) ) AND ($colors[$color] <= 0) ){
309 $imgname =
"pollicon-color{$color}.png";
317 $umfragen_anderer =
"Umfragen";
321 echo
"</tr></table>";
326 echo
"<p style='margin-top:2em'><a href='backend/#umfrage_hinzuf%C3%BCgen' style='font-size:1.2em' >→ Eine Umfrage erstellen</a></p>";
331 }
else if (
$page ==
"show poll"){
332 if( ($ppoll->status ==
STATUS_NORMAL) AND ($ppoll->get_timeout_timestamp() >=
$now) ){
334 if ($ppoll->owner == $_SESSION[
"user"]->ID ){
335 echo
"<p id='poll_title'> <span id='umfrage'>Umfrage</span> «<i>{$ppoll->name}</i>» von {$ppoll->owner_fn} <span style='float:right'><a href='backend/edit.php?pollID={$ppoll->ID}' style='font-size:60%;color:#5F5F5F' >bearbeiten</a></span></p>";
337 echo
"<p id='poll_title'><span id='umfrage'>Umfrage</span> «<i>{$ppoll->name}</i>» von {$ppoll->owner_fn} </p>";
343 }
else if(
$page ==
"handle poll"){
345 $errors = $ppoll->handle_inpt();
347 if(
sizeof($errors) != 0){
348 foreach($errors as $e){
352 if ($ppoll->owner == $_SESSION[
"user"]->ID ){
353 echo
"<p id='poll_title'> <span id='umfrage'>Umfrage</span> «<i>{$ppoll->name}</i>» von {$ppoll->owner_fn} <span style='float:right'><a href='backend/edit.php?pollID={$ppoll->ID}' style='font-size:60%;color:#5F5F5F' >bearbeiten</a></span></p>";
355 echo
"<p id='poll_title'><span id='umfrage'>Umfrage</span> «<i>{$ppoll->name}</i>» von {$ppoll->owner_fn} </p>";
362 if ( (isset($_SESSION[
"user"]->
name)) AND ($_SESSION[
"user"]->is_auth ===
true) ){
364 $email_stack = array(
"pollID" => $ppoll->ID ,
"type" =>
"insert" ,
"fullName" => $_SESSION[
"user"]->fullName,
"uname" => $_SESSION[
"user"]->name ,
"timestamp" =>
"NOW()" );
365 $ret =
$db->insert_poll_result($ppoll);
366 $email_stack[
"type"] = $ret[
"action"];
367 if ( $ret[
"value"] !==
false ){
368 $notif_events = $ppoll->get_config(
"email_notif");
369 if( in_array($ret[
"action"],$notif_events) ){
370 $db->email_stack_add($email_stack);
373 $messages->add_message(
new errorMessage(
"Fehler in der Datenbank! Deine Daten wurden <b>nicht</b> gespeichert") );
376 $db->update_visited_polls($_SESSION[
"user"]->
name,$ppoll->ID);
380 echo
"<a href='page.php'>Zurück</a>";
382 echo
"<p>Vielen Dank, dass du an dieser Umfrage teilgenommen hast.</p>";
384 if( $ppoll->anonymous ===
false ){
385 $res =
$db->get_poll_result_for_user($ppoll->ID,$_SESSION[
"user"]->name);
387 echo
"<p>Du hast folgende Werte übertragen:</p>";
388 echo
"<table class='table_3'> <tr> <th>Frage</th> <th>Wert</th> </tr> ";
389 $res_db_colnames = array_keys($res);
391 foreach( $res_db_colnames as $col){
393 $w = $ppoll->get_widget_by_id( intval($col) );
395 $question = $w->dispName;
404 echo
"<tr class='line$r'>";
405 echo
"<td>$question</td>";
406 echo
"<td>{$res[$col]}</td>";
415 echo
"<p>Du hast folgende Werte übertragen:</p>";
416 echo
"<table class='table_3'> <tr> <th>Frage</th> <th>Wert</th> </tr> ";
418 foreach( $ppoll->widget_list as
$widget ){
420 foreach( $widget->widget_list as $question ){
422 echo
"<tr class='line$r'>";
423 echo
"<td>{$question->dispName}</td>";
424 $value = htmlspecialchars($question->value,ENT_QUOTES,
"UTF-8",
true);
425 echo
"<td>{$value}</td>";
431 echo
"<tr class='line$r'>";
432 echo
"<td>{$widget->dispName}</td>";
433 $value = htmlspecialchars($widget->value,ENT_QUOTES,
"UTF-8",
true);
434 echo
"<td>{$value}</td>";
444 if( $ppoll->anonymous ===
false ){
445 $tmout = $ppoll->get_timeout_string();
446 echo
"<p>Du kannst deine Angaben noch bis zum <b>$tmout</b> ändern.</p>";
450 $aktuelle_statistik =
false;
451 foreach( $ppoll->widget_list as $widget ){
452 if( $widget->get_config(
"showCharts") ){
453 $aktuelle_statistik =
true;
457 if( $aktuelle_statistik ){
458 echo
"<h2>Aktuelle Statistik</h2>";
459 echo
'<script src="JS/Chart.js"></script>';
460 $ppoll->load_widget_result_count(
$db);
461 foreach( $ppoll->widget_list as $widget ){
462 $c = $widget->get_config(
"showCharts");
465 $widget->chart_display();
473 }
else if (
$page ==
"preview"){
474 echo
"<p id='poll_title'><span id='umfrage'>Umfrage</span> «<i>{$ppoll->name}</i>» von {$ppoll->owner_fn}</p>";
483 exec(
"cd backend && php email-bg.php");