forked from aadl/sopac
-
Notifications
You must be signed in to change notification settings - Fork 1
/
sopac_admin.php
584 lines (522 loc) · 24 KB
/
sopac_admin.php
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
<?php
/**
* SOPAC is The Social OPAC: a Drupal module that serves as a wholly integrated web OPAC for the Drupal CMS
* This file contains the Drupal include functions for all the SOPAC admin pieces and configuration options
* This file is called via hook_menu
*
* @package SOPAC
* @version 2.1
* @author John Blyberg
*/
/**
* Sets up administrative options for SOPAC and returns a systems settings form
*
* @return string Settings form HTML
*/
function sopac_admin() {
$form = array();
$current_ils = variable_get('sopac_ils', FALSE);
if (!$current_ils) {
$form['starter_instruction'] = array(
'#type' => 'markup',
'#value' => 'Please select your ILS, then submit this form to continue setup.',
);
}
$form['sopac_general'] = array(
'#type' => 'fieldset',
'#title' => t('General Settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['sopac_general']['sopac_ils'] = array(
'#type' => 'select',
'#title' => t('Your ILS name'),
'#default_value' => variable_get('sopac_ils', 'iii'),
'#options' => array('iii' => 'iii', 'koha' => 'koha', 'sirsi' => 'sirsi'),
'#required' => TRUE,
);
// Start admin with only choice of ILS.
if (!$current_ils) {
$form['sopac_general']['#collapsed'] = FALSE;
// This will call sopac_admin_submit() to clear menu cache
$form = system_settings_form($form);
$form['#submit'][] = 'sopac_admin_submit';
return $form;
}
$form['sopac_general']['sopac_lib_name'] = array(
'#type' => 'textfield',
'#title' => t('Your Institution\'s name'),
'#default_value' => variable_get('sopac_lib_name', 'Anytown Public Library'),
'#size' => 32,
'#maxlength' => 254,
'#description' => t("The name of your library or institution."),
'#required' => TRUE,
);
$locum_path = trim(variable_get('sopac_locum_path', '/usr/local/include/locum'));
if ($locum_path[0] != '/') {
$locum_path = '/' . $locum_path;
}
if (substr($locum_path, -1) != '/') {
$locum_path .= '/';
}
if (!file_exists($locum_path . 'locum-client.php')) {
$locum_error = '<br /><span style="color: red;">NOTE: ' . $locum_path . 'locum-client.php does not seem to exist!</span>' ;
}
$form['sopac_general']['sopac_locum_path'] = array(
'#type' => 'textfield',
'#title' => t('Path to the Locum Client Library'),
'#default_value' => variable_get('sopac_locum_path', '/usr/local/include/locum'),
'#size' => 32,
'#maxlength' => 128,
'#description' => t("The path to where you have installed Locum." . $locum_error),
'#required' => TRUE,
);
$insurge_path = trim(variable_get('sopac_insurge_path', '/usr/local/include/insurge'));
if ($insurge_path[0] != '/') {
$insurge_path = '/' . $insurge_path;
}
if (substr($insurge_path, -1) != '/') {
$insurge_path .= '/';
}
if (!file_exists($insurge_path . 'insurge-client.php')) {
$insurge_error = '<br /><span style="color: red;">NOTE: ' . $insurge_path . 'insurge-client.php does not seem to exist!</span>' ;
}
$form['sopac_general']['sopac_insurge_path'] = array(
'#type' => 'textfield',
'#title' => t('Path to the Insurge Client Library'),
'#default_value' => variable_get('sopac_insurge_path', '/usr/local/include/insurge'),
'#size' => 32,
'#maxlength' => 128,
'#description' => t("The path to where you have installed Insurge." . $insurge_error),
'#required' => TRUE,
);
$form['sopac_general']['sopac_url_prefix'] = array(
'#type' => 'textfield',
'#title' => t('SOPAC URL prefix'),
'#default_value' => variable_get('sopac_url_prefix', 'cat/seek'),
'#size' => 24,
'#maxlength' => 72,
'#description' => t("This is the URL prefix you wish SOPAC to use within the site, for example, to use www.yoursite.com/cat/seek as the base URL for SOPAC, enter 'cat/seek' without the leading or trailing slash. If you change this, you will likely need to clear your site cache in your ") . l(t('performance settings'), 'admin/settings/performance'),
'#required' => TRUE,
);
$form['sopac_general']['sopac_results_per_page'] = array(
'#type' => 'textfield',
'#title' => t('Max # of results per page'),
'#default_value' => variable_get('sopac_results_per_page', 20),
'#size' => 10,
'#maxlength' => 4,
'#description' => t("This is the maxumum number of results that will be displayed per page in the catalog hit-list."),
'#required' => TRUE,
);
$form['sopac_general']['sopac_search_form_cfg'] = array(
'#type' => 'select',
'#title' => t('Default Search Form Display'),
'#default_value' => variable_get('sopac_search_form_cfg', 'both'),
'#description' => t("This option allows you to configure how you want the search form to be displayed from within the SOPAC context. You can Display Just the basic search box, or the basic search box and the advanced search form drop-down option."),
'#options' => array('basic' => t('Display just the basic form'), 'both' => t('Display both basic and advanced forms'))
);
$form['sopac_general']['sopac_multi_branch_enable'] = array(
'#type' => 'checkbox',
'#title' => t('Enable Multi-Branch Support'),
'#default_value' => variable_get('sopac_multi_branch_enable', 0),
'#description' => t('Select this option if you plan to operate SOPAC in a multi-branch environment.'),
);
// the next two settings to support giving users ability to select a home branch
$description = t('Check this box if your library has multiple branches, and you would like each user to be able to select a home branch.');
$description .= t('<br />NOTE: this feature requires that branches are set up in the locum config.');
$description .= t('<br />NOTE: If you check this box, you must also enter a valid library card number in the next field.');
$description = t('Check this box if your library has multiple branches, and you would like each user to be able to select a home branch.');
$description .= t('<br />NOTE: the user option will be set up during the first cron job after at least 1 bib record has been harvested.');
$form['sopac_general']['sopac_home_branch_enable'] = array(
'#type' => 'checkbox',
'#title' => t('Allow Users to Select a Home Branch'),
'#default_value' => variable_get('sopac_home_branch_enable', 0),
'#description' => $description,
);
$form['sopac_general']['sopac_admin_card'] = array(
'#type' => 'textfield',
'#title' => t('Library Card Number For Use in Setup'),
'#default_value' => variable_get('sopac_admin_card', ''),
'#description' => t("Enter a valid library card number for use in setting up user's and build you to select a home branch."),
);
$form['sopac_general']['sopac_ssl_enable'] = array(
'#type' => 'checkbox',
'#title' => t('Enable SSL for Account Management'),
'#default_value' => variable_get('sopac_ssl_enable', 0),
'#description' => t("Selecting this option will cause SOPAC to redirect browsers to an encrypted page if the user is accesing their personal information. You will need to have SSL enabled on your web server. This is HIGHLY RECCOMENDED. If you enable this option, you must put the following setting in your Apache vhost configuration for this site's <VirtualHost *:443> section: SetEnv HTTPS TRUE"),
);
$form['sopac_general']['sopac_ssl_port'] = array(
'#type' => 'textfield',
'#title' => t('SSL Connection Port'),
'#default_value' => variable_get('sopac_ssl_port', 443),
'#size' => 6,
'#maxlength' => 4,
'#description' => t("This is the port that your Apache SSL process is listening on."),
'#required' => TRUE,
);
$form['sopac_fines'] = array(
'#type' => 'fieldset',
'#title' => t('Fines Settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['sopac_fines']['sopac_fines_enable'] = array(
'#type' => 'checkbox',
'#title' => t('Enable Fines Management'),
'#default_value' => variable_get('sopac_fines_enable', 1),
'#description' => t("Check this box to allow users to access their fines through SOPAC."),
);
$form['sopac_fines']['sopac_payments_enable'] = array(
'#type' => 'checkbox',
'#title' => t('Enable Payments Management'),
'#default_value' => variable_get('sopac_payments_enable', 1),
'#description' => t("Check this box to allow users to pay their fines through SOPAC."),
);
$form['sopac_fines']['sopac_fines_warning_amount'] = array(
'#type' => 'textfield',
'#title' => t('Fine Warning Amount'),
'#default_value' => variable_get('sopac_fines_warning_amount', ''),
'#size' => 60,
'#maxlength' => 128,
'#description' => t("Warning will appear on the My Account page if fines are equal to or greater than this amount"),
);
$form['sopac_social_features'] = array(
'#type' => 'fieldset',
'#title' => t('Social Feature Settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
// This really isn't implemented yet and is here are a reminder
$form['sopac_social_features']['sopac_social_enable'] = array(
'#type' => 'checkbox',
'#title' => t('Enable the Social Catalog Components'),
'#default_value' => variable_get('sopac_social_enable', 1),
'#description' => t("Check this box if you would like to enable community-driven reviews, ratings, comments, and tagging in the catalog."),
);
$form['sopac_social_features']['sopac_random_tags'] = array(
'#type' => 'checkbox',
'#title' => t('Random Tags'),
'#default_value' => variable_get('sopac_random_tags', 1),
'#description' => t("Check this box if you would like to display tags in random order."),
);
$form['sopac_social_features']['sopac_tag_limit'] = array(
'#type' => 'textfield',
'#title' => t('Tag Limit'),
'#default_value' => variable_get('sopac_tag_limit', 100),
'#size' => 6,
'#maxlength' => 5,
'#description' => t("This is the maximum number of tags to display in the tag cloud."),
);
$form['sopac_social_features']['sopac_tag_sort'] = array(
'#type' => 'select',
'#title' => t('Tag Cloud Sorting'),
'#default_value' => variable_get('sopac_tag_sort', 'ORDER BY count DESC'),
'#description' => t("How to sort tags in tag cloud if Random Tags is not checked."),
'#options' => array(
'ORDER BY count ASC' => t('By count, ascending'),
'ORDER BY count DESC' => t('By count, descending'),
'ORDER BY tag ASC' => t('Alphabeticaly, ascending'),
'ORDER BY tag DESC' => t('Alphabeticaly, descending'),
),
);
$form['sopac_social_features']['sopac_lists_staff_roles'] = array(
'#type' => 'checkboxes',
'#title' => t('Lists Staff Roles'),
'#default_value' => variable_get('sopac_lists_staff_roles', array()),
'#options' => user_roles(TRUE),
'#description' => "Select which roles will be marked as STAFF on public list display",
);
$form['sopac_account'] = array(
'#type' => 'fieldset',
'#title' => t('Account Page Settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['sopac_account']['sopac_summary_enable'] = array(
'#type' => 'checkbox',
'#title' => t('Enable the Account Summary on the Account page'),
'#default_value' => variable_get('sopac_summary_enable', 1),
'#description' => t("Check this box if you would like to enable the Account Summary on the Account page. You probably want this."),
);
$form['sopac_account']['sopac_pname_enable'] = array(
'#type' => 'checkbox',
'#title' => t('Display Patron Name in the Account Summary'),
'#default_value' => variable_get('sopac_pname_enable', 1),
'#description' => t("Check this box if you would like to have patron names appear in the Account Summary."),
);
$form['sopac_account']['sopac_lcard_enable'] = array(
'#type' => 'checkbox',
'#title' => t('Display Library Card Number in the Account Summary'),
'#default_value' => variable_get('sopac_lcard_enable', 1),
'#description' => t("Check this box if you would like to have library card numbers appear in the Account Summary."),
);
$form['sopac_account']['sopac_numco_enable'] = array(
'#type' => 'checkbox',
'#title' => t('Display # of checkouts in the Account Summary'),
'#default_value' => variable_get('sopac_numco_enable', 1),
'#description' => t("Check this box if you would like # of checkouts appear in the Account Summary."),
);
$form['sopac_account']['sopac_checkout_history_enable'] = array(
'#type' => 'checkbox',
'#title' => t('Display checkout history in the user area'),
'#default_value' => variable_get('sopac_checkout_history_enable', 1),
'#description' => t("Check this box if you would like checkout history to appear in the user area."),
);
$form['sopac_account']['sopac_checkout_history_wipe'] = array(
'#type' => 'checkbox',
'#title' => t('Delete checkout history from ILS after harvest'),
'#default_value' => variable_get('sopac_checkout_history_wipe', 1),
'#description' => t("Check this box if you would like to purge checkout history from the ILS after it's imported into SOPAC."),
);
$form['sopac_account']['sopac_checkout_history_cache_time'] = array(
'#type' => 'textfield',
'#title' => t('Checkout history cache time'),
'#default_value' => variable_get('sopac_checkout_history_cache_time', 60),
'#description' => t("How many minutes should SOPAC wait before checking the ILS for checkout history again?"),
'#size' => 6,
'#maxlength' => 5,
);
$form['sopac_account']['sopac_hold_freezes_enable'] = array(
'#type' => 'checkbox',
'#title' => t('Enable freezing holds'),
'#default_value' => variable_get('sopac_hold_freezes_enable', 1),
'#description' => t("Check this box if you would like users to be able to freeze holds."),
);
if (variable_get('sopac_fines_enable', 1)) {
$form['sopac_account']['sopac_fines_display'] = array(
'#type' => 'checkbox',
'#title' => t('Display Fine Amounts in the Account Summary'),
'#default_value' => variable_get('sopac_fines_display', 1),
'#description' => t("Check this box if you would like fine amounts to appear in the Account Summary."),
);
}
$form['sopac_account']['sopac_cardexp_enable'] = array(
'#type' => 'checkbox',
'#title' => t('Display Library Card Expiration Date in the Account Summary'),
'#default_value' => variable_get('sopac_cardexp_enable', 1),
'#description' => t("Check this box if you would like to have library card expiration dates appear in the Account Summary."),
);
$form['sopac_account']['sopac_tel_enable'] = array(
'#type' => 'checkbox',
'#title' => t('Display telephone # in the Account Summary'),
'#default_value' => variable_get('sopac_tel_enable', 1),
'#description' => t("Check this box if you would like the patron telephone # to appear in the Account Summary."),
);
$form['sopac_account']['sopac_email_enable'] = array(
'#type' => 'checkbox',
'#title' => t('Display Email Address in the Account Summary'),
'#default_value' => variable_get('sopac_email_enable', 1),
'#description' => t("Check this box if you would like the patron email address to appear in the Account Summary."),
);
$form['sopac_account']['sopac_invalid_cardnum'] = array(
'#type' => 'textarea',
'#title' => t('Invalid Library Card Message'),
'#default_value' => variable_get('sopac_invalid_cardnum', 'It appears that your card number is invalid. If you feel that this is in error, please contact us.'),
'#description' => t("This is the message that is displayed to users if they have entered an invalid library card number. HTML is OK."),
'#required' => TRUE,
);
$form['sopac_cardnum_verify'] = array(
'#type' => 'fieldset',
'#title' => t('Card Number Verification Requirements'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['sopac_cardnum_verify']['sopac_require_cfg'] = array(
'#type' => 'select',
'#title' => t('Require Patrons to Meet All or One of the Requirements'),
'#default_value' => variable_get('sopac_require_cfg', 'one'),
'#description' => t("This option allows you to tell SOPAC if you would like to require users to fulfill all of the following enabled requirements, or just one. For example, if this is set to just 'One', users would have to enter one correct value instead of all corect values in order to have their library card verified."),
'#options' => array('one' => t('Just One'), 'all' => t('All Requirements'))
);
$form['sopac_cardnum_verify']['sopac_require_name'] = array(
'#type' => 'checkbox',
'#title' => t('Require Patron name for Verification'),
'#default_value' => variable_get('sopac_require_name', 1),
'#description' => t("Check this box if you would like to require the patron to type in their name in order to verify their library card number."),
);
$form['sopac_cardnum_verify']['sopac_require_tel'] = array(
'#type' => 'checkbox',
'#title' => t('Require Telephone Number for Verification'),
'#default_value' => variable_get('sopac_require_tel', 1),
'#description' => t("Check this box if you would like to require the patron to type in their telephone number in order to verify their library card number."),
);
$form['sopac_cardnum_verify']['sopac_require_streetname'] = array(
'#type' => 'checkbox',
'#title' => t('Use Address Street Name for Verification'),
'#default_value' => variable_get('sopac_require_streetname', 1),
'#description' => t("Check this box if you would like to use the street name of the patron's address to verify their library card number."),
);
$form['sopac_cardnum_verify']['sopac_uv_cardnum'] = array(
'#type' => 'textarea',
'#title' => t('Unvalidated Library Card Message'),
'#default_value' => variable_get('sopac_uv_cardnum', 'The card number you have provided has not yet been verified by you. In order to make sure that you are the rightful owner of this library card number, we need to ask you some simple questions.'),
'#description' => t("This is the message that is displayed to users on their account page if they have not yet verified their library card number. HTML is OK."),
'#required' => TRUE,
);
if ($current_ils == 'sirsi') {
$form['core']['sopac_changeable_pickup_location'] = array(
'#type' => 'hidden',
'#value' => TRUE,
);
$form['core']['sopac_suspend_holds'] = array(
'#type' => 'hidden',
'#value' => TRUE,
);
}
else {
$form['core']['sopac_changeable_pickup_location'] = array(
'#type' => 'hidden',
'#value' => FALSE,
);
$form['core']['sopac_suspend_holds'] = array(
'#type' => 'hidden',
'#value' => FALSE,
);
}
// This will call sopac_admin_submit() to clear menu cache
$form = system_settings_form($form);
$form['#submit'][] = 'sopac_admin_submit';
// Return the SOPAC configuration form
return $form;
}
// Part of supporting user home branch in multibranch situation
function sopac_setup_user_home_selector() {
if (!variable_get('sopac_home_branch_enable', 0) || variable_get('sopac_home_selector_options', FALSE)) {
return FALSE;
}
$locum = sopac_get_locum();
$branches = $locum->locum_config['branches'];
if (!(is_array($branches) && count($branches))) {
return FALSE;
}
$options = array_values($branches);
$options = join("\n\r", $options);
$description = t('Choose a branch as your home. This will be the default pickup location when you place holds.');
$result = db_query("
INSERT INTO {profile_fields} (title, name, explanation, category, type, weight, required, register, visibility, autocomplete, options, page)
VALUES ('%s', '%s', '%s', '%s', '%s', %d, %d, %d, %d, %d, '%s', '%s')",
'Home Branch', 'profile_pref_home_branch', $description, 'Preferences', 'selection', 1, 0, 1, 1, 0, $options, ''
);
if ($result) {
variable_set('sopac_home_selector_options', TRUE);
return TRUE;
}
return FALSE;
}
// Rebuild menu cache
function sopac_admin_submit($form, &$form_state) {
menu_rebuild();
}
function sopac_admin_moderate_form($form_state, $offset = 0) {
$insurge = sopac_get_insurge();
if ($form_state['storage']['review_ids']) {
$review_ids = $form_state['storage']['review_ids'];
$form['reviews'] = array(
'#prefix' => '<h2>Are you sure you want to delete these reviews?</h2><ul>',
'#suffix' => '</ul>',
'#tree' => TRUE,
);
$reviews = $insurge->get_reviews(NULL, NULL, $review_ids);
foreach ($reviews['reviews'] as $review) {
$rev_id = $review['rev_id'];
$form['reviews'][$rev_id] = array(
'#type' => 'hidden',
'#value' => $rev_id,
'#prefix' => '<li>',
'#suffix' => check_plain($review['rev_title']) . "</li>\n",
);
}
$form['operation'] = array(
'#type' => 'hidden',
'#value' => 'delete',
);
$form['#submit'][] = 'sopac_multiple_reviews_delete_confirm_submit';
return confirm_form($form,
t('Are you sure you want to delete these reviews?'),
'admin/settings/sopac/moderate', t('This action cannot be undone.'),
t('Delete all'), t('Cancel'));
}
else {
$limit = 100;
$reviews = $insurge->get_reviews(NULL, NULL, NULL, $limit, intval($offset));
$checkboxes = array();
$form = array();
foreach ($reviews['reviews'] as $review) {
$checkboxes[$review['rev_id']] = '';
$account = user_load(array('uid' => $review['uid']));
$form[$review['rev_id']] = array(
'user' => array('#value' => l($account->name, 'user/' . $account->uid)),
'bnum' => array('#value' => l($review['bnum'], 'catalog/record/' . $review['bnum'])),
'title' => array('#value' => $review['rev_title']),
'body' => array('#value' => $review['rev_body']),
'created' => array('#value' => date("F j, Y, g:i a", $review['rev_create_date'])),
'update' => array('#value' => date("F j, Y, g:i a", $review['rev_last_update'])),
);
}
$form['checkboxes'] = array(
'#type' => 'checkboxes',
'#options' => $checkboxes,
);
$form['operation'] = array(
'#type' => 'hidden',
'#value' => 'delete',
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Delete Selected Reviews'),
);
$form['next'] = array(
'#value' => '<p>' . l('NEXT PAGE', 'admin/settings/sopac/moderate/' . ($offset + $limit)) . '</p>',
);
$form['#theme'] = 'sopac_admin_moderate_reviews';
return $form;
}
}
function sopac_admin_moderate_form_submit($form, &$form_state) {
$form_state['storage']['review_ids'] = $form_state['values']['checkboxes'];
$form_state[‘rebuild’] = TRUE;
}
function sopac_multiple_reviews_delete_confirm_submit($form, &$form_state) {
$insurge = sopac_get_insurge();
$reviews = $insurge->get_reviews(NULL, NULL, $form_state['values']['reviews']);
foreach ($reviews['reviews'] as $review) {
if (module_exists('summergame')) {
if ($player = summergame_player_load(array('uid' => $review['uid']))) {
// Delete the points from the player record if found
db_query("DELETE FROM sg_ledger WHERE pid = %d AND code_text = 'Wrote Review' " .
"AND description LIKE '%%bnum:%d' AND description LIKE '%s%%'",
$player['pid'], $review['bnum'], $review['rev_title']);
if (db_affected_rows()) {
$player_link = l($points . ' Summer Game score card', 'summergame/player/' . $player['pid']);
drupal_set_message("Removed points for this review from player's $player_link");
}
}
}
$insurge->delete_review($review['uid'], $review['rev_id']);
}
drupal_goto('admin/settings/sopac/moderate');
}
function theme_sopac_admin_moderate_reviews($form) {
$rows = array();
foreach (element_children($form['checkboxes']) as $rev_id) {
$rows[] = array(
drupal_render($form['checkboxes'][$rev_id]),
drupal_render($form[$rev_id]['user']),
drupal_render($form[$rev_id]['bnum']),
drupal_render($form[$rev_id]['title']),
drupal_render($form[$rev_id]['body']),
drupal_render($form[$rev_id]['created']),
drupal_render($form[$rev_id]['update']),
);
}
$header = array(
'Select',
'User',
'Bib #',
'Title',
'Body',
'Created',
'Updated',
);
return theme('table', $header, $rows) . drupal_render($form);
}