KTDashletPlugins.php
1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
require_once(KT_LIB_DIR . '/plugins/pluginregistry.inc.php');
require_once(KT_LIB_DIR . '/plugins/plugin.inc.php');
require_once(KT_LIB_DIR . '/dashboard/dashlet.inc.php');
require_once(KT_LIB_DIR . "/templating/templating.inc.php");
require_once(KT_LIB_DIR . "/dashboard/Notification.inc.php");
/*
* The registration hooks.
*
* Since this is too small to _actually_ need a full plugin object, we go:
*
*/
class KTNotificationDashlet extends KTBaseDashlet {
var $oUser;
function is_active($oUser) {
$this->oUser = $oUser;
return true;
}
function render() {
$notifications = KTNotification::getList(array("user_id = ?", $this->oUser->getId()));
$oTemplating = new KTTemplating;
$oTemplate = $oTemplating->loadTemplate("ktcore/dashlets/notifications");
$aTemplateData = array(
"notifications" => $notifications,
);
return $oTemplate->render($aTemplateData);
}
}
$oRegistry =& KTPluginRegistry::getSingleton();
$oPlugin =& $oRegistry->getPlugin('ktcore.plugin');
$oPlugin->registerDashlet('KTNotificationDashlet', 'ktcore.notifications.dashlet', __FILE__);
?>