Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
VoteWidget.php
1 <?php
2  Yii::app()->getClientScript()->registerScriptFile(Yii::app()->getModule('vote')->getAssetsUrl() . '/js/jquery.scrollTo-1.4.3-min.js', CClientScript::POS_READY);
3 ?>
4 
5 
6 
7 <div class="ask_block" id="<?php echo 'ask-block-'.$this->id ?>" >
8 
9  <div class="results">
10  <?php $this->widget('vote.widgets.ResultsWidget', array(
11  'id' => $this->id,
12  'inPercents' => $this->inPercents,
13  'precision' => $this->precision,
14  'unvotedShow' => ($this->firstResult)?true:$this->resultsUnvotedShow,
15  'firstResult' =>$this->firstResult
16  ))
17  ?>
18 
19  <?php if($this->firstResult && !$this->getIsVoted()): ?>
20 
21  <button class="to_cast_a_vote firstResultControl">
22  <?php echo VoteModule::t('Cast a vote'); ?>
23  </button>
24 
25  <?php endif; ?>
26 
27  </div>
28 
29 
30 
31  <div class="cast_a_vote" style="display: <?php echo ($this->firstResult?'none':'block') ?>">
32  <?php $this->widget('vote.widgets.PoolWidget', array(
33  'id' => $this->id,
34  'author_id' => $this->author_id,
35  'question' => $this->question,
36  'answers' => $this->answers,
37  'multiply' => $this->multiply,
38  'dynamic' => $this->dynamic,
39  'allowAnonymous' => $this->allowAnonymous,
40  'additionalFields' => $this->additionalFields,
41  'ajax' => $this->ajax,
42  'votedShow' => $this->poolVotedShow,
43  'resultOptions' => array(
44  'id' => $this->id,
45  'inPercents' => $this->inPercents,
46  'precision' => $this->precision,
47  'unvotedShow' => ($this->firstResult)?true:$this->resultsUnvotedShow,
48  ),
49 
50  ));
51  ?>
52 
53  <?php if($this->firstResult && !$this->getIsVoted()): ?>
54 
55  <button class="back_to_result firstResultControl">
56  <?php echo VoteModule::t('Back to result'); ?>
57  </button>
58 
59  <?php endif; ?>
60 
61  </div> <!-- cust_a_vote -->
62 
63 </div> <!-- ask_block -->
64 
65 <script type="text/javascript" charset="utf-8">
66  jQuery(function(){
67  $("button.to_cast_a_vote").click(function(){
68  //$(this).hide();
69  ask_block = $(this).closest('.ask_block');
70  cast_a_vote = $(ask_block).children('.cast_a_vote');
71  results = $(ask_block).children('.results');
72 
73  $(cast_a_vote).show();
74  $(results).hide();
75  });
76  $("button.back_to_result").click(function(){
77  //$(this).hide();
78  ask_block = $(this).closest('.ask_block');
79  cast_a_vote = $(ask_block).children('.cast_a_vote');
80  results = $(ask_block).children('.results');
81 
82  $(cast_a_vote).hide();
83  $(results).show();
84  });
85  });
86 </script>