$sectionuser->pending = $_POST['pending']; $sectionuser->enabled = $_POST['enabled']; $sectionuser->userid = $_POST['userid']; $sectionuser->schoolid = $_POST['schoolid']; $sectionuser->batchid = $_POST['batchid']; $sectionuser->sectionuserid = $_POST['sectionuserid']; $sectionuser->level = $_POST['level']; $sectionuser->create(); $log = new Log($session->user_id, $clientip, "WEB", "CREATED SECTIONUSER: "******"WEB", "UPDATED SECTIONUSER: "******"WEB", "DELETED SECTIONUSER: " . $_POST['id']); $log->create(); SectionUser::get_by_id($_POST['id'])->delete(); } } }
require_once "header.php"; if (!$session->is_logged_in()) { header("location: index.php?negative"); } else { $user = User::get_by_id($session->user_id); if ($user->enabled == DISABLED) { header("location: index.php?disabled"); } } $school = School::get_by_id(CSNTRID); $pathinfo = pathinfo($_SERVER["PHP_SELF"]); $basename = $pathinfo["basename"]; $currentFile = str_replace(".php", "", $basename); $schoolusers = SchoolUser::getAdminSchools($session->user_id); $batchusers = BatchUser::getAdminBatchs($session->user_id); $sectionusers = SectionUser::getAdminSections($session->user_id); if (count($schoolusers) == 0 && count($batchusers) == 0 && count($sectionusers) == 0) { header("location: index.php?negative"); } ?> <div class="container-fluid"> <div class="row-fluid"> <div class="span1"></div> <div class="span9"> <form id="theform" class="form-horizontal" method="post" action="#" enctype="multipart/form-data"> <fieldset> <legend> Create Student </legend> <div class="control-group <?php
} $html .= "Now friends"; } else { if ($notification->itemtype == "schooluser") { $object = SchoolUser::get_by_id($notification->itemid); $school = School::get_by_id($object->schoolid); $html .= "Now a member in School <a href='school.php?id=" . $school->id . "'>" . $school->name . "</a>"; } else { if ($notification->itemtype == "batchuser") { $object = BatchUser::get_by_id($notification->itemid); $batch = Batch::get_by_id($object->batchid); $school = School::get_by_id($object->schoolid); $html .= "Now a member in Batch <a href='batch.php?id=" . $batch->id . "'>" . $batch->get_batchyear() . "</a> of School <a href='school.php?id=" . $school->id . "'>" . $school->name . "</a>"; } else { if ($notification->itemtype == "sectionuser") { $object = SectionUser::get_by_id($notification->itemid); $section = Section::get_by_id($object->sectionid); $batch = Batch::get_by_id($object->batchid); $school = School::get_by_id($object->schoolid); $html .= "Now a member in Section <a href='section.php?id=" . $section->id . "'>" . $section->name . "</a> of Batch <a href='batch.php?id=" . $batch->id . "'>" . $batch->get_batchyear() . "</a> of School <a href='school.php?id=" . $school->id . "'>" . $school->name . "</a>"; } else { if ($notification->itemtype == "clubuser") { $object = ClubUser::get_by_id($notification->itemid); $club = Club::get_by_id($object->clubid); $school = School::get_by_id($object->schoolid); $html .= "Now a member in Club <a href='club.php?id=" . $club->id . "'>" . $club->name . "</a> of School <a href='school.php?id=" . $school->id . "'>" . $school->name . "</a>"; } else { if ($notification->itemtype == "groupuser") { $object = GroupUser::get_by_id($notification->itemid); $group = Group::get_by_id($object->groupid); $school = School::get_by_id($object->schoolid);
foreach ($sections as $section) { $counter++; $filename = $counter; echo '<div class="span12"></div>'; echo ' <div class="span12 thebox">'; echo ' <p class="ybname2">' . $section->name . '</p>'; file_put_contents($path . "images/" . $filename . ".jpg", base64_decode($section->picture)); echo ' <img class="img-polaroid" src="http://skoolyf.kellyescape.com/' . $path . 'images/' . $filename . '.jpg" />'; echo ' </div>'; echo ' <div class="span12 thebox">'; echo ' <p class="ybname2">Adviser Message</p>'; echo ' <p class="advisermessage">'; echo ' ' . $section->advisermessage . ''; echo ' </p>'; echo ' </div>'; $sectionusers = SectionUser::getUsersInSection($section->id); foreach ($sectionusers as $sectionuser) { $counter++; $filename = $counter; if ($sectionuser->pending == 0 && $sectionuser->enabled == 1) { $user = User::get_by_id($sectionuser->userid); $achievements = Achievement::get($user->id, "user", $batch->id); $clubusers = ClubUser::getClubsImIn($user->id); $groupusers = GroupUser::getGroupsImIn($user->id); $comments = Comment::get_all_comments($user->id, "user"); if ($user->pending == 0 && $user->enabled == 1) { echo '<div class="span12"></div>'; echo ' <div class="span12 mygridbox">'; echo ' <div class="span4">'; file_put_contents($path . "images/" . $filename . "xx.jpg", base64_decode($user->picture)); echo ' <img class="img-polaroid img-circle yearbookimage ybimage" src="http://skoolyf.kellyescape.com/' . $path . 'images/' . $filename . 'xx.jpg" />';
<?php require_once "../initialize.php"; $id = $_GET['id']; $section = Section::get_by_id($id); $batch = Batch::get_by_id($section->batchid); SectionUser::delete_all_by_sectionid($section->id); $section->delete(); $log = new Log($session->user_id, $clientip, "WEB", "DELETED SECTION: " . $section->id); $log->create(); echo "success";
</button> '; } } } echo ' <div class="btn-group pull-right"> <a id="btninvite" class="btn-mini dropdown-toggle" data-toggle="dropdown" href="#"> <i class="icon-large icon-circle-arrow-down"></i> Invite <i class="icon-caret-down"></i> <span class="caret"></span> </a> <ul class="dropdown-menu"> '; $schoolsImIn = SchoolUser::getSchoolsImIn($session->user_id); $bathsImIn = BatchUser::getBatchsImIn($session->user_id); $sectionsImIn = SectionUser::getSectionsImIn($session->user_id); if ($loggeduser->is_super_admin()) { if (count($schoolsImIn) > 0) { echo '<li class="divider"> schools</li>'; foreach ($schoolsImIn as $theuser) { $school = School::get_by_id($theuser->schoolid); if (!$school) { $theuser->delete(); } echo '<li><a href="#" onclick="invite(\'schoolid\', ' . $school->id . '); return false;">' . $school->name . '</a></li>'; } } } if (count($bathsImIn) > 0) { echo '<li class="divider"> batchs</li>'; foreach ($bathsImIn as $theuser) {
} else { if ($filterby == "batchmates") { $orgbyuser = BatchUser::getBatchsImIn($thestudent->id); $ids = array(); foreach ($orgbyuser as $item) { array_push($ids, $item->batchid); } $mates = BatchUser::getUsersInMultipleBatchsSearch($ids, $_GET['input']); } else { if ($filterby == "sectionmates") { $orgbyuser = SectionUser::getSectionsImIn($thestudent->id); $ids = array(); foreach ($orgbyuser as $item) { array_push($ids, $item->sectionid); } $mates = SectionUser::getUsersInMultipleSectionsSearch($ids, $_GET['input']); } else { if ($filterby == "clubmates") { $orgbyuser = ClubUser::getClubsImIn($thestudent->id); $ids = array(); foreach ($orgbyuser as $item) { array_push($ids, $item->clubid); } $mates = ClubUser::getUsersInMultipleClubsSearch($ids, $_GET['input']); } else { if ($filterby == "groupmates") { $orgbyuser = GroupUser::getGroupsImIn($thestudent->id); $ids = array(); foreach ($orgbyuser as $item) { array_push($ids, $item->groupid); }
header("location: index.php"); } else { $batch = Batch::get_by_id($object->batchid); $school = School::get_by_id($batch->schoolid); } } else { header("location: index.php?negative"); } if (!$session->is_logged_in()) { header("location: index.php?negative"); } else { $user = User::get_by_id($session->user_id); if ($user->enabled == DISABLED) { header("location: index.php?disabled"); } if (!SchoolUser::amIAdmin($session->user_id, $object->schoolid) && !BatchUser::amIAdmin($session->user_id, $object->batchid) && !SectionUser::amIAdmin($session->user_id, $object->id) && !$user->is_super_admin()) { header("location: index.php?negative"); } } $pathinfo = pathinfo($_SERVER["PHP_SELF"]); $basename = $pathinfo["basename"]; $currentFile = str_replace(".php", "", $basename); ?> <div class="container-fluid"> <div class="row-fluid"> <div class="span1"></div> <div class="span9"> <form id="theform" class="form-horizontal" method="post" action="#" enctype="multipart/form-data"> <fieldset> <legend> Update Section: <?php
<?php require_once "../initialize.php"; $batchid = $_GET['id']; $batch = Batch::get_by_id($batchid); $batch->delete(); SectionUser::delete_all_by_batchid($batch->id); BatchUser::delete_all_by_batchid($batch->id); $folder_path = "../../public/schools/" . $batch->schoolid . "/yearbooks/" . $batch->id; rrmdir($folder_path); $log = new Log($session->user_id, $clientip, "WEB", "DELETED BATCH: " . $batch->id); $log->create(); echo "success"; function rrmdir($dir) { foreach (glob($dir . '/*') as $file) { if (is_dir($file)) { rrmdir($file); } else { unlink($file); } } rmdir($dir); }
$user->comments = $_POST['comments']; $user->pending = $_POST['pending']; $user->enabled = $_POST['enabled']; $user->username = $_POST['username']; $user->password = $_POST['password']; $user->email = $_POST['email']; $user->firstname = $_POST['firstname']; $user->middlename = $_POST['middlename']; $user->lastname = $_POST['lastname']; $user->address = $_POST['address']; $user->moto = $_POST['moto']; $user->birthdate = $_POST['birthdate']; $user->number = $_POST['number']; $user->update(); $log = new Log($session->user_id, $clientip, "WEB", "UPDATED USER: "******"WEB", "DELETED USER: " . $_POST['id']); $log->create(); SchoolUser::delete_all_by_userid($_POST['id']); BatchUser::delete_all_by_userid($_POST['id']); SectionUser::delete_all_by_userid($_POST['id']); ClubUser::delete_all_by_userid($_POST['id']); GroupUser::delete_all_by_userid($_POST['id']); User::get_by_id($_POST['id'])->delete(); } } } }
if ($searchOper == 'eq') { $searchString = $searchString; } if ($searchOper == 'bw' || $searchOper == 'bn') { $searchString .= '%'; } if ($searchOper == 'ew' || $searchOper == 'en') { $searchString = '%' . $searchString; } if ($searchOper == 'cn' || $searchOper == 'nc' || $searchOper == 'in' || $searchOper == 'ni') { $searchString = '%' . $searchString . '%'; } $where = "{$searchField} {$ops} '{$searchString}'"; $sectionusers = SectionUser::get_by_sql("SELECT * FROM " . T_SECTIONUSERS . " WHERE " . $where . " AND " . $where2 . " ORDER BY {$sidx} {$sord} LIMIT {$start} , {$limit}"); } else { $sectionusers = SectionUser::get_by_sql("SELECT * FROM " . T_SECTIONUSERS . " WHERE " . $where2 . " ORDER BY {$sidx} {$sord} LIMIT {$start} , {$limit}"); } header("Content-type: text/xml;charset=utf-8"); $s = "<?xml version='1.0' encoding='utf-8'?>"; $s .= "<rows>"; $s .= "<page>" . $page . "</page>"; $s .= "<total>" . $total_pages . "</total>"; $s .= "<records>" . $count . "</records>"; foreach ($sectionusers as $sectionuser) { $user = User::get_by_id($sectionuser->userid); if (!$user) { $user = new User(); } $school = School::get_by_id($sectionuser->schoolid); if (!$school) { $school = new School();
} else { $response = "Error"; } } else { if (isset($_GET['batchid'])) { if (BatchUser::userExists($session->user_id, $_GET['batchid'])) { $object = BatchUser::getUser($session->user_id, $_GET['batchid']); $object->update(); $response = "success"; } 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 {
require_once "header.php"; $pathinfo = pathinfo($_SERVER["PHP_SELF"]); $basename = $pathinfo["basename"]; $currentFile = str_replace(".php", "", $basename); $sound = isset($_GET['positive']) ? "positive" : ""; $sound = isset($_GET['negative']) ? "negative" : $sound; $batchsInSchool = BatchUser::getBatchsInSchool(CSNTRID); $usersinbatch = array(); $batchsIds = array(); if (count($batchsInSchool) > 0) { foreach ($batchsInSchool as $batchuser) { array_push($batchsIds, $batchuser->batchid); } } if (isset($_GET['sectionid'])) { $theusers = SectionUser::getUsersInSection($_GET['sectionid']); } else { if (isset($_GET['batchid'])) { $theusers = BatchUser::getUsersInBatch($_GET['batchid']); } else { if (isset($_GET['schoolid'])) { $theusers = SchoolUser::getUsersInSchool($_GET['schoolid']); } else { $theusers = SchoolUser::getUsersInSchool(CSNTRID); } } } ?> <div class="container-fixed" > <div class="span12 offset1">
if (BatchUser::amIAdmin($session->user_id, $batch->id) || SchoolUser::amIAdmin($session->user_id, $batch->schoolid) || $user->is_super_admin()) { echo ' <li class="divider"></li> <li><a href="updatebatch.php?id=' . $batch->id . '"><i class="icon-large icon-pencil"></i> Edit Batch</a></li> <li><a href="editor.php?id=' . $batch->id . '"><i class="icon-large icon-pencil"></i> Edit Yearbook</a></li> <li class="divider"></li>'; } $sectionsInBatch = Section::get_all_by_batchid($batch->id); if (count($sectionsInBatch) > 0) { foreach ($sectionsInBatch as $section) { echo ' <li class="dropdown-submenu"> <a tabindex="-1" href="section.php?id=' . $section->id . '"> ' . $section->name . ' </a> <ul class="dropdown-menu"> <li><a href="section.php?id=' . $section->id . '"><i class="icon-large icon-play"></i> View</a></li>'; if (SectionUser::amIAdmin($session->user_id, $section->id) || BatchUser::amIAdmin($session->user_id, $section->batchid) || SchoolUser::amIAdmin($session->user_id, $section->schoolid) || $user->is_super_admin()) { echo '<li><a href="updatesection.php?id=' . $section->id . '"><i class="icon-large icon-pencil"></i> Edit</a></li>'; } echo ' </ul> </li> '; } } echo ' </ul> </li> '; } } } else {
$school->about = $_POST['about']; $school->address = $_POST['address']; $school->update(); $log = new Log($session->user_id, $clientip, "WEB", "UPDATED SCHOOL: " . $_POST['id']); $log->create(); } else { if ($_POST['oper'] == 'del') { $log = new Log($session->user_id, $clientip, "WEB", "DELETED SCHOOL: " . $_POST['id']); $log->create(); $school = School::get_by_id($_POST['id']); $folder_path = "../../public/schools/" . $school->id; if (file_exists($folder_path) && $folder_path != "../../public/schools/") { rrmdir($folder_path); } //===================SECTION=============================// SectionUser::delete_all_by_schoolid($school->id); Section::delete_all_by_schoolid($school->id); //===================BATCH=============================// BatchUser::delete_all_by_schoolid($school->id); Batch::delete_all_by_schoolid($school->id); //===================SCHOOL=============================// SchoolUser::delete_all_by_schoolid($school->id); $school->delete(); } } } function rrmdir($dir) { foreach (glob($dir . '/*') as $file) { if (is_dir($file)) { rrmdir($file);
<?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() || SectionUser::amIAdmin($loggeduser->id, $section->id)) { echo ' <a href="updatesection.php?id=' . $section->id . '" class="btn-mini pull-right"> <i class="icon-large icon-pencil"></i> Edit </a> '; } $loggedsectionuser = SectionUser::getUser($session->user_id, $section->id); if ($loggedsectionuser == 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 ($loggedsectionuser != null) { if ($loggedsectionuser->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 {
$response = "success"; } else { $theuser = BatchUser::getUser($user->id, $_GET['batchid']); if ($theuser->pending == 0) { $response = "This user is already a member."; } else { $response = "This user is already pending."; } } } else { if (isset($_GET['sectionid'])) { if (!SectionUser::userExists($user->id, $_GET['sectionid'])) { $section = Section::get_by_id($_GET['sectionid']); $batch = Batch::get_by_id($section->batchid); $school = School::get_by_id($batch->schoolid); $object = new SectionUser(); $object->userid = $user->id; $object->schoolid = $school->id; $object->batchid = $batch->id; $object->sectionid = $section->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 = "sectionuser"; $notification->title = "Invites you";
if (isset($_GET['batchid'])) { $batch = Batch::get_by_id($_GET['batchid']); $theuser = BatchUser::getUser($object->id, $batch->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['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) {
$schooluser->create(); if (isset($_POST['batchselect']) && $_POST['batchselect'] != "NOTHING") { $batch = Batch::get_by_id($_POST['batchselect']); $batchuser = new BatchUser(); $batchuser->schoolid = $school->id; $batchuser->batchid = $batch->id; $batchuser->userid = $object->id; $batchuser->level = 0; $batchuser->enabled = 1; $batchuser->pending = 0; $batchuser->create(); } if (isset($_POST['sectionselect']) && $_POST['sectionselect'] != "NOTHING") { $section = Section::get_by_id($_POST['sectionselect']); $batch = Batch::get_by_id($section->batchid); $sectionuser = new SectionUser(); $sectionuser->sectionid = $section->id; $sectionuser->batchid = $batch->id; $sectionuser->userid = $object->id; $sectionuser->schoolid = $school->id; $sectionuser->level = 0; $sectionuser->enabled = 1; $sectionuser->pending = 0; $sectionuser->create(); } $log = new Log($session->user_id, $clientip, "WEB", "CREATED USER: "******"success"; } } else { $log = new Log($session->user_id, $clientip, "WEB", "CREATE USER NOT FILLED");
} $log = new Log($session->userid, $clientip, "WEB", "DELETED MULTIPLE BATCHUSERS"); $log->create(); $response = "success"; } else { if ($what == "section") { foreach ($ids as $id) { Section::get_by_id($id)->delete(); } $log = new Log($session->userid, $clientip, "WEB", "DELETED MULTIPLE SECTIONS"); $log->create(); $response = "success"; } else { if ($what == "sectionuser") { foreach ($ids as $id) { SectionUser::get_by_id($id)->delete(); } $log = new Log($session->userid, $clientip, "WEB", "DELETED MULTIPLE SECTIONUSERS"); $log->create(); $response = "success"; } else { if ($what == "pending") { foreach ($ids as $id) { Pending::get_by_id($id)->delete(); } $log = new Log($session->userid, $clientip, "WEB", "DELETED MULTIPLE PENDINGS"); $log->create(); $response = "success"; } else { if ($what == "log") { foreach ($ids as $id) {
<?php require_once "header.php"; $pathinfo = pathinfo($_SERVER["PHP_SELF"]); $basename = $pathinfo["basename"]; $currentFile = str_replace(".php", "", $basename); $sound = isset($_GET['success']) ? "positive" : ""; if ($session->is_logged_in()) { $user = User::get_by_id($session->user_id); if ($user->enabled == DISABLED) { header("location: index.php?disabled"); } else { $schoolsIAdminCount = count(SchoolUser::getAdminSchools($session->user_id)); $batchsIAdminCount = count(BatchUser::getAdminBatchs($session->user_id)); $sectionsIAdminCount = count(SectionUser::getAdminSections($session->user_id)); $iAdminSomething = false; if ($schoolsIAdminCount + $batchsIAdminCount + $sectionsIAdminCount > 0 || $user->is_super_admin()) { $iAdminSomething = true; } } } else { header("location: index.php?negative"); } ?> <div class="container-fluid"> <div class="row-fluid"> <ul class="nav nav-tabs"> <?php if ($user->is_super_admin()) { echo '<li><a id="userstab" href="#users" data-toggle="tab">Students</a></li>';
$object->pending = 0; $object->update(); $notification->title = "message"; $notification->itemid = $itemid; $notification->itemtype = "schooluser"; } else { if ($itemtype == "batchuser") { $object = BatchUser::get_by_id($itemid); $object->pending = 0; $object->update(); $notification->title = "message"; $notification->itemid = $itemid; $notification->itemtype = "batchuser"; } else { if ($itemtype == "sectionuser") { $object = SectionUser::get_by_id($itemid); $object->pending = 0; $object->update(); $notification->title = "message"; $notification->itemid = $itemid; $notification->itemtype = "sectionuser"; } else { if ($itemtype == "clubuser") { $object = ClubUser::get_by_id($itemid); $object->pending = 0; $object->update(); $notification->title = "message"; $notification->itemid = $itemid; $notification->itemtype = "clubuser"; } else { if ($itemtype == "groupuser") {
$batch = Batch::get_by_id($_POST['id']); $batch->comments = $_POST['comments']; $batch->about = $_POST['about']; $batch->pending = $_POST['pending']; $batch->enabled = $_POST['enabled']; $batch->fromyear = $_POST['fromyear']; $batch->schoolid = $_POST['schoolid']; $batch->update(); $log = new Log($session->user_id, $clientip, "WEB", "UPDATED BATCH: " . $_POST['id']); $log->create(); } else { if ($_POST['oper'] == 'del') { $log = new Log($session->user_id, $clientip, "WEB", "DELETED BATCH: " . $_POST['id']); $log->create(); $batch = Batch::get_by_id($_POST['id']); SectionUser::delete_all_by_schoolid($batch->schoolid); Section::delete_all_by_schoolid($batch->schoolid); BatchUser::delete_all_by_batchid($batch->id); $folder_path = "../../public/schools/" . $batch->schoolid . "/yearbooks/" . $batch->id; rrmdir($folder_path); $batch->delete(); } } } function rrmdir($dir) { foreach (glob($dir . '/*') as $file) { if (is_dir($file)) { rrmdir($file); } else { unlink($file);
} else { $response = "Error"; } } else { if (isset($_GET['sectionid'])) { $section = Section::get_by_id($_GET['sectionid']); if (SectionUser::userExists($loggeduser->id, $_GET['sectionid'])) { $object = SectionUser::getUser($loggeduser->id, $_GET['sectionid']); $object->delete(); $response = "success"; $notification = new Notification(); $notification->fromuserid = $loggeduser->id; $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();