/[drupal]/contributions/modules/volunteer/volunteer.module
ViewVC logotype

Diff of /contributions/modules/volunteer/volunteer.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.56, Fri May 12 21:37:23 2006 UTC revision 1.57, Fri May 12 22:22:26 2006 UTC
# Line 1  Line 1 
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  /**  /**
# Line 40  Volunteer Status >> select a volun Line 40  Volunteer Status >> select a volun
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;
# Line 457  function volunteer_question_coordinator( Line 460  function volunteer_question_coordinator(
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  }  }
# Line 479  function volunteer_has_user_volunteered( Line 482  function volunteer_has_user_volunteered(
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    
# Line 542  function volunteer_volunteer($nid, $wait Line 546  function volunteer_volunteer($nid, $wait
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){
# Line 555  function _volunteer_get_email(){ Line 560  function _volunteer_get_email(){
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...
# Line 633  function volunteer_volunteer_form($nid, Line 639  function volunteer_volunteer_form($nid,
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');
# Line 917  function volunteer_wait_volunteer($cid, Line 924  function volunteer_wait_volunteer($cid,
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');
# Line 1001  function volunteer_nodeapi(&$node, $op, Line 1009  function volunteer_nodeapi(&$node, $op,
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);
# Line 1034  function volunteer_form() { Line 1043  function volunteer_form() {
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;

Legend:
Removed from v.1.56  
changed lines
  Added in v.1.57

  ViewVC Help
Powered by ViewVC 1.1.2