function rejectTeam($TID) { dbRejectTeam($TID); $UID = dbGetOwnerForTeam($TID); drupal_mail('adminFunctions', 'teamRejected', dbGetUserPrimaryEmail($UID), variable_get('language_default'), $params = array('teamName' => dbGetTeamName($TID), 'fullName' => dbGetUserName($UID)), $from = NULL, $send = TRUE); drupal_set_message('The team has been rejected and the team owner has been notified!'); if (isset($_SERVER['HTTP_REFERER'])) { drupal_goto($_SERVER['HTTP_REFERER']); } else { drupal_goto('adminPage'); } }
function applyForTeamForm() { global $user; $params = drupal_get_query_parameters(); $profile = dbGetUserProfile($user->uid); if (isset($params['url'])) { $form['back'] = array('#markup' => "<a href=\"?q={$params['url']}\"><button type=\"button\">Cancel</button></a>"); } $form['fields'] = array('#type' => 'fieldset', '#title' => t('Apply to Join a Team')); $form['fields']['tableHeader'] = array('#markup' => '<table>'); $form['fields']['number'] = array('#prefix' => '<tr><td>', '#type' => 'textfield', '#title' => t('Team Number:'), '#suffix' => '</td><td>', '#ajax' => array('callback' => 'fillTeamName', 'keypress' => true, 'wrapper' => 'div_team_name_wrapper')); // this form will be filled in via AJAX $form['fields']['teamName'] = array('#prefix' => '<div id="div_team_name_wrapper">', '#type' => 'textfield', '#title' => t('Team Name:'), '#disabled' => true, '#suffix' => '</div>'); // this form is filled in from previous data $form['fields']['personName'] = array('#prefix' => '</td></tr><tr><td>', '#type' => 'textfield', '#title' => t('Your Name:'), '#default_value' => "{$profile['firstName']} {$profile['lastName']}", '#disabled' => true, '#suffix' => '</td>'); // user email is filled in, but still editable $form['fields']['email'] = array('#prefix' => '<td>', '#type' => 'textfield', '#title' => t('Your Email:'), '#default_value' => dbGetUserPrimaryEmail($user->uid), '#suffix' => '</td></tr>'); $defaultMessage = "Hi, I'd like to join your team!"; $form['fields']['message'] = array('#prefix' => '<tr><td colspan="2">', '#type' => 'textarea', '#title' => t('Personal Message:'), '#default_value' => $defaultMessage, '#suffix' => '</td></tr>'); $form['fields']['submit'] = array('#prefix' => '<tr><td colspan="2" style="text-align:right">', '#type' => 'submit', '#value' => t('Submit'), '#suffix' => '</td></tr>'); $form['fields']['tableFooter'] = array('#markup' => '</table>'); return $form; }
function viewUsersForTeam($form, &$form_state) { global $user; $params = drupal_get_query_parameters(); if (isset($params['TID'])) { $TID = $params['TID']; } else { $TID = getCurrentTeam()['TID']; } if (teamIsIneligible($TID) || !isMyTeam($TID)) { drupal_set_message('You do not have permission to access that page.', 'error'); drupal_goto($_SERVER['HTTP_REFERER']); } $form_state['TID'] = $TID; $canManageTeamMembers = hasPermissionForTeam('manageTeamMembers', $TID); $canManageTeamOwners = hasPermissionForTeam('manageTeamOwners', $TID); $markup = '<table><tr><td colspan="3">'; if (isset($params['query'])) { $persons = dbSearchUsersFromTeam($TID, $params['query']); } else { $type = isset($params['type']) ? $params['type'] : ''; // filter by type (student vs mentor vs alumni) $persons = dbGetUsersFromTeam($TID, $type); } if (empty($persons)) { drupal_set_message('No users found.', 'error'); drupal_goto($_SERVER['HTTP_REFERER']); } else { if (isset($params['query'])) { $markup .= '<h1>Search Results (' . count($persons) . ' matches)</h1></td>'; } else { $markup .= '<h1>' . count($persons) . ' users on Team ' . dbGetTeamNumber($TID) . '</h1></td>'; } } // create page header, table, and pending users/view all button $markup .= '<td colspan="3" style="text-align:right">'; if ($canManageTeamMembers) { if (!empty(dbGetUsersAwaitingApproval($TID))) { $markup .= '<a href="?q=viewUsersToBeApproved&TID=' . $TID; $markup .= '"><button type="button">View Pending Users</button></a>'; } else { $markup .= '<button type="button" disabled>No Pending Users</button>'; } $markup .= '<a href="?q=addTeamMember&TID=' . $TID; $markup .= '&destination=' . current_path(); $markup .= '"><button type="button">Add User</button></a>'; } if (isset($params['type'])) { $markup .= '<a href="?q=showUsersForTeam&TID=' . $TID; $markup .= '"><button type="button">View All</button></a>'; } $markup .= '</td></tr></table>'; // sets up the table to display name, role, and grade of every user on the certain team $markup .= '<table class="infoTable"><th>Name</th>'; $markup .= '<th>Email</td></th>'; $markup .= '<th>Team Role</td></th>'; $markup .= '<th>CROMA Role</th>'; // if user is an admin, they see a new column where they can change the role of other team members if ($canManageTeamMembers) { $markup .= '<th>Admin Functions</th>'; } else { $markup .= '<th></th>'; } $form['tableHeader'] = array('#markup' => $markup); $i = 0; foreach ($persons as $person) { $form_state["UID-{$i}"] = $person['UID']; $markup = '<tr><td><a href="?q=viewUser&UID=' . $person["UID"] . ' ">'; // hyperlinks the name so every name is linked to its user profile $markup .= $person["firstName"] . " " . $person["lastName"] . '</a></td>'; $form["name-{$i}"] = array('#markup' => $markup); $email = dbGetUserPrimaryEmail($person['UID']); $markup = "<td><a href=\"mailto:{$email}\" target=\"_top\">{$email}</a></td>"; $form["email-{$i}"] = array('#markup' => $markup); $markup = '<td>' . ucfirst(dbGetUserProfile($person['UID'])['type']) . '</td>'; $form["isStudent-{$i}"] = array('#markup' => $markup); $RID = dbGetRIDForTeam($person['UID'], $TID); $teamOwnerRID = dbGetRID('teamOwner'); $personIsTeamOwner = $RID == $teamOwnerRID; // allow current user to change roles (but not change the role of the team owner) if ($canManageTeamMembers && !$personIsTeamOwner) { // if the person in question doesn't have a role if (!$RID) { $RID = 0; } $roles = dbGetAllRoles(); $roles[0] = 'Team Member'; // if current user can't create team owners if (!$canManageTeamOwners) { unset($roles[$teamOwnerRID]); } // make sure the roles are still in order ksort($roles); $form["RID-{$i}"] = array('#prefix' => '<td class="roleSelector">', '#type' => 'select', '#default_value' => $RID, '#options' => $roles, '#suffix' => '</td>', '#ajax' => array('event' => 'change', 'callback' => 'callback', 'wrapper' => 'confirm-div', 'method' => 'replace')); } else { // if the current user can't change the role if ($RID == 0) { $role = 'Member'; } else { $role = dbGetRoleName($RID); } $form["role-{$i}"] = array('#prefix' => '<td>', '#markup' => $role, '#suffix' => '</td>'); } // if the person in question is the current user if ($person['UID'] == $user->uid) { // if the person is the team owner -- transfer ownership if ($personIsTeamOwner) { $markup = "<td><a href=\"?q=transferTeamOwnership&TID={$TID}\">"; $markup .= "<button type=\"button\">Transfer Ownership</button></a></td>"; } else { // allow user to leave team $markup = "<td><a href=\"?q=leaveTeam/{$TID}\">"; $markup .= "<button type=\"button\">Leave Team</button></a></td>"; } // if the current user can remove users } else { if ($canManageTeamMembers && !$personIsTeamOwner) { $markup = "<td><a href=\"?q=kickUserFromTeam/{$person['UID']}/{$TID}\">"; $markup .= "<button type=\"button\" onclick=\"if(!confirm('Are you sure you want to remove this user from your team?')){return false;}\">Kick User</button></a></td>"; } else { // or just some random person $markup = '<td></td>'; } } $form["adminFunctions-{$i}"] = array('#markup' => $markup); $form["rowFooter-{$i}"] = array('#markup' => '</tr>'); $i++; } // end of foreach $form_state['numUsers'] = $i; $form['tableFooter'] = array('#markup' => '</table>'); if ($canManageTeamMembers) { $form['buttons'] = array('#prefix' => '<div id="confirm-div" style="visibility:hidden">', '#suffix' => '</div>'); $form['buttons']['confirm'] = array('#type' => 'submit', '#value' => 'Confirm'); } return $form; }
function viewHours() { $params = drupal_get_query_parameters(); global $user; // checks to make sure you are assigned to a team if (dbGetTeamsForUser($user->uid) == NULL) { drupal_set_message("You don't have a team assigned.", 'error'); drupal_goto($_SERVER['HTTP_REFERER']); } // setting all permissions to a default "false" value $canEdit = $canApprove = $myHours = false; $markup = ''; // showing the hours if the UID is set for a user $filterParams = array(); if (isset($params['UID'])) { $UID = $params['UID']; $myHours = $UID == $user->uid; $filterParams['hourCounting.UID'] = $UID; $userName = dbGetUserName($UID); $markup = "<table><tr><td><h1>Hours for {$userName}</h1></td></tr></table>"; } // showing the hours if the OID is set for an outreach if (isset($params['OID'])) { $OID = $params['OID']; $TID = getCurrentTeam()['TID']; $filterParams['OID'] = $OID; $canEdit = canEditHoursForOutreach($OID); // can be set for the entire page if (hasPermissionForTeam('manageOutreachTags', $TID)) { $canApprove = true; // can be set for the entire page } $outreachName = dbGetOutreachName($OID); $markup = "<table><tr><td><h1>Hours for {$outreachName}</a></h1></td>"; } if (isset($params['OID']) && isset($params['UID']) && !isset($params['TID'])) { $markup = "<table><tr><td><h1>Hours contributed to {$outreachName} by {$userName}</h1></td></tr></table>"; } // showing the hours needing to be approved for a team if the TID is set if (isset($params['TID'])) { $TID = $params['TID']; $filterParams['TID'] = $TID; $filterParams['isApproved'] = 0; $teamName = dbGetTeamName($TID); $markup = "<table><tr><td><h1>Hours to be approved for {$teamName}</h1></td></tr></table>"; } // if the filters are not empty... if (!empty($filterParams)) { $hoursEntries = dbGetHours($filterParams); // get all the matching "hour" records if (isset($OID)) { $markup .= '<td style="text-align:right">'; $markup .= "<a href=\"?q=logHours&OID={$OID}\"><button>Add Hours</button></a></td></tr></table>"; } $markup .= '<table class="infoTable">'; // starting the table if (empty($OID)) { $markup .= '<th>Event</th>'; } if (!$myHours) { $markup .= '<th>Person</th>'; } $markup .= '<th>Type</th><th># Hours</th>'; $markup .= '<th></th>'; // create placeholder column foreach ($hoursEntries as $hours) { $markup .= '<tr>'; if (!isset($OID)) { // permissions must be set per hour record $canEdit = canEditHours($hours['HID']); // can be set for the entire page $canApprove = canApproveHours($hours['HID']); // can be set for the entire page if (isset($TID) && !$canApprove) { // if trying to approve hours for the team continue; } $outreachName = dbGetOutreachName($hours['OID']); $markup .= "<td><a href=\"?q=viewOutreach&OID={$hours['OID']}\">{$outreachName}</a></td>"; } // if the hours don't belong the current user, show the name of the person they do belong to if (!$myHours) { $markup .= '<td>'; if ($hours['UID'] != null) { $name = dbGetUserName($hours['UID']); $email = dbGetUserPrimaryEmail($hours['UID']); $markup .= "<a href=\"mailto:{$email}\" target=\"_top\">{$name}</a>"; } else { $markup .= '[none]'; } $markup .= '</td>'; } switch ($hours['type']) { // switch the type to be more formal case 'prep': $formalType = "Preparation"; break; case 'atEvent': $formalType = "At Event"; break; case 'writeUp': $formalType = "Write Up"; break; case 'followUp': $formalType = "Follow Up"; break; case 'other': $formalType = "Other"; break; } $markup .= "<td>{$formalType}</td>"; $markup .= "<td>{$hours['numberOfHours']}</td>"; if ($canEdit || $canApprove) { $markup .= '<td>'; if ($canEdit) { // if user can edit... $markup .= "<a href=\"?q=logHours&HID={$hours['HID']}\">"; $markup .= '<button><img class="editIcon" src="/images/icons/editWhite.png"></button></a>'; $markup .= "<a href=\"?q=deleteHours/{$hours['HID']}\">"; $markup .= '<button><img class="trashIcon" src="/images/icons/trashWhite.png"></button></a>'; } if ($canApprove && !$hours['isApproved']) { // if user can approve hours and the hours are not approved... $markup .= "<a href=\"?q=approveHours/{$hours['HID']}\">"; $markup .= '<button>Approve Hours</button></a>'; } else { if (!$hours['isApproved']) { $markup .= '<button disabled>Approve Hours</button>'; } } $markup .= '</td>'; } $markup .= '</tr>'; } if (empty($hoursEntries)) { $markup .= '<tr><td style="text-align:center" colspan="10"><em>[None]</em></td></tr>'; } $markup .= '</table>'; } else { // no filter params drupal_set_message('No filter parameters selected.', 'error'); drupal_goto($_SERVER['HTTP_REFERER']); } return array('#markup' => $markup); }
function signUp($form, &$form_state) { global $user; $UID = $user->uid; $new = $form_state['new'] = true; $params = drupal_get_query_parameters(); // various checks for permissions if (dbGetTeamsForUser($user->uid) == false) { drupal_set_message("You don't have a team assigned.", 'error'); drupal_goto($_SERVER['HTTP_REFERER']); } // getting the outreach ID from the URL parameters and setting that and the team ID into local variables if (isset($params['OID']) && $params['OID'] > 0) { $OID = $params['OID']; $TID = dbGetTeamForOutreach($OID); if (!dbIsUserApprovedForTeam($UID, $TID)) { drupal_set_message('You do not have the permission to contribute to this event.', 'error'); drupal_goto($_SERVER['HTTP_REFERER']); } if (dbIsOutreachOver($OID)) { drupal_set_message('You can not contribute to this event. It has already ended.', 'error'); drupal_goto($_SERVER['HTTP_REFERER']); } $outreach = dbGetOutreach($OID); if (dbIsUserSignedUp($UID, $OID)) { // if user is already signed up for outreach then sets "new" to false $new = $form_state['new'] = false; $data = dbGetUserSignUpType($UID, $OID); // getting data related to sign up } $types = array('prep' => 'Preparation', 'atEvent' => 'At Event', 'writeUp' => 'Write Up', 'followUp' => 'Follow Up'); $form = array(); $form['fields'] = array('#type' => 'fieldset', '#title' => t('Sign Up For Outreach: ' . dbGetOutreachName($OID))); // displays outreach owner's name and email (unless they are no longer on the team) $ownerUID = dbGetOutreachOwner($OID); $email = dbGetUserPrimaryEmail($ownerUID); if (dbGetUserName($ownerUID) != -1) { $markup = '<b>Owner of Outreach: </b>' . dbGetUserName($ownerUID); if (dbIsUserApprovedForTeam($ownerUID, $TID)) { $markup .= "<br><b>Email of Owner: </b><a href=\"mailto:{$email}\" target=\"_top\">{$email}</a>"; } else { $markup .= ' (no longer on this team)<br>'; } } else { $markup = '<b>Owner of Outreach: </b>[none]<br>'; $markup .= '<b>Email of Owner: </b>[none]'; } $form['tableHeader'] = array('#markup' => $markup); // signing up for time slots listed in the array above (local variable --> "types") $form['fields']['times'] = array('#prefix' => '<table colspan="4"><tr><td colspan="2">', '#type' => 'checkboxes', '#title' => t('<h4>Which time(s) would you like to sign up for?</h4>'), '#options' => $types, '#default_value' => $new ? array() : $data, '#suffix' => '</td>'); // obligatory confirmation for the user to understand their commitment $form['fields']['confirmation'] = array('#prefix' => '<td colspan="2">', '#type' => 'checkbox', '#title' => t('<b>By checking this box, I understand that I am signing up for this event and am committed to the time(s) I agreed to.</b>'), '#suffix' => '</td></tr>'); $form['fields']['html1'] = array('#markup' => '<tr>'); // allows a user to cancel their commitment to their outreach times if (!$new) { $form['fields']['cancel'] = array('#prefix' => '<td colspan="2">', '#type' => 'submit', '#value' => 'Remove Commitment', '#limit_validation_errors' => array(), '#submit' => array('cancelCommit'), '#suffix' => '</td>'); } else { $form['fields']['html'] = array('#markup' => '<td></td>'); } $form['fields']['submit'] = array('#prefix' => '<td colspan="2" style="text-align:right">', '#type' => 'submit', '#value' => t('Submit'), '#suffix' => '</td>'); $form['fields']['footer'] = array('#markup' => '</tr></table>'); return $form; } else { // in case the parameter passed was an invalid OID drupal_set_message('Invalid outreach event. Click <a href="?q=teamDashboard">here</a> to naviagte back to events in Team Dashboard.', 'error'); } }
function viewUser() { global $user; $currentUID = $user->uid; $params = drupal_get_query_parameters(); // checks that there is a user if (isset($params["UID"])) { $UID = $params["UID"]; } else { drupal_set_message('No user specified.', 'error'); drupal_goto($_SERVER['HTTP_REFERER']); } // checks that the user being viewed shares a team with the user currently viewing if (!($UID == $currentUID || isOnMyTeam($UID))) { drupal_set_message("You can't view this profile.", 'error'); drupal_goto($_SERVER['HTTP_REFERER']); } $profile = dbGetUserProfile($UID); $canEdit = false; $sharedTeams = getSharedTeams($UID); if (!empty($sharedTeams)) { foreach ($sharedTeams as $TID) { if (hasPermissionForTeam('manageTeamMembers', $TID)) { $canEdit = true; break; } } } if ($user->uid == $UID) { $canEdit = true; } $markup = ''; // create name header and table $markup .= '<div style="float:left; width:28%">'; $markup .= '<table style="margin:0px 0px 10px 0px;"><tr>'; $markup .= '<td style="padding:0px 14px 10px 14px;"><div align="left"><h2 style="margin:0px 0px 7px 0px;"><b>'; $markup .= $profile['firstName'] . ' ' . $profile['lastName']; $markup .= '</b></h2></div></td></tr></table>'; $markup .= '<table id="photoAndEdit"><tr><td style="padding:0px;">'; // if the profile belongs to the currently logged in user, the picture should be editable if ($canEdit) { $markup .= '<div align="right">'; $markup .= '<a href= "?q=editThumbnail'; $markup .= '&UID=' . $UID . '&FID=' . $profile['FID'] . '">'; $markup .= '<span title="Edit Photo"><button type="button"><img class="editIcon" src="/images/icons/editThumbnailWhite.png"></button></a></span>'; $markup .= '</div>'; } $markup .= '</td></tr><tr><td style="padding:0px;">'; // if user has picture, display picture if (!empty($profile['FID'])) { $url = generateURL($profile['FID']); $markup .= '<div align="center"><img src="' . $url . '" style="max-width:150px; width:auto; height:auto; padding: 5px 0px 5px 0px">'; // default picture if user does not have a picture } else { $markup .= '<div align="center"><img src="/images/defaultPics/user.png" style="max-width:200px; width:auto; height:auto; padding: 15px 0px 15px 0px">'; } $markup .= '</div></td></tr></table></div>'; $markup .= '<div align="right">'; // if user has permissions or owns the profile, edit info if ($canEdit) { $markup .= '<a href= "?q=profileForm'; $markup .= '&UID=' . $UID . '">'; $markup .= '<span title="Edit Profile"><button type="button"><img class="editIcon" src="/images/icons/editWhite.png"></button></a></span>'; } // if the user wants to change their own password - no one else can access this feature on someone's profile if ($UID == $currentUID) { $markup .= '<a href="?q=user/' . $UID . '/edit"'; $markup .= '<span title="Change Password"><button type="button"><img class="keyIcon" src="/images/icons/keyWhite.png"></button></a></span>'; } // users are only allowed to delete their own profiles if ($UID == $currentUID) { $markup .= '<span title="Delete User"><a href="?q=deleteUser&UID=' . $UID . '"><button type="button"><img class="trashIcon" src="/images/icons/trashWhite.png"></button></a></span>'; } $markup .= '</div>'; // begin displaying info portion $markup .= '<div style="width:70%; float:right; padding-left:10px">'; $markup .= '<table id="miniViewTeam" style="margin:16px 0px 0px 0px"><tr><td><b>Role: </b>' . ucfirst($profile['type']) . '</td>'; $markup .= '<td><b>Position: </b> ' . strip_tags($profile['position']) . '</td>'; if ($profile['grade'] == '0') { $markup .= '<tr><td><b>Grade: </b> N/A</td>'; } else { $markup .= '<tr><td><b>Grade: </b> ' . $profile['grade'] . '</td>'; } $markup .= '<td><b>Gender: </b> ' . $profile['gender'] . '</td></tr>'; $email = dbGetUserPrimaryEmail($UID); $markup .= '<tr><td><b>Email: </b> <a href="mailto:' . $email . '" target="_blank">'; $markup .= $email . '</a>'; $secondaryEmail = dbGetSecondaryEmailForUser($UID); if ($secondaryEmail) { $markup .= "<br>(" . '<a href="mailto:' . $secondaryEmail . '" target="_blank">' . $secondaryEmail . '</a>' . ')'; } $phoneNumber = dbFormatPhoneNumber($profile['phone']); $markup .= '</td><td><b>Phone: </b> ' . $phoneNumber . '</td></tr>'; // displays teams the user is on $teamNumbers = ''; $first = true; // used to put commas in the right places $teams = dbGetTeamsForUser($UID); foreach ($teams as $team) { if ($first) { $teamNumbers = '<a href="?q=viewTeam&TID=' . $team['TID'] . '">' . $team['number'] . '</a>'; $first = false; } else { $teamNumbers = $teamNumbers . ', <a href="?q=viewTeam&TID=' . $team['TID'] . '">' . $team['number'] . '</a>'; } } if (count($teams) > 1) { $teamLabel = 'Teams'; } else { $teamLabel = 'Team'; } if ($UID == $currentUID) { $markup .= '<tr><td><a href="?q=manageUserTeams"><b>' . $teamLabel . ':</b></a> ' . $teamNumbers . '</td>'; } else { $markup .= '<tr><td><b>' . $teamLabel . ':</b> ' . $teamNumbers . '</td>'; } // displays user hours $numberOfHours = dbGetUserHours($UID); if ($numberOfHours != 0) { $markup .= "<td><a href=\"?q=viewHours&UID={$UID}\"><b>Number of Hours:</b></a> {$numberOfHours}</td>"; } else { $markup .= "<td><b>Number of Hours:</b> No Hours!</td>"; } // displays user bio $markup .= '</table><table id="miniViewTeam" style="margin:16px 0px 0px 0px"><tr><td><b>Bio: </b>'; $markup .= wordwrap($profile['bio'], 92, "<br />\n") . '</td></tr>'; $markup .= '</table></div>'; return array("#markup" => $markup); }
function viewPeopleForEvent() { global $user; $params = drupal_get_query_parameters(); $TID = getCurrentTeam()['TID']; if (teamIsIneligible($TID)) { drupal_set_message('Your team does not have permission to access this page.', 'error'); drupal_goto($_SERVER['HTTP_REFERER']); } if (dbGetTeamsForUser($user->uid) == NULL) { drupal_set_message("You don't have a team assigned.", 'error'); drupal_goto($_SERVER['HTTP_REFERER']); } if (isset($params['OID']) && $params['OID'] > 0) { $OID = $params['OID']; $outreach = dbGetOutreach($OID); // if the outreach is invalid if ($outreach == false) { drupal_set_message('Invalid outreach event. Click <a href="?q=teamDashboard">here</a> to navigate back to events in Team Dashboard.', 'error'); return; } // begin header $markup = '<div align="left">' . "<br><h1><b> Users Signed Up For: {$outreach['name']}</b></h1></div>"; $ppl = dbGetPplSignedUpForEvent($OID); if ($ppl == false) { $markup .= '<tr><td><h4>No people signed up for outreach: ' . $outreach['name'] . '</h4></td></tr>'; } else { // Begin Displaying Info Body $markup .= '<table class="infoTable">'; $markup .= '<tr><th>Name</th>'; $markup .= '<th>Email</th>'; $markup .= '<th>Time Slot(s)</th></tr>'; foreach ($ppl as $UID) { $profile = dbGetUserProfile($UID); $markup .= '<tr><td><a href="?q=viewUser&UID=' . $profile["UID"] . ' ">'; $markup .= $profile["firstName"] . " " . $profile["lastName"] . '</a></td>'; // display the user's email $email = dbGetUserPrimaryEmail($UID); $markup .= "<td><a href=\"mailto:{$email}\" target=\"_top\">{$email}</a></td>"; $timeSlots = dbGetUserSignUpType($UID, $OID); $markup .= '<td>'; foreach ($timeSlots as $timeSlot) { switch ($timeSlot) { case 'prep': $markup .= 'Preparation<br>'; break; case 'atEvent': $markup .= 'At Event<br>'; break; case 'followUp': $markup .= 'Follow Up<br>'; break; case 'writeUp': $markup .= 'Write Up<br>'; break; case 'owner': $markup .= 'Owner<br>'; break; default: break; } } $markup .= '</td>'; } } $markup .= '</table>'; $retArray = array(); $retArray['#markup'] = $markup; return $retArray; } else { drupal_set_message('Invalid outreach event. Click <a href="?q=teamDashboard">here</a> to navigate back to events in Team Dashboard.', 'error'); } }
function rejectUser($UID, $TID) { if (teamIsIneligible($TID)) { drupal_set_message('Your team does not have permission to access this page.', 'error'); drupal_goto($_SERVER['HTTP_REFERER']); } // currently delete the user's application to the team dbRejectUser($UID, $TID); $notification = array('UID' => $UID, 'TID' => $TID, 'dateCreated' => dbDatePHP2SQL(time()), 'dateTargeted' => dbDatePHP2SQL(time())); $notification['message'] = 'You have been rejected from ' . dbGetTeamName($TID) . '.'; $notification['bttnTitle'] = 'Reapply'; $notification['bttnLink'] = "?q=applyForTeamForm"; dbAddNotification($notification); module_load_include('inc', 'mimemail'); drupal_mail('teams', 'rejectedFromTeam', dbGetUserPrimaryEmail($UID), variable_get('language_default'), $params = array('teamName' => dbGetTeamName($TID), 'fullName' => dbGetUserName($UID)), $from = NULL, $send = TRUE); drupal_set_message("User has been rejected from your team."); if (isset($_SERVER['HTTP_REFERER'])) { drupal_goto($_SERVER['HTTP_REFERER']); } else { drupal_goto('viewUsersToBeApproved', array('query' => array('TID' => $TID))); } }