diff options
author | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-01-23 14:33:12 +0000 |
---|---|---|
committer | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-01-23 14:33:12 +0000 |
commit | 52a6050d1b4a7fae752019570bf2af521f4e2f6c (patch) | |
tree | a561c0cc433bd4c13f2cb16121a152621023bbb8 /mod/notifications | |
parent | c8c02ae0a8a4cbb11c0d76386ab12fad73376aef (diff) | |
download | elgg-52a6050d1b4a7fae752019570bf2af521f4e2f6c.tar.gz elgg-52a6050d1b4a7fae752019570bf2af521f4e2f6c.tar.bz2 |
Added notification subscriptions page.
git-svn-id: https://code.elgg.org/elgg/trunk@2608 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/notifications')
-rw-r--r-- | mod/notifications/index.php | 39 | ||||
-rw-r--r-- | mod/notifications/languages/en.php | 14 | ||||
-rw-r--r-- | mod/notifications/start.php | 30 | ||||
-rw-r--r-- | mod/notifications/views/default/notifications/subscriptions/form.php | 36 |
4 files changed, 119 insertions, 0 deletions
diff --git a/mod/notifications/index.php b/mod/notifications/index.php new file mode 100644 index 000000000..670265753 --- /dev/null +++ b/mod/notifications/index.php @@ -0,0 +1,39 @@ +<?php
+
+ /**
+ * Elgg notifications plugin index
+ *
+ * @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-2009
+ * @link http://elgg.com/
+ */
+
+ // Load Elgg framework
+ require_once(dirname(dirname(dirname(__FILE__))) . '/engine/start.php');
+
+ // Ensure only logged-in users can see this page
+ gatekeeper();
+
+ // Set the context to settings
+ set_context('settings');
+
+ // Get the form
+ global $SESSION;
+ $people = array();
+ if ($people_ents = get_entities_from_relationship('notify',$SESSION['user']->guid,false,'user','',0,'',99999)) {
+ foreach($people_ents as $ent)
+ $people[] = $ent->guid;
+ }
+ $body = elgg_view('notifications/subscriptions/form',array(
+ 'people' => $people
+ ));
+
+ // Insert it into the correct canvas layout
+ $body = elgg_view_layout('two_column_left_sidebar','',$body);
+
+ // Draw the page
+ echo page_draw(elgg_echo('notifications:subscriptions:changesettings'),$body);
+
+?>
\ No newline at end of file diff --git a/mod/notifications/languages/en.php b/mod/notifications/languages/en.php new file mode 100644 index 000000000..ecf2dba97 --- /dev/null +++ b/mod/notifications/languages/en.php @@ -0,0 +1,14 @@ +<?php
+
+ $english = array(
+
+ 'notifications:subscriptions:changesettings' => 'Change your content subscriptions',
+ 'notifications:subscriptions:description' => 'Content subscriptions allow you to be notified when one of your friends creates new content. To receive these notifications from your friends, make sure they are selected in the list below:',
+
+ 'notifications:subscriptions:success' => 'Your subscriptions have been saved.',
+
+ );
+
+ add_translation("en",$english);
+
+?>
\ No newline at end of file diff --git a/mod/notifications/start.php b/mod/notifications/start.php new file mode 100644 index 000000000..d7d1c87ea --- /dev/null +++ b/mod/notifications/start.php @@ -0,0 +1,30 @@ +<?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-2009
+ * @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/",'notifications');
+ }
+
+ register_elgg_event_handler('pagesetup','system','notifications_plugin_pagesetup',1000);
+
+ // Register action
+ global $CONFIG;
+ register_action("notificationsettings/save",false,$CONFIG->pluginspath . "notifications/actions/save.php");
+
+?>
\ No newline at end of file diff --git a/mod/notifications/views/default/notifications/subscriptions/form.php b/mod/notifications/views/default/notifications/subscriptions/form.php new file mode 100644 index 000000000..3533a6ac3 --- /dev/null +++ b/mod/notifications/views/default/notifications/subscriptions/form.php @@ -0,0 +1,36 @@ +<?php
+
+ /**
+ * Elgg notifications plugin settings form
+ *
+ * @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-2009
+ * @link http://elgg.com/
+ */
+
+ // Get subscriptions
+ $people = $vars['subscriptions'];
+ if (empty($people) || !is_array($people))
+ $people = array();
+
+ // Echo title
+ echo elgg_view_title(elgg_echo('notifications:subscriptions:changesettings'));
+
+ // Display a description
+?>
+ <p>
+ <?php echo elgg_echo('notifications:subscriptions:description'); ?>
+ </p>
+<?php
+
+ // Get the friends picker and load it with our people subscriptions
+ echo elgg_view('friends/picker',array(
+ 'internalname' => 'subscriptions',
+ 'entities' => get_user_friends($vars['user']->guid,'',9999,0),
+ 'value' => $people,
+ 'formtarget' => $vars['url'] . 'action/notificationsettings/save'
+ ));
+
+?>
\ No newline at end of file |