示例#1
0
function viewEventsForTeam()
{
    global $user;
    $params = drupal_get_query_parameters();
    if (dbGetTeamsForUser($user->uid) == NULL) {
        drupal_set_message("You don't have a team assigned.", 'error');
        drupal_goto($_SERVER['HTTP_REFERER']);
        return;
    }
    if (isset($params['UID'])) {
        $UID = $params['UID'];
    } else {
        $UID = $user->uid;
    }
    if (isset($params['TID'])) {
        $TID = $params['TID'];
    } else {
        $currentTeam = getCurrentTeam();
        $TID = $currentTeam['TID'];
    }
    $outreaches = dbGetOutreachesForUserForTeam($UID, $TID);
    $markup = '<div style="width:50%;align-text:right;"><h2>Outreaches You Have <b>Signed Up</b> For</h2></div>';
    $markup .= '<table>';
    $markup .= '<tr>';
    $markup .= "<th>Name</th>";
    $markup .= "<th>Description</th>";
    $markup .= "<th>Hours</th>";
    $markup .= "</tr>";
    foreach ($outreaches as $outreach) {
        $markup .= "<tr>";
        $markup .= "<td>" . '<b><a href="?q=viewOutreach&OID=' . $outreach['OID'] . '">' . chopString($outreach["name"], 15) . '</a>' . "<b></td>";
        $markup .= "<td>" . chopString($outreach["description"], 15) . "</td>";
        $markup .= "<td>" . dbGetHoursForUserFromOutreach($UID, $outreach['OID']) . "</tr>";
        $markup .= "</tr>";
    }
    $markup .= "</table></div>";
    $retArray = array();
    $retArray['#markup'] = $markup;
    return $retArray;
}
示例#2
0
function viewUserEventsForTeam()
{
    global $user;
    $params = drupal_get_query_parameters();
    // if user does not have a team
    if (dbGetTeamsForUser($user->uid) == NULL) {
        drupal_set_message("You don't have a team assigned.", 'error');
        drupal_goto($_SERVER['HTTP_REFERER']);
    }
    if (isset($params['UID'])) {
        $UID = $params['UID'];
    } else {
        $UID = $user->uid;
    }
    if (isset($params['TID'])) {
        $TID = $params['TID'];
    } else {
        $currentTeam = getCurrentTeam();
        $TID = $currentTeam['TID'];
    }
    $outreaches = dbGetOutreachesForUserForTeam($UID, $TID);
    $teamName = dbGetTeamName($TID);
    // create page header and table
    $markup = "<table><h1>My Outreaches For {$teamName}</h1></table>";
    $markup .= '<table class="infoTable">';
    $markup .= '<tr>';
    $markup .= '<th colspan="3">Outreach Name</th>';
    $markup .= '<th colspan="3">Description</th>';
    $markup .= '<th colspan="2">Hours</th>';
    $markup .= "</tr>";
    // if user has outreaches for the current team
    if (!empty($outreaches)) {
        foreach ($outreaches as $outreach) {
            $markup .= "<tr>";
            $markup .= '<td colspan="3">' . '<a href="?q=viewOutreach&OID=' . $outreach['OID'] . '">' . chopString($outreach["name"], 30) . '</a>' . "</td>";
            $markup .= '<td colspan="3">' . chopString($outreach["description"], 30) . "</td>";
            $markup .= '<td colspan="2">' . dbGetHoursForUserFromOutreach($UID, $outreach['OID']) . "</tr>";
            $markup .= "</tr>";
        }
        $markup .= "</table>";
    } else {
        // if the user does not have any outreaches for the current team
        $markup .= '<tr><td style="text-align:center" colspan="10"><em>[None]</em></td>';
        $markup .= "</tr>";
    }
    $markup .= "</table>";
    $retArray = array();
    $retArray['#markup'] = $markup;
    return $retArray;
}
示例#3
0
function viewOwnedOutreaches()
{
    global $user;
    if (dbGetTeamsForUser($user->uid) == NULL) {
        drupal_set_message("You don't have a team assigned.", 'error');
        drupal_goto($_SERVER['HTTP_REFERER']);
        return;
    }
    $UID = $user->uid;
    $ownedOutreaches = dbGetOwnedOutreachForUser($UID);
    // get the owned outreaches for a user
    $markup = '<div align = "right"><a href="?q=outreachesSignedUpFor&UID=' . $UID . '"><button>View Outreaches You Have Signed Up For</button></a></div>';
    $markup .= '<div style="right" . width:30%;"><h2>Outreaches You <b>Own</b></h2>';
    // begin table
    $markup .= '<table>';
    $markup .= '<tr>';
    $markup .= "<th>Name</th>";
    $markup .= "<th>Description</th>";
    $markup .= "<th>Hours</th>";
    $markup .= "</tr>";
    foreach ($ownedOutreaches as $ownedOutreach) {
        $markup .= "<tr>";
        $markup .= "<td>" . '<b><a href="?q=viewOutreach&OID=' . $ownedOutreach['OID'] . '">' . chopString($ownedOutreach["name"], 15) . '</a>' . "<b></td>";
        $markup .= "<td>" . chopString($ownedOutreach["description"], 15) . "</td>";
        $markup .= "<td>" . dbGetHoursForUserFromOutreach($UID, $ownedOutreach['OID']) . "</tr>";
        $markup .= "</tr>";
    }
    $markup .= "</table></div>";
    $retArray = array();
    $retArray['#markup'] = $markup;
    return $retArray;
}