aboutsummaryrefslogtreecommitdiff
path: root/mod/uservalidationbyemail/views/default/forms/uservalidationbyemail/bulk_action.php
blob: 2872b7a0c298fe3248f18ef50e55d0f1dc7c0454 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?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 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(
	'baseurl' => 'admin/users/unvalidated',
	'offset' => $offset,
	'count' => $count,
	'limit' => $limit,
));

echo $pagination;

$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',
));

$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',
));

$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 $pagination;