aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/admin.php
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-07-29 13:52:16 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-07-29 13:52:16 +0000
commitba1ceb336c2ec35816342c38017e8f3700308155 (patch)
treeab104b931b2ca07a4441172d4648c129a53b9f94 /engine/lib/admin.php
parent81ea240cfa86266725f3984dc9985e7eea0b3eb9 (diff)
downloadelgg-ba1ceb336c2ec35816342c38017e8f3700308155.tar.gz
elgg-ba1ceb336c2ec35816342c38017e8f3700308155.tar.bz2
Admin notify method added, view 'admin_message' for this.
git-svn-id: https://code.elgg.org/elgg/trunk@1568 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/admin.php')
-rw-r--r--engine/lib/admin.php47
1 files changed, 47 insertions, 0 deletions
diff --git a/engine/lib/admin.php b/engine/lib/admin.php
index 974f6b35d..abf3dad01 100644
--- a/engine/lib/admin.php
+++ b/engine/lib/admin.php
@@ -68,6 +68,53 @@
}
}
+ }
+
+ /**
+ * Write a persistent message to the administrator's notification window.
+ *
+ * Currently this writes a message to the admin store, we may want to come up with another way at some point.
+ *
+ * @param string $subject Subject of the message
+ * @param string $message Body of the message
+ */
+ function send_admin_message($subject, $message)
+ {
+ $subject = sanitise_string($subject);
+ $message = sanitise_string($message);
+
+ if (($subject) && ($message))
+ {
+ $admin_message = new ElggObject();
+ $admin_message->subtype = 'admin_message';
+ $admin_message->access_id = 2;
+ $admin_message->title = $subject;
+ $admin_message->description = $message;
+
+ return $admin_message->save();
+ }
+
+ return false;
+ }
+
+ /**
+ * List all admin messages.
+ *
+ * @param int $limit Limit
+ */
+ function list_admin_messages($limit = 10)
+ {
+ return list_entities('object','admin_message',0,$limit);
+ }
+
+ /**
+ * Remove an admin message.
+ *
+ * @param int $guid The
+ */
+ function clear_admin_message($guid)
+ {
+ return delete_entity($guid);
}
/// Register init function