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" />'; //echo ' <img class="img-polaroid img-circle yearbookimage ybimage" src="data:image/jpeg;base64, '.$user->picture.'"/>'; echo ' </div>'; echo ' <div class="span8">'; echo ' <p class="ybname">' . $user->get_full_name() . '</p>'; echo ' <p class="ybmotto">'; echo ' ' . $user->moto . ''; echo ' </p>';
} 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); } $mates = GroupUser::getUsersInMultipleGroupsSearch($ids, $_GET['input']); } } } } } if (count($mates) > 0) { foreach ($mates as $mate) {
if (isset($_GET['id'])) { $object = Club::get_by_id($_GET['id']); if ($object == false || $object == null || $object == "") { header("location: index.php"); } } 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 (!ClubUser::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 Club: <?php
$notification->title = "Invites you"; $notification->create(); $response = "success"; } else { $theuser = SectionUser::getUser($user->id, $_GET['sectionid']); if ($theuser->pending == 0) { $response = "This user is already a member."; } else { $response = "This user is already pending."; } } } else { if (isset($_GET['clubid'])) { if (!ClubUser::userExists($user->id, $_GET['clubid'])) { $club = Club::get_by_id($_GET['clubid']); $object = new ClubUser(); $object->userid = $user->id; $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";
$object = new Club(); $object->schoolid = $school->id; $object->name = $_POST['name']; $object->about = $_POST['about']; $object->fbcomments = $_POST['fbcomments']; $object->comments = $_POST['comments']; $file = new File($_FILES['logo']); if ($file->valid) { $object->logo = $file->data; } $file = new File($_FILES['cover']); if ($file->valid) { $object->cover = $file->data; } $object->create(); $clubuser = new ClubUser(); $clubuser->clubid = $object->id; $clubuser->userid = $session->user_id; $clubuser->level = 1; $clubuser->role = "admin"; $clubuser->enabled = 1; $clubuser->pending = 0; $clubuser->create(); $log = new Log($session->user_id, $clientip, "WEB", "CREATED CLUB: " . $object->id); $log->create(); $message = "success"; } else { $log = new Log($session->user_id, $clientip, "WEB", "CREATE CLUB NOT FILLED"); $log->create(); $message = "All fields are required."; }
$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") { $object = GroupUser::get_by_id($itemid); $object->pending = 0; $object->update(); $notification->title = "message"; $notification->itemid = $itemid; $notification->itemtype = "groupuser"; } }
} 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); $html .= "Now a member in Group <a href='group.php?id=" . $group->id . "'>" . $group->name . "</a> of School <a href='school.php?id=" . $school->id . "'>" . $school->name . "</a>"; } } } } } }
function link_users_to_clubs() { foreach (User::find('all') as $user) { foreach (Club::find('all') as $club) { ClubUser::create(array('user_id' => $user->id, 'club_id' => $club->id)); } } }
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) {
<?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 {
<?php require_once "../../includes/initialize.php"; $what = $_POST['what']; $ids = $_POST['ids']; $response = "error"; global $session; if (!$session->is_logged_in()) { die("not logged in"); } if ($what == "user") { foreach ($ids as $id) { SchoolUser::delete_all_by_userid($id); BatchUser::delete_all_by_userid($id); SectionUser::delete_all_by_userid($id); ClubUser::delete_all_by_userid($id); GroupUser::delete_all_by_userid($id); User::get_by_id($id)->delete(); } $log = new Log($session->user_id, $clientip, "WEB", "DELETED MULTIPLE USERS"); $log->create(); $response = "success"; } else { if ($what == "school") { foreach ($ids as $id) { $school = School::get_by_id($id); $folder_path = "../../public/schools/" . $school->id; if (file_exists($folder_path) && $folder_path != "../../public/schools/") { rrmdir($folder_path); } //===================SECTION=============================//
$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(); } } } }
} 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 require_once "../initialize.php"; $id = $_GET['id']; $object = Club::get_by_id($id); ClubUser::delete_all_by_sectionid($object->id); $object->delete(); $log = new Log($session->user_id, $clientip, "WEB", "DELETED CLUB: " . $object->id); $log->create(); echo "success";
echo CSNTRID; ?> ">Clubs</a> <ul class="dropdown-menu"> <?php $objects = Club::get_all_by_schoolid(CSNTRID); if (count($objects) > 0) { foreach ($objects as $theobject) { echo ' <li class="dropdown-submenu"> <a tabindex="-1" href="club.php?id=' . $theobject->id . '">' . $theobject->name . '</a> <ul class="dropdown-menu"> '; echo '<li><a href="club.php?id=' . $theobject->id . '"><i class="icon-large icon-play"></i> View</a></li>'; if ($session->is_logged_in()) { if (SchoolUser::amIAdmin($session->user_id, $theobject->schoolid) || ClubUser::amIAdmin($session->user_id, $theobject->id) || $user->is_super_admin()) { echo '<li><a href="updateclub.php?id=' . $theobject->id . '"><i class="icon-large icon-pencil"></i> Edit</a></li>'; } } echo ' </ul> </li>'; } } else { echo '<li class="disabled"><a href="#">no clubs yet</a></li>'; } ?> </ul> </li> <li class="dropdown-submenu"> <a tabindex="-1" href="groups.php?schoolid=<?php
} 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"; } } else { if (isset($_GET['groupid'])) { $group = Group::get_by_id($_GET['groupid']); if (GroupUser::userExists($loggeduser->id, $_GET['groupid'])) { $object = GroupUser::getUser($loggeduser->id, $_GET['groupid']); $object->delete(); $response = "success"; $notification = new Notification();