Esempio n. 1
0
                            $object->groupid = $group->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 = "groupuser";
                            $notification->title = "Invites you";
                            $notification->create();
                            $response = "success";
                        } else {
                            $theuser = GroupUser::getUser($user->id, $_GET['groupid']);
                            if ($theuser->pending == 0) {
                                $response = "This user is already a member.";
                            } else {
                                $response = "This user is already pending.";
                            }
                        }
                    }
                }
            }
        }
    }
    $log = new Log($session->user_id, $clientip, "WEB", "INVITED: " . $user->id);
    $log->create();
} else {
    $response = "error";
Esempio n. 2
0
             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) {
                             $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>';
                     }
                 }
             }
         }
     }
 }
 $html .= '</tr>';
Esempio n. 3
0
        <?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() || GroupUser::amIAdmin($loggeduser->id, $group->id)) {
        echo '
              <a href="updategroup.php?id=' . $group->id . '" class="btn-mini pull-right">
              <i class="icon-large icon-pencil"></i> Edit
              </a>
            ';
    }
    $loggedschooluser = GroupUser::getUser($session->user_id, $group->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 {
Esempio n. 4
0
                } 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";
                        }
                    }
                }
            }
        }
    }
    $log = new Log($session->user_id, $clientip, "WEB", "JOINED");
    $log->create();
} else {
    $response = "error";
}
Esempio n. 5
0
         $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();
             $notification->fromuserid = $loggeduser->id;
             $notification->itemid = $object->id;
             $notification->itemtype = "message";
             $notification->title = "Opted Out";
             $admins = GroupUser::getAdmins($group->id);
             foreach ($admins as $admin) {
                 $notification->touserid = $admin->userid;
                 $notification->create();
             }
         } else {
             $response = "Error";
         }