KTDashletPlugins.php
2.28 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?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");
require_once(KT_LIB_DIR . "/security/Permission.inc");
$oRegistry =& KTPluginRegistry::getSingleton();
$oPlugin =& $oRegistry->getPlugin('ktcore.plugin');
// ultra simple skeleton for the admin tutorial
class KTBeta1InfoDashlet extends KTBaseDashlet {
function is_active($oUser) {
return true;
}
function render() {
$oTemplating = new KTTemplating;
$oTemplate = $oTemplating->loadTemplate("ktcore/dashlets/beta1info");
$aTemplateData = array(
);
return $oTemplate->render($aTemplateData);
}
}
$oPlugin->registerDashlet('KTBeta1InfoDashlet', 'ktcore.dashlet.beta1info', __FILE__);
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);
}
}
$oPlugin->registerDashlet('KTNotificationDashlet', 'ktcore.dashlet.notifications', __FILE__);
// replace the old checked-out docs.
class KTCheckoutDashlet extends KTBaseDashlet {
var $oUser;
function is_active($oUser) {
$this->oUser = $oUser;
return true;
}
function getDocumentLink($oDocument) {
return generateControllerLink('viewDocument', 'fDocumentId=' . $oDocument->getId());
}
function render() {
$checked_out_documents = Document::getList(array("checked_out_user_id = ?", $this->oUser->getId()));
$oTemplating = new KTTemplating;
$oTemplate = $oTemplating->loadTemplate("ktcore/dashlets/checkedout");
$aTemplateData = array(
"context" => $this,
"documents" => $checked_out_documents,
);
return $oTemplate->render($aTemplateData);
}
}
$oPlugin->registerDashlet('KTCheckoutDashlet', 'ktcore.dashlet.checkout', __FILE__);
?>