?> </div> <div class="chunk"> <?php $callings = $mem->Callings(); echo count($callings) == 1 ? '<b>Calling</b>' : '<b>Callings</b>'; foreach ($callings as $c) { echo $c->Name . "<br>"; } ?> </div> <div class="chunk"> <b>FHE group</b> <?php $group = FheGroup::Load($mem->FheGroup); if ($group) { echo $group->GroupName; } ?> </div> <div class="chunk"> <b>Member since</b> <?php echo date('F Y', strtotime($mem->RegistrationDate())); ?> </div> <div class="chunk"> <b>Profile updated</b>
$action = "edit"; } else { Response::Send(400, "Not sure what to do."); } if ($action == "new") { @($name = $_POST['groupname']); @($ldr1 = $_POST['ldr1']); @($ldr2 = $_POST['ldr2']); @($ldr3 = $_POST['ldr3']); if (!$name) { Response::Send(400, "Can't create a group unless there's a name for it."); } if ($ldr1 == $ldr2 && $ldr1 != 0 || $ldr2 == $ldr3 && $ldr2 != 0 || $ldr1 == $ldr3 && $ldr3 != 0) { Response::Send(400, "Each leader of the group must be different."); } $fhe = new FheGroup(); $fhe->GroupName = $name; $fhe->Leader1 = $ldr1; $fhe->Leader2 = $ldr2; $fhe->Leader3 = $ldr3; $fhe->WardID = $MEMBER->WardID; // This next for loop is the SAME THING as in the "Edit" part later on... // Make sure new leaders are removed from any existing group leaderships. // TODO: This way of doing it is too redundant. I want to redo this another time. What if the // leadership becomes discombobulated? (e.g. removes a leader1 but keeps leader 2... just looks weird) // This is a messy implementation. That's what I get for being in a hurry, I guess. for ($i = 1; $i <= 3; $i++) { DB::Run("UPDATE FheGroups SET Leader{$i}=0 WHERE Leader{$i}='{$ldr1}' OR Leader{$i}='{$ldr2}' OR Leader{$i}='{$ldr3}'"); } if ($fhe->Save()) { // Put leaders into the group
public function FheGroup() { return FheGroup::Load($this->FheGroup); }
$r = DB::Run($q); while ($row = mysql_fetch_array($r)) { array_push($mems, Member::Load($row['ID'])); } // Build list of options $memList = ""; foreach ($mems as $mem) { $memList .= "\r\n<option value=\"{$mem->ID()}\">" . $mem->FirstName() . " " . $mem->LastName . "</option>"; } $memList .= "\r\n"; // Get a list of FHE groups $groups = array(); $q2 = "SELECT ID FROM FheGroups WHERE WardID={$MEMBER->WardID} ORDER BY GroupName ASC"; $r2 = DB::Run($q2); while ($row = mysql_fetch_array($r2)) { array_push($groups, FheGroup::Load($row['ID'])); } ?> <!DOCTYPE html> <html> <head> <title>Manage FHE groups — <?php echo $WARD ? $WARD->Name . " Ward" : SITE_NAME; ?> </title> <?php include "../includes/head.php"; ?> <style> .no-group { background-color: #FFFFAA !important;