aboutsummaryrefslogtreecommitdiff
path: root/mod/uservalidationbyemail/views
diff options
context:
space:
mode:
Diffstat (limited to 'mod/uservalidationbyemail/views')
-rw-r--r--mod/uservalidationbyemail/views/default/admin/users/unvalidated.php5
-rw-r--r--mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php92
-rw-r--r--mod/uservalidationbyemail/views/default/uservalidationbyemail/js.php27
-rw-r--r--mod/uservalidationbyemail/views/default/uservalidationbyemail/unvalidated_user.php2
4 files changed, 98 insertions, 28 deletions
diff --git a/mod/uservalidationbyemail/views/default/admin/users/unvalidated.php b/mod/uservalidationbyemail/views/default/admin/users/unvalidated.php
index 0b94ab039..f34447b65 100644
--- a/mod/uservalidationbyemail/views/default/admin/users/unvalidated.php
+++ b/mod/uservalidationbyemail/views/default/admin/users/unvalidated.php
@@ -1,3 +1,6 @@
<?php
-echo elgg_view_form('uservalidationbyemail/bulk_action');
+echo elgg_view_form('uservalidationbyemail/bulk_action', array(
+ 'name' => 'unvalidated-users',
+ 'action' => 'action/uservalidationbyemail/bulk_action'
+));
diff --git a/mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php b/mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php
index d5060d7e5..fb0d9e5b1 100644
--- a/mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php
+++ b/mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php
@@ -16,22 +16,33 @@ access_show_hidden_entities(TRUE);
$options = array(
'type' => 'user',
- 'metadata_name' => 'validated',
- 'metadata_value' => 0,
+ 'wheres' => uservalidationbyemail_get_unvalidated_users_sql_where(),
'limit' => $limit,
- 'offset' => $offset
+ 'offset' => $offset,
+ 'count' => TRUE,
);
-$users = elgg_get_entities_from_metadata($options);
+$count = elgg_get_entities($options);
+
+if (!$count) {
+ access_show_hidden_entities($hidden_entities);
+ elgg_set_ignore_access($ia);
+
+ echo elgg_view('page_elements/contentwrapper', array(
+ 'body' => elgg_echo('uservalidationbyemail:admin:no_unvalidated_users')
+ ));
+ return;
+}
-$options['count'] = TRUE;
-$count = elgg_get_entities_from_metadata($options);
+$options['count'] = FALSE;
+
+$users = elgg_get_entities($options);
access_show_hidden_entities($hidden_entities);
elgg_set_ignore_access($ia);
// setup pagination
-$pagination = elgg_view('navigation/pagination', array(
- 'baseurl' => elgg_get_site_url() . 'pg/admin/users/unvalidated',
+$pagination = elgg_view('navigation/pagination',array(
+ 'baseurl' => $vars['url'] . '/pg/uservalidationbyemail/admin/',
'offset' => $offset,
'count' => $count,
'limit' => $limit,
@@ -39,25 +50,54 @@ $pagination = elgg_view('navigation/pagination', array(
echo $pagination;
-if ($users) {
- foreach ($users as $user) {
- $form_body .= elgg_view('uservalidationbyemail/unvalidated_user', array('theuser' => $user));
- }
-} else {
- echo elgg_echo('uservalidationbyemail:admin:no_unvalidated_users');
- return;
-}
+$bulk_actions_checkbox = '<label><input type="checkbox" class="unvalidated-users-checkall" />'
+ . elgg_echo('uservalidationbyemail:check_all') . '</label>';
+
+$validate = elgg_view('output/url', array(
+ 'is_action' => TRUE,
+ 'js' => 'title="' . elgg_echo('uservalidationbyemail:confirm_validate_checked') . '"',
+ 'href' => $vars['url'] . "action/uservalidationbyemail/validate/",
+ 'text' => elgg_echo('uservalidationbyemail:admin:validate'),
+ 'class' => 'unvalidated-users-bulk-post',
+));
-$form_body .= elgg_echo('uservalidationbyemail:admin:with_checked') . elgg_view('input/dropdown', array(
- 'name' => 'action_type',
- 'options_values' => array(
- 'validate' => elgg_echo('uservalidationbyemail:admin:validate'),
- 'resend_validation' => elgg_echo('uservalidationbyemail:admin:resend_validation'),
- 'delete' => elgg_echo('uservalidationbyemail:admin:delete'),
- ),
- 'value' => 'resend_validation',
+$resend_email = elgg_view('output/url', array(
+ 'is_action' => TRUE,
+ 'js' => 'title="' . elgg_echo('uservalidationbyemail:confirm_resend_validation_checked') . '"',
+ 'href' => $vars['url'] . "action/uservalidationbyemail/resend_validation/",
+ 'text' => elgg_echo('uservalidationbyemail:admin:resend_validation'),
+ 'class' => 'unvalidated-users-bulk-post',
));
-$form_body .= '<br />' . elgg_view('input/submit', array('value' => elgg_echo('submit')));
+$delete = elgg_view('output/url', array(
+ 'is_action' => TRUE,
+ 'js' => 'title="' . elgg_echo('uservalidationbyemail:confirm_delete_checked') . '"',
+ 'href' => $vars['url'] . "action/uservalidationbyemail/delete/",
+ 'text' => elgg_echo('uservalidationbyemail:admin:delete'),
+ 'class' => 'unvalidated-users-bulk-post',
+));
+
+$bulk_actions = <<<___END
+<div class="uvbe_bulk_actions">
+ <div class="uvbe_admin_controls">
+ $resend_email | $validate | $delete
+ </div>
+
+ $bulk_actions_checkbox
+</div>
+___END;
+
+//$bulk_actions = elgg_view('page_elements/contentwrapper', array('body' => $bulk_actions));
+
+echo $bulk_actions;
+
+
+foreach ($users as $user) {
+ echo elgg_view('uservalidationbyemail/unvalidated_user', array('user' => $user));
+}
+
+if ($count > 5) {
+ echo $bulk_actions;
+}
-echo $form_body; \ No newline at end of file
+echo $pagination; \ No newline at end of file
diff --git a/mod/uservalidationbyemail/views/default/uservalidationbyemail/js.php b/mod/uservalidationbyemail/views/default/uservalidationbyemail/js.php
new file mode 100644
index 000000000..c1ca58559
--- /dev/null
+++ b/mod/uservalidationbyemail/views/default/uservalidationbyemail/js.php
@@ -0,0 +1,27 @@
+elgg.provide('elgg.uservalidationbyemail');
+
+elgg.uservalidationbyemail.init = function() {
+ $('.unvalidated-users-checkall').click(function() {
+ checked = $(this).attr('checked');
+ $('form[name=unvalidated-users]').find('input[type=checkbox]').attr('checked', checked);
+ });
+
+ $('.unvalidated-users-bulk-post').click(function(event) {
+ $form = $('form[name=unvalidated-users]');
+ event.preventDefault();
+
+ // check there are selected users
+ if ($form.find('input[type=checkbox]:checked').length < 1) {
+ return false;
+ }
+
+ // confirmation
+ if (!confirm($(this).attr('title'))) {
+ return false;
+ }
+
+ $form.attr('action', $(this).attr('href')).submit();
+ });
+};
+
+elgg.register_event_handler('init', 'system', elgg.uservalidationbyemail.init); \ No newline at end of file
diff --git a/mod/uservalidationbyemail/views/default/uservalidationbyemail/unvalidated_user.php b/mod/uservalidationbyemail/views/default/uservalidationbyemail/unvalidated_user.php
index 295f4170e..209dbe02b 100644
--- a/mod/uservalidationbyemail/views/default/uservalidationbyemail/unvalidated_user.php
+++ b/mod/uservalidationbyemail/views/default/uservalidationbyemail/unvalidated_user.php
@@ -6,7 +6,7 @@
* @subpackage UserValidationByEmail.Administration
*/
-$user = elgg_extract('theuser', $vars);
+$user = elgg_extract('user', $vars);
// doesn't work.
//$checkbox = elgg_view('input/checkboxes', array(