aboutsummaryrefslogtreecommitdiff
path: root/mod/notifications/views
diff options
context:
space:
mode:
Diffstat (limited to 'mod/notifications/views')
-rw-r--r--mod/notifications/views/default/forms/notificationsettings/groupsave.php59
-rw-r--r--mod/notifications/views/default/forms/notificationsettings/save.php22
-rw-r--r--mod/notifications/views/default/notifications/subscriptions/collections.php38
-rw-r--r--mod/notifications/views/default/notifications/subscriptions/form.php11
-rw-r--r--mod/notifications/views/default/notifications/subscriptions/forminternals.php46
-rw-r--r--mod/notifications/views/default/notifications/subscriptions/personal.php10
6 files changed, 121 insertions, 65 deletions
diff --git a/mod/notifications/views/default/forms/notificationsettings/groupsave.php b/mod/notifications/views/default/forms/notificationsettings/groupsave.php
index 632e34a54..f3e5f693a 100644
--- a/mod/notifications/views/default/forms/notificationsettings/groupsave.php
+++ b/mod/notifications/views/default/forms/notificationsettings/groupsave.php
@@ -3,11 +3,21 @@
* Elgg notifications groups subscription form
*
* @package ElggNotifications
+ *
+ * @uses $vars['user'] ElggUser
*/
+/* @var ElggUser $user */
+$user = $vars['user'];
+
global $NOTIFICATION_HANDLERS;
-foreach($NOTIFICATION_HANDLERS as $method => $foo) {
- $subsbig[$method] = elgg_get_entities_from_relationship(array('relationship' => 'notify' . $method, 'relationship_guid' => elgg_get_logged_in_user_guid(), 'types' => 'group', 'limit' => 99999));
+foreach ($NOTIFICATION_HANDLERS as $method => $foo) {
+ $subsbig[$method] = elgg_get_entities_from_relationship(array(
+ 'relationship' => 'notify' . $method,
+ 'relationship_guid' => $user->guid,
+ 'type' => 'group',
+ 'limit' => false,
+ ));
$tmparray = array();
if ($subsbig[$method]) {
foreach($subsbig[$method] as $tmpent) {
@@ -24,22 +34,19 @@ foreach($NOTIFICATION_HANDLERS as $method => $foo) {
<?php
echo elgg_view('notifications/subscriptions/jsfuncs',$vars);
?>
-
- <p>
+ <div>
<?php
-
echo elgg_echo('notifications:subscriptions:groups:description');
-
?>
- </p>
+ </div>
<?php
if (isset($vars['groups']) && !empty($vars['groups'])) {
?>
- <table id="notificationstable" cellspacing="0" cellpadding="4" border="0" width="100%">
- <tr>
- <td>&nbsp;</td>
+ <table id="notificationstable" cellspacing="0" cellpadding="4" width="100%">
+ <tr>
+ <td>&nbsp;</td>
<?php
$i = 0;
@@ -48,13 +55,13 @@ if (isset($vars['groups']) && !empty($vars['groups'])) {
echo "<td class='spacercolumn'>&nbsp;</td>";
}
?>
- <td class="<?php echo $method; ?>togglefield"><?php echo elgg_echo('notification:method:'.$method); ?></td>
+ <td class="<?php echo $method; ?>togglefield"><?php echo elgg_echo('notification:method:'.$method); ?></td>
<?php
$i++;
}
?>
- <td>&nbsp;</td>
- </tr>
+ <td>&nbsp;</td>
+ </tr>
<?php
foreach($vars['groups'] as $group) {
@@ -79,24 +86,26 @@ END;
}
?>
- <tr>
- <td class="namefield">
- <p>
+ <tr>
+ <td class="namefield">
+ <div>
<?php echo $group->name; ?>
- </p>
- </td>
-<?php
- echo $fields;
-?>
- <td>&nbsp;</td>
- </tr>
+ </div>
+ </td>
+ <?php echo $fields; ?>
+ <td>&nbsp;</td>
+ </tr>
<?php
}
?>
- </table>
+ </table>
<?php
}
+ echo '<div class="elgg-foot mtm">';
+ echo elgg_view('input/hidden', array('name' => 'guid', 'value' => $user->guid));
+ echo elgg_view('input/submit', array('value' => elgg_echo('save')));
+ echo '</div>';
+
?>
- <input type="submit" value="<?php echo elgg_echo('save'); ?>" />
</div>
</div>
diff --git a/mod/notifications/views/default/forms/notificationsettings/save.php b/mod/notifications/views/default/forms/notificationsettings/save.php
index ec0c9c701..9470256ca 100644
--- a/mod/notifications/views/default/forms/notificationsettings/save.php
+++ b/mod/notifications/views/default/forms/notificationsettings/save.php
@@ -1,5 +1,21 @@
<?php
+/**
+ * Personal notifications form body
+ *
+ * @uses $vars['user'] ElggUser
+ */
-echo elgg_view('notifications/subscriptions/personal');
-echo elgg_view('notifications/subscriptions/collections');
-echo elgg_view('notifications/subscriptions/forminternals'); \ No newline at end of file
+/* @var ElggUser $user */
+$user = $vars['user'];
+
+echo elgg_view('notifications/subscriptions/personal', $vars);
+echo elgg_view('notifications/subscriptions/collections', $vars);
+echo elgg_view('notifications/subscriptions/forminternals', $vars);
+
+?>
+<div class="elgg-foot">
+<?php
+echo elgg_view('input/hidden', array('name' => 'guid', 'value' => $user->guid));
+echo elgg_view('input/submit', array('value' => elgg_echo('save')));
+?>
+</div>
diff --git a/mod/notifications/views/default/notifications/subscriptions/collections.php b/mod/notifications/views/default/notifications/subscriptions/collections.php
index 8daae6f4f..207b2e3b9 100644
--- a/mod/notifications/views/default/notifications/subscriptions/collections.php
+++ b/mod/notifications/views/default/notifications/subscriptions/collections.php
@@ -1,4 +1,12 @@
-<?php //@todo JS 1.8: no ?>
+<?php
+/**
+ * @uses $vars['user'] ElggUser
+ */
+
+/* @var ElggUser $user */
+$user = $vars['user'];
+
+//@todo JS 1.8: no ?>
<script type="text/javascript">
function setCollection(members, method, id) {
@@ -22,7 +30,7 @@
<p class="margin-none">
<?php echo elgg_echo('notifications:subscriptions:friends:description'); ?>
</p>
-<table id="notificationstable" cellspacing="0" cellpadding="4" border="0" width="100%">
+<table id="notificationstable" cellspacing="0" cellpadding="4" width="100%">
<tr>
<td>&nbsp;</td>
<?php
@@ -42,7 +50,7 @@
</tr>
<?php
$members = array();
- if ($friends = get_user_friends(elgg_get_logged_in_user_guid(), '', 9999, 0)) {
+ if ($friends = get_user_friends($user->guid, '', 9999, 0)) {
foreach($friends as $friend) {
$members[] = $friend->guid;
}
@@ -63,7 +71,7 @@
$i = 0;
foreach($NOTIFICATION_HANDLERS as $method => $foo) {
$metaname = 'collections_notifications_preferences_' . $method;
- if ($collections_preferences = elgg_get_logged_in_user_entity()->$metaname) {
+ if ($collections_preferences = $user->$metaname) {
if (!empty($collections_preferences) && !is_array($collections_preferences)) {
$collections_preferences = array($collections_preferences);
}
@@ -91,15 +99,18 @@ END;
<td>&nbsp;</td>
</tr>
<?php
-/*
- @todo
- collections removed from notifications - they are no longer used and will be replaced with shared access collections
-
- if ($collections = get_user_access_collections(elgg_get_logged_in_user_guid())) {
- foreach($collections as $collection) {
+
+ if ($collections = get_user_access_collections($user->guid)) {
+ foreach ($collections as $collection) {
$members = get_members_of_access_collection($collection->id, true);
- $memberno = sizeof($members);
- $members = implode(',', $members);
+ $memberno = 0;
+ if ($members) {
+ $memberno = sizeof($members);
+ $members = implode(',', $members);
+ } else {
+ $members = '';
+ }
+
?>
<tr>
@@ -115,7 +126,7 @@ END;
$i = 0;
foreach($NOTIFICATION_HANDLERS as $method => $foo) {
$metaname = 'collections_notifications_preferences_' . $method;
- if ($collections_preferences = elgg_get_logged_in_user_entity()->$metaname) {
+ if ($collections_preferences = $user->$metaname) {
if (!empty($collections_preferences) && !is_array($collections_preferences)) {
$collections_preferences = array($collections_preferences);
}
@@ -148,7 +159,6 @@ END;
}
}
-*/
?>
</table>
</div>
diff --git a/mod/notifications/views/default/notifications/subscriptions/form.php b/mod/notifications/views/default/notifications/subscriptions/form.php
index 008e98554..559354eff 100644
--- a/mod/notifications/views/default/notifications/subscriptions/form.php
+++ b/mod/notifications/views/default/notifications/subscriptions/form.php
@@ -1,11 +1,12 @@
<?php
/**
* Elgg personal notifications
+ *
+ * @uses $vars['user'] ElggUser that owns the notification settings
*/
-
-echo elgg_view('subscriptions/form/additions',$vars);
-
-// Display a description
+// @todo is this a view for extensions?
+echo elgg_view('subscriptions/form/additions', $vars);
-echo elgg_view_form('notificationsettings/save');
+$form_vars = array('class' => 'elgg-form-alt');
+echo elgg_view_form('notificationsettings/save', $form_vars, $vars);
diff --git a/mod/notifications/views/default/notifications/subscriptions/forminternals.php b/mod/notifications/views/default/notifications/subscriptions/forminternals.php
index 98ca1ccb5..79a7959ac 100644
--- a/mod/notifications/views/default/notifications/subscriptions/forminternals.php
+++ b/mod/notifications/views/default/notifications/subscriptions/forminternals.php
@@ -1,4 +1,17 @@
+<?php
+/**
+ * Hacked up friends picker that needs to be replaced
+ *
+ * @uses $vars['user'] ElggUser
+ */
+
+/* @var ElggUser $user */
+$user = $vars['user'];
+
+elgg_load_js('elgg.friendspicker');
+elgg_load_js('jquery.easing');
+?>
<div class="elgg-module elgg-module-info">
<div class="elgg-head">
<h3>
@@ -11,11 +24,16 @@
<?php
// Get friends and subscriptions
-$friends = get_user_friends(elgg_get_logged_in_user_guid(),'',9999,0);
+$friends = get_user_friends($user->guid, '', 9999, 0);
global $NOTIFICATION_HANDLERS;
foreach($NOTIFICATION_HANDLERS as $method => $foo) {
- $subsbig[$method] = elgg_get_entities_from_relationship(array('relationship' => 'notify' . $method, 'relationship_guid' => elgg_get_logged_in_user_guid(), 'types' => 'user', 'limit' => 99999));
+ $subsbig[$method] = elgg_get_entities_from_relationship(array(
+ 'relationship' => 'notify' . $method,
+ 'relationship_guid' => $user->guid,
+ 'type' => 'user',
+ 'limit' => false,
+ ));
}
$subs = array();
@@ -32,11 +50,11 @@ global $pickerinuse;
$pickerinuse = true;
$chararray = elgg_echo('friendspicker:chararray');
-// Initialise internalname
-if (!isset($vars['internalname'])) {
- $internalname = "friend";
+// Initialise name
+if (!isset($vars['name'])) {
+ $name = "friend";
} else {
- $internalname = $vars['internalname'];
+ $name = $vars['name'];
}
// Initialise values
@@ -80,9 +98,9 @@ if (isset($vars['formtarget'])) {
// Sort users by letter
if (is_array($friends) && sizeof($friends)) {
- foreach($friends as $user) {
+ foreach($friends as $friend) {
- $letter = elgg_substr($user->name,0,1);
+ $letter = elgg_substr($friend->name,0,1);
$letter = elgg_strtoupper($letter);
if (!elgg_substr_count($chararray,$letter)) {
$letter = "*";
@@ -90,7 +108,7 @@ if (is_array($friends) && sizeof($friends)) {
if (!isset($users[$letter])) {
$users[$letter] = array();
}
- $users[$letter][$user->guid] = $user;
+ $users[$letter][$friend->guid] = $friend;
}
}
@@ -98,7 +116,7 @@ if (!$callback) {
?>
-<div class="friends-picker">
+<div class="friends-picker-main-wrapper">
<?php
@@ -226,7 +244,7 @@ END;
<td class="namefield">
<a href="<?php echo $friend->getURL(); ?>">
<?php
- echo elgg_view("profile/icon",array('entity' => $friend, 'size' => 'tiny', 'override' => true));
+ echo elgg_view_entity_icon($friend, 'tiny', array('use_hover' => false));
?>
</a>
<p class="namefieldlink">
@@ -294,7 +312,7 @@ if (!isset($vars['replacement'])) {
$("div#friends-picker<?php echo $friendspicker; ?>").friendsPicker(<?php echo $friendspicker; ?>);
</script>
<script type="text/javascript">
- $(document).ready(function () {
+ $(function () {
// manually add class to corresponding tab for panels that have content
<?php
if (sizeof($activeletters) > 0) {
@@ -316,8 +334,4 @@ if (!isset($vars['replacement'])) {
}
?>
-
- <p class="bta">
- <input type="submit" value="<?php echo elgg_echo('save'); ?>" />
- </p>
</div>
diff --git a/mod/notifications/views/default/notifications/subscriptions/personal.php b/mod/notifications/views/default/notifications/subscriptions/personal.php
index e75bda758..cf05426e2 100644
--- a/mod/notifications/views/default/notifications/subscriptions/personal.php
+++ b/mod/notifications/views/default/notifications/subscriptions/personal.php
@@ -1,4 +1,10 @@
<?php
+/**
+ * @uses $vars['user'] ElggUser
+ */
+
+/* @var ElggUser $user */
+$user = $vars['user'];
global $NOTIFICATION_HANDLERS;
@@ -11,7 +17,7 @@ global $NOTIFICATION_HANDLERS;
</h3>
</div>
</div>
-<table id="notificationstable" cellspacing="0" cellpadding="4" border="0" width="100%">
+<table id="notificationstable" cellspacing="0" cellpadding="4" width="100%">
<tr>
<td>&nbsp;</td>
<?php
@@ -40,7 +46,7 @@ foreach($NOTIFICATION_HANDLERS as $method => $foo) {
$fields = '';
$i = 0;
foreach($NOTIFICATION_HANDLERS as $method => $foo) {
- if ($notification_settings = get_user_notification_settings(elgg_get_logged_in_user_guid())) {
+ if ($notification_settings = get_user_notification_settings($user->guid)) {
if ($notification_settings->$method) {
$personalchecked[$method] = 'checked="checked"';
} else {