aboutsummaryrefslogtreecommitdiff
path: root/mod/ecml/views/default/ecml/keywords
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-13 19:13:36 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-13 19:13:36 +0000
commit444fb4e8a3e5189868b8b12c5fdccc4bef6868fc (patch)
tree2df668e1e079d354006938b2f6a0528b2b22d09b /mod/ecml/views/default/ecml/keywords
parentece80595836be086201629824bceeae05892cd55 (diff)
downloadelgg-444fb4e8a3e5189868b8b12c5fdccc4bef6868fc.tar.gz
elgg-444fb4e8a3e5189868b8b12c5fdccc4bef6868fc.tar.bz2
First version of ecml.
git-svn-id: http://code.elgg.org/elgg/trunk@5722 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/ecml/views/default/ecml/keywords')
-rw-r--r--mod/ecml/views/default/ecml/keywords/user_list.php47
1 files changed, 47 insertions, 0 deletions
diff --git a/mod/ecml/views/default/ecml/keywords/user_list.php b/mod/ecml/views/default/ecml/keywords/user_list.php
new file mode 100644
index 000000000..2f2f09c49
--- /dev/null
+++ b/mod/ecml/views/default/ecml/keywords/user_list.php
@@ -0,0 +1,47 @@
+<?php
+/**
+ * Lists users
+ *
+ * @package SitePages
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.org/
+ */
+
+$only_with_avatars = (isset($vars['only_with_avatars'])) ? $vars['only_with_avatars'] : TRUE;
+$list_type = (isset($vars['list_type'])) ? $vars['list_type'] : 'newest';
+$limit = (isset($vars['limit'])) ? $vars['limit'] : 10;
+
+$options = array(
+ 'type' => 'user',
+ 'limit' => $limit
+);
+
+if ($only_with_avatars == TRUE) {
+ $options['metadata_name_value_pairs'] = array('name' => 'icontime', 'operand' => '!=', 'value' => 0);
+}
+
+switch ($list_type) {
+ case 'newest':
+ $options['order_by'] = 'e.time_created DESC';
+ break;
+
+ case 'online':
+ // show people with a last action of < 10 minutes.
+ $last_action = time() - 10 * 60;
+ $options['joins'] = array("JOIN {$vars['config']->dbprefix}users_entity ue on ue.guid = e.guid");
+ $options['wheres'] = array("ue.last_action > $last_action");
+ break;
+
+ case 'random':
+ $options['order_by'] = 'RAND()';
+ break;
+
+ default:
+ break;
+}
+
+$users = elgg_get_entities_from_metadata($options);
+
+echo elgg_view_entity_list($users, count($users), 0, $limit, FALSE, FALSE, FALSE); \ No newline at end of file