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.php9
-rw-r--r--mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php112
-rw-r--r--mod/uservalidationbyemail/views/default/uservalidationbyemail/css.php12
-rw-r--r--mod/uservalidationbyemail/views/default/uservalidationbyemail/js.php28
-rw-r--r--mod/uservalidationbyemail/views/default/uservalidationbyemail/unvalidated_user.php50
5 files changed, 211 insertions, 0 deletions
diff --git a/mod/uservalidationbyemail/views/default/admin/users/unvalidated.php b/mod/uservalidationbyemail/views/default/admin/users/unvalidated.php
new file mode 100644
index 000000000..62a35d0bb
--- /dev/null
+++ b/mod/uservalidationbyemail/views/default/admin/users/unvalidated.php
@@ -0,0 +1,9 @@
+<?php
+/**
+ * List of unvalidated users
+ */
+
+echo elgg_view_form('uservalidationbyemail/bulk_action', array(
+ 'id' => 'uservalidationbyemail-form',
+ '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
new file mode 100644
index 000000000..9199922d6
--- /dev/null
+++ b/mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php
@@ -0,0 +1,112 @@
+<?php
+/**
+ * Admin area to view, validate, resend validation email, or delete unvalidated users.
+ *
+ * @package Elgg.Core.Plugin
+ * @subpackage UserValidationByEmail.Administration
+ */
+
+$limit = get_input('limit', 10);
+$offset = get_input('offset', 0);
+
+// can't use elgg_list_entities() and friends because we don't use the default view for users.
+$ia = elgg_set_ignore_access(TRUE);
+$hidden_entities = access_get_show_hidden_status();
+access_show_hidden_entities(TRUE);
+
+$options = array(
+ 'type' => 'user',
+ 'wheres' => uservalidationbyemail_get_unvalidated_users_sql_where(),
+ 'limit' => $limit,
+ 'offset' => $offset,
+ 'count' => TRUE,
+);
+$count = elgg_get_entities($options);
+
+if (!$count) {
+ access_show_hidden_entities($hidden_entities);
+ elgg_set_ignore_access($ia);
+
+ echo elgg_autop(elgg_echo('uservalidationbyemail:admin:no_unvalidated_users'));
+ return TRUE;
+}
+
+$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(
+ 'base_url' => 'admin/users/unvalidated',
+ 'offset' => $offset,
+ 'count' => $count,
+ 'limit' => $limit,
+));
+
+$bulk_actions_checkbox = '<label><input type="checkbox" id="uservalidationbyemail-checkall" />'
+ . elgg_echo('uservalidationbyemail:check_all') . '</label>';
+
+$validate = elgg_view('output/url', array(
+ 'href' => 'action/uservalidationbyemail/validate/',
+ 'text' => elgg_echo('uservalidationbyemail:admin:validate'),
+ 'title' => elgg_echo('uservalidationbyemail:confirm_validate_checked'),
+ 'class' => 'uservalidationbyemail-submit',
+ 'is_action' => true,
+ 'is_trusted' => true,
+));
+
+$resend_email = elgg_view('output/url', array(
+ 'href' => 'action/uservalidationbyemail/resend_validation/',
+ 'text' => elgg_echo('uservalidationbyemail:admin:resend_validation'),
+ 'title' => elgg_echo('uservalidationbyemail:confirm_resend_validation_checked'),
+ 'class' => 'uservalidationbyemail-submit',
+ 'is_action' => true,
+ 'is_trusted' => true,
+));
+
+$delete = elgg_view('output/url', array(
+ 'href' => 'action/uservalidationbyemail/delete/',
+ 'text' => elgg_echo('uservalidationbyemail:admin:delete'),
+ 'title' => elgg_echo('uservalidationbyemail:confirm_delete_checked'),
+ 'class' => 'uservalidationbyemail-submit',
+ 'is_action' => true,
+ 'is_trusted' => true,
+));
+
+$bulk_actions = <<<___END
+ <ul class="elgg-menu elgg-menu-general elgg-menu-hz float-alt">
+ <li>$resend_email</li><li>$validate</li><li>$delete</li>
+ </ul>
+
+ $bulk_actions_checkbox
+___END;
+
+if (is_array($users) && count($users) > 0) {
+ $html = '<ul class="elgg-list elgg-list-distinct">';
+ foreach ($users as $user) {
+ $html .= "<li id=\"unvalidated-user-{$user->guid}\" class=\"elgg-item uservalidationbyemail-unvalidated-user-item\">";
+ $html .= elgg_view('uservalidationbyemail/unvalidated_user', array('user' => $user));
+ $html .= '</li>';
+ }
+ $html .= '</ul>';
+}
+
+echo <<<___END
+<div class="elgg-module elgg-module-inline uservalidation-module">
+ <div class="elgg-head">
+ $bulk_actions
+ </div>
+ <div class="elgg-body">
+ $html
+ </div>
+</div>
+___END;
+
+if ($count > 5) {
+ echo $bulk_actions;
+}
+
+echo $pagination;
diff --git a/mod/uservalidationbyemail/views/default/uservalidationbyemail/css.php b/mod/uservalidationbyemail/views/default/uservalidationbyemail/css.php
new file mode 100644
index 000000000..afe334713
--- /dev/null
+++ b/mod/uservalidationbyemail/views/default/uservalidationbyemail/css.php
@@ -0,0 +1,12 @@
+<?php
+/**
+ * CSS for user validation by email
+ */
+?>
+
+.uservalidation-module > .elgg-head * {
+ color: white;
+}
+.uservalidation-module > .elgg-body * {
+ color: #333;
+} \ 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..948a54651
--- /dev/null
+++ b/mod/uservalidationbyemail/views/default/uservalidationbyemail/js.php
@@ -0,0 +1,28 @@
+
+elgg.provide('elgg.uservalidationbyemail');
+
+elgg.uservalidationbyemail.init = function() {
+ $('#uservalidationbyemail-checkall').click(function() {
+ var checked = $(this).attr('checked') == 'checked';
+ $('#uservalidationbyemail-form .elgg-body').find('input[type=checkbox]').attr('checked', checked);
+ });
+
+ $('.uservalidationbyemail-submit').click(function(event) {
+ var $form = $('#uservalidationbyemail-form');
+ event.preventDefault();
+
+ // check if there are selected users
+ if ($('#uservalidationbyemail-form .elgg-body').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_hook_handler('init', 'system', elgg.uservalidationbyemail.init);
diff --git a/mod/uservalidationbyemail/views/default/uservalidationbyemail/unvalidated_user.php b/mod/uservalidationbyemail/views/default/uservalidationbyemail/unvalidated_user.php
new file mode 100644
index 000000000..5c652a637
--- /dev/null
+++ b/mod/uservalidationbyemail/views/default/uservalidationbyemail/unvalidated_user.php
@@ -0,0 +1,50 @@
+<?php
+/**
+ * Formats and list an unvalidated user.
+ *
+ * @package Elgg.Core.Plugin
+ * @subpackage UserValidationByEmail.Administration
+ */
+
+$user = elgg_extract('user', $vars);
+
+$checkbox = elgg_view('input/checkbox', array(
+ 'name' => 'user_guids[]',
+ 'value' => $user->guid,
+ 'default' => false,
+));
+
+$created = elgg_echo('uservalidationbyemail:admin:user_created', array(elgg_view_friendly_time($user->time_created)));
+
+$validate = elgg_view('output/confirmlink', array(
+ 'confirm' => elgg_echo('uservalidationbyemail:confirm_validate_user', array($user->username)),
+ 'href' => "action/uservalidationbyemail/validate/?user_guids[]=$user->guid",
+ 'text' => elgg_echo('uservalidationbyemail:admin:validate')
+));
+
+$resend_email = elgg_view('output/confirmlink', array(
+ 'confirm' => elgg_echo('uservalidationbyemail:confirm_resend_validation', array($user->username)),
+ 'href' => "action/uservalidationbyemail/resend_validation/?user_guids[]=$user->guid",
+ 'text' => elgg_echo('uservalidationbyemail:admin:resend_validation')
+));
+
+$delete = elgg_view('output/confirmlink', array(
+ 'confirm' => elgg_echo('uservalidationbyemail:confirm_delete', array($user->username)),
+ 'href' => "action/uservalidationbyemail/delete/?user_guids[]=$user->guid",
+ 'text' => elgg_echo('uservalidationbyemail:admin:delete')
+));
+$menu = 'test';
+$block = <<<___END
+ <label>$user->username: "$user->name" &lt;$user->email&gt;</label>
+ <div class="uservalidationbyemail-unvalidated-user-details">
+ $created
+ </div>
+___END;
+
+$menu = <<<__END
+ <ul class="elgg-menu elgg-menu-general elgg-menu-hz float-alt">
+ <li>$resend_email</li><li>$validate</li><li>$delete</li>
+ </ul>
+__END;
+
+echo elgg_view_image_block($checkbox, $block, array('image_alt' => $menu));