function removeCalendar($username, $calname) { $CI = get_instance(); $calendars = getCalendars($username); $cid = null; foreach ($calendars as $c) { if ($c['name'] == $calname) { $cid = $c['cid']; break; } } if ($cid == null) { return false; } $CI->db->delete('Events', array('cid' => $cid)); $CI->db->delete('Calendars', array('cid' => $cid)); return true; }
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']; } } print "---------------------- Members of KKK ---------------\n"; printTable(getGroupMembers($kkk)); print "---------------------- All KKK member events ---------------\n"; //printTable(getGroupMemberEvents(1)); print_r(getGroupMemberEvents($kkk)); rejectGroup(5, $user); acceptGroup(5, $user);