示例#1
0
 public function json_AddNewUser()
 {
     $data = json_decode(file_get_contents('php://input'), true);
     $data['username'] = user_decrypt($data['username']);
     $check = $this->checkInput($data, array('username', 'gid', 'newUser'));
     if ($check == '') {
         $return['error'] = addMemberToGroup($data['gid'], $data['newUser']);
         if ($return['error'] == -1) {
             $return['value'] = "The new user is already part of this group";
         } else {
             if ($return['error'] == -2) {
                 $return['value'] = "This user does not exist yet";
             } else {
                 $return['value'] = "The new user was successfully added";
             }
         }
     } else {
         $return['error'] = -2;
         $return['value'] = $check;
     }
     $jsonstring = json_encode($return);
     echo $jsonstring;
 }
示例#2
0
}
if (isset($request_obj->arg[0])) {
    switch ($request_obj->arg[0]) {
        //this checks what you want to effect and what action you want to use on this page
        case "groupAssignment":
            // this for adding or removing some one from a group
            if ($request_obj->account_priv == "Admin" or $request_obj->account_priv == "Officer") {
                //make sure some is allowed to make change
                switch ($request_obj->action) {
                    case "DELETE":
                        // remove from group
                        deleteMemberFromGroup($request_obj);
                        break;
                    case "POST":
                        // add to group
                        addMemberToGroup($request_obj);
                        break;
                }
            }
            break;
        case "groupList":
            // this for adding groups, removeing groups or changeging group name
            if ($request_obj->account_priv == "Admin") {
                switch ($request_obj->action) {
                    case "DELETE":
                        deleteGroup($request_obj);
                        break;
                    case "POST":
                        createNewGroup($request_obj);
                        break;
                    case "PUT":
 public function join($id)
 {
     $group = loadGroup($id)[0];
     if (isMemberOfGroup($id)) {
         flash()->error('You are already a member of this group.');
         return redirect('groups/' . $group->name);
     }
     if ($group->private == true) {
         storeJoinGroupRequest(\Auth::id(), $id);
         storeNotification($group->founderId, 'join group request', \Auth::id(), $id);
         flash()->info('You have sent a request to join the group.');
         return redirect('groups/' . $group->name);
     } else {
         addMemberToGroup(\Auth::id(), $id);
         flash()->success('You succesfully joined the group.');
         return redirect('groups/' . $group->name);
     }
 }
示例#4
0
    insertUser($user3, 'password', null);
    addMemberToGroup($kkk, $user2);
    acceptGroup($kkk, $user2);
    newCalendar($user2, 'google');
    $ds = createDBdate($today['year'], $today['mon'], 6, 14, 0, 0);
    $de = createDBdate($today['year'], $today['mon'], 6, 16, 0, 0);
    insertEvent($user2, 'google', 'Autumn', $ds, $de, 1);
    addMemberToGroup($kkk, $user3);
    // acceptGroup(1,$user3);
    rejectGroup($kkk, $user3);
    newCalendar($user2, 'outlook');
    $ds = createDBdate($today['year'], $today['mon'], 6, 16, 0, 0);
    $de = createDBdate($today['year'], $today['mon'], 6, 18, 0, 0);
    insertEvent($user2, 'outlook', 'Winter', $ds, $de, 1);
    insertUser('noEventGuy', 'password', null);
    addMemberToGroup($kkk, 'noEventGuy');
    acceptGroup($kkk, 'noEventGuy');
}
updateEvent(5, 'Lunch 3', null, null, null);
displayAllEvents($user, 'unsw');
//$results = getEvents($user,'unsw');
$results = getEventsForAMonth($user, 'unsw', 10, 2014);
//print_r($results);
print "--------------- Calendars of {$user} ---------------\n";
printTable(getCalendars($user));
print_r($results);
print "--------------- All groups {$user} belongs to ---------------\n";
printTable(memberOf($user));
foreach (memberOf($user) as $group) {
    if ($group['name'] == 'KKK') {
        $kkk = $group['gid'];