2 namespace wcf\system\package\plugin;
6 * This PIP installs, updates or deletes user notification events.
9 * @copyright 2001-2011 WoltLab GmbH
10 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
11 * @package com.woltlab.wcf.notification
12 * @subpackage system.package.plugin
13 * @category Community Framework
15 class UserNotificationEventPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin {
17 * @see AbstractXMLPackageInstallationPlugin::$className
19 public $className = 'wcf\data\user\notification\event\UserNotificationEventEditor';
22 * @see AbstractXMLPackageInstallationPlugin::$tableName
24 public $tableName = 'user_notification_event';
27 * @see AbstractXMLPackageInstallationPlugin::$tagName
29 public $tagName = 'event';
32 * @see AbstractXMLPackageInstallationPlugin::handleDelete()
34 protected function handleDelete(array $items) {
35 $sql = "DELETE FROM wcf".WCF_N."_".$this->tableName."
38 $statement = WCF::getDB()->prepareStatement($sql);
39 foreach ($items as $item) {
40 $statement->execute(array(
41 $this->installation->getPackageID(),
42 $item['elements']['name']
48 * @see AbstractXMLPackageInstallationPlugin::prepareImport()
50 protected function prepareImport(array $data) {
52 $defaultNotificationTypeID = 0;
55 'eventName' => $data['elements']['name'],
56 'className' => $data['elements']['classname'],
57 'objectTypeID' => $objectTypeID,
58 'defaultNotificationTypeID' => $defaultNotificationTypeID,
59 'languageCategory' => (isset($data['elements']['languagecategory']) ? $data['elements']['languagecategory'] : ''),
60 'requiresConfirmation' => (isset($data['elements']['requiresconfirmation']) ? intval($data['elements']['requiresconfirmation']) : 0),
61 'acceptURL' => (isset($data['elements']['accepturl']) ? $data['elements']['accepturl'] : ''),
62 'declineURL' => (isset($data['elements']['declineurl']) ? $data['elements']['declineurl'] : ''),
63 'permissions' => (isset($data['elements']['permissions']) ? $data['elements']['permissions'] : ''),
64 'options' => (isset($data['elements']['options']) ? $data['elements']['options'] : '')
69 * @see AbstractXMLPackageInstallationPlugin::findExistingItem()
71 protected function findExistingItem(array $data) {
73 FROM wcf".WCF_N."_".$this->tableName."
77 $this->installation->getPackageID(),
83 'parameters' => $parameters