<?php echo $header; ?>
<div id="content">
  <div class="breadcrumb">
    <?php foreach ($breadcrumbs as $breadcrumb) { ?>
    <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
    <?php } ?>
  </div>
  <?php if ($error_warning) { ?>
  <div class="warning"><?php echo $error_warning; ?></div>
  <?php } ?>
  <?php echo $shortcut_route;?> 
  <div class="box">
    <div class="heading">
      <h1><img src="view/image/module.png" alt="" /> <?php echo $heading_title; ?></h1>
     <div class="buttons">
     <a onclick="location='<?php echo $poll_setting;?>';" class="button"><span><?php echo $button_module;?></span></a>
     <a onclick="$('#form').submit();" class="button"><span><?php echo $button_save;?></span></a>
      <a onclick="location='<?php echo $cancel;?>';" class="button"><span><?php echo $button_cancel;?></span></a></div>
    </div>
    <div class="content">
      <div id="tabs" class="htabs"><a href="#tab_general"><?php echo $tab_general;?></a><a href="#tab_data"><?php echo $tab_data;?></a><a href="#tab_results"><?php echo $tab_results;?></a></div>
      <form action="<?php echo $action;?>" method="post" enctype="multipart/form-data" id="form" name="form">
        <div id="tab_general">
          <div id="languages" class="htabs">
            <?php foreach($languages as $language){?>
            <a href="#language<?php echo $language['language_id'];?>"><img src="view/image/flags/<?php echo $language['image'];?>" title="<?php echo $language['name'];?>"/> <?php echo $language['name'];?></a>
            <?php }?>
          </div>
           
         
          <?php foreach($languages as $language){?>
          <div id="language<?php echo $language['language_id'];?>">
            <table class="form">
              <tr>
                <td><span class="required">*</span> <?php echo $entry_question;?></td>
                <td><input name="poll_description[<?php echo $language['language_id'];?>][question]" value="<?php echo isset($poll_description[$language['language_id']]) ? $poll_description[$language['language_id']]['question'] : '';?>" size="60"/>
                  <?php if(isset($error_question[$language['language_id']])){?>
                  <span class="error"><?php echo $error_question[$language['language_id']];?></span>
                  <?php }?></td>
              </tr>
               <?php for($i = 1;
		$i <= 15;
		$i++){?>
              <tr>
                <td><?php echo $entry_answer.'&nbsp;'.$i;?></td>
                <td><input name="poll_description[<?php echo $language['language_id'];?>][answer_<?php echo $i;?>]" value="<?php echo isset($poll_description[$language['language_id']]) ? $poll_description[$language['language_id']]['answer_'.$i] : '';?>" size="60"/>
                  <?php if(isset($error_answer[$i][$language['language_id']])){?>
                  <span class="error"><?php echo $error_answer[$i][$language['language_id']];?></span>
                  <?php }?></td>
              </tr>
         <?php }?>
            </table>
          </div>
          <?php }?>
        </div>
        <div id="tab_data">
          <table class="form">
            <tr>
              <td><?php echo $entry_store;?></td>
              <td><div class="scrollbox">
                  <?php $class='even';?>
                  <div class="<?php echo $class;?>">
                    <?php if(in_array(0,$poll_store)){?>
                    <input type="checkbox" name="poll_store[]" value="0" checked="checked"/>
                    <?php echo $text_default;?>
                    <?php }else{?>
                    <input type="checkbox" name="poll_store[]" value="0" checked="checked"/>
                    <?php echo $text_default;?>
                    <?php }?>
                  </div>
                  <?php foreach($stores as $store){?>
                  <?php $class = ($class=='even' ? 'odd' : 'even');?>
                  <div class="<?php echo $class;?>">
                    <?php if(in_array($store['store_id'],$poll_store)){?>
                    <input type="checkbox" name="poll_store[]" value="<?php echo $store['store_id'];?>" checked="checked"/>
                    <?php echo $store['name'];?>
                    <?php }else{?>
                    <input type="checkbox" name="poll_store[]" value="<?php echo $store['store_id'];?>" checked="checked"/>
                    <?php echo $store['name'];?>
                    <?php }?>
                  </div>
                  <?php }?>
                </div></td>
            </tr>
          </table>
        </div>
        <div id="tab_results">
          <?php if(isset($reactions)){?>
            <?php $labels=array();
		$values=array();?>
            <h1><?php echo $text_poll_results;?></h1>
            <h2><?php echo $poll_data['question'];?></h2>
            <table class="list">
              <thead>
                <tr>
                  <td width="10%"><?php echo $text_percent;?></td>
                  <td><?php echo $text_answer;?></td>
                </tr>
              </thead>
              <tbody>
                <?php $class='odd';?>
                <?php for($i = 0;
		$i < 15;
		$i++){?>
                  <?php if(!empty($poll_data['answer_' . ($i + 1)])){?>
                    <?php $class =$class=='even' ? 'odd' : 'even';?>
                    <?php array_push($labels,$poll_data['answer_' . ($i + 1)]);?>
                    <?php array_push($values,$percent[$i]);?>
                    <tr class="<?php echo $class;?>">
                      <td><strong><?php echo $percent[$i];?>%</strong></td>
                      <td><?php echo $poll_data['answer_' . ($i + 1)];?>  (<?php echo $vote[$i]?> )</td>
                    </tr>
                  <?php }?>
                <?php }?>
              </tbody>
            </table>
            <div style="text-align: center; margin-top: 10px;">
              <?php $labels = implode('|',$labels);
		$values = implode(',',$values);?>
              <img src="http://chart.apis.google.com/chart?cht=p3&chco=303F4A,E4EEF7,849721&chd=t:<?php echo $values;?>&chs=770x200&chl=<?php echo $labels;?>" width="770" height="200" alt="chart"/>
            </div>
          <?php }else{?>
            <div style="text-align: center; margin-top: 10px;"><?php echo $text_no_votes;?></div>
          <?php }?>
        </div>
      </form>
    </div>
  </div>
</div>
<script type="text/javascript">//<![CDATA[
$('#tabs a').tabs();
$('#languages a').tabs();
//]]></script>
 
<?php echo $footer;?></body></html>
