aboutsummaryrefslogtreecommitdiff
path: root/mod/notifications/start.php
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-05-13 01:11:33 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-05-13 01:11:33 +0000
commit402134632f0d60e9644d0121c2a84db4a4c1a169 (patch)
treef6bf653ec6b8a955ec77ff18fd9199583b79cfc0 /mod/notifications/start.php
parent4ae064871ba9dca9f03e095671db48815632d070 (diff)
downloadelgg-402134632f0d60e9644d0121c2a84db4a4c1a169.tar.gz
elgg-402134632f0d60e9644d0121c2a84db4a4c1a169.tar.bz2
merged in notifications plugin cleanup from 1.7 branch: [5962], [5978] - [5980], [6000]
git-svn-id: http://code.elgg.org/elgg/trunk@6020 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/notifications/start.php')
-rw-r--r--mod/notifications/start.php112
1 files changed, 70 insertions, 42 deletions
diff --git a/mod/notifications/start.php b/mod/notifications/start.php
index a08fe68f5..838a123fb 100644
--- a/mod/notifications/start.php
+++ b/mod/notifications/start.php
@@ -1,47 +1,75 @@
<?php
- /**
- * Elgg notifications plugin
- *
- * @package ElggNotifications
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Curverider Ltd
- * @copyright Curverider Ltd 2008-2010
- * @link http://elgg.com/
- */
-
-
- /**
- * Notification settings page setup function
- *
- */
- function notifications_plugin_pagesetup() {
- global $CONFIG;
- if (get_context() == 'settings') {
- add_submenu_item(elgg_echo('notifications:subscriptions:changesettings'), $CONFIG->wwwroot . "mod/notifications/");
- if (is_plugin_enabled('groups'))
- add_submenu_item(elgg_echo('notifications:subscriptions:changesettings:groups'), $CONFIG->wwwroot . "mod/notifications/groups.php");
- }
- }
-
- function notifications_plugin_init() {
- elgg_extend_view('css','notifications/css');
- global $CONFIG;
-
- // Unset the default user settings hook
- if (isset($CONFIG->hooks['usersettings:save']['user']))
- foreach($CONFIG->hooks['usersettings:save']['user'] as $key => $function) {
- if ($function == 'notification_user_settings_save')
- unset($CONFIG->hooks['usersettings:save']['user'][$key]);
- }
+/**
+ * Elgg notifications plugin
+ *
+ * @package ElggNotifications
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
+
+
+function notifications_plugin_init() {
+ global $CONFIG;
+
+ elgg_extend_view('css','notifications/css');
+
+ register_page_handler('notifications', 'notifications_page_handler');
+
+ register_elgg_event_handler('pagesetup', 'system', 'notifications_plugin_pagesetup');
+
+ // Unset the default notification settings
+ unregister_plugin_hook('usersettings:save', 'user', 'notification_user_settings_save');
+
+ // must wait until elgg_unextend_view() is merged in from 1.7 branch - if still needed
+ //elgg_unextend_view('usersettings/user', 'notifications/settings/usersettings');
+}
+
+/**
+ * Route page requests
+ *
+ * @param array $page Array of url parameters
+ */
+function notifications_page_handler($page) {
+ global $CONFIG;
+
+ // default to personal notifications
+ if (!isset($page[0])) {
+ $page[0] = 'personal';
+ }
+
+ switch ($page[0]) {
+ case 'group':
+ require $CONFIG->pluginspath . "notifications/groups.php";
+ break;
+ case 'personal':
+ default:
+ require $CONFIG->pluginspath . "notifications/index.php";
+ break;
+ }
+
+ return TRUE;
+}
+
+/**
+ * Notification settings page setup function
+ *
+ */
+function notifications_plugin_pagesetup() {
+ global $CONFIG;
+ if (get_context() == 'settings') {
+ add_submenu_item(elgg_echo('notifications:subscriptions:changesettings'), $CONFIG->wwwroot . "pg/notifications/personal");
+ if (is_plugin_enabled('groups')) {
+ add_submenu_item(elgg_echo('notifications:subscriptions:changesettings:groups'), $CONFIG->wwwroot . "pg/notifications/group");
}
+ }
+}
+
- register_elgg_event_handler('pagesetup','system','notifications_plugin_pagesetup',1000);
- register_elgg_event_handler('init','system','notifications_plugin_init',1000);
+register_elgg_event_handler('init', 'system', 'notifications_plugin_init', 1000);
- // Register action
- global $CONFIG;
- register_action("notificationsettings/save",false,$CONFIG->pluginspath . "notifications/actions/save.php");
- register_action("notificationsettings/groupsave",false,$CONFIG->pluginspath . "notifications/actions/groupsave.php");
-
-?> \ No newline at end of file
+// Register action
+register_action("notificationsettings/save", FALSE, $CONFIG->pluginspath . "notifications/actions/save.php");
+register_action("notificationsettings/groupsave", FALSE, $CONFIG->pluginspath . "notifications/actions/groupsave.php");