aboutsummaryrefslogtreecommitdiff
path: root/mod/ecml/views
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
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')
-rw-r--r--mod/ecml/views/default/ecml/help.php32
-rw-r--r--mod/ecml/views/default/ecml/input_ext.php14
-rw-r--r--mod/ecml/views/default/ecml/keywords/user_list.php47
3 files changed, 93 insertions, 0 deletions
diff --git a/mod/ecml/views/default/ecml/help.php b/mod/ecml/views/default/ecml/help.php
new file mode 100644
index 000000000..aed6bd2e1
--- /dev/null
+++ b/mod/ecml/views/default/ecml/help.php
@@ -0,0 +1,32 @@
+<?php
+/**
+ * Lists available keywords
+ *
+ * @package ECML
+ * @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/
+ */
+
+$keywords = $vars['config']->sitepages_keywords;
+$title = elgg_echo('ecml:keywords_title');
+$instructions = elgg_echo('ecml:keywords_instructions');
+$more_info = elgg_echo('ecml:keywords_instructions_more');
+
+
+
+$keywords_html = '';
+foreach ($keywords as $keyword => $info) {
+ $desc = htmlentities($info['description']);
+ $keywords_html .= "<li><acronym title=\"$desc\">[[$keyword]]</acronym></li>";
+}
+
+echo "
+<h3>$title</h3>
+<p>$instructions</p>
+$more_info
+<ul>
+ $keywords_html
+</ul>
+"; \ No newline at end of file
diff --git a/mod/ecml/views/default/ecml/input_ext.php b/mod/ecml/views/default/ecml/input_ext.php
new file mode 100644
index 000000000..03941fb08
--- /dev/null
+++ b/mod/ecml/views/default/ecml/input_ext.php
@@ -0,0 +1,14 @@
+<?php
+/**
+ * Displays an ECML icon on ECML-enabled forms
+ *
+ * @package ECML
+ * @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/
+ */
+
+$docs_href = "{$vars['url']}pg/ecml";
+?>
+<a href="<?php echo $docs_href; ?>" target="_new"><img src="<?php echo $vars['url']; ?>mod/ecml/graphics/ecml.png" width="50" height="15" alt="ECML" /></a> \ No newline at end of file
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