31 function form(&$form, &$form_state, $list) {
32 $section = $form_state[
'build_info'][
'args'][2];
34 $listname = $list->admin_name;
37 if (user_access(
'administer mailinglist members')) {
38 if ($section ==
"test") {
42 $progress =
'Progress: ' . $ScanStart .
' : ';
43 $next = $list->parameters[
'ScanNext'];
44 if (is_array($next)) {
45 foreach ($next as $item) {
46 $progress .= (string)$item .
' ';
51 $progress .=
'Cleanup';
53 elseif ($next === FALSE) {
57 $progress .= (string)$next;
60 $form[
'progress'] = array(
'#markup' => $progress .
'<br>');
74 if (!user_access(
'mailinglist ' . $listname .
' member details')
75 or 0 == strlen($section) or $section ==
'test') {
77 $sql =
'SELECT sub_type, COUNT(sub_type) as cnt' .
78 ' FROM {mailinglist_members_subscribers__' . $listname .
'}' .
79 ' WHERE sub_type > 0 GROUP BY sub_type ORDER BY cnt DESC';
80 $result = db_query($sql, array());
82 while ($row = $result -> fetchAssoc()) {
83 $cat = $row[
'sub_type'];
85 $subs[$sub_types[$cat]] = $cnt;
89 $form[
'Member Total'] =
90 array(
'#markup' =>
'Membership Summary: ' . $total .
' Members<br>');
91 $form[
'Sub Types'] = array(
94 array(
'data' => t(
'Subscription Type')),
95 array(
'data' => t(
'Percentage')),
99 foreach ($subs as $type => $cnt) {
100 $form[
'Sub Types'][
'#rows'][$type] = array($type, number_format(100*$cnt/$total, 1) .
'%');
103 $form[
'Domains'] = array(
106 array(
'data' => t(
'Domain')),
107 array(
'data' => t(
'Percentage')),
112 $sql =
'SELECT domain, COUNT(sub_type) as cnt' .
113 ' FROM {mailinglist_members_subscribers__' . $listname .
'}' .
114 ' WHERE sub_type > 0 GROUP BY domain HAVING cnt >= 20 ORDER BY cnt DESC LIMIT 10' ;
115 $result = db_query($sql, array());
117 while ($row = $result -> fetchAssoc()) {
118 $domain = $row[
'domain'];
120 $form[
'Domains'][
'#rows'][$domain] = array($domain, number_format(100*$cnt/$total, 1) .
'%');
126 if (user_access(
'mailinglist ' . $listname .
' member details')) {
129 $base = variable_get(
'mailinglist_base',
'mailinglist');
131 $form[
'details'][
'home'] = array(
'#markup' => l(
'Summary',
"$base/$listname/members") .
' ');
132 $sql =
'SELECT SUBSTRING(email, 1, 1) as c' .
133 ' FROM {mailinglist_members_subscribers__' . $listname .
'}' .
135 $result = db_query($sql, array());
136 while ($row = $result -> fetchAssoc()) {
138 $form[
'details'][
'letters'][$letter] =
139 array(
'#markup' => l($letter,
"$base/$listname/members/$letter") .
' ');
142 if (user_access(
'administer mailinglist members')) {
143 $form[
'details'][
'test'] = array(
'#markup' => l(
'Test',
"$base/$listname/members/test"));
148 if (0 < strlen($section) and $section !=
'test') {
149 $letter = $section[0];
150 $nextletter = $letter .
'zzzzzzzzzzzzzzzzzz';
151 if(strlen($section) >1) {
152 $skip = $chunksize * (int)substr($section, 1);
156 $form[
'details'][
'members'] = array(
159 'email' => array(
'data' => t(
'EMail')),
160 'type' => array(
'data' => t(
'Type')),
161 'moderated' => array(
'data' => t(
'Moderated')),
166 $sql =
'SELECT email, sub_type, moderated, options' .
167 ' FROM {mailinglist_members_subscribers__' . $listname .
'}' .
168 ' WHERE sub_type > 0 and \'' .$letter .
'\' <= email and email < \
'' . $nextletter .
'\'' .
169 ' ORDER BY email ASC';
170 $result = db_query($sql, array());
174 while($row = $result -> fetchAssoc()){
177 $firstname = $row[
'email'];
182 else if($index < $chunksize) {
183 $options = unserialize($row[
'options']);
184 $form[
'details'][
'members'][
'#rows'][$index] = array(
185 'email' => $row[
'email'],
186 'type' => $sub_types[$row[
'sub_type']],
187 'moderated' => $row[
'moderated'] ?
'Moderated' :
'',
189 foreach($options as $key => $value) {
190 $form[
'details'][
'members'][
'#header'][$key] = array(
'data' => t($key));
191 if($value === False) {
194 if($value === True) {
197 $form[
'details'][
'members'][
'#rows'][$index][$key] = $value;
204 if(($skip + $index) % $chunksize == 0) {
205 $form[
'details'][
'index'][$chunk] =
206 array(
'#markup' => l($firstname .
' - ' . $row[
'email'],
207 "$base/$listname/members/$letter$chunk") .
'<br>');
233 function submit(&$form, &$form_state, $list) {
Base Class for Mailinglist extensions.
const MAILINGLIST_SUB_MIME_DIGEST
const MAILINGLIST_SUB_NO
Defines for sub_types (subscription types)
submit(&$form, &$form_state, $list)
Operation page form submission.
Base Class for Mailinglist extensions.
const MAILINGLIST_SUB_NOMAIL
const MAILINGLIST_SUB_DIGEST
form(&$form, &$form_state, $list)
Operation page form generation.
const MAILINGLIST_SUB_INDEX
mailinglist_members_scan($list)
Process a partial scan of members for a mailinglist.
validate(&$form, &$form_state, $list)
Operation page form validation.
const MAILINGLIST_SUB_NORMAL
_mailinglist_datetime_ts($time)
Convert a 'datetime' field into a timestamp.