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 CacheBuilder {
19 * @see CacheBuilder::getData()
21 public function getData($cacheResource) {
25 $tmp = explode('-', $cacheResource['cache']);
26 $packageID = array_pop($packageID);
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 $data[$row['objectType']] = array(
41 'object' => new UserNotificationObjectType(null, $row),
48 $sql = "SELECT event.*, object_type.objectType
49 FROM wcf".WCF_N."_package_dependency package_dependency,
50 wcf".WCF_N."_user_notification_event event
51 LEFT JOIN wcf".WCF_N."_user_notification_object_type object_type
52 ON (object_type.objectTypeID = event.objectTypeID)
53 WHERE event.packageID = package_dependency.dependency
54 AND package_dependency.packageID = ?
55 ORDER BY package_dependency.priority DESC";
56 $statement = WCF::getDB()->prepareStatement($sql);
57 $statement->execute(array($packageID));
58 while ($row = $statement->fetchArray()) {
59 if (isset($data[$row['objectType']]) && !isset($data[$row['objectType']]['events'][$row['eventName']])) {
60 $data[$row['objectType']]['events'][$row['eventName']] = new UserNotificationEvent(null, $row);