diff options
Diffstat (limited to 'mod/notifications/views')
9 files changed, 378 insertions, 315 deletions
diff --git a/mod/notifications/views/default/forms/notificationsettings/groupsave.php b/mod/notifications/views/default/forms/notificationsettings/groupsave.php new file mode 100644 index 000000000..f3e5f693a --- /dev/null +++ b/mod/notifications/views/default/forms/notificationsettings/groupsave.php @@ -0,0 +1,111 @@ +<?php +/** + * 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' => $user->guid, + 'type' => 'group', + 'limit' => false, + )); + $tmparray = array(); + if ($subsbig[$method]) { + foreach($subsbig[$method] as $tmpent) { + $tmparray[] = $tmpent->guid; + } + } + $subsbig[$method] = $tmparray; +} + +?> + +<div class="elgg-module elgg-module-info"> + <div class="elgg-body"> + <?php + echo elgg_view('notifications/subscriptions/jsfuncs',$vars); + ?> + <div> + <?php + echo elgg_echo('notifications:subscriptions:groups:description'); + ?> + </div> +<?php + +if (isset($vars['groups']) && !empty($vars['groups'])) { + +?> + <table id="notificationstable" cellspacing="0" cellpadding="4" width="100%"> + <tr> + <td> </td> +<?php + + $i = 0; + foreach($NOTIFICATION_HANDLERS as $method => $foo) { + if ($i > 0) { + echo "<td class='spacercolumn'> </td>"; + } +?> + <td class="<?php echo $method; ?>togglefield"><?php echo elgg_echo('notification:method:'.$method); ?></td> +<?php + $i++; + } +?> + <td> </td> + </tr> +<?php + foreach($vars['groups'] as $group) { + + $fields = ''; + $i = 0; + + foreach($NOTIFICATION_HANDLERS as $method => $foo) { + if (in_array($group->guid,$subsbig[$method])) { + $checked[$method] = 'checked="checked"'; + } else { + $checked[$method] = ''; + } + if ($i > 0) { + $fields .= "<td class=\"spacercolumn\"> </td>"; + } + $fields .= <<< END + <td class="{$method}togglefield"> + <a border="0" id="{$method}{$group->guid}" class="{$method}toggleOff" onclick="adjust{$method}_alt('{$method}{$group->guid}');"> + <input type="checkbox" name="{$method}subscriptions[]" id="{$method}checkbox" onclick="adjust{$method}('{$method}{$group->guid}');" value="{$group->guid}" {$checked[$method]} /></a></td> +END; + $i++; + } + +?> + <tr> + <td class="namefield"> + <div> + <?php echo $group->name; ?> + </div> + </td> + <?php echo $fields; ?> + <td> </td> + </tr> +<?php + } +?> + </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>'; + +?> + </div> +</div> diff --git a/mod/notifications/views/default/forms/notificationsettings/save.php b/mod/notifications/views/default/forms/notificationsettings/save.php new file mode 100644 index 000000000..9470256ca --- /dev/null +++ b/mod/notifications/views/default/forms/notificationsettings/save.php @@ -0,0 +1,21 @@ +<?php +/** + * Personal notifications form body + * + * @uses $vars['user'] ElggUser + */ + +/* @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/css.php b/mod/notifications/views/default/notifications/css.php index bd6067c85..385c55b0b 100644 --- a/mod/notifications/views/default/notifications/css.php +++ b/mod/notifications/views/default/notifications/css.php @@ -3,10 +3,6 @@ * Elgg notifications CSS * * @package notifications - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.org/ */ ?> @@ -70,16 +66,16 @@ outline: none; } #notificationstable td.emailtogglefield a.emailtoggleOff { - background: url(<?php echo $vars['url']; ?>mod/notifications/graphics/icon_notifications_email.gif) no-repeat right 2px; + background: url(<?php echo elgg_get_site_url(); ?>mod/notifications/graphics/icon_notifications_email.gif) no-repeat right 2px; } #notificationstable td.emailtogglefield a.emailtoggleOn { - background: url(<?php echo $vars['url']; ?>mod/notifications/graphics/icon_notifications_email.gif) no-repeat right -36px; + background: url(<?php echo elgg_get_site_url(); ?>mod/notifications/graphics/icon_notifications_email.gif) no-repeat right -36px; } #notificationstable td.sitetogglefield a.sitetoggleOff { - background: url(<?php echo $vars['url']; ?>mod/notifications/graphics/icon_notifications_site.gif) no-repeat right 2px; + background: url(<?php echo elgg_get_site_url(); ?>mod/notifications/graphics/icon_notifications_site.gif) no-repeat right 2px; } #notificationstable td.sitetogglefield a.sitetoggleOn { - background: url(<?php echo $vars['url']; ?>mod/notifications/graphics/icon_notifications_site.gif) no-repeat right -37px; + background: url(<?php echo elgg_get_site_url(); ?>mod/notifications/graphics/icon_notifications_site.gif) no-repeat right -37px; } .notification_friends, .notification_personal, diff --git a/mod/notifications/views/default/notifications/subscriptions/collections.php b/mod/notifications/views/default/notifications/subscriptions/collections.php index 87906bf76..207b2e3b9 100644 --- a/mod/notifications/views/default/notifications/subscriptions/collections.php +++ b/mod/notifications/views/default/notifications/subscriptions/collections.php @@ -1,143 +1,164 @@ +<?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) { for ( var i in members ) { var checked = $('#' + method + 'collections' + id).children("INPUT[type='checkbox']").attr('checked'); if ($("#"+method+members[i]).children("INPUT[type='checkbox']").attr('checked') != checked) { - $("#"+method+members[i]).children("INPUT[type='checkbox']").attr('checked', checked); - functioncall = 'adjust' + method + '_alt("'+method+members[i]+'");'; - eval(functioncall); - } + $("#"+method+members[i]).children("INPUT[type='checkbox']").attr('checked', checked); + functioncall = 'adjust' + method + '_alt("'+method+members[i]+'");'; + eval(functioncall); + } } } </script> -<div class="notification_friends"> -<h3> - <?php echo elgg_echo('notifications:subscriptions:collections:title'); ?> -</h3> -<p class="margin_none"> - <?php echo elgg_echo('notifications:subscriptions:collections:description'); ?> +<div class="elgg-module elgg-module-info"> + <div class="elgg-head"> + <h3> + <?php echo elgg_echo('notifications:subscriptions:friends:title'); ?> + </h3> + </div> +<p class="margin-none"> + <?php echo elgg_echo('notifications:subscriptions:friends:description'); ?> </p> -<table id="notificationstable" cellspacing="0" cellpadding="4" border="0" width="100%"> - <tr> - <td> </td> +<table id="notificationstable" cellspacing="0" cellpadding="4" width="100%"> + <tr> + <td> </td> <?php $i = 0; global $NOTIFICATION_HANDLERS; foreach($NOTIFICATION_HANDLERS as $method => $foo) { - if ($i > 0) + if ($i > 0) { echo "<td class='spacercolumn'> </td>"; + } ?> <td class="<?php echo $method; ?>togglefield"><?php echo elgg_echo('notification:method:'.$method); ?></td> <?php $i++; } ?> - <td> </td> - </tr> + <td> </td> + </tr> <?php - $members = array(); - if ($friends = get_user_friends($vars['user']->guid,'',9999,0)) { - foreach($friends as $friend) - $members[] = $friend->guid; + $members = array(); + if ($friends = get_user_friends($user->guid, '', 9999, 0)) { + foreach($friends as $friend) { + $members[] = $friend->guid; } - $memberno = sizeof($members); - $members = implode(',',$members); + } + $memberno = sizeof($members); + $members = implode(',',$members); ?> - <tr> - <td class="namefield"> - <p> - <?php echo elgg_echo('friends:all'); ?> (<?php echo $memberno; ?>) - </p> - </td> + <tr> + <td class="namefield"> + <p> + <?php echo elgg_echo('friends:all'); ?> (<?php echo $memberno; ?>) + </p> + </td> <?php - $fields = ''; - $i = 0; - foreach($NOTIFICATION_HANDLERS as $method => $foo) { - $metaname = 'collections_notifications_preferences_' . $method; - if ($collections_preferences = $vars['user']->$metaname) { - if (!empty($collections_preferences) && !is_array($collections_preferences)) - $collections_preferences = array($collections_preferences); - if (is_array($collections_preferences)) + $fields = ''; + $i = 0; + foreach($NOTIFICATION_HANDLERS as $method => $foo) { + $metaname = 'collections_notifications_preferences_' . $method; + if ($collections_preferences = $user->$metaname) { + if (!empty($collections_preferences) && !is_array($collections_preferences)) { + $collections_preferences = array($collections_preferences); + } + if (is_array($collections_preferences)) { if (in_array(-1,$collections_preferences)) { $collectionschecked[$method] = 'checked="checked"'; } else { $collectionschecked[$method] = ''; } } - if ($i > 0) $fields .= "<td class='spacercolumn'> </td>"; - $fields .= <<< END - <td class="{$method}togglefield"> - <a border="0" id="{$method}collections-1" class="{$method}toggleOff" onclick="adjust{$method}_alt('{$method}collections-1'); setCollection([{$members}],'{$method}',-1);"> - <input type="checkbox" name="{$method}collections[]" id="{$method}checkbox" onclick="adjust{$method}('{$method}collections-1');" value="-1" {$collectionschecked[$method]} /></a></td> -END; - $i++; } - echo $fields; + if ($i > 0) { + $fields .= "<td class='spacercolumn'> </td>"; + } + $fields .= <<< END + <td class="{$method}togglefield"> + <a border="0" id="{$method}collections-1" class="{$method}toggleOff" onclick="adjust{$method}_alt('{$method}collections-1'); setCollection([{$members}],'{$method}',-1);"> + <input type="checkbox" name="{$method}collections[]" id="{$method}checkbox" onclick="adjust{$method}('{$method}collections-1');" value="-1" {$collectionschecked[$method]} /></a></td> +END; + $i++; + } + echo $fields; ?> - <td> </td> - </tr> + <td> </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($vars['user']->guid)) { - foreach($collections as $collection) { - $members = get_members_of_access_collection($collection->id, true); - $memberno = sizeof($members); - $members = implode(',',$members); + + if ($collections = get_user_access_collections($user->guid)) { + foreach ($collections as $collection) { + $members = get_members_of_access_collection($collection->id, true); + $memberno = 0; + if ($members) { + $memberno = sizeof($members); + $members = implode(',', $members); + } else { + $members = ''; + } + ?> - <tr> - <td class="namefield"> - <p> - <?php echo $collection->name; ?> (<?php echo $memberno; ?>) - </p> - - </td> - + <tr> + <td class="namefield"> + <p> + <?php echo $collection->name; ?> (<?php echo $memberno; ?>) + </p> + </td> + <?php - $fields = ''; - $i = 0; - foreach($NOTIFICATION_HANDLERS as $method => $foo) { - $metaname = 'collections_notifications_preferences_' . $method; - if ($collections_preferences = $vars['user']->$metaname) { - if (!empty($collections_preferences) && !is_array($collections_preferences)) - $collections_preferences = array($collections_preferences); - if (is_array($collections_preferences)) - if (in_array($collection->id,$collections_preferences)) { - $collectionschecked[$method] = 'checked="checked"'; - } else { - $collectionschecked[$method] = ''; + $fields = ''; + $i = 0; + foreach($NOTIFICATION_HANDLERS as $method => $foo) { + $metaname = 'collections_notifications_preferences_' . $method; + if ($collections_preferences = $user->$metaname) { + if (!empty($collections_preferences) && !is_array($collections_preferences)) { + $collections_preferences = array($collections_preferences); + } + if (is_array($collections_preferences)) { + if (in_array($collection->id,$collections_preferences)) { + $collectionschecked[$method] = 'checked="checked"'; + } else { + $collectionschecked[$method] = ''; + } + } } - } - if ($i > 0) $fields .= "<td class='spacercolumn'> </td>"; - $fields .= <<< END - <td class="{$method}togglefield"> - <a border="0" id="{$method}collections{$collection->id}" class="{$method}toggleOff" onclick="adjust{$method}_alt('{$method}collections{$collection->id}'); setCollection([{$members}],'{$method}',{$collection->id});"> - <input type="checkbox" name="{$method}collections[]" id="{$method}checkbox" onclick="adjust{$method}('{$method}collections{$collection->id}');" value="{$collection->id}" {$collectionschecked[$method]} /></a></td> + if ($i > 0) { + $fields .= "<td class='spacercolumn'> </td>"; + } + $fields .= <<< END + <td class="{$method}togglefield"> + <a border="0" id="{$method}collections{$collection->id}" class="{$method}toggleOff" onclick="adjust{$method}_alt('{$method}collections{$collection->id}'); setCollection([{$members}],'{$method}',{$collection->id});"> + <input type="checkbox" name="{$method}collections[]" id="{$method}checkbox" onclick="adjust{$method}('{$method}collections{$collection->id}');" value="{$collection->id}" {$collectionschecked[$method]} /></a></td> END; - $i++; - } - echo $fields; + $i++; + } + echo $fields; ?> - - <td> </td> - </tr> + + <td> </td> + </tr> <?php + } } -} -*/ ?> </table> </div> diff --git a/mod/notifications/views/default/notifications/subscriptions/form.php b/mod/notifications/views/default/notifications/subscriptions/form.php index 8ad0110bf..559354eff 100644 --- a/mod/notifications/views/default/notifications/subscriptions/form.php +++ b/mod/notifications/views/default/notifications/subscriptions/form.php @@ -1,33 +1,12 @@ <?php +/** + * Elgg personal notifications + * + * @uses $vars['user'] ElggUser that owns the notification settings + */ - /** - * Elgg SMS Client - * - * @package ElggSMS - * @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/ - */ +// @todo is this a view for extensions? +echo elgg_view('subscriptions/form/additions', $vars); - - // Echo title - echo elgg_view_title(elgg_echo('notifications:subscriptions:changesettings')); - - echo elgg_view('subscriptions/form/additions',$vars); - - // Display a description -?> -<div class="user_settings notifications"> -<?php - - echo elgg_view('input/form',array( - 'body' => elgg_view('notifications/subscriptions/personal') . - elgg_view('notifications/subscriptions/collections') . - elgg_view('notifications/subscriptions/forminternals'), - 'method' => 'post', - 'action' => $vars['url'] . 'action/notificationsettings/save', - )); - -?> -</div> +$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 113d4b0fa..79a7959ac 100644 --- a/mod/notifications/views/default/notifications/subscriptions/forminternals.php +++ b/mod/notifications/views/default/notifications/subscriptions/forminternals.php @@ -1,19 +1,39 @@ +<?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="notifications_per_user"> - <h3> - <?php echo elgg_echo('notifications:subscriptions:title'); ?> - </h3> +?> +<div class="elgg-module elgg-module-info"> + <div class="elgg-head"> + <h3> + <?php echo elgg_echo('notifications:subscriptions:title'); ?> + </h3> + </div> <p> <?php echo elgg_echo('notifications:subscriptions:description'); ?> </p> <?php // Get friends and subscriptions -$friends = get_user_friends($vars['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' => $vars['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(); @@ -30,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 @@ -78,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 = "*"; @@ -88,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; } } @@ -96,7 +116,7 @@ if (!$callback) { ?> -<div class="friends_picker"> +<div class="friends-picker-main-wrapper"> <?php @@ -106,7 +126,7 @@ if (!$callback) { ?> - <div id="friends_picker_placeholder<?php echo $friendspicker; ?>"> + <div id="friends-picker_placeholder<?php echo $friendspicker; ?>"> <?php @@ -116,7 +136,7 @@ if (!isset($vars['replacement'])) { if ($formtarget) { ?> - +<?php //@todo JS 1.8: no ?> <script language="text/javascript"> $(function() { // onload...do $('#collectionMembersForm<?php echo $friendspicker; ?>').submit(function() { @@ -131,13 +151,13 @@ if (!isset($vars['replacement'])) { data: inputs.join('&'), url: this.action, success: function(){ - $('a.collectionmembers<?php echo $friendspicker; ?>').click(); - } + $('a.collectionmembers<?php echo $friendspicker; ?>').click(); + } }); return false; - }) - }) + }) + }) </script> @@ -149,9 +169,9 @@ if (!isset($vars['replacement'])) { ?> - <div class="friends_picker_wrapper"> - <div id="friends_picker<?php echo $friendspicker; ?>"> - <div class="friends_picker_container"> + <div class="friends-picker-wrapper"> + <div id="friends-picker<?php echo $friendspicker; ?>"> + <div class="friends-picker-container"> <?php // Initialise letters @@ -171,8 +191,8 @@ if (!isset($vars['replacement'])) { ?> <table id="notificationstable" cellspacing="0" cellpadding="4" border="0" width="100%"> - <tr> - <td> </td> +<tr> + <td> </td> <?php $i = 0; foreach($NOTIFICATION_HANDLERS as $method => $foo) { @@ -185,8 +205,8 @@ if (!isset($vars['replacement'])) { $i++; } ?> - <td> </td> - </tr> + <td> </td> +</tr> <?php @@ -220,22 +240,22 @@ END; } ?> - <tr> - <td class="namefield"> +<tr> + <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"> <a href="<?php echo $friend->getURL(); ?>"><?php echo $friend->name ?></a> </p> </td> - + <?php echo $fields; ?> - - <td> </td> - </tr> + +<td> </td> +</tr> <?php @@ -286,13 +306,13 @@ if (!$callback) { <?php if (!isset($vars['replacement'])) { ?> - +<?php //@todo JS 1.8: no ?> <script type="text/javascript"> // initialise picker - $("div#friends_picker<?php echo $friendspicker; ?>").friendsPicker(<?php echo $friendspicker; ?>); + $("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) { @@ -300,7 +320,7 @@ if (!isset($vars['replacement'])) { foreach($activeletters as $letter) { $tab = elgg_strpos($chararray, $letter) + 1; ?> - $("div#friends_picker_navigation<?php echo $friendspicker; ?> li.tab<?php echo $tab; ?> a").addClass("tabHasContent"); + $("div#friends-picker-navigation<?php echo $friendspicker; ?> li.tab<?php echo $tab; ?> a").addClass("tabHasContent"); <?php } } @@ -314,8 +334,4 @@ if (!isset($vars['replacement'])) { } ?> - -<div class="divider"> - <input type="submit" value="<?php echo elgg_echo('save'); ?>" /> -</div> </div> diff --git a/mod/notifications/views/default/notifications/subscriptions/groupsform.php b/mod/notifications/views/default/notifications/subscriptions/groupsform.php index 4beefb943..f1dbdcff8 100644 --- a/mod/notifications/views/default/notifications/subscriptions/groupsform.php +++ b/mod/notifications/views/default/notifications/subscriptions/groupsform.php @@ -1,95 +1,4 @@ -<?php +<?php - global $NOTIFICATION_HANDLERS; - foreach($NOTIFICATION_HANDLERS as $method => $foo) { - $subsbig[$method] = elgg_get_entities_from_relationship(array('relationship' => 'notify' . $method, 'relationship_guid' => $vars['user']->guid, 'types' => 'group', 'limit' => 99999)); - $tmparray = array(); - if ($subsbig[$method]) { - foreach($subsbig[$method] as $tmpent) { - $tmparray[] = $tmpent->guid; - } - } - $subsbig[$method] = $tmparray; - } - -echo elgg_view_title(elgg_echo('notifications:subscriptions:changesettings:groups')); ?> -<div class="notification_groups margin_top"> - <?php - echo elgg_view('notifications/subscriptions/jsfuncs',$vars); - ?> - - <p> - <?php - - echo elgg_echo('notifications:subscriptions:groups:description'); - - ?> - </p> -<?php - - if (isset($vars['groups']) && !empty($vars['groups'])) { - -?> -<table id="notificationstable" cellspacing="0" cellpadding="4" border="0" width="100%"> - <tr> - <td> </td> -<?php - global $NOTIFICATION_HANDLERS; - $i = 0; - foreach($NOTIFICATION_HANDLERS as $method => $foo) { - if ($i > 0) - echo "<td class='spacercolumn'> </td>"; -?> - <td class="<?php echo $method; ?>togglefield"><?php echo elgg_echo('notification:method:'.$method); ?></td> -<?php - $i++; - } -?> - <td> </td> - </tr> -<?php - foreach($vars['groups'] as $group) { - - $fields = ''; - $i = 0; - - foreach($NOTIFICATION_HANDLERS as $method => $foo) { - if (in_array($group->guid,$subsbig[$method])) { - $checked[$method] = 'checked="checked"'; - } else { - $checked[$method] = ''; - } - if ($i > 0) $fields .= "<td class=\"spacercolumn\"> </td>"; - $fields .= <<< END - <td class="{$method}togglefield"> - <a border="0" id="{$method}{$group->guid}" class="{$method}toggleOff" onclick="adjust{$method}_alt('{$method}{$group->guid}');"> - <input type="checkbox" name="{$method}subscriptions[]" id="{$method}checkbox" onclick="adjust{$method}('{$method}{$group->guid}');" value="{$group->guid}" {$checked[$method]} /></a></td> -END; - $i++; - } - -?> - <tr> - <td class="namefield"> - <p> - <?php echo $group->name; ?> - </p> - </td> -<?php - echo $fields; -?> - <td> </td> - </tr> -<?php - - - } -?> -</table> -<?php - } - -?> - - <input type="submit" value="<?php echo elgg_echo('save'); ?>" /> -</div>
\ No newline at end of file +elgg_deprecated_notice("notifications/subscriptions/groupsform was moved to forms/notificationsettings/groupsave", 1.8); +echo elgg_view('forms/notificationsettings/groupsave');
\ No newline at end of file diff --git a/mod/notifications/views/default/notifications/subscriptions/jsfuncs.php b/mod/notifications/views/default/notifications/subscriptions/jsfuncs.php index da1598dae..ace622581 100644 --- a/mod/notifications/views/default/notifications/subscriptions/jsfuncs.php +++ b/mod/notifications/views/default/notifications/subscriptions/jsfuncs.php @@ -1,21 +1,21 @@ <?php - global $NOTIFICATION_HANDLERS; +global $NOTIFICATION_HANDLERS; ?> - +<?php //@todo JS 1.8: no ?> <script type="text/javascript"> $(document).ready(function () { <?php - foreach($NOTIFICATION_HANDLERS as $method => $foo) { +foreach($NOTIFICATION_HANDLERS as $method => $foo) { ?> $('input[type=checkbox]:checked').parent("a.<?php echo $method; ?>toggleOff").each(function(){ $(this).removeClass('<?php echo $method; ?>toggleOff').addClass('<?php echo $method; ?>toggleOn'); }); <?php - } +} ?> }); @@ -23,7 +23,7 @@ $(document).ready(function () { clickflag = 0; <?php - foreach($NOTIFICATION_HANDLERS as $method => $foo) { +foreach($NOTIFICATION_HANDLERS as $method => $foo) { ?> function adjust<?php echo $method; ?>(linkId) { var obj = $(this).prev("a"); @@ -48,7 +48,7 @@ function adjust<?php echo $method; ?>_alt(linkId) { return false; } <?php - } +} ?> </script>
\ No newline at end of file diff --git a/mod/notifications/views/default/notifications/subscriptions/personal.php b/mod/notifications/views/default/notifications/subscriptions/personal.php index d8ce0e97e..cf05426e2 100644 --- a/mod/notifications/views/default/notifications/subscriptions/personal.php +++ b/mod/notifications/views/default/notifications/subscriptions/personal.php @@ -1,63 +1,73 @@ <?php +/** + * @uses $vars['user'] ElggUser + */ - global $NOTIFICATION_HANDLERS; +/* @var ElggUser $user */ +$user = $vars['user']; + +global $NOTIFICATION_HANDLERS; ?> <div class="notification_personal"> -<div class="notification_methods"> - <h3> - <?php echo elgg_echo('notifications:subscriptions:personal:title'); ?> - </h3> +<div class="elgg-module elgg-module-info"> + <div class="elgg-head"> + <h3> + <?php echo elgg_echo('notifications:subscriptions:personal:title'); ?> + </h3> + </div> </div> -<table id="notificationstable" cellspacing="0" cellpadding="4" border="0" width="100%"> - <tr> - <td> </td> +<table id="notificationstable" cellspacing="0" cellpadding="4" width="100%"> + <tr> + <td> </td> <?php - $i = 0; - foreach($NOTIFICATION_HANDLERS as $method => $foo) { - if ($i > 0) - echo "<td class='spacercolumn'> </td>"; +$i = 0; +foreach($NOTIFICATION_HANDLERS as $method => $foo) { + if ($i > 0) { + echo "<td class='spacercolumn'> </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++; - } + $i++; +} ?> - <td> </td> - </tr> - <tr> - <td class="namefield"> - <p> - <?php echo elgg_echo('notifications:subscriptions:personal:description') ?> - </p> - - </td> - + <td> </td> + </tr> + <tr> + <td class="namefield"> + <p> + <?php echo elgg_echo('notifications:subscriptions:personal:description') ?> + </p> + </td> + <?php - $fields = ''; - $i = 0; - foreach($NOTIFICATION_HANDLERS as $method => $foo) { - if ($notification_settings = get_user_notification_settings($vars['user']->guid)) { - if ($notification_settings->$method) { - $personalchecked[$method] = 'checked="checked"'; - } else { - $personalchecked[$method] = ''; - } - } - if ($i > 0) $fields .= "<td class='spacercolumn'> </td>"; - $fields .= <<< END - <td class="{$method}togglefield"> - <a border="0" id="{$method}personal" class="{$method}toggleOff" onclick="adjust{$method}_alt('{$method}personal');"> - <input type="checkbox" name="{$method}personal" id="{$method}checkbox" onclick="adjust{$method}('{$method}personal');" value="1" {$personalchecked[$method]} /></a></td> -END; - $i++; +$fields = ''; +$i = 0; +foreach($NOTIFICATION_HANDLERS as $method => $foo) { + if ($notification_settings = get_user_notification_settings($user->guid)) { + if ($notification_settings->$method) { + $personalchecked[$method] = 'checked="checked"'; + } else { + $personalchecked[$method] = ''; } - echo $fields; + } + if ($i > 0) { + $fields .= "<td class='spacercolumn'> </td>"; + } + $fields .= <<< END + <td class="{$method}togglefield"> + <a border="0" id="{$method}personal" class="{$method}toggleOff" onclick="adjust{$method}_alt('{$method}personal');"> + <input type="checkbox" name="{$method}personal" id="{$method}checkbox" onclick="adjust{$method}('{$method}personal');" value="1" {$personalchecked[$method]} /></a></td> +END; + $i++; +} +echo $fields; ?> - - <td> </td> - </tr> + + <td> </td> + </tr> </table> </div>
\ No newline at end of file |
