Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

stats.php
Go to the documentation of this file.
1 <?php
4 // include_once( "classes/INIFile.php" );
5 // include_once( "classes/eztemplate.php" );
6 // include_once( "ezsurvey/classes/ezsurvey.php" );
7 // include_once( "ezsurvey/classes/ezquestion.php" );
8
9 $ini =& eZINI::instance( 'site.ini' );
10 $Language = $ini->variable( "eZSurveyMain", "Language" );
11
12
13 $SurveyID = $url_array[3];
14 $Page = $url_array[4];
15
16 $t = new eZTemplate( "kernel/ezsurvey/admin/" . $ini->variable( "eZSurveyMain", "AdminTemplateDir" ),
17 "kernel/ezsurvey/admin/intl", $Language, "stats.php" );
18
19 $t->set_file( "stats_tpl", "stats.tpl" );
20 $t->setAllStrings();
21
22 $t->set_block( "stats_tpl", "value_list_tpl", "value_list" );
23
24 $t->set_block( "value_list_tpl", "question_tpl", "question" );
25 $t->set_block( "question_tpl", "question_item_tpl", "question_item" );
26
27 $t->set_block( "stats_tpl", "next_page_button_tpl", "next_page_button" );
28 $t->set_block( "stats_tpl", "previous_page_button_tpl", "previous_page_button" );
29
30 $t->set_var( "survey_id", $SurveyID );
31 $t->set_var( "value_list", "" );
32
33 if ( $Page == "" )
34 {
35 $Page = 1;
36 }
37
38 if ( isset( $OK ) )
39 {
40 eZHTTPTool::header( "Location: /survey/surveyedit/edit/$SurveyID" );
41 exit();
42 }
43
44 if ( isset( $NextPage ) )
45 {
46 $Page++;
47 }
48 if ( isset( $PreviousPage ) )
49 {
50 $Page--;
51 }
52
53 $survey = new eZSurvey( $SurveyID );
54
55 $t->set_var( "title", $survey->title() );
56
57 $totalPages = $survey->numberOfPages();
58 $t->set_var( "page_number", $Page );
59 $t->set_var( "page_total", $totalPages );
60
61 $question_array = $survey->surveyQuestions( "Position", $Page );
62
63 $position = 0;
64 foreach ( $question_array as $questionItem )
65 {
66 if ( $questionItem->hasStats() )
67 {
68 // limpar as vari�veis
69 $t->set_var( "question", "" );
70
71 $t->set_var( "id", $position++ );
72 $t->set_var( "question_name", $questionItem->content() );
73
74 if ( $questionItem->hasChoices() )
75 {
76 $questionChoice_array = $questionItem->questionChoices();
77 }
78
79 $i = 0;
80
81 $stats = $questionItem->stats();
82
83 $clear = false;
84 for ( $i = 0; $i < count($stats[0]); $i++ )
85 {
86 $t->set_var( "choice_name", $stats[1][$i] );
87 $perc = $stats[3][$i];
88 $t->set_var( "choice_perc", round($perc, 2) );
89 $t->set_var( "choice_left", (100 - $perc) );
90 $t->set_var( "choice_total", round($stats[2][$i], 2) );
91 $t->parse( "question_item", "question_item_tpl", $clear );
92 $clear = true;
93 }
94
95 $t->parse( "question", "question_tpl", true );
96 $t->parse( "value_list", "value_list_tpl", true );
97 }
98 }
99
100 // Next page button
101 if ( $Page < $totalPages )
102 $t->parse( "next_page_button", "next_page_button_tpl" );
103 else
104 $t->set_var( "next_page_button", "" );
105
106 // Previous page button
107 if ( $Page > 1 )
108 $t->parse( "previous_page_button", "previous_page_button_tpl" );
109 else
110 $t->set_var( "previous_page_button", "" );
111
112 $t->pparse( "output", "stats_tpl" );
113
114 ?>
$i
$i
Definition: admin/adlist.php:91
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZSurvey
Definition: ezsurvey.php:8
eZTemplate
Definition: eztemplate.php:107
$url_array
$url_array
Definition: ezaddress/admin/datasupplier.php:34
exit
exit
Definition: folder.php:81
$t
$t
Definition: stats.php:16
$position
$position
Definition: stats.php:63
$Language
$Language
Definition: stats.php:10
$ini
$ini
Definition: stats.php:9
$totalPages
$totalPages
Definition: stats.php:57
$Page
$Page
Definition: stats.php:14
$question_array
$question_array
Definition: stats.php:61
$survey
if( $Page=="") if(isset( $OK)) if(isset( $NextPage)) if(isset( $PreviousPage)) $survey
Definition: stats.php:53
$SurveyID
$SurveyID
Definition: stats.php:13
$questionChoice_array
$questionChoice_array
Definition: values.php:69
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.