1: <?php
2: /**
3: * Groups methods
4: *
5: * Copyright 2009-2012 Horde LLC (http://www.horde.org/)
6: *
7: * @author Michael J. Rubinsky <mrubinsk@horde.org>
8: * @category Horde
9: * @package Service_Facebook
10: */
11: class Horde_Service_Facebook_Groups extends Horde_Service_Facebook_Base
12: {
13: /**
14: * Returns groups according to the filters specified.
15: *
16: * @param integer $uid (Optional) User associated with groups. A null
17: * parameter will default to the session user.
18: * @param string $gids (Optional) Comma-separated group ids to query. A null
19: * parameter will get all groups for the user.
20: *
21: * @return array An array of group objects
22: */
23: public function &get($uid, $gids)
24: {
25: // Session key is *required*
26: if (!$skey = $this->_facebook->auth->getSessionKey()) {
27: throw new Horde_Service_Facebook_Exception(
28: 'session_key is required',
29: Horde_Service_Facebook_ErrorCodes::API_EC_SESSION_REQUIRED);
30: }
31: return $this->_facebook->callMethod(
32: 'facebook.groups.get',
33: array('uid' => $uid, 'gids' => $gids));
34: }
35:
36: /**
37: * Returns the membership list of a group.
38: *
39: * @param integer $gid Group id
40: *
41: * @return array An array with four membership lists, with keys 'members',
42: * 'admins', 'officers', and 'not_replied'
43: */
44: public function &getMembers($gid)
45: {
46: // Session key is *required*
47: if (!$skey = $this->_facebook->auth->getSessionKey()) {
48: throw new Horde_Service_Facebook_Exception(
49: 'session_key is required',
50: Horde_Service_Facebook_ErrorCodes::API_EC_SESSION_REQUIRED);
51: }
52: return $this->_facebook->callMethod(
53: 'facebook.groups.getMembers',
54: array('gid' => $gid));
55: }
56:
57: }