aboutsummaryrefslogtreecommitdiff
path: root/mod/sitepages/views
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-12 22:23:05 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-12 22:23:05 +0000
commitaf113e044fe8225a40ddd128f9226b973b0b6437 (patch)
tree4456d4ee056a3564eb01837ab2f091b57ec540e2 /mod/sitepages/views
parent088d0638957cd6bc683711743d04091b6789cfd1 (diff)
downloadelgg-af113e044fe8225a40ddd128f9226b973b0b6437.tar.gz
elgg-af113e044fe8225a40ddd128f9226b973b0b6437.tar.bz2
Updated site pages docs.
Added ability to pass arguments to custom keywords. Added user_list keyword. Reject logged out front pages that don't have [[login_box]]. git-svn-id: http://code.elgg.org/elgg/trunk@5710 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/sitepages/views')
-rw-r--r--mod/sitepages/views/default/sitepages/keywords/site_stats.php12
-rw-r--r--mod/sitepages/views/default/sitepages/keywords/user_list.php47
2 files changed, 59 insertions, 0 deletions
diff --git a/mod/sitepages/views/default/sitepages/keywords/site_stats.php b/mod/sitepages/views/default/sitepages/keywords/site_stats.php
new file mode 100644
index 000000000..8ccb96794
--- /dev/null
+++ b/mod/sitepages/views/default/sitepages/keywords/site_stats.php
@@ -0,0 +1,12 @@
+<?php
+/**
+ * Site stats
+ *
+ * @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/
+ */
+
+echo "N/A"; \ No newline at end of file
diff --git a/mod/sitepages/views/default/sitepages/keywords/user_list.php b/mod/sitepages/views/default/sitepages/keywords/user_list.php
new file mode 100644
index 000000000..2f2f09c49
--- /dev/null
+++ b/mod/sitepages/views/default/sitepages/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