Gentics Portal.Node PHP API
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
All
Classes
Namespaces
Functions
Variables
Pages
common
modules
vote
widgets
VoteWidget.php
1
<?php
2
3
/**
4
* This widget is union of PoolWidget and ResultWidget
5
* If you wanna that pool and reslults of pool placed on the same page it will be usefull to use this widget.
6
*
7
*
8
**/
9
class
VoteWidget
extends
CWidget
10
{
11
12
/**
13
* Unique question identification string
14
*
15
* @var string
16
**/
17
public
$id;
18
19
/**
20
* Id of author of the question
21
*
22
* @var string
23
**/
24
public
$author_id;
25
/**
26
* Question
27
*
28
* @var string
29
**/
30
public
$question;
31
32
/**
33
* Array of answers with options.
34
* Format: 'key1' => array(
35
* array(
36
* 'order' => 1, //optional
37
* 'text' => 'Yes I do',
38
* ),
39
* 'key2' => array(
40
* 'order' => 2, //optional
41
* 'text' => 'No I dont',
42
* )
43
* )
44
*
45
* @var array
46
**/
47
public
$answers;
48
49
/**
50
* If allowed to selectmultiply answers
51
*
52
* @var boolean
53
**/
54
public
$multiply =
false
;
55
56
/**
57
* If single-answer-selection: don’t display a “save”-button; save on click on answer
58
*
59
* @var boolean
60
**/
61
public
$dynamic;
62
63
/**
64
* Defines if anonymous answers can be given
65
*
66
* @var boolean
67
**/
68
public
$allowAnonymous;
69
70
/**
71
* Array of variables and values, that should be added to the form and saved with the given answer
72
*
73
* @var array
74
**/
75
public
$additionalFields = array();
76
77
/**
78
* Submit form via ajax
79
*
80
* @public string
81
**/
82
public
$ajax
;
83
84
/**
85
* If display statistics in percents
86
*
87
* @public bool
88
**/
89
public
$inPercents
=
false
;
90
91
/**
92
* Precision when display votes in percents
93
*
94
* @public string
95
**/
96
public
$precision
= 1;
97
98
/**
99
* If show results for user which havent vote(by checking session)
100
*
101
* @public boolean
102
**/
103
public
$resultsUnvotedShow
=
false
;
104
105
/**
106
* If show poll for user which have voted(by checking session)
107
*
108
* @public boolean
109
**/
110
public
$poolVotedShow
=
false
;
111
/**
112
* Precision when result displays above vote form
113
*
114
* @public string
115
**/
116
public
$firstResult
=
false
;
117
118
public
function
run()
119
{
120
$this->render(
'VoteWidget'
);
121
}
122
123
public
function
getIsVoted()
124
{
125
return
Yii::app()->user->getState(
'vote-voted-'
.$this->
id
) ===
true
;
126
}
127
}
Generated on Thu Jun 20 2013 14:45:15 for Gentics Portal.Node PHP API by
1.8.1.2