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