Umfragen
edit.poll.php
Go to the documentation of this file.
1 <?php
2 /*
3  * edit.poll.php
4  *
5  * Copyright 2012 Johannes <jojo@jojo-42>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20  * MA 02110-1301, USA.
21  *
22  *
23  */
24 
25 require_once("../config.php");
26 require_once("../inc/auth.class.php");
27 require_once("../inc/messages.class.php");
28 //$au = new LDAPauth(LDAP_HOST , LDAP_PORT , LDAP_ROOTDN);
30 
31 // incomplete message
32 $comp = $poll->check_setup_complete(true);
33 if(sizeof($comp)>0){
34  $txt = "Umfrage inaktiv, da die Umfrageeinstellungen nicht vollständig sind. Noch Fehlende elemente:";
35  $desc = array("name"=>"Umfragename festlegen" , "groups"=>"Klassenbeschränkung der Umfrage" , "timeout"=>"Datum der automatischen Deaktivierung" , "widget_list" => "Bitte eine Frage angeben.");
36  $txt = $txt."<ul> ";
37  foreach($comp as $e){
38  $txt = $txt."<li>{$desc[$e]}</li>";
39  }
40  $txt = $txt."</ul>";
41 
42  $messages->add_message( new warningMessage($txt) );
43 }
44 
45 $messages->display_messages();
46 $messages->del_all_messages();
47 
48 
49 /*
50  *
51  * FRAGEN
52  *
53  * */
54 echo "<h2>Fragen <span style='font-size:60%'>(<a href='../page.php?preview={$poll->ID}' target='new_window'>Vorschau</a>)</span></h2>";
55 // display widgets
56 if( sizeof($poll->widget_list) > 0){
57  echo "<div style='margin:0px;padding:0px' id='widget_list'>";
58  foreach($poll->widget_list as $wid){
59  if(method_exists($wid,"display_edit")){
60  $wid->display_edit();
61  }
62  }
63  echo "</div>";
64  echo "<p style='margin-top:2em;'>Die Felder, die mit <span class='required_asterisk'>*</span> markiert sind, sind Plichtfelder.</p>";
65 }else{
66  echo "<p style='margin-left:2em'>Es sind noch keine Fragen hinzugefügt worden</p>";
67 }
68 
69 /*
70  *
71  * FRAGEN HINZUFÜGEN
72  *
73  * */
74 echo "<hr/>";
75 echo "<div>";
76  echo "<span style='font-size:120%;font-weight:bold'>Frage hinzufügen: </span>";
77  echo "<form action='action.widget.php' method='POST' style='display:inline'>";
78 
79  echo "<select size='1' name='widget_typ'>";
80  echo "<option value='none' >
81  Bitte Fragetyp auswählen
82  </option> ";
83 
84  echo "<option value='label' >
85  Textabsatz anzeigen
86  </option> ";
87 
88  echo "<option value='line' >
89  Trennung anzeigen
90  </option> ";
91 
92  echo "<option value='text' >
93  Kurzen Text abfragen
94  </option> ";
95 
96  echo "<option value='textExt' >
97  Erweiterte Textabfrage
98  </option> ";
99 
100  echo "<option value='longtext' >
101  Langen Text abfragen
102  </option> ";
103 
104  echo "<option value='radioButtonList' >
105  Aus einer Liste wählen
106  </option> ";
107 
108  echo "<option value='matrix' >
109  Matrix
110  </option> ";
111 
112  echo "<option value='schedule' >
113  Termin festlegen
114  </option> ";
115 
116  echo "<option value='checkBoxList' >
117  Aus einer Liste Ankreuzen
118  </option> ";
119 
120  echo "<option value='checkBoxSingle' >
121  Ankreuzen
122  </option> ";
123 
124 
125 
126 
127  echo "</select>";
128 
129  echo "<input type='hidden' name='pollID' value='{$poll->ID}'/>";
130  echo "<input type='submit' name='add_widget' value='&nbsp;&nbsp;&nbsp; hinzufügen' id='add_widget_button'/>";
131  echo "</form>";
132  echo '<form enctype="multipart/form-data" action="action.widget.php?pollID='.$poll->ID.'&amp;action=import_XML_widget" method="POST" style="margin-top:.5em">';
133  echo "<span style=''>Oder Datei hochladen: </span>";
134  echo '<input name="pollxmlfile" type="file" />';
135  echo '<input type="submit" value="hochladen" />';
136  echo '</form>';
137 
138 echo "</div>";
139 
140 
141 
142 /*
143  *
144  * SETTINGS
145  *
146  * */
147 echo "</div><div class='content'>";
148 
150 echo "<h2><a id='poll_settings' >Einstellungen</a></h2>";
151 echo "<form action='edit.handle.php' method='POST' id='edit_poll_form'>";
152 
153 echo "<table class='pollsettings_table'>";
154 
155 // EDIT name
156 echo "<tr class='line".$conf_index%2 ."'>";
157  echo "<td style='' class='pollsettings_optionname'>Name der Umfrage:</td>";
158  echo "<td style='' class='pollsettings_settings'>";
159  $poll->display_name_edit();
160  echo "</td>";
161  echo "<td class='pollsettings_desc'>Maximal 256 Zeichen.</td>";
162  ++$conf_index;
163 echo "</tr>";
164 
165 // EDIT GROUPS
166 echo "<tr class='line".$conf_index%2 ."' >";
167  echo "<td style='' class='pollsettings_optionname' >Auf Klassen beschränken:</td>";
168  echo "<td style='' class='pollsettings_settings'>";
169  $poll->display_groups_edit($au,$groups_whitelist);
170  echo "<span style='font-size:80%;margin-left:1.5em'>(Mehrfachauswahl)</span>";
171  echo "</td>";
172  echo "<td class='pollsettings_desc'>Beschränkt das Teilnehmen an dieser Umfrage auf bestimmte Klassen. <br/>Bei geteilten Vorlagen gilt die Klassenbeschränkung als Kopierkontrolle.</td>";
173  ++$conf_index;
174 echo "</tr>";
175 
176 // EDIT TIMEOUT
177 echo "<tr class='line".$conf_index%2 ."' >";
178  echo "<td style='' class='pollsettings_optionname'>Automatische Deaktivierung:</td>";
179  echo "<td style='min-width:20em;' class='pollsettings_settings'>";
180  $poll->display_timeout_edit();
181  echo "</td>";
182  echo "<td class='pollsettings_desc'>Nach dem Ablaufen des hier angegebenen Datum, ist die Umfrage nicht mehr für die Teilnehmer verfügbar.</td>";
183  ++$conf_index;
184 echo "</tr>";
185 
186 // EDIT STATUS
187 echo "<tr class='line".$conf_index%2 ."' >";
188  echo "<td style='' class='pollsettings_optionname'>Status:</td>";
189  echo "<td style='' class='pollsettings_settings'>";
190  $poll->display_status_edit();
191  echo "</td>";
192  echo "<td class='pollsettings_desc'>Unvollständig bedeutet, dass noch informationen und Einstellungen fehlen. </td>";
193  ++$conf_index;
194 echo "</tr>";
195 
196 // PUBLIC LINK
197 if( $poll->is_public === true ){
198  echo "<tr class='line".$conf_index%2 ."' >";
199  echo "<td style='' class='pollsettings_optionname'>Veröffentlichung:</td>";
200  echo "<td style='' class='pollsettings_settings' colspan='2'>";
201  if( defined('APP_ROOT_URL') ){
202  $url = APP_ROOT_URL."/public.php?h={$poll->hashID}";
203  echo "Link: <a href='$url' style='font-size:90%;'>$url</a> <br/>";
204  echo "<div style='margin:3px 0px 0px 0px;padding:0px;'>IFrame um in eine andere Seite einzubetten:</div>";
205  echo "<pre style='max-width:500px; overflow-x:scroll;padding:2px;margin:4px;background-color:#F5F5F5;border-bottom:2px solid white;border-right:2px solid white;border-top:2px solid black;border-left:2px solid black' > &lt;iframe src=\"".APP_ROOT_URL."/embed.php?h={$poll->hashID}\" width=\"400\" height=\"300\" &gt; &lt;/iframe &gt; </pre>";
206  }else{
207  echo "fehlkonfiguration. Link nicht verfügbar.";
208  }
209  echo "</td>";
210  ++$conf_index;
211  echo "</tr>";
212 }
213 
214 echo "</table>";
215 
216 echo "<script type='text/javascript'>";
217 echo "document.write('<hr style=\"margin-bottom:0px;color:#686868;background-color:#686868;height:1px\"/>');";
218 echo "document.write('<a href=\"#poll_settings\" id=\"pollsettings_advanced_showlink\"><img src=\"".APP_ROOT."/icons/16/go-down.png\" alt=\"\"/>Erweiterte Einstellungen</a>');";
219 echo "</script>";
220 
221 
222 echo "<table class='pollsettings_table' id='pollsettings_advanced'>";
223 echo "<tr class='line".$conf_index%2 ."' >";
224  echo "<td style='' class='pollsettings_optionname'>Aussehen:</td>";
225  echo "<td style='' class='pollsettings_settings'>";
226  echo "<div style='margin:0px;padding:4px'>Schrift:";
227  $poll->display_font_family_edit();
228  $poll->display_font_size_edit();
229  echo "</div>";
230 
231  echo "<div style='margin:0px;padding:4px'>";
232  echo "Thema:";
233  $poll->display_theme_edit();
234  echo "</div>";
235 
236  echo "<div style='margin:0px;padding:4px'>";
237  $poll->display_questions_bold_edit();
238  echo "</div>";
239 
240  echo "<div style='margin:0px;padding:4px'>";
241  $poll->display_noDisplay_edit();
242  echo "</div>";
243 
244  echo "</td>";
245  echo "<td class='pollsettings_desc'>Das Aussehen der Umfrage ändern. Schriftart und Größe, Thema, Fragen hervorheben.
246  Umfragen können auch auf der Hauptseite <i style='color:#5B0000'>unsichtbar</i> sein, aber dennoch durch einen Link erreichbar (aktiv).</td>";
247  ++$conf_index;
248 echo "</tr>";
249 
250 // ANONYMOUS
251 echo "<tr class='line".$conf_index%2 ."' >";
252  echo "<td style='' class='pollsettings_optionname'>Anonymität: </td>";
253  echo "<td style='' class='pollsettings_settings'>";
254  $poll->display_anonymous2_edit();
255  echo "</td>";
256  echo "<td class='pollsettings_desc'>
257  <i style='color:#5B0000'>Nicht anonym:</i> Die Antworten werden mit den Benutzerdaten (Name etc.) gespeichert.
258  <br/><i style='color:#5B0000'>Anonym:</i> Es werden keine Benutzerdaten gespeichert.
259  <br/><i style='color:#5B0000'>Öffendlich:</i> es ist zusätzlich zu \"Anonym\" keine Anmeldung erforderlich um an der Umfrage teilzunehmen.
260  </td> ";
261  ++$conf_index;
262 echo "</tr>";
263 
264 // POLLTYPE
265 echo "<tr class='line".$conf_index%2 ."' >";
266  echo "<td style='' class='pollsettings_optionname'>Modus:</td>";
267  echo "<td style='' class='pollsettings_settings'>";
268  if( $poll->type == POLLTYPE_ADVANCED ){
269  echo "erweiterter Modus";
270  echo "<br/>auf einfachern Modus <a href='action.poll.php?pollID={$poll->ID}&amp;action=toggle_polltype'>umschalten</a>";
271  }else if( $poll->type == POLLTYPE_SIMPLE ){
272  echo "Auf erweiterten Modus <a href='action.poll.php?pollID={$poll->ID}&amp;action=toggle_polltype'>umschalten</a>";
273  }
274  echo "</td>";
275  echo "<td class='pollsettings_desc' >Der erweiterte Modus bietet weitere Einstellmötglichkeiten für die Datenbank. Erfahrung mit Datenbanken empfohlen.</td>";
276  ++$conf_index;
277 echo "</tr>";
278 
279 
280 // EXPORT XML
281 echo "<tr class='line".$conf_index%2 ."' >";
282  echo "<td style='' class='pollsettings_optionname'>Export: </td>";
283  echo "<td style='' class='pollsettings_settings'>";
284  echo "Umfrage nach XML <a href='action.poll.php?pollID={$poll->ID}&amp;action=export_XML_poll'>exportieren</a>";
285  echo "</td>";
286  echo "<td class='pollsettings_desc'>Umfrage ohne Eregebnisse exportieren</td> ";
287  ++$conf_index;
288 echo "</tr>";
289 
290 
291 
292 // EMAIL
293 $teachers = explode(",",TEACHER_GROUP);
294 if( in_array("{$_SESSION["user"]->group}",$teachers) ){
295  echo "<tr class='line".$conf_index%2 ."' >";
296  echo "<td style='' class='pollsettings_optionname'>Rundmail:</td>";
297  echo "<td style='' class='pollsettings_settings'>";
298  echo "Email an alle Lehrer <a href='email.php?pollID={$poll->ID}'>versenden</a>.";
299  echo "</td>";
300  echo "<td class='pollsettings_desc'>Funktion steht nur Lehrern zur Verfügung.</td>";
301  ++$conf_index;
302  echo "</tr>";
303 }
304 echo "<tr class='line".$conf_index%2 ."' >";
305  echo "<td style='' class='pollsettings_optionname'>Rundmail:</td>";
306  echo "<td style='' class='pollsettings_settings'>";
307  $poll->display_notification_edit();
308  echo "</td>";
309  echo "<td class='pollsettings_desc'>Es wird bei den ausgewählten Ereignissen eine Email an die im <a href='profile.php'>Profil</a> hinterlegte E-Mail Adresse versendet.</td>";
310 ++$conf_index;
311 echo "</tr>";
312 
313 if( $poll->is_public === true ){
314  echo "<tr class='line".$conf_index%2 ."' >";
315  echo "<td style='' class='pollsettings_optionname'>Link:</td>";
316  echo "<td style='' class='pollsettings_settings'>";
317  echo "Link <a href='action.poll.php?pollID={$poll->ID}&amp;action=regenerate_link'>regenerieren</a>";
318  echo "</td>";
319  echo "<td class='pollsettings_desc'>Erstellt einen neuen Link bei öffentlichen Umfragen. <i style='color:#5B0000'>Achtung! dies deaktiviert unwiederruflich alle andenen bereits geteilten Links</i></td>";
320  ++$conf_index;
321  echo "</tr>";
322 }
323 
324 echo "</table>";
325 echo "<script tyle='text/javascript'>";
326 echo '$("#pollsettings_advanced").ready( function(){$("#pollsettings_advanced").toggle("blind",100);});';
327 echo "</script>";
328 // EDIT SAVE
329 echo "<p style='font-weight:bold;margin:7px 0px 2px 0px ;font-size:110%'>Einstellungen Speichern</p>";
330 
331 echo "<div class='form_save_container' style='width:25em;margin-left:0px;margin-top:.5em'>";
332 echo " <input type='hidden' name='pollID' value='{$poll->ID}'/>
333  <input type='submit' name='save_poll' value='Speichern'/> &nbsp;
334  <input type='submit' name='apply_poll' value='Übernehmen'/> &nbsp;
335  <input type='reset' value='Zurücksetzen'/>";
336 echo "</div>";
337 /*
338 echo " <input type='hidden' name='pollID' value='{$poll->ID}'/>";
339 echo " <input type='submit' name='save_poll' value='Speichern'/>";
340 echo " <input type='reset' value='Zurücksetzen'/>";
341 **/
342 echo "</form>";
343 
344 
345 
346 /*
347  *
348  * RESULTS
349  *
350  * */
351 echo "<h2 style='margin-top:1.5em'>Ergebnisse</h2>";
352 
353 echo "<table id='linkbox_poll_edit'>";
354  echo "<tr>";
355  echo "<td><a href='results.show.php?pollID={$poll->ID}&amp;view_charts'>";
356  echo "<img src='".APP_ROOT."/icons/48/x-office-presentation.png' alt=''/>";
357  echo "</a> </td>";
358  echo "<td style='vertical-align:middle;font-size:1.2em;padding-right:2em;'>";
359  echo "<a href='results.show.php?pollID={$poll->ID}&amp;view_charts' style=''>Diagramme ansehen</a>";
360  echo "</td>";
361  echo "<td><a href='results.show.php?pollID={$poll->ID}&amp;view_count'>";
362  echo "<img src='".APP_ROOT."/icons/48/x-office-presentation.png' alt=''/>";
363  echo "</a> </td>";
364  echo "<td style='vertical-align:middle;font-size:1.2em;padding-right:2em;'>";
365  echo "<a href='results.show.php?pollID={$poll->ID}&amp;view_count' style=''>Zahlenlisten</a>";
366  echo "</td>";
367  echo "</tr>";
368 
369  echo "<tr>";
370  echo "<td><a href='results.show.php?pollID={$poll->ID}&amp;view_html'>";
371  echo "<img src='".APP_ROOT."/icons/48/x-office-spreadsheet.png' alt=''/>";
372  echo "</a> </td>";
373  echo "<td style='vertical-align:middle;font-size:1.2em;padding-right:2em;'>";
374  echo "<a href='results.show.php?pollID={$poll->ID}&amp;view_html' style=''>In einer Tabelle ansehen</a>";
375  echo "</td>";
376  echo "<td><a href='results.show.php?pollID={$poll->ID}&amp;edit_html'>";
377  echo "<img src='".APP_ROOT."/icons/48/x-office-spreadsheet.png' alt=''/>";
378  echo "</a> </td>";
379  echo "<td style='vertical-align:middle;font-size:1.2em;padding-right:2em;'>";
380  echo "<a href='results.show.php?pollID={$poll->ID}&amp;edit_html' style=''>In einer Tabelle ansehen und <b>löschen</b></a>";
381  echo "</td>";
382  echo "</tr>";
383 
384 
385 echo "</table>";
386 echo "<br/>";
387 
388 // EXPORT
389 echo "<h3><img src='".APP_ROOT."/icons/32/libreoffice-oasis-spreadsheet.png' style='vertical-align:middle' alt=''/>CSV Export (Excel)</h3>";
390 echo "<form action='results.show.php' method='GET'>";
391 echo "<fieldset style='max-width:450px'>";
392 echo "<legend style='font-size:80%'>Optionale CSV Einstellungen</legend>";
393 $poll->display_export_edit();
394 echo "</fieldset>";
395 echo "<input type='hidden' name='pollID' value='{$poll->ID}'/>";
396 echo "<br/><input type='submit' name='dl_csv' value='Herunterladen'/>";
397 echo "<input type='submit' name='view_csv' value='Anzeigen'/>";
398 echo "</form>";
399 
400 ?>