Permalink
Browse files

fixed groups

  • Loading branch information...
1 parent b385878 commit 7f18239d0b45478036eabc2028f1a01fe6e84831 @DouglasSherk committed Mar 28, 2012
Showing with 47 additions and 28 deletions.
  1. +11 −0 activity.php
  2. +13 −20 email/group.html
  3. +2 −1 email/send-group.php
  4. +2 −0 groupResults.php
  5. +18 −6 groupmatch.php
  6. +1 −1 match.php
View
@@ -258,6 +258,17 @@ function toggleHint() {
}
?>
+<?php
+ if (isset($_SESSION['group_name_filled'])) {
+?>
+ <div id="FlashMessage">
+ <p>You have joined a group to do <?php echo $_SESSION['group_name_filled']; ?>. You will receive an email shortly with this group's contact info.</p>
+ </div>
+<?php
+ unset($_SESSION['group_name_filled']);
+ }
+?>
+
<script type="text/javascript">
var memo = {};
$('.ui-menu-item').live('click', function() {
View
@@ -1,41 +1,34 @@
<html>
<body style="font-family: &quot;Verdana&quot;, Arial, sans-serif; font-size: 20px;">
<table
- background="http://dev.recmeet.apollorp.org/res/images/email-background.png"
- height="460" width="660" style="margin: auto; padding: 30px;">
+ width="660" style="margin: auto; padding: 30px;">
<tr height="72" width="200">
<td style="text-align: center;" colspan=2>
<img src="http://dev.recmeet.apollorp.org/res/images/logo.png" />
</td>
</tr>
<tr>
<td colspan=2>
- Somebody has requested you as a <?php echo $activity; ?> partner!<br/>
+ You have been matched with a group to do <?php echo $activity; ?>!<br/><br/>
- Click 'accept' to accept or just ignore this email if
- you're not interested.<br/>
-
- <a href="http://somebody.nu/acceptmatch?token=<?php echo $token ?>">
- Accept
- </a>
+ Just hit "reply-all" to start communicating with your new partners!
</td>
</tr>
<?php
foreach ($users as $member) {
$uid = $member['uid'];
- $name = $member['uid'];
- $html = <<<EOH
- <tr>
- <td width="100%" style="text-align: center;">
- <a href="http://www.facebook.com/profile.php?id=$uid">
- <p style="font-weight: bold;">$name</p>
- <img src="https://graph.facebook.com/$uid/picture?type=square" alt="Profile Picture" />
- </a>
- </td>
- </tr>
-<<<EOH;
+ $name = $member['name'];
+ $html = '<tr>' .
+ '<td width="100%" style="text-align: center;">' .
+ '<a href="http://www.facebook.com/profile.php?id=' . $uid . '">' .
+ '<p style="font-weight: bold;">' . $name . '</p>' .
+ '<img src="https://graph.facebook.com/' . $uid . '/picture?type=square" alt="Profile Picture" />' .
+ '</a>' .
+ '</td>' .
+ '</tr>';
echo $html;
}
+?>
<tr style="font-size: 12px;">
<td colspan=2>
<table width="100%" style="margin-bottom: -15px;">
View
@@ -1,4 +1,4 @@
-<?
+<?php
include_once('email/postageapp.php');
$siteFrom = "no-reply@somebody.nu";
@@ -22,4 +22,5 @@
"From" => $siteFrom,
"Reply-to" => $replyTo,
);
+
PostageApp::mail($replyTo, $subject, $content, $headers);
View
@@ -139,8 +139,10 @@ function format_rel_ts($secs) {
<a href="groupmatch?group_id=$group_id&activity_id=$activity_id">
<div name="result[]" class="Result">
EOH;
+ echo $html;
}
}
+ $previous_group_id = $group_id;
$html = <<<EOH
<img class="ProfilePic" alt="Profile Picture"
View
@@ -19,18 +19,20 @@
}
$query = "SELECT activities.*," .
- "groups.size - (SELECT COUNT(*) FROM group_members WHERE group_id=(SELECT group_id FROM group_members WHERE user_id=$user->id)) AS remaining " .
- "LEFT JOIN activities ON activities.id = groups.activity_id, "
- "FROM groups;";
+ "groups.size - (SELECT COUNT(*) FROM group_members WHERE group_id=$group_id) AS remaining " .
+ "FROM groups " .
+ "LEFT JOIN activities ON activities.id = groups.activity_id";
$result = mysql_query($query) or die(mysql_error());
if ($row = mysql_fetch_assoc($result)) {
if ($row['remaining'] == 1) {
$users = array();
+ $activity = $row['name'];
+
$query = "SELECT group_members.*, users.* FROM group_members " .
"LEFT JOIN users ON users.id = group_members.user_id " .
- "WHERE group_id = $group_id;"
+ "WHERE group_id = $group_id;";
$result = mysql_query($query) or die(mysql_error());
while ($row2 = mysql_fetch_assoc($result)) {
@@ -41,21 +43,31 @@
));
}
+ array_push($users, array(
+ 'email' => $user->email,
+ 'name' => $user->name,
+ 'uid' => $user->uid
+ ));
+
$query = "DELETE FROM group_members WHERE group_id = $group_id;";
mysql_query($query) or die(mysql_error());
- $query = "DELETE FROM groups WHERE group_id = $group_id;";
+ $query = "DELETE FROM groups WHERE id = $group_id;";
mysql_query($query) or die(mysql_error());
$tmpl = 'group';
$subject = 'You have been matched with a group!';
include_once('email/send-group.php');
+
+ $_SESSION['group_name_filled'] = $row['name'];
} else {
$query = "INSERT INTO group_members (id, user_id, group_id) " .
"VALUES(null, $user->id, $group_id);";
mysql_query($query) or die(mysql_error());
+
+ $_SESSION['group_name'] = $row['name'];
}
- $_SESSION['group_name'] = $row['name'];
+ header('Location: /');
}
View
@@ -62,7 +62,7 @@
} else {
$query = "SELECT group_members.*, groups.*, users.*, " .
"groups.id = (SELECT group_id FROM group_members WHERE user_id=$user->id) AS userInGroup, " .
- "groups.size - (SELECT COUNT(*) FROM group_members WHERE group_id=(SELECT group_id FROM group_members WHERE user_id=$user->id)) AS remaining " .
+ "groups.size - (SELECT COUNT(*) FROM group_members WHERE group_id=groups.id) AS remaining " .
"FROM group_members " .
"LEFT JOIN groups ON groups.id = group_members.group_id " .
"LEFT JOIN users ON users.id = group_members.user_id " .

0 comments on commit 7f18239

Please sign in to comment.