<?php
  /**************************************************************************\
  * phpGroupWare - Polls                                                     *
  * http://www.phpgroupware.org                                              *
  * --------------------------------------------                             *
  *  This program is free software; you can redistribute it and/or modify it *
  *  under the terms of the GNU General Public License as published by the   *
  *  Free Software Foundation; either version 2 of the License, or (at your  *
  *  option) any later version.                                              *
  \**************************************************************************/

  /* $Id: admin_deleteanswer.php,v 1.6.2.2 2002/11/23 01:40:48 skwashd Exp $ */

	$phpgw_info = array();
	$GLOBALS['phpgw_info']['flags'] = array(
		'admin_only'              => True,
		'currentapp'              => 'polls',
		'enable_nextmatchs_class' => True,
		'admin_header'            => True
	);
	if ($HTTP_GET_VARS['confirm'])
	{
		$GLOBALS['phpgw_info']['flags']['noheader'] = True;
		$GLOBALS['phpgw_info']['flags']['nonavbar'] = True;
		$GLOBALS['phpgw_info']['flags']['admin_header'] = False;
	}
	include('../header.inc.php');

	if ($HTTP_GET_VARS['confirm'])
	{
		$GLOBALS['phpgw']->db->query("delete from phpgw_polls_data where vote_id='" . $HTTP_GET_VARS['vote_id'] . "' AND poll_id=". $HTTP_GET_VARS['poll_id']);
		Header('Location: ' . $GLOBALS['phpgw']->link('/polls/admin.php','show=answers'));
	}
	else
	{
		echo '<p><br><table border="0" width="40%" align="center"><tr><td align="center" colspan="center">';
		echo lang('Are you sure want to delete this answer ?') . '</td></tr>';
		echo '<tr><td align="left"><a href="' . $GLOBALS['phpgw']->link('/polls/admin.php','show=answers') . '">' . lang('No') . '</td>';
		echo '    <td align="right"><a href="' . $GLOBALS['phpgw']->link('/polls/admin_deleteanswer.php','vote_id='
			. $HTTP_GET_VARS['vote_id'] . '&poll_id=' . $HTTP_GET_VARS['poll_id'] . '&confirm=True') . '">' . lang('Yes') . '</td></tr>';
		echo '</table>';
	}
	$GLOBALS['phpgw']->common->phpgw_footer();
?>
