aboutsummaryrefslogtreecommitdiff
path: root/views/default/bulk_user_admin
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-03-15 14:48:09 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-03-15 14:48:09 -0300
commitbd1864363fada1c3122b053b83c4d8b9526bbfa3 (patch)
treed9384adec24d864e71c169f3b52605a53228e02c /views/default/bulk_user_admin
downloadelgg-bd1864363fada1c3122b053b83c4d8b9526bbfa3.tar.gz
elgg-bd1864363fada1c3122b053b83c4d8b9526bbfa3.tar.bz2
Squashed 'mod/bulk_user_admin/' content from commit 17664c9
git-subtree-dir: mod/bulk_user_admin git-subtree-split: 17664c9c5af5ee2d74b7c378ccc52ee65074ad6c
Diffstat (limited to 'views/default/bulk_user_admin')
-rw-r--r--views/default/bulk_user_admin/css.php26
-rw-r--r--views/default/bulk_user_admin/email_domain_stats.php49
-rw-r--r--views/default/bulk_user_admin/search_by_domain.php16
-rw-r--r--views/default/bulk_user_admin/user.php49
4 files changed, 140 insertions, 0 deletions
diff --git a/views/default/bulk_user_admin/css.php b/views/default/bulk_user_admin/css.php
new file mode 100644
index 000000000..3254c1700
--- /dev/null
+++ b/views/default/bulk_user_admin/css.php
@@ -0,0 +1,26 @@
+
+table.bulk_user_admin_email_domains {
+ width: 300px;
+}
+
+table.bulk_user_admin_email_domains th {
+ text-align: center;
+ font-weight: bold;
+ font-size: 125%;
+}
+
+table.bulk_user_admin_email_domains td {
+ padding: 3px;
+}
+
+table.bulk_user_admin_email_domains td.center {
+ text-align: center;
+}
+
+table.bulk_user_admin_email_domains tr.odd {
+ background-color: #fff;
+}
+
+table.bulk_user_admin_email_domains tr.even {
+ background-color: #dedede;
+} \ No newline at end of file
diff --git a/views/default/bulk_user_admin/email_domain_stats.php b/views/default/bulk_user_admin/email_domain_stats.php
new file mode 100644
index 000000000..3936eb0ea
--- /dev/null
+++ b/views/default/bulk_user_admin/email_domain_stats.php
@@ -0,0 +1,49 @@
+<?php
+
+$domains = $vars['domains'];
+
+?>
+<table class="bulk_user_admin_email_domains">
+ <tr>
+ <th>Domain</th>
+ <th>Registered users</th>
+ </tr>
+<?php
+
+
+$i = 0;
+foreach ($domains as $domain_info) {
+ if (!$domain_info->domain) {
+ continue;
+ }
+
+ $domain = elgg_view('output/url', array(
+ 'text' => $domain_info->domain,
+ 'href' => $domain_info->domain
+ ));
+
+ $url = elgg_http_add_url_query_elements($vars['url'] . 'admin/user', array('domain' => $domain_info->domain));
+
+ // can't use $_GET variables in admin
+ // otherwise admin_page_handler() tries to call the view: view/name?variable=value
+ // which clearly doesn't work
+ // so we'll pass the domain via post
+ $users = '<form id="domain:' . $domain_info->domain . '" action="' . elgg_get_site_url() . 'admin/user" method="post">';
+ $users .= elgg_view('input/hidden', array('name' => 'domain', 'value' => $domain_info->domain));
+ $users .= '</form>';
+ $users .= '<a href="javascript:document.forms[\'domain:' . $domain_info->domain . '\'].submit();">' . $domain_info->count . '</a>';
+
+ $class = ($i % 2) ? 'odd' : 'even';
+
+ echo <<<___HTML
+ <tr class="$class">
+ <td>$domain</td>
+ <td class="center">$users</td>
+ </tr>
+___HTML;
+
+ $i++;
+}
+
+?>
+</table> \ No newline at end of file
diff --git a/views/default/bulk_user_admin/search_by_domain.php b/views/default/bulk_user_admin/search_by_domain.php
new file mode 100644
index 000000000..5c65a3903
--- /dev/null
+++ b/views/default/bulk_user_admin/search_by_domain.php
@@ -0,0 +1,16 @@
+<?php
+/**
+ * Search by email domain
+ */
+?>
+<div id="search-box">
+ <form action="<?php echo current_page_url() ?>" method="get">
+ <b>Search by email domain</b>
+ <?php
+
+ echo elgg_view('input/text', array('name' => 'domain'));
+
+ ?>
+ <input type="submit" value="Search by domain" />
+ </form>
+</div>
diff --git a/views/default/bulk_user_admin/user.php b/views/default/bulk_user_admin/user.php
new file mode 100644
index 000000000..d05d92fd3
--- /dev/null
+++ b/views/default/bulk_user_admin/user.php
@@ -0,0 +1,49 @@
+<?php
+/**
+ * Show a user for bulk actions. Includes a checkbox on the left.
+ */
+if($vars['entity'] instanceof ElggUser){
+$icon = elgg_view_entity_icon($vars['entity'], 'small');
+
+$banned = $vars['entity']->isBanned();
+$user = $vars['entity'];
+
+$checkbox = "<input type=\"checkbox\" name=\"bulk_user_admin_guids[]\" value=\"$user->guid\">";
+$first_login = elgg_view_friendly_time($user->time_created);
+$last_login = elgg_view_friendly_time($user->last_login);
+$last_action = elgg_view_friendly_time($user->last_action);
+$objects = elgg_get_entities(array(
+ 'owner_guid' => $user->guid,
+ 'count' => true
+));
+
+$db_prefix = elgg_get_config('dbprefix');
+
+$q = "SELECT COUNT(id) as count FROM {$db_prefix}annotations WHERE owner_guid = $user->guid";
+$data = get_data($q);
+$annotations = (int) $data[0]->count;
+
+$q = "SELECT COUNT(id) as count FROM {$db_prefix}metadata WHERE owner_guid = $user->guid";
+$data = get_data($q);
+$metadata = (int) $data[0]->count;
+
+// the CSS for classless <label> is really, really annoying.
+$info = <<<___HTML
+<label style="font-size: inherit; font-weight: inherit; color: inherit;">
+<p>$checkbox $user->name | $user->username | $user->email | $user->guid </p>
+<p>Last login: $last_login | First login: $first_login | Last action: $last_action</p>
+<p>Objects: $objects | Annotations: $annotations | Metadata: $metadata</p>
+___HTML;
+
+if ($banned) {
+ $info .= '<div id="profile_banned">';
+ $info .= elgg_echo('profile:banned');
+ $info .= '<br />';
+ $info .= $user->ban_reason;
+ $info .= '</div>';
+}
+
+$info .= '</label>';
+
+echo elgg_view('page/components/image_block', array('image' => $icon, 'body' => $info));
+} \ No newline at end of file