Esempio n. 1
0
function transferTeamOwnershipForm($form, &$form_state)
{
    global $user;
    $params = drupal_get_query_parameters();
    if (isset($params['TID'])) {
        $form_state['TID'] = $TID = $params['TID'];
    } else {
        drupal_set_message('You need to choose a team.', 'error');
        drupal_goto('showUsersForTeam');
    }
    $team = dbGetTeam($TID);
    if ($user->uid != $team['UID']) {
        // if the user is not the team owner
        drupal_set_message("You are not the owner of team {$team['name']}", 'error');
        drupal_goto($_SERVER['HTTP_REFERER']);
    }
    $people = dbGetUsersListFromTeam($TID);
    unset($people[$user->uid]);
    // shouldn't be able to transfer to self
    $people[0] = '';
    // field needs a default value
    $form['header'] = array('#markup' => "<h1>Transfer Ownership of {$team['name']}</h1>");
    $form['fields'] = array('#type' => 'fieldset');
    $form['fields']['table'] = array('#prefix' => '<table><tr>', '#suffix' => '</tr></table>');
    $form['fields']['table']['info'] = array('#prefix' => '<td>', '#markup' => 'Transferring ownership of this team will make you into a team admin (at which point you may leave the team if you wish). The new owner you choose will be notified of their promotion via email, and will gain the <strong>ability to delete the team at will</strong>. His/her notification email will also include your email for contact purposes in case of an error. If you wish to become the team owner again, the new owner must transfer ownership.', '#suffix' => '</td>');
    $form['fields']['table']['newOwner'] = array('#prefix' => '<td>', '#type' => 'select', '#title' => t('New Team Owner:'), '#default_value' => 0, '#options' => $people, '#chosen' => true, '#suffix' => '</td>');
    $form['submit'] = array('#prefix' => '<div align="right">', '#attributes' => array('onclick' => 'return confirm("Are you sure you want to transfer ownership?");'), '#type' => 'submit', '#value' => 'Submit', '#suffix' => '</div>');
    return $form;
}
Esempio n. 2
0
function teamForm($form, &$form_state)
{
    global $user;
    $UID = $user->uid;
    $params = drupal_get_query_parameters();
    $new = true;
    if (isset($params["TID"])) {
        // getting the team ID if it's set in the URL's parameters
        $oldTeam = dbGetTeam($params["TID"]);
        $new = false;
    }
    $form = array();
    if ($new) {
        // if user is creating a completely new team
        $form['fields'] = array('#type' => 'fieldset', '#title' => t('Create A New Team'));
    } else {
        // if user is editing a team
        $form['fields'] = array('#type' => 'fieldset', '#title' => t('Edit: ' . $oldTeam['name']));
    }
    if (!$new) {
        // if user wants to cancel any changes they made
        $form['fields']['back'] = array('#prefix' => '<left>', '#limit_validation_errors' => array(), '#submit' => array('backToTeam'), '#type' => 'submit', '#value' => '⇦ Cancel Changes', '#attributes' => array('OnSubmit' => 'if(!confirm("Back?")){return false;}'), '#suffix' => '</left>');
    }
    // setting the team name
    $form['fields']['name'] = array('#prefix' => '<table><tr><td colspan="3" style="text-align:center">', '#default_value' => $new ? '' : $oldTeam['name'], '#type' => 'textfield', '#disabled' => $new ? false : true, '#title' => t('Team Name'), '#suffix' => '</td>');
    // setting the team number
    $form['fields']['number'] = array('#prefix' => '<td colspan="3" style="text-align:center">', '#default_value' => $new ? '' : $oldTeam['number'], '#type' => 'textfield', '#disabled' => $new ? false : true, '#title' => t('Team Number'), '#suffix' => '</td></tr>');
    // setting the type of robotics team (FLL vs FTC vs FRC etc.)
    $form['fields']['type'] = array('#prefix' => '<tr><td colspan="3" style="text-align:center">', '#default_value' => $new ? '' : $oldTeam['type'], '#type' => 'select', '#title' => t('Type of Team'), '#options' => array('FRC' => 'FIRST Robotics Competition', 'FTC' => 'FIRST Technology Challenge', 'FLL' => 'FIRST Lego League', 'Other' => 'Other'), '#chosen' => true, '#suffix' => '</td>');
    // setting the home city
    $form['fields']['city'] = array('#prefix' => '<td colspan="3" style="text-align:center">', '#default_value' => $new ? '' : $oldTeam['city'], '#type' => 'textfield', '#title' => t('City'), '#suffix' => '</td></tr>');
    // setting the home state
    $form['fields']['state'] = array('#prefix' => '<tr><td colspan="3" style="text-align:center">', '#default_value' => $new ? '' : $oldTeam['state'], '#type' => 'select', '#title' => t('State'), '#options' => states_list(), '#chosen' => true, '#suffix' => '</td>');
    // setting the home country of the team
    $form['fields']['country'] = array('#prefix' => '<td colspan="3" style="text-align:center">', '#default_value' => $new ? '' : $oldTeam['country'], '#type' => 'select', '#title' => t('Country'), '#options' => countries_list(), '#default_value' => 'United States', '#chosen' => true, '#suffix' => '</td></tr>');
    // rookie year of team
    $form['fields']['rookieYear'] = array('#prefix' => '<tr><td colspan="6" style="text-align:center">', '#type' => 'textfield', '#title' => t('Rookie Year'), '#default_value' => $new ? NULL : $oldTeam['rookieYear'], '#suffix' => '</td></tr><tr>');
    if (!$new) {
        // if the team is not new and you want to delete permanently, then you can do it via this button
        $form['fields']['delete'] = array('#prefix' => '<td colspan="3" style="text-align:left">', '#type' => 'submit', '#value' => 'Delete Team', '#limit_validation_errors' => array(), '#attributes' => array('onclick' => 'if(!confirm("Are you sure you want to delete this team PERMANENTLY?")){return false;}'), '#submit' => array('deleteTeam'), '#suffix' => '</td>');
        // submitting the info which the user just updated
        $form['fields']['submit'] = array('#prefix' => '<td colspan="3" style="text-align:right">', '#type' => 'submit', '#value' => t('Save'), '#suffix' => '</td>');
    } else {
        // submitting the info which the user just inputted (with a different colspan)
        $form['fields']['submit'] = array('#prefix' => '<td colspan="6" style="text-align:right">', '#type' => 'submit', '#value' => t('Save'), '#suffix' => '</td>');
    }
    $form['fields']['footer'] = array('#markup' => '</tr></table>');
    // checking proper permissions for user
    if (!$new && !hasPermissionForTeam('editTeam', $params['TID'])) {
        drupal_set_message("You don't have permission to edit {$oldTeam['name']}.", 'error');
        drupal_goto('viewTeam', array('query' => array('TID' => $params['TID'])));
    }
    return $form;
}
Esempio n. 3
0
function usersSearch($form, &$form_state)
{
    global $user;
    if (isset($params['TID'])) {
        $TID = $params['TID'];
        $team = dbGetTeam($TID);
    } else {
        $team = getCurrentTeam();
        $TID = $team['TID'];
    }
    if (teamIsIneligible($TID)) {
        drupal_set_message('Your team does not have permission to access this page.', 'error');
        drupal_goto('myDashboard');
    }
    $form = array();
    // displays what a user can search
    $form['fields']['nameContains'] = array('#type' => 'textfield', '#placeholder' => 'Name or Email');
    // submit button
    $form['fields']['submit'] = array('#prefix' => '<div align="left" style="float:left">', '#type' => 'submit', '#value' => t('Search'), '#suffix' => '</div>');
    // button to view all team members on current team
    $form['fields']['button'] = array('#markup' => '<div align="right" style="float:right"><a href="?q=showUsersForTeam"><button type="button">View All Team Members</button></a></div>');
    return $form;
}
Esempio n. 4
0
function leaveTeam($TID)
{
    global $user;
    dbKickUserFromTeam($user->uid, $TID);
    dbRemoveAllUserRoles($user->uid, $TID);
    dbRemoveUserFromFutureTeamOutreach($user->uid, $TID);
    clearCurrentTeam();
    $notification = array();
    $notification['dateCreated'] = dbDatePHP2SQL(time());
    $notification['dateTargeted'] = dbDatePHP2SQL(time());
    $userName = dbGetUserName($user->uid);
    $teamName = dbGetTeamName($TID);
    $notification['message'] = "{$userName} has left team {$teamName}.";
    $notification['bttnTitle'] = "View";
    $notification['bttnLink'] = "?q=viewUser&UID={$user->uid}";
    $notification['TID'] = $TID;
    notifyUsersByRole($notification, 'teamAdmin');
    // notify team owner
    $notification['UID'] = dbGetTeam($TID)['UID'];
    dbAddNotification($notification);
    drupal_set_message("You have successfully left {$teamName}.");
    if (isset($_SERVER['HTTP_REFERER'])) {
        drupal_goto($_SERVER['HTTP_REFERER']);
    } else {
        drupal_goto('manageUserTeams');
    }
}
Esempio n. 5
0
function teamSummary($form, &$form_state)
{
    global $user;
    $UID = $user->uid;
    $team = getCurrentTeam();
    $teams = dbGetTeamsForUser($UID);
    $form = array();
    if (isset($params["UID"])) {
        $UID = $params["UID"];
    } else {
        $UID = $user->uid;
    }
    if (isset($params['TID'])) {
        $TID = $params['TID'];
        $team = dbGetTeam($TID);
        $teamNumber = $team['number'];
    } else {
        $team = getCurrentTeam();
        $TID = $team['TID'];
        $team = dbGetTeam($TID);
        $teamNumber = $team['number'];
    }
    // if team is not empty
    if (!empty($teams)) {
        $TID = $team['TID'];
        if (count($teams) != 1) {
            // if user has multiple teams then able to change team
            $multiple = true;
            $choices = array();
        } else {
            // if user has one team then display team number
            $multiple = false;
        }
        foreach ($teams as $userTeam) {
            $choices[$userTeam['TID']] = $userTeam['number'];
        }
        $markup = '<table id="teamPageSummary" style="margin:112px 0px 0px 0px; padding:0px"><tr style="text-align:center"><td ';
        if (!$multiple) {
            $markup .= 'colspan="2" style="text-align:center;';
        } else {
            $markup .= 'style="text-align:right;';
        }
        $markup .= ' width:50%; padding:0px"><h2>' . $team['type'] . ' ';
        $form['fields']['header'] = array('#markup' => $markup);
        if ($multiple) {
            $form['fields']['team'] = array('#prefix' => '</h2></td><td style="width:50%;padding:0px">', '#type' => 'select', '#default_value' => $TID, '#options' => $choices, '#chosen' => true, '#attributes' => array('onChange' => 'document.getElementById("teamsummary").submit();'), '#suffix' => '</td></tr>');
        } else {
            $form['fields']['team'] = array('#markup' => $team['number'] . '</h2></td></tr>');
        }
        if (!empty($team['FID'])) {
            $FID = $team['FID'];
            $file = file_load($FID);
            $uri = $file->uri;
            $variables = array('style_name' => 'profile', 'path' => $uri, 'width' => '150', 'height' => '150');
            $image = theme_image_style($variables);
            $form['fields']['FID'] = array('#prefix' => '<tr><td colspan="2" style="text-align:center">', '#type' => 'item', '#markup' => $image, '#suffix' => '</td></tr>');
        } else {
            // if team does not have a picture, then displays default pic
            $form['fields']['FID'] = array('#prefix' => '<tr><td colspan="2" style="text-align:center">', '#markup' => '<img src="/images/defaultPics/team.png" style="max-width:200px; width:auto; height:auto; padding: 15px 0px 15px 0px">', '#suffix' => '</td></tr>');
        }
        $form['fields']['markupOne'] = array('#markup' => '<tr><td style="text-align:left"><a href="?q=viewTeam&TID=' . $TID . '"><div class="help tooltip4"><button type="button">Team Info</button><span id="helptext"; class="helptext tooltiptext4">Click here to view/edit your team info or to enter old team hours.</span></div></a></td>');
        if (hasPermissionForTeam('manageOutreachTags', $TID)) {
            $form['fields']['markupTwo'] = array('#markup' => '<td colspan="2" style="text-align:right"><a href="?q=teamOutreachSettings"><div class="help tooltip3"><button type="button">Settings</button><span id="helptext"; class="helptext tooltiptext3">If you have permission, click here to manage your teams outreach tags and outreach visibilities.</span></div></a></td></tr></table>');
        } else {
            $form['fields']['markupTwo'] = array('#markup' => '<td colspan="2" style="text-align:right"><div class="help tooltip3"><button type="button" disabled>Settings</button><span id="helptext"; class="helptext tooltiptext3">If you have permission, click here to manage your teams outreach tags and outreach visibilities.</span></div></td></tr></table>');
        }
        if ($multiple) {
            $form['fields']['submit'] = array('#type' => 'submit', '#value' => 'Update', '#attributes' => array('style' => array('display: none;')));
        }
    }
    return $form;
}
function writeUpsAwaitingApproval()
{
    $currentTeam = getCurrentTeam();
    if ($currentTeam == false) {
        drupal_set_message("You don't have a team assigned.", 'error');
        return;
    }
    $TID = $currentTeam['TID'];
    $teamNumber = $currentTeam['number'];
    // create header
    $markup = '<h2>Write-Ups Awaiting Approval</h2>';
    $markup .= '<table class="infoTable"><tr><th colspan="3">Name</th>';
    $markup .= '<th colspan="2">Log Date</th>';
    $markup .= '<th colspan="2">Owner</th>';
    $markup .= '<th></th>';
    $markup .= "</tr>";
    // "true" indicates to only get write-ups that have been submitted
    $outreaches = dbGetWriteUpsForTeam($TID, true);
    // if the team has write-ups
    if (!empty($outreaches)) {
        $count = 0;
        foreach ($outreaches as $outreach) {
            $count++;
            $TID = $outreach['TID'];
            $team = dbGetTeam($outreach['TID']);
            $rawDate = $outreach['logDate'];
            $rawDate = dbDateSQL2PHP($rawDate);
            $logDate = date(TIME_FORMAT, $rawDate);
            $OID = $outreach['OID'];
            $owner = dbGetOutreachOwner($OID);
            $markup .= "<tr>";
            $markup .= '<td colspan="3">' . '<a href="?q=viewOutreach&OID=' . $outreach['OID'] . '">' . chopString($outreach["name"], 20) . '</a>' . '</td>';
            $markup .= '<td colspan="2">' . $logDate . '</td>';
            $markup .= '<td colspan="2">' . dbGetUserName($owner) . ' </td>';
            // button to view the write up
            if (hasPermissionForTeam('approveIdeas', $TID)) {
                $markup .= '<td><a href="?q=writeupform&approving&OID=' . $OID . '"><button>View</button></a></td>';
            } else {
                $markup .= '<td></td>';
            }
            $markup .= "</tr>";
        }
        // if the team doesn't have any write-ups
    } else {
        $markup .= "<tr>";
        $markup .= '<td style="text-align:center" colspan="8"><em>[None]</em></td>';
        $markup .= "</tr>";
    }
    $markup .= "</table>";
    $retArray = array();
    $retArray['#markup'] = $markup;
    return $retArray;
}
Esempio n. 7
0
function outreachForm($form, &$form_state)
{
    global $user;
    $UID = $user->uid;
    $params = drupal_get_query_parameters();
    $currentTeam = getCurrentTeam();
    $TID = $currentTeam['TID'];
    $form_state['TID'] = $TID;
    $new = $form_state['new'] = true;
    if (teamIsIneligible($TID)) {
        drupal_set_message('Your team does not have permission to access this page.', 'error');
        drupal_goto($_SERVER['HTTP_REFERER']);
    }
    if (isset($params["OID"])) {
        $form_state['OID'] = $params['OID'];
        $new = $form_state['new'] = false;
        $outreach = dbGetOutreach($params["OID"]);
        $times = dbGetTimesForOutreach($params["OID"]);
        // set to display all times
        $form_state['numRows'] = count($times);
        // record how many were there before (in case user deletes one)
        $form_state['initialNumTimes'] = count($times);
        $TID = $outreach['TID'];
        $form_state['TID'] = $TID;
    }
    $form = array();
    // if the user is editing an old outreach
    if (!$new) {
        // menu hook to duplicate outreach
        $confirmBoxJS = "if(!confirm('Are you sure you want to duplicate this outreach? Any changes you made just now will NOT be saved.')){return false;}";
        $form['duplicate'] = array('#prefix' => "<div style=\"text-align:right\"><a href=\"?q=duplicateOutreach/{$form_state['OID']}/{$TID}\">", '#markup' => "<button onclick=\"{$confirmBoxJS}\" type=\"button\">Duplicate</button>", '#suffix' => '</a>');
    }
    if (!$new) {
        // menu hook to cancel the outreach
        if ($outreach["cancelled"]) {
            $confirmBoxJS = "if(!confirm('Are you sure you want to uncancel this outreach for the team?')){return false;}";
            $form['cancel'] = array('#prefix' => "<a href=\"?q=cancelOutreach/{$form_state['OID']}/{$TID}\">", '#markup' => "<button onclick=\"{$confirmBoxJS}\" type=\"button\">Uncancel Outreach</button>", '#suffix' => '</a></div>');
        } else {
            $confirmBoxJS = "if(!confirm('Are you sure you want to cancel this outreach for the team? This will remove the outreach from current team use.')){return false;}";
            $form['cancel'] = array('#prefix' => "<a href=\"?q=cancelOutreach/{$form_state['OID']}/{$TID}\">", '#markup' => "<button onclick=\"{$confirmBoxJS}\" type=\"button\">Cancel From Team Use</button>", '#suffix' => '</a></div>');
        }
    }
    $teamNumb = dbGetTeamNumber($TID);
    // form title
    $form['fields'] = array('#type' => 'fieldset', '#title' => t('Add Outreach: Team ' . '<b>' . $teamNumb . '</b>'));
    // if editing an outreach, then allow a user to cancel changes
    if (!$new) {
        $form['fields']['back'] = array('#prefix' => '<left>', '#limit_validation_errors' => array(), '#submit' => array('backToEvent'), '#type' => 'submit', '#value' => '⇦ Cancel Changes', '#attributes' => array('OnSubmit' => 'if(!confirm("Back?")){return false;}'), '#suffix' => '</left>');
    }
    $form['fields']['markupOne'] = array('#markup' => '<table>');
    // displays the name of the outreach editing
    $form['fields']['name'] = array('#prefix' => '<tr><td colspan="3" style="text-align:center">', '#type' => 'textfield', '#title' => t('Outreach Name:'), '#default_value' => $new ? '' : $outreach['name'], '#placeholder' => 'Name of the event', '#attributes' => array('onsubmit' => 'return false'), '#suffix' => '</td>');
    $tags = dbGetOutreachTagsForTeam($TID);
    // notifies a user to create outreach tags if the team doesn't have any
    if (empty($tags)) {
        if (hasPermissionForTeam('manageOutreachTags', $TID)) {
            $msg = 'Click <a href="?q=teamOutreachSettings"><b>here</b></a> to change your settings.';
        } else {
            $msg = 'Please have a team admin or owner set up tags for your team.';
        }
        drupal_set_message('To give the outreach a tag, you need to set up the tag options for your team! ' . $msg, 'error');
        $form['fields']['tags'] = array('#prefix' => '<td colspan="3" style="text-align:center">', '#markup' => 'Tags:<br><em>You have no available tags.</em>', '#suffix' => '</td></tr>');
    } else {
        // allows a user to add tags to the outreach
        if (!$new) {
            // get only OTID's to satisfy select field
            $oldTags = dbGetTagsForOutreach($form_state['OID'], true);
        }
        $form['fields']['tags'] = array('#prefix' => '<td colspan="3" style="text-align:center">', '#type' => 'select', '#id' => 'tags_field', '#title' => t('Tags:'), '#options' => $tags, '#default_value' => $new ? '' : $oldTags, '#chosen' => true, '#multiple' => true, '#suffix' => '</td></tr>');
    }
    // allows a user to change the status of the outreach if they have permission
    if (hasPermissionForTeam('manageOutreachTags', $TID)) {
        $form['fields']['status'] = array('#prefix' => '<tr><td colspan="3" style="text-align:center">', '#type' => 'select', '#default_value' => $new ? 'Select' : $outreach['status'], '#options' => array('isIdea' => 'Idea', 'isOutreach' => 'Outreach', 'doingWriteUp' => 'Write-Up', 'locked' => 'Locked'), '#title' => t('Status:'), '#chosen' => true, '#suffix' => '</td>');
        // if the user doesn't have permission, then the status of isIdea displays idea
    } else {
        if (!$new && $outreach['status'] == 'isIdea') {
            $form['fields']['status'] = array('#prefix' => '<tr><td colspan="3" style="text-align:center">', '#type' => 'select', '#title' => t('Status:'), '#options' => array('isIdea' => 'Idea'), '#default_value' => 'isIdea', '#disabled' => true, '#suffix' => '</td>');
            // if the user doesn't have permission, then the status of isOutreach displays outreach
        } else {
            if (!$new && $outreach['status'] == 'isOutreach') {
                $form['fields']['status'] = array('#prefix' => '<tr><td colspan="3" style="text-align:center">', '#type' => 'select', '#title' => t('Status:'), '#options' => array('isOutreach' => 'Outreach'), '#default_value' => 'isOutreach', '#disabled' => true, '#suffix' => '</td>');
                // if the user doesn't have permission, then the status of doingWriteUp displays write-up
            } else {
                if (!$new && $outreach['status'] == 'doingWriteUp') {
                    $form['fields']['status'] = array('#prefix' => '<tr><td colspan="3" style="text-align:center">', '#type' => 'select', '#title' => t('Status:'), '#options' => array('doingWriteUp' => 'Write-Up'), '#default_value' => 'doingWriteUp', '#disabled' => true, '#suffix' => '</td>');
                    // if the user doesn't have permission, then the status of locked displays locked
                } else {
                    if (!$new && $outreach['status'] == 'locked') {
                        $form['fields']['status'] = array('#prefix' => '<tr><td colspan="3" style="text-align:center">', '#type' => 'select', '#title' => t('Status:'), '#options' => array('locked' => 'Locked'), '#default_value' => 'locked', '#disabled' => true, '#suffix' => '</td>');
                        // if the user doesn't have permission, then the events created can only have a status of idea
                    } else {
                        $form['fields']['status'] = array('#prefix' => '<tr><td colspan="3" style="text-align:center">', '#type' => 'select', '#default_value' => $new ? 'Select' : $outreach['status'], '#options' => array('isIdea' => 'Idea'), '#title' => t('Status:'), '#chosen' => true, '#suffix' => '</td>');
                    }
                }
            }
        }
    }
    // allows a user to go to team outreach settings
    $form['fields']['manageTagsBttn'] = array('#prefix' => '<td colspan ="3" style="text-align:center">', '#markup' => '<a href="?q=teamOutreachSettings" target="_blank"><button type="button">Manage Tags</button></a>', '#suffix' => '</td></tr>');
    $form['fields']['description'] = array('#prefix' => '<tr><td colspan="6" style="text-align:center">', '#type' => 'textarea', '#title' => t('Description:'), '#default_value' => $new ? '' : $outreach['description'], '#placeholder' => 'Maximum of 500 characters', '#suffix' => '</td></tr>', '#maxlength_js' => 'TRUE', '#maxlength' => '500');
    $form['fields']['address'] = array('#prefix' => '<tr><td colspan="3" style="text-align:center">', '#type' => 'textfield', '#title' => t('Address:'), '#default_value' => $new ? '' : $outreach['address'], '#suffix' => '</td>');
    $team = dbGetTeam($TID);
    // default value from the team form
    $form['fields']['city'] = array('#prefix' => '<td colspan="1" style="text-align:center">', '#type' => 'textfield', '#title' => t('City:'), '#default_value' => $new ? $team['city'] : $outreach['city'], '#suffix' => '</td></tr>');
    $form['fields']['state'] = array('#prefix' => '<tr><td colspan="3" style="text-align:center">', '#type' => 'select', '#title' => t('State:'), '#options' => states_list(), '#default_value' => $new ? $team['state'] : $outreach['state'], '#chosen' => true, '#suffix' => '</td>');
    $form['fields']['country'] = array('#prefix' => '<td colspan="3" style="text-align:center">', '#type' => 'select', '#title' => t('Country:'), '#options' => countries_list(), '#default_value' => $new ? $team['country'] : $outreach['country'], '#chosen' => true, '#suffix' => '</td></tr>');
    $form['fields']['co_firstName'] = array('#prefix' => '<tr><td colspan="3" style="text-align:center">', '#type' => 'textfield', '#title' => t("Host Contact's First Name:"), '#default_value' => $new ? '' : $outreach['co_firstName'], '#placeholder' => 'Contact for this outreach', '#suffix' => '</td>');
    $form['fields']['co_lastName'] = array('#prefix' => '<td colspan="3" style="text-align:center">', '#type' => 'textfield', '#title' => t("Host Contact's Last Name:"), '#default_value' => $new ? '' : $outreach['co_lastName'], '#suffix' => '</tr>');
    $form['fields']['co_phoneNumber'] = array('#prefix' => '<tr><td colspan="3" style="text-align:center">', '#type' => 'textfield', '#title' => t("Host Contact's Phone Number:"), '#default_value' => $new ? '' : $outreach['co_phoneNumber'], '#placeholder' => 'Format: XXXXXXXXXX', '#suffix' => '</td>');
    $form['fields']['co_email'] = array('#prefix' => '<td colspan="3" style="text-align:center">', '#type' => 'textfield', '#title' => t("Host Contact's Email:"), '#default_value' => $new ? '' : $outreach['co_email'], '#placeholder' => 'Email of outreach contact', '#suffix' => '</td></tr>');
    $form['fields']['co_organization'] = array('#prefix' => '<tr><td colspan="6" style="text-align:center">', '#type' => 'textfield', '#title' => t("Host Organization:"), '#default_value' => $new ? '' : $outreach['co_organization'], '#placeholder' => 'Group participating with for this outreach', '#suffix' => '</td></tr>');
    // allows a user to add dates to an outreach
    if (empty($form_state['numRows'])) {
        $form_state['numRows'] = 1;
    }
    $form['fields']['datesHeader'] = array('#markup' => '<tr><td colspan="6">');
    $form['fields']['dates']['header'] = array('#markup' => '<div id="dates-div"><table>');
    $date = date(DEFAULT_TIME_FORMAT, strtotime('today noon'));
    for ($i = 0; $i < $form_state['numRows']; $i++) {
        $form['fields']['dates']["openFieldOfStart-{$i}"] = array('#markup' => '<tr><td colspan="2" align="left" style="text-align:left">');
        if (!empty($times)) {
            $startTime = date(DEFAULT_TIME_FORMAT, dbDateSQL2PHP($times[$i]['startTime']));
        }
        $form['fields']['dates']["startTime-{$i}"] = array('#type' => 'date_popup', '#title' => t('Start Date:'), '#default_value' => !isset($startTime) ? $date : $startTime, '#date_format' => TIME_FORMAT, '#date_label_position' => 'within', '#date_increment' => 1, '#date_year_range' => '-20:+20', '#datepicker_options' => array(), '#states' => array('invisible' => array(':input[name="status"]' => array('value' => 'isIdea'))));
        if (!$new) {
            $form_state['fields']['dates']["TOID-{$i}"] = $times[$i]['TOID'];
        }
        $form['fields']['dates']["closeFieldOfStart-{$i}"] = array('#markup' => '</td>');
        $form['fields']['dates']["openFieldOfEnd-{$i}"] = array('#markup' => '<td colspan="2" align="right" style="text-align:left">');
        if (!empty($times)) {
            $endTime = date(DEFAULT_TIME_FORMAT, dbDateSQL2PHP($times[$i]['endTime']));
        }
        $form['fields']['dates']["endTime-{$i}"] = array('#type' => 'date_popup', '#title' => t('End Date:'), '#default_value' => !isset($endTime) ? $date : $endTime, '#date_format' => TIME_FORMAT, '#date_label_position' => 'within', '#date_increment' => 1, '#date_year_range' => '-20:+20', '#datepicker_options' => array(), '#states' => array('invisible' => array(':input[name="status"]' => array('value' => 'isIdea'))));
        $form['fields']['dates']["closeFieldOfEnd-{$i}"] = array('#markup' => '</td>');
        if ($i == $form_state['numRows'] - 1) {
            $form['fields']['dates']["addRowButton-{$i}"] = array('#prefix' => '<td colspan="1" style="text-align:center">', '#type' => 'submit', '#submit' => array('addDateRow'), '#value' => '+', '#limit_validation_errors' => array(), '#ajax' => array('callback' => 'modifyDateRows_callback', 'wrapper' => 'dates-div'), '#states' => array('invisible' => array(':input[name="status"]' => array('value' => 'isIdea'))), '#suffix' => '</td>');
        }
        if ($i == $form_state['numRows'] - 1) {
            $form['fields']['dates']["removeRowButton-{$i}"] = array('#prefix' => '<td colspan="1" style="text-align:center">', '#type' => 'submit', '#submit' => array('removeDateRow'), '#value' => '-', '#limit_validation_errors' => array(), '#ajax' => array('callback' => 'modifyDateRows_callback', 'wrapper' => 'dates-div'), '#states' => array('invisible' => array(':input[name="status"]' => array('value' => 'isIdea'))), '#suffix' => '</td>');
        }
        $form['fields']['dates']["rowFooter-{$i}"] = array('#markup' => '</tr>');
    }
    // end of for loop
    $form['fields']['dates']["divFooter-{$i}"] = array('#markup' => '</table></div></td>');
    // allows the user to change the outreach visibility if the status is locked
    if (!$new && $outreach["status"] == "locked") {
        $isPublicOptions = array(0 => t('Private'), 1 => t('Public'));
        $form['fields']['isPublic'] = array('#prefix' => '<tr><td colspan="3" style="text-align:center">', '#type' => 'radios', '#title' => t('Set Event Visibility'), '#options' => $isPublicOptions, '#default_value' => $new ? '1' : $outreach['isPublic'], '#suffix' => '</td></tr>');
    }
    $form['fields']['submit'] = array('#prefix' => '<tr><td colspan="6" style="text-align:right">', '#type' => 'submit', '#value' => t('Save'), '#sorted' => false, '#suffix' => '</td></tr>');
    $form['fields']['finalFooter'] = array('#markup' => '</table>');
    if (!$new && !(hasPermissionForTeam('editAnyOutreach', $TID) || isMyOutreach($params['OID']))) {
        drupal_set_message("You don't have permission to edit this outreach.", 'error');
        drupal_goto('viewOutreach', array('query' => array('OID' => $params['OID'])));
    }
    if (dbGetTeamsForUser($user->uid) == NULL) {
        drupal_set_message("You don't have a team assigned.", 'error');
        drupal_goto($_SERVER['HTTP_REFERER']);
    }
    if (!dbIsUserApprovedForTeam($UID, $TID)) {
        drupal_set_message("You aren't approved for this team.", 'error');
        drupal_goto($_SERVER['HTTP_REFERER']);
    }
    if (dbGetStatusForTeam($TID) == "0" || dbGetStatusForTeam($TID) == FALSE) {
        drupal_set_message("This team isn't active/approved.", 'error');
        drupal_goto($_SERVER['HTTP_REFERER']);
    }
    return $form;
}
Esempio n. 8
0
function viewOutreachEvent()
{
    global $user;
    $UID = $user->uid;
    $params = drupal_get_query_parameters();
    if (isset($params['OID']) && $params['OID'] > 0) {
        $OID = $params['OID'];
        $outreach = dbGetOutreach($OID);
        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;
        }
        $TID = $outreach['TID'];
        if (!isMyTeam($TID)) {
            drupal_set_message('You do not have permission to access this page.', 'error');
            return;
        }
        // if the outreach status is outreach and the event is over, then turn the status to write up
        if ($outreach['status'] == "isOutreach") {
            outreachToWriteUp($OID);
        }
        // determine if the user can physically sign up
        $canSignUp = !dbIsOutreachOver($OID) && ($outreach['status'] == 'isOutreach' || $outreach['status'] == 'doingWriteUp');
        $markup = '';
        $markup .= '<div style="float:left; width:38%">';
        $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>';
        // display outreach name
        $markup .= "{$outreach['name']}";
        $markup .= '</b></h2></div></td></tr>';
        $markup .= '<tr><td>';
        $markup .= showOutreachStatusIcon($outreach['status']);
        // displays the icon for a public outreach
        $markup .= $outreach['isPublic'] ? '<span title="Public"><img class="eventPrivacyIcon" src="/images/icons/publicBlue.png"></span>' : '<span title="Private"><img class="eventPrivacyIcon" src="/images/icons/privateBlue.png"></span>';
        // displays the icon for a cancelled outreach
        $markup .= $outreach['cancelled'] ? '<span title="Event Cancelled"><img class="eventCancelledIcon" src="/images/icons/cancelledRed.png"' : '';
        $markup .= '</td></tr></table>';
        $markup .= '<table id="photoAndEdit"><tr><td style="padding:0px;">';
        // cannot edit photo if user doesn't have the correct permissions
        if (!isMyOutreach($OID) && !hasPermissionForTeam('editAnyOutreach', getCurrentTeam()['TID'])) {
            $markup .= '<div align="right">';
            $markup .= '<span title="Edit Photo"><button type="button" disabled><img class="editIcon" src="/images/icons/editThumbnailWhite.png"></button></span>';
            $markup .= '</div>';
        } else {
            // edit photo if user has permissions
            $markup .= '<div align="right">';
            $markup .= '<a href= "?q=editThumbnail';
            $markup .= '&OID=' . $OID . '&FID=' . $outreach['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;">';
        // default picture for outreach
        if (!empty($outreach['FID'])) {
            $FID = dbGetOutreachThumbnail($OID);
            $url = generateURL($FID);
            $markup .= '<div align="center"><img src="' . $url . '" style="max-width:150px; width:auto; height:auto; padding: 5px 0px 5px 0px">';
        } else {
            $markup .= '<div align="center"><img src="/images/defaultPics/team.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 the status is write-up, then allow a user to submit a write up
        if ($outreach['status'] == 'doingWriteUp' && !$outreach['isWriteUpSubmitted']) {
            $markup .= '<a href="?q=writeupform&OID=' . $outreach['OID'] . '"><button>Write Up</button></a>';
        } else {
            if ($outreach['isWriteUpSubmitted'] && hasPermissionForTeam('approveIdeas', $TID) && $outreach['status'] == 'doingWriteUp') {
                $markup .= '<a href="?q=writeupform&OID=' . $outreach['OID'] . '&approving"><button>Approve Write Up</button></a>';
            }
        }
        // if the status is idea, then allow a user with permissions to approve or reject the idea
        if ($outreach['status'] == 'isIdea' && hasPermissionForTeam('approveIdeas', $TID)) {
            $markup .= '<a href="?q=approveIdea/' . $outreach['OID'] . '/' . $TID . '"><button>Approve</button></a>';
            $markup .= '<a href="?q=rejectIdea/' . $outreach['OID'] . '/' . $TID . '"><button>Reject</button></a>';
        }
        // notifications button
        if (!isMyOutreach($OID) && !hasPermissionForTeam('editAnyOutreach', getCurrentTeam()['TID'])) {
            $markup .= '<button type="button" disabled>Notifications</button>';
        } else {
            $markup .= '<a href="?q=manageNotifications&OID=' . $outreach['OID'] . '"><button>Notifications</button></a>';
        }
        // manage sign-ups button
        if (!dbIsOutreachCancelled($OID)) {
            if (dbIsUserSignedUp($UID, $OID)) {
                if (dbIsOutreachOver($OID)) {
                    $markup .= '<a href="?q=signUp&OID=' . $OID . '"><div class="help tooltip4"><button type="button" disabled>Edit Sign Up</button><span id="helptext"; class="helptext tooltiptext4">You cannot edit your sign up for this event because it is already over.</span></div></a>';
                } else {
                    $markup .= '<a href="?q=signUp&OID=' . $OID . '"><div class="help tooltip4"><button type="button">Edit Sign Up</button><span id="helptext"; class="helptext tooltiptext4">Click here to edit your sign up for this event.</span></div></a>';
                }
            } else {
                if (dbIsOutreachOver($OID) || $outreach['status'] == 'isIdea') {
                    $markup .= '<a href="?q=signUp&OID=' . $OID . '"><div class="help tooltip4"><button type="button" disabled>Sign Up</button><span id="helptext"; class="helptext tooltiptext4">You cannot sign up for this event because it is already over.</span></div></a>';
                } else {
                    $markup .= '<a href="?q=signUp&OID=' . $OID . '"><div class="help tooltip4"><button type="button">Sign Up</button><span id="helptext"; class="helptext tooltiptext4">Click here to sign up for this event.</span></div></a>';
                }
            }
        } else {
            $markup .= '<a href="?q=signUp&OID=' . $OID . '"><div class="help tooltip4"><button type="button" disabled>Sign Up</button><span id="helptext"; class="helptext tooltiptext4">You cannot sign up for this event because it is cancelled.</span></div></a>';
        }
        // hours button
        if (!dbIsOutreachCancelled($OID)) {
            $markup .= '<a href= "?q=viewHours';
            $markup .= '&OID=' . $OID . '">';
            $markup .= '<button type="button" ';
            $markup .= $outreach['status'] == 'isIdea' ? ' disabled' : '';
            $markup .= '>Hours</button></a>';
        } else {
            // if outreach is cancelled
            $markup .= '<button type="button" disabled';
            $markup .= $outreach['status'] == 'isIdea' ? ' disabled' : '';
            $markup .= '>Hours</button>';
        }
        // view media button
        $markup .= '<a href="?q=viewMedia';
        $markup .= '&OID=' . $OID . '">';
        $markup .= '<button type="button"';
        $markup .= $outreach['status'] == 'isIdea' ? ' disabled' : '';
        $markup .= '>Media</button></a>';
        // edit outreach button
        if (!isMyOutreach($OID) && !hasPermissionForTeam('editAnyOutreach', getCurrentTeam()['TID'])) {
            $markup .= '<button type="button" disabled><img class="editIcon" src="/images/icons/editWhite.png"></button>';
        } else {
            $markup .= '<a href= "?q=outreachForm';
            $markup .= '&OID=' . $OID . '">';
            $markup .= '<button type="button"><img class="editIcon" src="/images/icons/editWhite.png"></button></a>';
        }
        $markup .= '</div>';
        $markup .= '<div style="width:60%; float:right; padding-left:10px">';
        $hasPointOfContact = false;
        if (!(empty($outreach['co_organization']) && empty($outreach['co_firstName']) && empty($outreach['co_email']) && empty($outreach['co_phoneNumber']))) {
            $hasPointOfContact = true;
        }
        // account for cases where no info is present
        if ($outreach['description'] == null) {
            $outreach['description'] = '[none]';
        }
        if ($outreach['type'] == null || $outreach['type'] == '') {
            $outreach['type'] = '[none]';
        }
        if ($outreach['status'] == null) {
            $outreach['status'] = '[none]';
        }
        if ($outreach['co_organization'] == null) {
            $outreach['co_organization'] = '[none]';
        }
        if ($outreach['co_position'] == null) {
            $outreach['co_position'] = '[none]';
        }
        if ($outreach['co_firstName'] == null) {
            $outreach['co_firstName'] = '[none]';
        }
        if ($outreach['co_email'] == null) {
            $outreach['co_email'] = '[none]';
        }
        if ($outreach['co_phoneNumber'] == null) {
            $outreach['co_phoneNumber'] = '[none]';
        }
        if ($outreach['city'] == null) {
            $outreach['city'] = '[none]';
        }
        if ($outreach['state'] == null) {
            $outreach['state'] = '[none]';
        }
        if ($outreach['address'] == null) {
            $outreach['address'] = '[none]';
        }
        if ($outreach['country'] == null) {
            $outreach['country'] = '[none]';
        }
        if ($outreach['totalAttendance'] == null) {
            $outreach['totalAttendance'] = 0;
        }
        if ($outreach['testimonial'] == null) {
            $outreach['testimonial'] = '[none]';
        }
        $team = dbGetTeam($outreach['TID']);
        // begin displaying info body
        $markup .= '<table id="miniViewTeam" style="margin:16px 0px 0px 0px"><tr><td><h3><b><u>General<u></b></h3></td></tr>';
        $owner = dbGetOutreachOwner($OID);
        $markup .= "<tr><td colspan='3'><b>Owner: </b>" . dbGetUserName($owner) . "</a></td>";
        $markup .= "<td colspan='3'><b>Team: </b>{$team['number']}</td></tr>";
        $markup .= '<tr><td colspan="3"><b>Tags: </b>';
        $tags = dbGetTagsForOutreach($OID);
        if (!empty($tags)) {
            dpm($tags);
            $first = true;
            $length = count($tags);
            $i = 1;
            foreach ($tags as $OTID => $tagName) {
                $markup .= '<a href="?q=outreach&tag=' . $OTID . '">' . $tagName . '</a>';
                if ($i < $length) {
                    $markup .= ', ';
                }
                $i++;
            }
            // if there aren't any tags
        } else {
            $markup .= '[none]';
        }
        $markup .= '</td></tr>';
        $times = dbGetTimesForOutreach($OID);
        // display time if the outreach status isn't an idea
        if ($outreach['status'] != 'isIdea') {
            if (!empty($times)) {
                foreach ($times as $time) {
                    $startTime = date(TIME_FORMAT, dbDateSQL2PHP($time['startTime']));
                    $endTime = date(TIME_FORMAT, dbDateSQL2PHP($time['endTime']));
                    $markup .= '<tr><td colspan="3"><b>Start Date: </b>' . $startTime . '</td>';
                    $markup .= '<td colspan="3"><b>End Date: </b>' . $endTime . '</td></tr>';
                }
            }
        }
        $markup .= '<tr><td colspan="5" style="word-break:break-word"><b>Description: </b>';
        $markup .= wordwrap($outreach['description'], 70, "<br />\n");
        $markup .= '</td></tr>';
        // if the outreach has contact information
        if ($hasPointOfContact) {
            $markup .= '<tr><td><h3><b><u>Contact Info<u></b></h3></td></tr>';
            $markup .= '<tr><td colspan="3"><b>Host Organization: </b>';
            $markup .= strip_tags($outreach['co_organization'], ALLOWED_TAGS) . '</td>';
            $markup .= '<td colspan="3"><b>Contact Name: </b>';
            $markup .= strip_tags($outreach['co_firstName'] . ' ' . $outreach['co_lastName'], ALLOWED_TAGS) . '</td></tr>';
            $markup .= '<tr><td colspan="3"><b>Contact Email: </b>' . strip_tags($outreach['co_email'], ALLOWED_TAGS) . '</td>';
            $phoneNumber = dbFormatPhoneNumber($outreach['co_phoneNumber']);
            $markup .= '<td colspan="3"><b>Contact Number: </b>' . $phoneNumber . '</td></tr>';
            $markup .= '<tr><td colspan="6"><b>Address: </b>' . strip_tags($outreach['address'], ALLOWED_TAGS) . ', ' . strip_tags($outreach['city'], ALLOWED_TAGS) . ', ' . strip_tags($outreach['state'], ALLOWED_TAGS) . '</td></tr>';
            $markup .= '</tr>';
        } else {
            $markup .= '<tr><td><h3><b><u>Contact Info<u></b></h3></td></tr>';
            $markup .= '<tr><td colspan="6"><b>Address: </b>' . strip_tags($outreach['address'], ALLOWED_TAGS) . ', ' . strip_tags($outreach['city'], ALLOWED_TAGS) . ', ' . strip_tags($outreach['state'], ALLOWED_TAGS) . '</td></tr>';
            $markup .= '</tr>';
        }
        $markup .= '<tr><td><h3><b><u>Statistics<u></b></h3></td></tr>';
        $markup .= '<tr>';
        if ($outreach['status'] != 'isIdea') {
            $numPpl = dbGetNumPplSignedUpForEvent($OID);
            $markup .= '<td colspan="3"><b>';
            // only show the link if people are signed up
            if ($numPpl != 0) {
                $markup .= '<a href="?q=outreachList&OID=' . $OID . '"target="_blank">';
            }
            $markup .= 'People Signed Up: </b>';
            // end the link
            if ($numPpl != 0) {
                $markup .= '</a>';
            }
            $markup .= $numPpl . '</td>';
            // view total hours for the outreach
            $markup .= '<td colspan="3"><b>Total Hours: </b><a href="?q=viewHours&OID=' . $OID . '">' . dbGetHoursForOutreach($OID) . '</a></td></tr>';
            //if the outreach status is idea
        } else {
            $markup .= '<td colspan="3">';
            $markup .= '<b>People Signed Up: </b>';
            $markup .= 'None';
            $markup .= '</td></tr>';
        }
        $markup .= '</table></div>';
        // if the outreach has an approved write-up
        if ($outreach['isWriteUpApproved'] && $outreach['status'] == 'locked') {
            $writeUp = empty($outreach["writeUp"]) ? '[None]' : $outreach["writeUp"];
            $totalAttendance = empty($outreach["totalAttendance"]) ? '[Not Filled Out]' : $outreach["totalAttendance"];
            $testimonial = empty($outreach["testimonial"]) ? '[None]' : $outreach["testimonial"];
            $markup .= '<div style="float:left; width:38%;"><table id="miniViewTeam" style="margin:16px 0px 0px 0px"><tr><td><h3><b><u>Write Up<u></b></h3></td>';
            $markup .= '<td><a href="?q=writeupform&OID=' . $outreach['OID'] . '&approved"><button> View</button></a></td></tr>';
            $markup .= '<tr><td><b>Write Up:</b></td></tr>';
            $markup .= '<tr><td>' . $writeUp . '</td></tr>';
            $markup .= '<tr><td><b>Total Attendance:</b></td></tr>';
            $markup .= '<tr><td>' . $totalAttendance . '</td></tr>';
            $markup .= '<tr><td><b>Testimonials/Comments:</b></td></tr>';
            $markup .= '<tr><td>' . $testimonial . '</td></tr>';
            $markup .= '</table></div>';
        }
        $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');
    }
}
Esempio n. 9
0
function oldHoursForm_validate($form, $form_state)
{
    $currentYear = date("Y");
    for ($i = 0; $i < $form_state['numRows']; $i++) {
        // hours field cannot be blank
        if (empty($form_state['values']["hours-{$i}"])) {
            form_set_error("fields][hours-{$i}", 'Number of hours cannot be empty.');
        } else {
            // hours field must be a number
            if (!is_numeric($form_state['values']["hours-{$i}"])) {
                form_set_error("fields][hours-{$i}", 'Hours field must be a number.');
            } else {
                // the number can't be too big
                if ($form_state['values']["hours-{$i}"] > 9999) {
                    form_set_error("fields][hours-{$i}", 'Please enter a valid number of hours less than 9,999.');
                }
            }
        }
        $rookieYear = dbGetTeam($form_state['TID'])['rookieYear'];
        // year field cannot be blank
        if (empty($form_state['values']["year-{$i}"])) {
            form_set_error("fields][year-{$i}", 'Year cannot be empty.');
        } else {
            // year field must be a number
            if (!is_numeric($form_state['values']["year-{$i}"])) {
                form_set_error("fields][year-{$i}", 'Year field must be a number.');
            } else {
                // year field cannot be before 1980 (the year FIRST was founded)
                if ($form_state['values']["year-{$i}"] < 1980) {
                    form_set_error("fields][year-{$i}", 'Please enter a valid year after 1980.');
                }
                // year field cannot be before the team's rookie year
                if ($form_state['values']["year-{$i}"] < $rookieYear) {
                    form_set_error("fields][year-{$i}", 'Please enter a valid year after your rookie year ' . "({$rookieYear})");
                }
                // cannot log hours for years in the future
                if ($form_state['values']["year-{$i}"] > $currentYear) {
                    form_set_error("fields][year-{$i}", 'You can not enter an year after ' . $currentYear . '.');
                }
            }
        }
    }
    // end of for loop
}
Esempio n. 10
0
function viewUserUpcomingEvents()
{
    global $user;
    $UID = $user->uid;
    $currentTeam = getCurrentTeam();
    $TID = $currentTeam['TID'];
    $teamNumber = $currentTeam['number'];
    $markup = '<div class="help tooltip2">';
    $markup .= '<h2>My Upcoming Events</h2>';
    $markup .= '<span id="helptext"; class="helptext tooltiptext2">';
    $markup .= 'These are your upcoming events that you own or have signed up for.';
    $markup .= '</span></div>';
    $markup .= '<table class="infoTable"><tr><th colspan="3">Name</th>';
    $markup .= '<th colspan="2">Event Date</th>';
    if (dbUserMoreThan1Team($UID)) {
        // if the user has more than one team
        $markup .= '<th>Team</th>';
    } else {
        $markup .= '<th></th>';
    }
    $markup .= '<th></th>';
    $markup .= "</tr>";
    $orderParams = 'upcoming';
    $outreaches = dbGetOutreachForUser($user->uid, $orderParams, NUM_UPCOMING_OUTREACHES_SHOWN);
    // if the user has upcoming outreaches
    if (!empty($outreaches)) {
        foreach ($outreaches as $outreach) {
            $OID = $outreach['OID'];
            $TID = $outreach['TID'];
            $team = dbGetTeam($outreach['TID']);
            $eventDate = date(TIME_FORMAT, strtotime(dbGetEarliestTimeForOutreach($OID)));
            // display outreach information
            $markup .= "<tr>";
            $markup .= '<td colspan="3">' . '<a href="?q=viewOutreach&OID=' . $OID . '">' . chopString($outreach["name"], 20) . '</a>' . "</td>";
            $markup .= '<td colspan="2">' . $eventDate . "</td>";
            $markup .= "<td>{$team['number']}</td>";
            $markup .= '<td><a href="?q=signUp&OID=' . $OID . '">';
            $markup .= '<button type="button">Edit Sign Up</button></a></td>';
            $markup .= "</tr>";
        }
    } else {
        // if the user does not have any upcoming events
        $markup .= "<tr>";
        $markup .= '<td style="text-align:center" colspan="7"><em>[None]</em></td>';
        $markup .= "</tr>";
    }
    $markup .= "</table>";
    $retArray = array();
    $retArray['#markup'] = $markup;
    return $retArray;
}