*/
function _params()
{
- $params = array('display' => array('name' => _("Show friends that are"),
+ return array('display' => array('name' => _("Show friends that are"),
'type' => 'enum',
'default' => 'online',
'values' => array('all' => _("All"),
return $users;
}
- $online = '';
- $offline = '';
-
- foreach ($friends as $friend) {
- if (array_key_exists($friend, $users)) {
- $online .= '<a href="' . Folks::getUrlFor('user', $friend) . '">' . $friend . '</a> ';
- } else {
- $offline .= '<a href="' . Folks::getUrlFor('user', $friend) . '">' . $friend . '</a> ';
+ if (empty($this->_params['display']) || $this->_params['display'] == 'all') {
+ $list = $friends;
+ } else {
+ $list = array();
+ foreach ($friends as $friend) {
+ if ($this->_params['display'] == 'online') {
+ if (array_key_exists($friend, $users)) {
+ $list[] = $friend;
+ }
+ } elseif ($this->_params['display'] == 'offline') {
+ if (!array_key_exists($friend, $users)) {
+ $list[] = $friend;
+ }
+ }
}
}
- switch ($this->_params['display']) {
-
- case 'online':
- return $online;
- break;
+ // Prepare actions
+ $actions = array(
+ array('url' => Horde::applicationUrl('user.php'),
+ 'id' => 'user',
+ 'name' => _("View profile")));
+ if ($GLOBALS['registry']->hasInterface('letter')) {
+ $actions[] = array('url' => $GLOBALS['registry']->callByPackage('letter', 'compose', ''),
+ 'id' => 'user_to',
+ 'name' => _("Send message"));
+ }
- case 'offline':
- return $offline;
- break;
+ Horde::addScriptFile('stripe.js', 'horde', true);
- default:
- return $online . $offline;
- break;
- }
+ ob_start();
+ require FOLKS_TEMPLATES . '/block/users.php';
+ return ob_get_clean();
}
}
\ No newline at end of file
return $new;
}
- $html = '';
+ $list = array();
+ foreach ($new as $u) {
+ $list[] = $u['user_uid'];
+ }
- foreach ($new as $user) {
- $html .= '<a href="' . Folks::getUrlFor('user', $user['user_uid']) . '">' . $user['user_uid'] . '</a> ';
+ // Prepare actions
+ $actions = array(
+ array('url' => Horde::applicationUrl('user.php'),
+ 'id' => 'user',
+ 'name' => _("View profile")));
+ if ($GLOBALS['registry']->hasInterface('letter')) {
+ $actions[] = array('url' => $GLOBALS['registry']->callByPackage('letter', 'compose', ''),
+ 'id' => 'user_to',
+ 'name' => _("Send message"));
}
- return $html;
+ Horde::addScriptFile('stripe.js', 'horde', true);
+
+ ob_start();
+ require FOLKS_TEMPLATES . '/block/users.php';
+ return ob_get_clean();
}
}
\ No newline at end of file
{
require_once dirname(__FILE__) . '/../base.php';
- $recent = $GLOBALS['folks_driver']->getRandomUsers($this->_params['limit'], $this->_params['online'] == 'online');
- if ($recent instanceof PEAR_Error) {
- return $recent;
+ $list = $GLOBALS['folks_driver']->getRandomUsers($this->_params['limit'],
+ $this->_params['online'] == 'online');
+ if ($list instanceof PEAR_Error) {
+ return $list;
}
- $html = '';
-
- foreach ($recent as $user) {
- $html .= '<a href="' . Folks::getUrlFor('user', $user) . '">' . $user . '</a> ';
+ // Prepare actions
+ $actions = array(
+ array('url' => Horde::applicationUrl('user.php'),
+ 'id' => 'user',
+ 'name' => _("View profile")));
+ if ($GLOBALS['registry']->hasInterface('letter')) {
+ $actions[] = array('url' => $GLOBALS['registry']->callByPackage('letter', 'compose', ''),
+ 'id' => 'user_to',
+ 'name' => _("Send message"));
}
- return '';
+ Horde::addScriptFile('stripe.js', 'horde', true);
+
+ ob_start();
+ require FOLKS_TEMPLATES . '/block/users.php';
+ return ob_get_clean();
}
}
\ No newline at end of file
{
require_once dirname(__FILE__) . '/../base.php';
- $recent = $GLOBALS['folks_driver']->getRecentVisitors($this->_params['limit']);
- if ($recent instanceof PEAR_Error) {
- return $recent;
+ $list = $GLOBALS['folks_driver']->getRecentVisitors($this->_params['limit']);
+ if ($list instanceof PEAR_Error) {
+ return $list;
}
- $html = '';
-
- foreach ($recent as $user) {
- $html .= '<a href="' . Folks::getUrlFor('user', $user) . '">' . $user . '</a>';
+ // Prepare actions
+ $actions = array(
+ array('url' => Horde::applicationUrl('user.php'),
+ 'id' => 'user',
+ 'name' => _("View profile")));
+ if ($GLOBALS['registry']->hasInterface('letter')) {
+ $actions[] = array('url' => $GLOBALS['registry']->callByPackage('letter', 'compose', ''),
+ 'id' => 'user_to',
+ 'name' => _("Send message"));
}
- return $html;
+ Horde::addScriptFile('stripe.js', 'horde', true);
+
+ ob_start();
+ require FOLKS_TEMPLATES . '/block/users.php';
+ return ob_get_clean();
}
}
\ No newline at end of file
--- /dev/null
+<table class="striped" style="width: 100%">
+<?php foreach ($list as $user): ?>
+<tr valign="top">
+<td>
+<a href="<?php echo Folks::getUrlFor('user', $user) ?>" alt="<?php echo $user ?>" title="<?php echo $user ?>">
+<img src="<?php echo Folks::getImageUrl($user) ?>" class="userMiniIcon" style="float: left" />
+<strong><?php echo $user ?></strong></a><br />
+<span class="small">
+<?php foreach ($actions as $action): ?>
+<a href="<?php echo Util::addParameter($action['url'], $action['id'], $user) ?>"><?php echo $action['name'] ?> </a>
+<?php endforeach; ?>
+<br />
+<?php
+ if ($GLOBALS['folks_driver']->isOnline($user)) {
+ echo '<span class="online">' . _("Online") . '</span>';
+ } else {
+ echo '<span class="offline">' . _("Offline") . '</span>';
+ }
+?>
+
+</span>
+</td>
+</tr>
+<?php endforeach; ?>
+</table>