<?php

# $Id: method.uninstall.php 1 2011-06-12 15:25:27Z arnoud $ 

#BEGIN_LICENSE
#-------------------------------------------------------------------------
# Module: UpCoupon (c) 2011 by Arnoud van Susteren (arnoud@upservice.nl)
#
# An addon module for CMS Made Simple to setup a Coupon Codes Lottery
# 
#-------------------------------------------------------------------------
# CMS - CMS Made Simple is (c) 2005 by Ted Kulp (wishy@cmsmadesimple.org)
# This project's homepage is: http://www.cmsmadesimple.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.
#
# However, as a special exception to the GPL, this software is distributed
# as an addon module to CMS Made Simple.  You may not use this software
# in any Non GPL version of CMS Made simple, or in any version of CMS
# Made simple that does not indicate clearly and obviously in its admin 
# section that the site was built with CMS Made simple.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Or read it online: http://www.gnu.org/licenses/licenses.html#GPL
#
#-------------------------------------------------------------------------
#END_LICENSE

if(!is_object(cmsms())) exit;

###############################################################################
# tables
###############################################################################

$db = $this->GetDb(); 
$dict = NewDataDictionary($db);

$sqlarray = $dict->DropTableSQL(UPCOUPON_ACTION_TABLE);
$dict->ExecuteSQLArray($sqlarray);

$sqlarray = $dict->DropTableSQL(UPCOUPON_PERIOD_TABLE);
$dict->ExecuteSQLArray($sqlarray);

$sqlarray = $dict->DropTableSQL(UPCOUPON_PRIZE_TABLE);
$dict->ExecuteSQLArray($sqlarray);

$sqlarray = $dict->DropTableSQL(UPCOUPON_CUSTOMER_TABLE);
$dict->ExecuteSQLArray($sqlarray);

$sqlarray = $dict->DropTableSQL(UPCOUPON_CODE_TABLE);
$dict->ExecuteSQLArray($sqlarray);

###############################################################################
# permissions
###############################################################################

$this->RemovePermission('Modify UpCoupon', 'Modify UpCoupon');	

###############################################################################
# events
###############################################################################

$this->RemoveEvent('UpCouponActionAdded');
$this->RemoveEvent('UpCouponActionEdited');
$this->RemoveEvent('UpCouponActionDeleted');

$this->RemoveEvent('UpCouponPeriodAdded');
$this->RemoveEvent('UpCouponPeriodEdited');
$this->RemoveEvent('UpCouponPeriodDeleted');

$this->RemoveEvent('UpCouponPriceAdded');
$this->RemoveEvent('UpCouponPriceEdited');
$this->RemoveEvent('UpCouponPriceDeleted');

$this->RemoveEvent('UpCouponWinnerAdded');
$this->RemoveEvent('UpCouponWinnerEdited');
$this->RemoveEvent('UpCouponWinnerDeleted');

$this->RemoveEvent('UpCouponStatisticsAdded');
$this->RemoveEvent('UpCouponStatisticsEdited');
$this->RemoveEvent('UpCouponStatisticsDeleted');

$this->RemoveEvent('UpCouponTemplatesAdded');
$this->RemoveEvent('UpCouponTemplatesEdited');
$this->RemoveEvent('UpCouponTemplatesDeleted');

$this->RemoveEvent('UpCouponPreferencesAdded');
$this->RemoveEvent('UpCouponPreferencesEdited');
$this->RemoveEvent('UpCouponPreferencesDeleted');

###############################################################################
# preferences
###############################################################################

$this->RemovePreference();

$this->Audit( 0, $this->Lang('friendlyname'), $this->Lang('uninstalled', $this->GetVersion()) );

#
# EOF
#
?>
