1: <?php
2: 3: 4: 5:
6: class Folks_Block_Random extends Horde_Core_Block
7: {
8: 9:
10: public function __construct($app, $params = array())
11: {
12: parent::__construct($app, $params);
13:
14: $this->_name = _("Random users");
15: }
16:
17: 18:
19: protected function _params()
20: {
21: return array(
22: 'limit' => array(
23: 'name' => _("Limit"),
24: 'type' => 'int',
25: 'default' => 10
26: ),
27: 'online' => array(
28: 'name' => _("User is currently online?"),
29: 'type' => 'enum',
30: 'default' => 'online',
31: 'values' => array(
32: 'online' => _("Online"),
33: 'all' => _("Does not metter")
34: )
35: )
36: );
37: }
38:
39: 40:
41: protected function _content()
42: {
43: require_once dirname(__FILE__) . '/../base.php';
44:
45: $list = $GLOBALS['folks_driver']->getRandomUsers(
46: $this->_params['limit'],
47: $this->_params['online'] == 'online'
48: );
49: if ($list instanceof PEAR_Error) {
50: return $list;
51: }
52:
53:
54: $actions = array(
55: array('url' => Horde::url('user.php'),
56: 'id' => 'user',
57: 'name' => _("View profile")));
58: if ($GLOBALS['registry']->hasInterface('letter')) {
59: $actions[] = array('url' => $GLOBALS['registry']->callByPackage('letter', 'compose', ''),
60: 'id' => 'user_to',
61: 'name' => _("Send message"));
62: }
63:
64: Horde::addScriptFile('stripe.js', 'horde');
65:
66: ob_start();
67: require FOLKS_TEMPLATES . '/block/users.php';
68: return ob_get_clean();
69: }
70: }
71: