<?php include VIEW_DIR.'mobile/common/menu/poll.tpl'; ?>


<form method="post" action="<?php e($this->_vars['action']['url']); ?>"><?php HTML::requires(); ?>
<?php if ($this->_vars['action']['complete'] || $this->_vars['action']['deleted']): ?>
	<?php e($this->_vars['action']['complete']? _('Updated'):_('Deleted')); ?><br><br>
	<?php loadPlugin::callFunc('hitsuji_banner', POSITION_MOBILE); ?><br>
<?php elseif ($this->_vars['action']['confirm'] || $this->_vars['action']['delete']): ?>
<table border="0" width="<?php Theme::exec()->mainWidth(); ?>">
	<tr><td align="center" bgcolor="<?php Theme::exec()->bgTitleColor(); ?>"><img src="<?php e(BASE_URL); ?>resource/img/icons/chart_pie_edit.gif" width="16" height="16" alt="&gt;">&nbsp;<?php e($this->_vars['sum_poll']['poll']); ?></td></tr>
	<tr><td bgcolor="<?php Theme::exec()->bgColor(); ?>">
		<font color="<?php Theme::exec()->columnColor(); ?>"><?php _e('Deadline'); ?>:</font><?php eDate($this->_vars['sum_poll']['deadline'], _('Y-m-d')); ?><br>
		<font color="<?php Theme::exec()->columnColor(); ?>"><?php _e('Answers'); ?>:</font><?php printf(_('%s answers'), 0); ?><br>
		<font color="<?php Theme::exec()->columnColor(); ?>"><?php _e('Posted by'); ?>:</font><?php loadPlugin::callFunc('hitsuji_profile', $this->_vars['base']['account']['id'], 'nickname'); ?>
		<?php eDate(ifNull($this->_vars['sum_poll']['regist_date'], 'now'), _('Y-m-d H:i')); ?>
		<img src="<?php e(BASE_URL); ?>resource/img/icons/<?php e($this->_vars['base']['visibility_icon'][$this->_vars['sum_poll']['visibility']]); ?>" width="16" height="16" alt="&gt;">
	<br></td></tr>
	<tr><td bgcolor="<?php Theme::exec()->bgColor(); ?>">
<?php foreach ($this->_vars['answers'] as $_value): ?>
<?php   if(!empty($_value)): ?>
				<font color="<?php Theme::exec()->columnColor(); ?>"><?php e($_value); ?>:</font>
				0<input type="hidden" name="answers[]" value="<?php e($_value); ?>"><br>
<?php   endif; ?>
<?php endforeach; ?>
	</td></tr>
	<tr><td bgcolor="<?php Theme::exec()->bgColor(); ?>"><?php HTML::htmlBody($this->_vars['sum_poll']['comment']); ?><br></td></tr>
	<tr><td bgcolor="<?php Theme::exec()->bgColor(); ?>" align="center">
		<input type="submit" name="manip" value="<?php e($this->_vars['action']['confirm']? _('Submit'):_('Delete')); ?>">
		<input type="submit" name="<?php e($this->_vars['action']['goback']); ?>" value="<?php _e('Go back'); ?>">
	<br></td></tr>
</table>
<?php else: ?>
<table border="0" width="<?php Theme::exec()->mainWidth(); ?>">
	<tr><td align="center" bgcolor="<?php Theme::exec()->bgTitleColor(); ?>"><img src="<?php e(BASE_URL); ?>resource/img/icons/chart_pie_edit.gif" width="16" height="16" alt="&gt;">&nbsp;<?php _e('Post an Question'); ?></td></tr>
	<tr><td bgcolor="<?php Theme::exec()->bgColumnColor(); ?>"><?php _e('Title'); ?>:<br></td></tr>
	<tr><td>
		<?php if (!empty($this->_vars['alert']['poll'])): ?><font color="<?php Theme::exec()->alertColor(); ?>"><?php _e('Please enter.'); ?></font><br><?php endif; ?>
		<input type="text" name="poll" value="<?php e($this->_vars['sum_poll']['poll']); ?>" size="42">
	<br></td></tr>

	<tr><td bgcolor="<?php Theme::exec()->bgColumnColor(); ?>"><?php _e('Deadline'); ?>:<br></td></tr>
	<tr><td>
		<?php if (!empty($this->_vars['alert']['deadline'])): ?><font color="<?php Theme::exec()->alertColor(); ?>"><?php _e('Please select date.'); ?></font><br><?php endif; ?>
		<?php HTML::dateSelect('deadline', $this->_vars['sum_poll']['deadline']); ?>
	<br></td></tr>

	<tr><td bgcolor="<?php Theme::exec()->bgColumnColor(); ?>"><?php _e('Visibility'); ?>:<br></td></tr>
	<tr><td>
		<?php if (!empty($this->_vars['alert']['visibility'])): ?><font color="<?php Theme::exec()->alertColor(); ?>"><?php _e('Please select.'); ?></font><br><?php endif; ?>
		<?php HTML::radio('visibility', $this->_vars['visibility'], $this->_vars['sum_poll']['visibility'], '<br>'); ?>
	</td></tr>

	<tr><td bgcolor="<?php Theme::exec()->bgColumnColor(); ?>"><?php _e('Answers'); ?>:<br></td></tr>
	<tr><td>
<?php if (empty($this->_vars['answers'])): ?>
		<input type="text" name="answers[]" value=""><br>
		<input type="text" name="answers[]" value=""><br>
		<input type="text" name="answers[]" value=""><br>
		<input type="text" name="answers[]" value=""><br>
<?php else: ?>
<?php foreach ($this->_vars['answers'] as $_value): ?>
		<input type="text" name="answers[]" value="<?php e($_value); ?>"><br>
<?php endforeach; ?>
<?php endif; ?>
		<input type="text" name="answers[]" value="">
	<br></td></tr>

	<tr><td bgcolor="<?php Theme::exec()->bgColumnColor(); ?>"><?php _e('Comment'); ?>:<br></td></tr>
	<tr><td>
		<?php if (!empty($this->_vars['alert']['comment'])): ?><font color="<?php Theme::exec()->alertColor(); ?>"><?php _e('Please enter.'); ?></font><br><?php endif; ?>
		<?php HTML::mobileRichEditor('comment', $this->_vars['sum_poll']['comment'], _('Comment')); ?>
		<br><input name="attach" type="submit" value="<?php _e('Attach'); ?>">
	<br></td></tr>
	<tr><td bgcolor="<?php Theme::exec()->bgColor(); ?>" align="center"><input type="submit" name="confirm" value="<?php _e('Confirm'); ?>"><br></td></tr>
</table>
<?php endif; ?>
</form>
