egroupware/preferences/deletecategory.php

94 lines
3.5 KiB
PHP
Raw Normal View History

<?php
2001-05-15 01:33:42 +02:00
/***************************************************************************\
* phpGroupWare - Categories *
* (http://www.phpgroupware.org) *
* Written by Bettina Gille [ceb@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$ */
2001-05-15 01:33:42 +02:00
if (! $cat_id)
2001-05-11 22:14:28 +02:00
{
2001-06-10 23:01:49 +02:00
Header('Location: ' . $phpgw->link('/preferences/categories.php','cats_app=' . $cats_app . '&extra=' . $extra . '&cats_level=' . $cats_level
. '&global_cats=' . $global_cats));
2001-05-11 22:14:28 +02:00
}
2001-05-15 01:33:42 +02:00
if ($confirm)
2001-05-11 22:14:28 +02:00
{
2001-05-15 01:33:42 +02:00
$phpgw_info['flags'] = array('noheader' => True,
'nonavbar' => True);
2001-05-11 22:14:28 +02:00
}
2001-05-15 01:33:42 +02:00
$phpgw_info['flags']['currentapp'] = $cats_app;
$phpgw_info['flags']['noappheader'] = True;
$phpgw_info['flags']['noappfooter'] = True;
2001-05-15 01:33:42 +02:00
include('../header.inc.php');
$c = CreateObject('phpgwapi.categories');
$c->app_name = $cats_app;
if ($confirm)
2001-05-11 22:14:28 +02:00
{
2001-05-15 01:33:42 +02:00
if ($subs)
{
2001-07-20 03:05:47 +02:00
$c->delete($cat_id,True);
2001-05-15 01:33:42 +02:00
}
else
{
$c->delete($cat_id);
}
2001-07-20 03:05:47 +02:00
2001-06-10 23:01:49 +02:00
Header('Location: ' . $phpgw->link('/preferences/categories.php','cats_app=' . $cats_app . '&extra=' . $extra . '&cats_level=' . $cats_level
. '&global_cats=' . $global_cats));
2001-05-11 22:14:28 +02:00
}
else
{
2001-05-15 01:33:42 +02:00
$hidden_vars = '<input type="hidden" name="sort" value="' . $sort . '">' . "\n"
. '<input type="hidden" name="order" value="' . $order . '">' . "\n"
. '<input type="hidden" name="start" value="' . $start . '">' . "\n"
. '<input type="hidden" name="query" value="' . $query . '">' . "\n"
. '<input type="hidden" name="filter" value="' . $filter . '">' . "\n"
. '<input type="hidden" name="cat_id" value="' . $cat_id . '">' . "\n"
. '<input type="hidden" name="cats_app" value="' . $cats_app . '">' . "\n"
. '<input type="hidden" name="cats_level" value="' . $cats_level . '">' . "\n"
. '<input type="hidden" name="global_cats" value="' . $global_cats . '">' . "\n"
. '<input type="hidden" name="extra" value="' . $extra . '">' . "\n";
2001-05-15 01:33:42 +02:00
$t = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('preferences'));
$t->set_file(array('category_delete' => 'delete.tpl'));
$t->set_var('deleteheader',lang('Are you sure you want to delete this category ?'));
$t->set_var('font',$phpgw_info['theme']['font']);
$t->set_var('hidden_vars',$hidden_vars);
2001-05-15 01:33:42 +02:00
$exists = $c->exists('subs',$cat_name='',$cat_id);
2001-07-20 03:05:47 +02:00
if ($exists)
2001-05-15 01:33:42 +02:00
{
$t->set_var('lang_subs',lang('Do you also want to delete all subcategories ?'));
$t->set_var('subs','<input type="checkbox" name="subs" value="True">');
}
else
{
$t->set_var('lang_subs','');
$t->set_var('subs', '');
}
2001-06-10 23:01:49 +02:00
$t->set_var('nolink',$phpgw->link('/preferences/categories.php','cat_id=' . $cat_id . '&cats_app=' . $cats_app . '&extra=' . $extra . '&cats_level='
. $cats_level . '&global_cats=' . $global_cats));
2001-05-15 01:33:42 +02:00
$t->set_var('lang_no',lang('No'));
2001-06-10 23:01:49 +02:00
$t->set_var('action_url',$phpgw->link('/preferences/deletecategory.php','cat_id=' . $cat_id . '&cats_app=' . $cats_app . '&extra=' . $extra
. '&cats_level=' . $cats_level . '&global_cats=' . $global_cats));
2001-05-15 01:33:42 +02:00
$t->set_var('lang_yes',lang('Yes'));
$t->pparse('out','category_delete');
}
2001-06-10 23:01:49 +02:00
2001-05-15 01:33:42 +02:00
$phpgw->common->phpgw_footer();
2001-05-11 22:14:28 +02:00
?>