2 namespace wcf\system\cache;
3 use wcf\data\user\notification\event\UserNotificationEvent;
4 use wcf\data\user\notification\object\type\UserNotificationObjectType;
8 * Caches user notification object types and events.
10 * @author Marcell Werk, Oliver Kliebisch
11 * @copyright 2001-2011 WoltLab GmbH, Oliver Kliebisch
12 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
13 * @package com.woltlab.wcf.notification
14 * @subpackage system.cache
15 * @category Community Framework
17 class CacheBuilderUserNotificationObjectType implements ICacheBuilder {
19 * @see wcf\system\cache\ICacheBuilder::getData()
21 public function getData($cacheResource) {
25 $tmp = explode('-', $cacheResource['cache']);
26 $packageID = array_pop($tmp);
29 $typeIDArray = array();
30 $sql = "SELECT object_type.*
31 FROM wcf".WCF_N."_user_notification_object_type object_type,
32 wcf".WCF_N."_package_dependency package_dependency
33 WHERE object_type.packageID = package_dependency.dependency
34 AND package_dependency.packageID = ?
35 ORDER BY package_dependency.priority DESC";
36 $statement = WCF::getDB()->prepareStatement($sql);
37 $statement->execute(array($packageID));
38 while ($row = $statement->fetchArray()) {
39 if (!isset($data[$row['objectType']])) {
40 $databaseObject = new UserNotificationObjectType(null, $row);
41 $data[$row['objectType']] = array(
42 'object' => $databaseObject->getProcessor(),
49 $sql = "SELECT event.*, object_type.objectType
50 FROM wcf".WCF_N."_package_dependency package_dependency,
51 wcf".WCF_N."_user_notification_event event
52 LEFT JOIN wcf".WCF_N."_user_notification_object_type object_type
53 ON (object_type.objectTypeID = event.objectTypeID)
54 WHERE event.packageID = package_dependency.dependency
55 AND package_dependency.packageID = ?
56 ORDER BY package_dependency.priority DESC";
57 $statement = WCF::getDB()->prepareStatement($sql);
58 $statement->execute(array($packageID));
59 while ($row = $statement->fetchArray()) {
60 if (isset($data[$row['objectType']]) && !isset($data[$row['objectType']]['events'][$row['eventName']])) {
61 $databaseObject = new UserNotificationEvent(null, $row);
62 $data[$row['objectType']]['events'][$row['eventName']] = $databaseObject->getProcessor();