Ejemplo n.º 1
0
         $response = "success";
     } 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";
                 }
Ejemplo n.º 2
0
         $notification->itemid = $object->id;
         $notification->itemtype = "batchuser";
         $notification->title = "Invites you";
         $notification->create();
         $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;
Ejemplo n.º 3
0
         $notification->fromuserid = $loggeduser->id;
         $notification->itemid = $object->id;
         $notification->itemtype = "message";
         $notification->title = "Opted Out";
         $admins = BatchUser::getAdmins($batch->id);
         foreach ($admins as $admin) {
             $notification->touserid = $admin->userid;
             $notification->create();
         }
     } 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";