$object->clubid = $club->id; $object->level = 0; $object->role = "student"; $object->enabled = 1; $object->pending = 1; $object->create(); $notification = new Notification(); $notification->fromuserid = $session->user_id; $notification->touserid = $user->id; $notification->itemid = $object->id; $notification->itemtype = "clubuser"; $notification->title = "Invites you"; $notification->create(); $response = "success"; } else { $theuser = ClubUser::getUser($user->id, $_GET['clubid']); if ($theuser->pending == 0) { $response = "This user is already a member."; } else { $response = "This user is already pending."; } } } else { if (isset($_GET['groupid'])) { if (!GroupUser::userExists($user->id, $_GET['groupid'])) { $group = Group::get_by_id($_GET['groupid']); $object = new GroupUser(); $object->userid = $user->id; $object->groupid = $group->id; $object->level = 0; $object->role = "student";
if (isset($_GET['sectionid'])) { $section = Section::get_by_id($_GET['sectionid']); $theuser = SectionUser::getUser($object->id, $section->id); if ($theuser) { if ($theuser->pending == 1) { $html .= ' <td><button class="btn-small button-flat-primary disabled">Already Pending</button></td>'; } else { $html .= '<td><button class="btn-small button-flat-action disabled">Member</button></td>'; } } else { $html .= '<td><button class="btn-small button-flat-primary btninvite">Invite<span hidden>' . $object->id . '</span></button></td>'; } } else { if (isset($_GET['clubid'])) { $club = Club::get_by_id($_GET['clubid']); $theuser = ClubUser::getUser($object->id, $club->id); if ($theuser) { if ($theuser->pending == 1) { $html .= ' <td><button class="btn-small button-flat-primary disabled">Already Pending</button></td>'; } else { $html .= '<td><button class="btn-small button-flat-action disabled">Member</button></td>'; } } else { $html .= '<td><button class="btn-small button-flat-primary btninvite">Invite<span hidden>' . $object->id . '</span></button></td>'; } } else { if (isset($_GET['groupid'])) { $group = Group::get_by_id($_GET['groupid']); $theuser = GroupUser::getUser($object->id, $group->id); if ($theuser) { if ($theuser->pending == 1) {
} else { $response = "Error"; } } else { if (isset($_GET['sectionid'])) { if (SectionUser::userExists($session->user_id, $_GET['sectionid'])) { $object = SectionUser::getUser($session->user_id, $_GET['sectionid']); $object->update(); $response = "success"; } else { $response = "Error"; } } else { if (isset($_GET['clubid'])) { if (ClubUser::userExists($session->user_id, $_GET['clubid'])) { $object = ClubUser::getUser($session->user_id, $_GET['clubid']); $object->update(); $response = "success"; } else { $response = "Error"; } } else { if (isset($_GET['groupid'])) { if (GroupUser::userExists($session->user_id, $_GET['groupid'])) { $object = GroupUser::getUser($session->user_id, $_GET['groupid']); $object->update(); $response = "success"; } else { $response = "Error"; } }
<?php if ($session->is_logged_in()) { echo ' <a href="#invitationBox" role="button" class="btn-mini pull-right" data-toggle="modal"> <i class="icon-large icon-comment"></i> Invite Students </a> '; if ($loggeduser->is_super_admin() || ClubUser::amIAdmin($loggeduser->id, $club->id)) { echo ' <a href="updateclub.php?id=' . $club->id . '" class="btn-mini pull-right"> <i class="icon-large icon-pencil"></i> Edit </a> '; } $loggedschooluser = ClubUser::getUser($session->user_id, $club->id); if ($loggedschooluser == null) { echo ' <button role="button" class="btn-mini btn-link pull-right" onclick="join(); return false;"> <i class="icon-large icon-envelope"></i> Join </button> '; } else { if ($loggedschooluser != null) { if ($loggedschooluser->pending == 1) { echo ' <button role="button" class="btn-mini btn-link pull-right" onclick="cancelpending(); return false;"> <i class="icon-large icon-envelope"></i> Cancel Pending </button> '; } else {
$notification->itemid = $object->id; $notification->itemtype = "message"; $notification->title = "Opted Out"; $admins = SectionUser::getAdmins($section->id); foreach ($admins as $admin) { $notification->touserid = $admin->userid; $notification->create(); } } else { $response = "Error"; } } else { if (isset($_GET['clubid'])) { $club = Club::get_by_id($_GET['clubid']); if (ClubUser::userExists($loggeduser->id, $_GET['clubid'])) { $object = ClubUser::getUser($loggeduser->id, $_GET['clubid']); $object->delete(); $response = "success"; $notification = new Notification(); $notification->fromuserid = $loggeduser->id; $notification->itemid = $object->id; $notification->itemtype = "message"; $notification->title = "Opted Out"; $admins = ClubUser::getAdmins($club->id); foreach ($admins as $admin) { $notification->touserid = $admin->userid; $notification->create(); } } else { $response = "Error"; }