25 require_once(
"../config.php");
44 if( (isset($_GET[
"page"])) AND ($_GET[
"page"] !=
"") ){
45 if( $_GET[
"page"] ==
"archive" ){
47 }
else if( $_GET[
"page"] ==
"templates" ){
60 $db=
new db( DB_USER, DB_PASS, DB_DATABASE, DB_HOST );
78 if( ($p[
"owner"] == $_SESSION[
"user"]->ID) ){
83 $groups = explode(
",",$p[
"groups"]);
84 if( (in_array($_SESSION[
"user"]->group,
$groups)) OR (in_array(
"*",
$groups)) ){
92 $poll_list_normal = array();
104 $poll_list_normal[] = $p;
113 if(
$page ==
"index" ){
114 foreach($poll_list_normal as $p){
116 $pp->load_from_id(
$db,$p[
"ID"]);
119 }
else if(
$page ==
"templates"){
122 $pp->load_from_id(
$db,$p[
"ID"]);
127 $pp->load_from_id(
$db,$p[
"ID"]);
130 }
else if(
$page ==
"archive"){
133 $pp->load_from_id(
$db,$p[
"ID"]);
145 $navbar = array( 0 => array(
"name"=>
"Backend",
"href"=>
"index.php",
"onclick"=>
"") );
146 if(
$page ==
"templates" ){
147 $navbar[] = array(
"name"=>
"Vorlagen" ,
"href"=>
"index.php?page=templates" ,
"onclick"=>
"");
149 }
else if(
$page ==
"archive"){
150 $navbar[] = array(
"name"=>
"Archiv" ,
"href"=>
"index.php?page=archive" ,
"onclick"=>
"");
160 if(
$page ==
"index" ){
162 echo
"<table id='linkbox_backend_index'><tr>";
163 echo
"<td><a href='index.php?page=archive'> <img src='".APP_ROOT.
"/icons/32/package-x-generic.png' alt='' /> </a> </td>";
164 echo
"<td style='vertical-align:middle;font-size:1.2em;padding-right:2em;'><a href='index.php?page=archive' style=''> zum Archiv</a> </td>";
166 echo
"<td><a href='index.php?page=templates'> <img src='".APP_ROOT.
"/icons/32/edit-paste.png' alt=''/> </a> </td>";
167 echo
"<td style='vertical-align:middle;font-size:1.2em;'> <a href='index.php?page=templates' style=''>zu den Vorlagen</a> </td>";
168 echo
"</tr></table>";
171 echo
"<table class='backend_poll_table' style='margin-top:1.5em'>";
173 echo
"<tr class='table_header'> <th>ID</th> <th>Name</th> <th>Status</th> <th>Ablaufdatum</th> <th>Bearbeiten</th> </tr>";
175 echo
"<tr class='table_header'> <th>ID</th> <th>Name</th> <th>Status</th> <th>Ablaufdatum</th> <th>von</th> <th>Bearbeiten</th> </tr>";
178 $status_mapping = array(
179 STATUS_NORMAL => array(
"name"=>
"aktiv" ,
"css"=>
"status_active"),
185 $timeout = $poll->get_timeout_string();
186 $ts = $poll->get_timeout_timestamp();
187 $color_class=
"status_active";
190 $status_string =
"aktiv";
193 $status_string =
"abgelaufen";
194 $color_class=
"status_timeout";
197 $status_string =
"inaktiv";
198 $color_class=
"status_inactive";
201 $color_class=
"status_deactivated";
202 $status_string =
"deaktiviert";
205 if( (isset($_SESSION[
"last_poll_edit"])) AND ($_SESSION[
"last_poll_edit"] == $poll->ID) ){
206 $edited =
"poll_last_edit";
207 unset($_SESSION[
"last_poll_edit"]);
211 echo
"<tr class='line{$rowc} $edited'>";
213 echo
"<td class=''>{$poll->ID}</td>";
215 echo
"<td class='table_colored_col{$rowc}'> <a href='edit.php?pollID={$poll->ID}' style='color:black;text-decoration:none;' title='Bearbeiten' id='poll{$poll->ID}'> {$poll->name} </a> </td>";
217 echo
"<td><div class='status_indicator_container'>";
218 echo
"<span class='{$color_class} status_indicator' id='status_indicator_pID{$poll->ID}'>$status_string</span>";
219 echo
"<ul class='status_submenu'>";
221 echo
"<li class='{$status_mapping[$stat]["css
"]}' id='status_button_pID{$poll->ID}_sID{$stat}'>{$status_mapping[$stat]["name"]}</li>";
226 echo
"<td>$timeout</td>";
229 echo
"<td>{$poll->owner_fn}</td>";
232 echo
"<td style='vertical-align:top;width:130px' >";
234 echo
"<a href='edit.php?pollID={$poll->ID}' title='Bearbeiten'><img src='".APP_ROOT.
"/icons/22/preferences-system.png' alt='edit'/></a>";
236 echo
"<a href='action.poll.php?pollID={$poll->ID}&action=duplicate' title='Kopieren'><img src='".APP_ROOT.
"/icons/22/edit-copy.png' alt='duplicate'/></a>";
238 echo
"<a href='action.poll.php?pollID={$poll->ID}&action=rm' title='Löschen'><img src='".APP_ROOT.
"/icons/22/edit-delete.png' alt='delete'/></a>";
240 echo
"<span style='margin-left:7px'> </span>";
241 echo
"<a href='action.poll.php?pollID={$poll->ID}&action=set_template' title='Als Vorlage kopieren'><img src='".APP_ROOT.
"/icons/22/edit-paste.png' alt='set_template'/></a>";
243 echo
"<a href='action.poll.php?pollID={$poll->ID}&action=archive' title='Archivieren'><img src='".APP_ROOT.
"/icons/22/package-x-generic.png' alt='archive'/></a>";
256 echo
"<h2><a id='umfrage_hinzufügen'>Neue Umfrage hinzufügen</a></h2>";
257 echo
"<form action='action.poll.php' method='POST'>";
260 echo
"<label for='poll_name'>Bitte gebe der neuen Umfrage einen Namen: </label>";
261 echo
"<input type='text' name='poll_name' id='poll_name' size='50'/> <br/><br/>";
265 echo
"<fieldset id='optional_new_poll' style='max-width:15em;'>";
266 echo
"<legend style='color:#5E5E5E'>Optionale Angaben</legend>";
267 echo
"<input style='margin-left:0em' type='checkbox' name='poll_anonymous' id='poll_anonymous' value='true'/>
268 <label for='poll_anonymous'>Anonyme Umfrage</label><br/>";
269 echo
"<input style='margin-left:0em' type='checkbox' name='poll_public' id='poll_public' value='true'/>
270 <label for='poll_public'>Öffentliche Umfrage</label><br/>";
273 echo
"<br/><input type='submit' name='add_poll' value='Hinzufügen'/> ";
276 echo
"<h2><a id='umfrage_import'>Umfrage importieren</a></h2>";
277 echo
'<form enctype="multipart/form-data" action="action.poll.php?action=import_XML_poll" method="POST" style="margin-top:.5em">';
278 echo
"<span style=''>Datei hochladen: </span>";
279 echo
'<input name="pollxmlfile" type="file" />';
280 echo
'<input type="submit" value="hochladen" />';
286 }
else if(
$page ==
"templates" ){
289 echo
"<h2> <img src='".APP_ROOT.
"/icons/32/edit-paste.png' style='vertical-align:middle' alt=''/> Private Vorlagen</h2>";
291 echo
"<table class='backend_poll_table'>";
292 echo
"<tr class='table_header'> <th>ID</th> <th>Name</th> <th>edit</th> </tr>";
297 if( (isset($_SESSION[
"last_poll_edit"])) AND ($_SESSION[
"last_poll_edit"] == $template->ID) ){
298 $edited =
"poll_last_edit";
299 unset($_SESSION[
"last_poll_edit"]);
302 echo
"<tr class='line$r $edited'>";
303 echo
"<td>{$template->ID}</td>";
305 echo
"<td><a id='poll{$template->ID}' href='edit.php?pollID={$template->ID}' style='color:black;text-decoration:none;' >{$template->name}</a></td>";
308 echo
"<a href='edit.php?pollID={$template->ID}' title='Bearbeiten' ><img src='".APP_ROOT.
"/icons/22/preferences-system.png' alt='edit'/></a>";
310 echo
"<a href='action.poll.php?pollID={$template->ID}&action=duplicate' title='Kopieren' ><img src='".APP_ROOT.
"/icons/22/edit-copy.png' alt='duplicate'/></a>";
312 echo
"<a href='action.poll.php?pollID={$template->ID}&action=rm' title='Löschen' ><img src='".APP_ROOT.
"/icons/22/edit-delete.png' alt='delete'/></a>";
314 echo
"<span style='margin-left:7px'> </span>";
315 echo
"<a href='action.poll.php?pollID={$template->ID}&action=archive' title='Archivieren'><img src='".APP_ROOT.
"/icons/22/package-x-generic.png' alt='archive'/></a>";
317 echo
"<a href='action.poll.php?pollID={$template->ID}&action=share' title='Vorlage teilen'><img src='".APP_ROOT.
"/icons/22/share-template.png' alt='share'/></a>";
325 echo
"<p>Keine Vorlagen</p>";
329 echo
"<h2> <img src='".APP_ROOT.
"/icons/32/share-template.png' style='vertical-align:middle' alt=''/> Geteilte Vorlagen</h2>";
332 $map =
$au->get_gid_to_name_mapping();
335 echo
"<table class='backend_poll_table'>";
336 echo
"<tr class='table_header'> <th>ID</th> <th>Name</th> <th>geteilt mit</th> <th>edit</th> </tr>";
339 if( $template->owner == $_SESSION[
"user"]->ID ){
340 if( in_array(
"*",$template->groups) ){
341 $shared_with =
"Alle";
344 foreach( $template->groups as $gr ){
345 if( isset( $map[$gr] ) ){
346 $shared_with = $shared_with.
"{$map[$gr]}, ";
349 $shared_with =trim($shared_with,
", ");
353 if( (isset($_SESSION[
"last_poll_edit"])) AND ($_SESSION[
"last_poll_edit"] == $template->ID) ){
354 $edited =
"poll_last_edit";
355 unset($_SESSION[
"last_poll_edit"]);
359 echo
"<tr class='line$r $edited'>";
360 echo
"<td>{$template->ID}</td>";
361 echo
"<td><a id='poll{$template->ID}' href='edit.php?pollID={$template->ID}' style='color:black;text-decoration:none;' >{$template->name}</a></td>";
362 echo
"<td>$shared_with</td>";
365 echo
"<a href='edit.php?pollID={$template->ID}' title='Bearbeiten' ><img src='".APP_ROOT.
"/icons/22/preferences-system.png' alt='edit'/></a>";
367 echo
"<a href='action.poll.php?pollID={$template->ID}&action=duplicate' title='Kopieren' ><img src='".APP_ROOT.
"/icons/22/edit-copy.png' alt='duplicate'/></a>";
369 echo
"<a href='action.poll.php?pollID={$template->ID}&action=unshare' title='nicht mehr teilen' ><img src='".APP_ROOT.
"/icons/22/share-template-delete.png' alt='unshare'/></a>";
380 echo
"<p>Keine Vorlagen</p>";
384 echo
"<h2> <img src='".APP_ROOT.
"/icons/32/share-template.png' style='vertical-align:middle' alt=''/> Vorlagen, die andere teilen</h2>";
386 echo
"<table class='backend_poll_table'>";
387 echo
"<tr class='table_header'> <th>ID</th> <th>Name</th> <th>von</th> <th>edit</th> </tr>";
390 if( $template->owner != $_SESSION[
"user"]->ID ){
393 if( (isset($_SESSION[
"last_poll_edit"])) AND ($_SESSION[
"last_poll_edit"] == $template->ID) ){
394 $edited =
"poll_last_edit";
395 unset($_SESSION[
"last_poll_edit"]);
398 echo
"<tr class='line$r $edited'>";
399 echo
"<td>{$template->ID}</td>";
401 echo
"<td><a id='poll{$template->ID}' href='edit.php?pollID={$template->ID}' style='color:black;text-decoration:none;' >{$template->name}</a></td>";
403 echo
"<td>{$template->name}</td>";
405 echo
"<td>{$template->owner_fn}</td>";
409 echo
"<a href='edit.php?pollID={$template->ID}' title='Bearbeiten' ><img src='".APP_ROOT.
"/icons/22/preferences-system.png' alt='edit'/></a>";
412 echo
"<a href='action.poll.php?pollID={$template->ID}&action=duplicate' title='Kopieren' ><img src='".APP_ROOT.
"/icons/22/edit-copy.png' alt='duplicate'/></a>";
415 echo
"<a href='action.poll.php?pollID={$template->ID}&action=rm' title='Löschen' ><img src='".APP_ROOT.
"/icons/22/edit-delete.png' alt='delete'/></a>";
426 echo
"<p>Keine Vorlagen</p>";
431 }
else if(
$page ==
"archive"){
432 echo
"<h2>Archivierte Umfragen</h2>";
434 echo
"<table class='backend_poll_table'>";
435 echo
"<tr class='table_header'> <th>ID</th> <th>Name</th> <th>edit</th> </tr>";
440 if( (isset($_SESSION[
"last_poll_edit"])) AND ($_SESSION[
"last_poll_edit"] == $poll->ID) ){
441 $edited =
"poll_last_edit";
442 unset($_SESSION[
"last_poll_edit"]);
445 echo
"<tr class='line$r $edited'>";
446 echo
"<td>{$poll->ID}</td>";
447 echo
"<td><a id='poll{$poll->ID}'>{$poll->name}</a></td>";
450 echo
"<a href='edit.php?pollID={$poll->ID}' title='Bearbeiten' ><img src='".APP_ROOT.
"/icons/22/preferences-system.png' alt='edit'/></a>";
452 echo
"<a href='action.poll.php?pollID={$poll->ID}&action=rm' title='Löschen' ><img src='".APP_ROOT.
"/icons/22/edit-delete.png' alt='delete'/></a>";
454 echo
"<a href='action.poll.php?pollID={$poll->ID}&action=duplicate' title='Kopieren' ><img src='".APP_ROOT.
"/icons/22/edit-copy.png' alt='duplicate'/></a>";
456 echo
"<a href='action.poll.php?pollID={$poll->ID}&action=unarchive' title='Wiederherstellen' ><img src='".APP_ROOT.
"/icons/22/extract-archive.png' alt='unarchive'/></a>";
463 echo
"<p>Keine archivierten Umfragen</p>";