Пример #1
0
         $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 {
             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";
                 }
Пример #2
0
         $notification->itemid = $object->id;
         $notification->itemtype = "sectionuser";
         $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";
Пример #3
0
         $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();
             $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";