Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

values.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/ezquestion.php" );
7 // include_once( "ezsurvey/classes/ezquestionchoice.php" );
8
9 $ini =& eZINI::instance( 'site.ini' );
10 $Language = $ini->variable( "eZSurveyMain", "Language" );
11
12 $t = new eZTemplate( "kernel/ezsurvey/admin/" . $ini->variable( "eZSurveyMain", "AdminTemplateDir" ),
13 "kernel/ezsurvey/admin/intl", $Language, "values.php" );
14
15
16 $SurveyID = $url_array[3];
17 $QuestionID = $url_array[4];
18
19 $t->set_file( "values_tpl", "values.tpl" );
20 $t->setAllStrings();
21
22 $t->set_block( "values_tpl", "value_list_tpl", "value_list" );
23 $t->set_block( "value_list_tpl", "value_item_tpl", "value_item" );
24
25 $t->set_var( "value_list", "" );
26 $t->set_var( "survey_id", $SurveyID );
27 $t->set_var( "question_id", $QuestionID );
28
29 $question = new eZQuestion( $QuestionID );
30
31 // altera��o das op��es
32 $i = 0;
33 if ( isset($ValueID) )
34 {
35 foreach ($ValueID as $valueItem )
36 {
37 $questionChoice = new eZQuestionChoice( $valueItem );
38 // trata da elimina��o caso tenha sido pedida
39 if ( isset($ValueDeleteID) && in_array($valueItem, $ValueDeleteID) )
40 {
41 $questionChoice->delete();
42 }
43 else
44 {
45 $questionChoice->setContent( $Value[$i] );
46 $questionChoice->store();
47 }
48 $i++;
49 }
50 }
51
52 if( isset( $OK ) )
53 {
54 eZHTTPTool::header( "Location: /survey/surveyedit/edit/$SurveyID" );
55 exit();
56 }
57
58 // adiciona op��o
59 if ( isset( $AddValue ) )
60 {
61 $questionChoice = new eZQuestionChoice();
62 $questionChoice->setQuestionID( $QuestionID );
63 $questionChoice->setContent( "Choice " . ($question->numberOfQuestionsChoices()+1) );
64 $questionChoice->store();
65 }
66
67 // lista op��es
68 $i = 0;
69 $questionChoice_array = $question->questionChoices();
70 foreach ( $questionChoice_array as $questionItem )
71 {
72 if ($i++ % 2)
73 $t->set_var( "td_class", "bgdark" );
74 else
75 $t->set_var( "td_class", "bglight" );
76
77 $t->set_var( "value", $questionItem->content() );
78 $t->set_var( "value_id", $questionItem->id() );
79 $t->parse( "value_item", "value_item_tpl", true );
80 }
81
82 if ( count($questionChoice_array) > 0 )
83 {
84 $t->parse( "value_list", "value_list_tpl" );
85 }
86
87 $t->pparse( "output", "values_tpl" );
88
89 ?>
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZQuestion
Definition: ezquestion.php:11
eZTemplate
Definition: eztemplate.php:107
$url_array
$url_array
Definition: ezaddress/admin/datasupplier.php:34
eZQuestionChoice
Class eZQuestionChoice
Definition: ezquestionchoice.php:5
$Value
$Value
Definition: ezquestionchoice.php:118
exit
exit
Definition: folder.php:81
$questionChoice_array
$questionChoice_array
Definition: values.php:69
$t
$t
Definition: values.php:12
$QuestionID
$QuestionID
Definition: values.php:17
$Language
$Language
Definition: values.php:10
$ini
$ini
Definition: values.php:9
$question
$question
Definition: values.php:29
$i
$i
Definition: values.php:32
$SurveyID
$SurveyID
Definition: values.php:16
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.