Umfragen
test3.php
Go to the documentation of this file.
1 <?php
2 /*
3  * test3.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 require_once("config.php");
25 require_once("inc/db.class.php");
26 require_once("inc/auth.class.php");
27 require_once("inc/poll.class.php");
28 require_once("inc/html.class.php");
29 require_once("inc/user.class.php");
30 
31 // SESSION
32 if( !(isset($_SESSION)) ){
33  session_start();
34 }
35 
36 //require_once("inc/html.class.php");
37 $db= new db( DB_USER, DB_PASS, DB_DATABASE, DB_HOST );
38 //$au = new LDAPauth(LDAP_HOST , LDAP_PORT , LDAP_ROOTDN);
40 
41 //$poll = new poll();
42 //$poll->load_from_id($db,162);
43 
44 //$db->export_to_csv($poll,';','"');
45 
46 if (isset($_POST["send"])){
47  echo "<pre>";
48  var_dump($_POST);
49  //var_dump($_POST["txt1"]);
50  //var_dump($_POST["txt2"]);
51  echo "</pre>";
52 }
53 
54 if( isset($_GET["ID"]) AND ($_GET["ID"] != "" ) ){
55  $pollId = intval($_GET["ID"]);
56 }else{
57  die();
58 }
59 $poll = new poll();
60 $poll->load_from_id($db,$pollId);
61 
62 // BEGIN HTML
64 HTML::head();
65 HTML::menu();
66 
67 $count = $db->extended_result_count($poll);
68 
69 echo "<table class='table_3'>";
70 foreach($poll->widget_list as $widget){
71  echo "<tr>";
72  if( $widget instanceof container ){
73  echo "<td colspan='2'>{$widget->dispName}";
74  echo "<table class='table_3' >";
75  foreach($widget->option_list as $opt){
76  echo "<tr>";
77  echo "<td>{$opt->value}</td>";
78  echo "<td>{$count[$opt->ID]}</td>";
79  echo "</tr>";
80  }
81  echo "</table></td>";
82  }else{
83  if( $widget instanceof checkBoxSingle ){
84  $f = $widget->get_config("false");
85  $t = $widget->get_config("true");
86  $i = "{$widget->ID}_true";
87  $i2 = "{$widget->ID}_false";
88 
89  echo "<td>{$widget->dispName} $t <br/> {$widget->dispName} $f</td>";
90  echo "<td>{$count[ $i ]} <br/> {$count[ $i2 ]}</td>";
91  }else{
92  echo "<td>{$widget->dispName}</td>";
93  echo "<td>{$count[ $widget->ID ]}</td>";
94  }
95  }
96  echo "</tr>";
97 }
98 echo "</table>";
99 
100 HTML::foot();
101 
102 
103 ?>