| 1 |
<?php |
<?php |
| 2 |
// $Id: volunteer.module,v 1.55 2006/05/12 21:36:08 killes Exp $ |
// $Id: volunteer.module,v 1.56 2006/05/12 21:37:23 killes Exp $ |
| 3 |
|
|
| 4 |
|
|
| 5 |
/** |
/** |
| 40 |
*/ |
*/ |
| 41 |
function volunteer_settings() { |
function volunteer_settings() { |
| 42 |
$all_volunteer_coordinators = array(); |
$all_volunteer_coordinators = array(); |
| 43 |
|
// TODO: Check if this still works on 4.7. Probably doesn't since |
| 44 |
|
// users_roles does not have entries for "authenticated user" |
| 45 |
|
// anymore |
| 46 |
$result = db_query("SELECT u.uid, u.name FROM {users} u INNER JOIN {users_roles} r ON u.uid = r.uid LEFT JOIN {permission} p ON r.rid = p.rid WHERE p.perm LIKE '%s' OR u.uid = 1", '%volunteer coordinate%'); |
$result = db_query("SELECT u.uid, u.name FROM {users} u INNER JOIN {users_roles} r ON u.uid = r.uid LEFT JOIN {permission} p ON r.rid = p.rid WHERE p.perm LIKE '%s' OR u.uid = 1", '%volunteer coordinate%'); |
| 47 |
while ($user = db_fetch_object($result)) { |
while ($user = db_fetch_object($result)) { |
| 48 |
$all_volunteer_coordinators[$user->uid] = $user->name; |
$all_volunteer_coordinators[$user->uid] = $user->name; |
| 460 |
'#value' => t('Cancel'), |
'#value' => t('Cancel'), |
| 461 |
); |
); |
| 462 |
} |
} |
| 463 |
|
// TODO: rework this function, $form isn't defined in all cases. |
| 464 |
drupal_set_title(t('Volunteer Status')); |
drupal_set_title(t('Volunteer Status')); |
| 465 |
return drupal_get_form('volunteer_question_coordinator', $form); |
return drupal_get_form('volunteer_question_coordinator', $form); |
| 466 |
} |
} |
| 482 |
|
|
| 483 |
function volunteer_volunteer($nid, $wait_list = NULL) { |
function volunteer_volunteer($nid, $wait_list = NULL) { |
| 484 |
global $user; |
global $user; |
| 485 |
|
// TODO: convert to validate/submit model for better readability |
| 486 |
$edit = $_POST['edit']; |
$edit = $_POST['edit']; |
| 487 |
$op = $_POST['op']; |
$op = $_POST['op']; |
| 488 |
|
|
| 546 |
* This should probably move into civicrm.module... |
* This should probably move into civicrm.module... |
| 547 |
*/ |
*/ |
| 548 |
function _volunteer_get_email(){ |
function _volunteer_get_email(){ |
| 549 |
|
// TODO: Check if this still works/ is needed with 4.7. |
| 550 |
if(isset($_POST['op'])){ |
if(isset($_POST['op'])){ |
| 551 |
foreach($_POST as $key => $val){ |
foreach($_POST as $key => $val){ |
| 552 |
if(strncmp($key, 'email', 5) == 0){ |
if(strncmp($key, 'email', 5) == 0){ |
| 560 |
|
|
| 561 |
|
|
| 562 |
function volunteer_volunteer_form($nid, &$edit) { |
function volunteer_volunteer_form($nid, &$edit) { |
| 563 |
|
// TODO: convert to validate/submit model for better radability |
| 564 |
global $user; |
global $user; |
| 565 |
//why factor this? Because the HTML 1.0 designers did not |
//why factor this? Because the HTML 1.0 designers did not |
| 566 |
//care about I18n... |
//care about I18n... |
| 639 |
/********************************/ |
/********************************/ |
| 640 |
|
|
| 641 |
function volunteer_rate($cid, $nid = 0) { |
function volunteer_rate($cid, $nid = 0) { |
| 642 |
|
// TODO: convert to validate/submit model for better radability |
| 643 |
civicrm_initialize(TRUE); |
civicrm_initialize(TRUE); |
| 644 |
|
|
| 645 |
db_set_active('civicrm'); |
db_set_active('civicrm'); |
| 924 |
} |
} |
| 925 |
|
|
| 926 |
function volunteer_approve_volunteer($cid, $nid) { |
function volunteer_approve_volunteer($cid, $nid) { |
| 927 |
|
// TODO: convert to validate/submit model for better radability |
| 928 |
if (!volunteer_check_overload($nid) || $_POST['op'] == 'Overload') { |
if (!volunteer_check_overload($nid) || $_POST['op'] == 'Overload') { |
| 929 |
db_query('UPDATE {volunteer_contact_event} SET stage = %d WHERE cid = %d AND nid = %d', 3, $cid, $nid); |
db_query('UPDATE {volunteer_contact_event} SET stage = %d WHERE cid = %d AND nid = %d', 3, $cid, $nid); |
| 930 |
volunteer_mail($cid, $nid,'approve'); |
volunteer_mail($cid, $nid,'approve'); |
| 1009 |
} |
} |
| 1010 |
|
|
| 1011 |
function volunteer_form() { |
function volunteer_form() { |
| 1012 |
|
// TODO: convert to validate/submit model for better radability |
| 1013 |
civicrm_initialize(TRUE); |
civicrm_initialize(TRUE); |
| 1014 |
|
|
| 1015 |
$nid = arg(1); |
$nid = arg(1); |
| 1043 |
} |
} |
| 1044 |
//start set all_volunteer_coordinators |
//start set all_volunteer_coordinators |
| 1045 |
$all_volunteer_coordinators = array(); |
$all_volunteer_coordinators = array(); |
| 1046 |
|
// TODO: Check if this still works on 4.7. Probably doesn't since |
| 1047 |
|
// users_roles does not have entries for "authenticated user" |
| 1048 |
|
// anymore |
| 1049 |
$result = db_query("SELECT DISTINCT u.uid, u.name FROM {users} u INNER JOIN {users_roles} r ON u.uid = r.uid INNER JOIN {permission} p ON r.rid = p.rid WHERE p.perm LIKE '%volunteer coordinate%'"); |
$result = db_query("SELECT DISTINCT u.uid, u.name FROM {users} u INNER JOIN {users_roles} r ON u.uid = r.uid INNER JOIN {permission} p ON r.rid = p.rid WHERE p.perm LIKE '%volunteer coordinate%'"); |
| 1050 |
while ($user = db_fetch_object($result)) { |
while ($user = db_fetch_object($result)) { |
| 1051 |
$all_volunteer_coordinators[$user->uid] = $user->name; |
$all_volunteer_coordinators[$user->uid] = $user->name; |