<?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_deletequestion.php,v 1.2.2.1 2001/06/26 16:08:10 el_latino Exp $ */

	$phpgw_info['flags'] = array(
		'currentapp'   => 'polls',
		'enable_nextmatchs_class' => True,
		'admin_header' => True
	);

	include('../header.inc.php');

	if ($confirm)
	{
		$phpgw->db->query("delete from phpgw_polls_desc where poll_id='$poll_id'");
		$phpgw->db->query("delete from phpgw_polls_data where poll_id='$poll_id'");
		$phpgw->db->query("delete from phpgw_polls_user where poll_id='$poll_id'");
		$phpgw->db->query("select MAX(poll_id) from phpgw_polls_desc");
		$max = $phpgw->db->f("1");
		$phpgw->db->query("update phpgw_polls_settings set setting_value='$max_poll' where setting_name='currentpoll'");
	}
	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 question ?') . '</td></tr>';
		echo '<tr><td align="left"><a href="' . $phpgw->link('/polls/admin.php','show=answers') . '">' . lang('No') . '</td>';
		echo '    <td align="right"><a href="' . $phpgw->link('/polls/admin_deletequestion.php','poll_id='
			. $poll_id .'&confirm=True') . '">' . lang('Yes') . '</td></tr>';
		echo '</table>';
	}
	$phpgw->common->phpgw_footer();
?>
