<?php use_helper('ModalBox'); ?>
<?php $isVote = $sf_user->isVote();?>
<?php if($isVote !== null):?>
  <?php $options = $isVote?'disabled=disabled':null ?>
  <?php $tblblogpoll = blogStore::$tblblogpoll ?>
  <div class="block-content">
    <?php echo form_tag('/block/updatepoll') ?>
    <?php echo input_hidden_tag('poll_id', $tblblogpoll->getPollId()) ?>
    <?php echo blogStore::$tblblogpoll->getPollName();?>
    <?php $questions = blogStore::$tblblogpoll->getPollQuestions();?>
    <?php $arrQuestion = explode('|', $questions);?>
    
    <?php if(blogStore::$tblblogpoll->getPollType() == 1):?>
      <?php foreach ($arrQuestion as $key=>$question):?>
      <div>
        <?php echo radiobutton_tag('choice[]', $key, false, $options) ?>
        <?php echo $question ?>
      </div>
      <?php endforeach?>
    <?php else:?>
      <?php foreach ($arrQuestion as $key=>$question):?>
      <div>
        <?php if (!$isVote) echo checkbox_tag('choice[]', $key, false, $options) ?>
        <?php echo $question ?>
      </div>
      <?php endforeach?>
    <?php endif?>
    
    <div><?php if (!$isVote) echo submit_tag('Biểu quyết') ?></div>
    </form>
  </div>
<?php endif ?>
<?php if ($isVote):?>
  <?php echo m_link_to('Kết quả','/block/resultpoll?poll_id='.blogStore::$tblblogpoll->getPollId())?>
<?php endif;?>

