1: <?php
2: 3: 4: 5:
6: class Folks_Block_Activities extends Horde_Core_Block
7: {
8: 9:
10: public function __construct($app, $params = array())
11: {
12: parent::__construct($app, $params);
13:
14: $this->_name = _("Friends activities");
15: }
16:
17: 18:
19: protected function _params()
20: {
21: return array(
22: 'limit' => array(
23: 'name' => _("Number of activities to display"),
24: 'type' => 'int',
25: 'default' => 10
26: )
27: );
28: }
29:
30: 31:
32: protected function _content()
33: {
34: require_once dirname(__FILE__) . '/../base.php';
35:
36: $friends_driver = Folks_Friends::singleton();
37: $friend_list = $friends_driver->getFriends();
38: if ($friend_list instanceof PEAR_Error) {
39: return $friend_list;
40: }
41:
42:
43: $list = array();
44: foreach ($friend_list as $user) {
45: $activities = $GLOBALS['folks_driver']->getActivity($user);
46: if ($activities instanceof PEAR_Error) {
47: return $activities;
48: }
49: foreach ($activities as $activity) {
50: $list[$activity['activity_date']] = $activity;
51: }
52: }
53: krsort($list);
54: $list = array_slice($list, 0, $this->_params['limit']);
55:
56: Horde::addScriptFile('stripe.js', 'horde');
57:
58: ob_start();
59: require FOLKS_TEMPLATES . '/block/activities.php';
60: return ob_get_clean();
61: }
62: }
63: