aboutsummaryrefslogtreecommitdiff
path: root/views/default/river
diff options
context:
space:
mode:
Diffstat (limited to 'views/default/river')
-rw-r--r--views/default/river/annotation/generic_comment/create.php11
-rw-r--r--views/default/river/elements/body.php67
-rw-r--r--views/default/river/elements/image.php16
-rw-r--r--views/default/river/elements/layout.php14
-rw-r--r--views/default/river/elements/responses.php63
-rw-r--r--views/default/river/elements/summary.php53
-rw-r--r--views/default/river/item.php30
-rw-r--r--views/default/river/relationship/friend/create.php14
-rw-r--r--views/default/river/user/default/profileiconupdate.php24
-rw-r--r--views/default/river/user/default/profileupdate.php20
10 files changed, 312 insertions, 0 deletions
diff --git a/views/default/river/annotation/generic_comment/create.php b/views/default/river/annotation/generic_comment/create.php
new file mode 100644
index 000000000..7d586450d
--- /dev/null
+++ b/views/default/river/annotation/generic_comment/create.php
@@ -0,0 +1,11 @@
+<?php
+/**
+ * Post comment river view
+ */
+$object = $vars['item']->getObjectEntity();
+$comment = $vars['item']->getAnnotation();
+
+echo elgg_view('river/elements/layout', array(
+ 'item' => $vars['item'],
+ 'message' => elgg_get_excerpt($comment->value),
+));
diff --git a/views/default/river/elements/body.php b/views/default/river/elements/body.php
new file mode 100644
index 000000000..2cd7f2289
--- /dev/null
+++ b/views/default/river/elements/body.php
@@ -0,0 +1,67 @@
+<?php
+/**
+ * Body of river item
+ *
+ * @uses $vars['item'] ElggRiverItem
+ * @uses $vars['summary'] Alternate summary (the short text summary of action)
+ * @uses $vars['message'] Optional message (usually excerpt of text)
+ * @uses $vars['attachments'] Optional attachments (displaying icons or other non-text data)
+ * @uses $vars['responses'] Alternate respones (comments, replies, etc.)
+ */
+
+$item = $vars['item'];
+
+$menu = elgg_view_menu('river', array(
+ 'item' => $item,
+ 'sort_by' => 'priority',
+ 'class' => 'elgg-menu-hz',
+));
+
+// river item header
+$timestamp = elgg_view_friendly_time($item->getPostedTime());
+
+$summary = elgg_extract('summary', $vars, elgg_view('river/elements/summary', array('item' => $vars['item'])));
+if ($summary === false) {
+ $subject = $item->getSubjectEntity();
+ $summary = elgg_view('output/url', array(
+ 'href' => $subject->getURL(),
+ 'text' => $subject->name,
+ 'class' => 'elgg-river-subject',
+ 'is_trusted' => true,
+ ));
+}
+
+$message = elgg_extract('message', $vars, false);
+if ($message !== false) {
+ $message = "<div class=\"elgg-river-message\">$message</div>";
+}
+
+$attachments = elgg_extract('attachments', $vars, false);
+if ($attachments !== false) {
+ $attachments = "<div class=\"elgg-river-attachments clearfix\">$attachments</div>";
+}
+
+$responses = elgg_view('river/elements/responses', $vars);
+if ($responses) {
+ $responses = "<div class=\"elgg-river-responses\">$responses</div>";
+}
+
+$group_string = '';
+$object = $item->getObjectEntity();
+$container = $object->getContainerEntity();
+if ($container instanceof ElggGroup && $container->guid != elgg_get_page_owner_guid()) {
+ $group_link = elgg_view('output/url', array(
+ 'href' => $container->getURL(),
+ 'text' => $container->name,
+ 'is_trusted' => true,
+ ));
+ $group_string = elgg_echo('river:ingroup', array($group_link));
+}
+
+echo <<<RIVER
+$menu
+<div class="elgg-river-summary">$summary $group_string <span class="elgg-river-timestamp">$timestamp</span></div>
+$message
+$attachments
+$responses
+RIVER;
diff --git a/views/default/river/elements/image.php b/views/default/river/elements/image.php
new file mode 100644
index 000000000..6f6aeae65
--- /dev/null
+++ b/views/default/river/elements/image.php
@@ -0,0 +1,16 @@
+<?php
+/**
+ * Elgg river image
+ *
+ * Displayed next to the body of each river item
+ *
+ * @uses $vars['item']
+ */
+
+$subject = $vars['item']->getSubjectEntity();
+
+if (elgg_in_context('widgets')) {
+ echo elgg_view_entity_icon($subject, 'tiny');
+} else {
+ echo elgg_view_entity_icon($subject, 'small');
+}
diff --git a/views/default/river/elements/layout.php b/views/default/river/elements/layout.php
new file mode 100644
index 000000000..94622e272
--- /dev/null
+++ b/views/default/river/elements/layout.php
@@ -0,0 +1,14 @@
+<?php
+/**
+ * Layout of a river item
+ *
+ * @uses $vars['item'] ElggRiverItem
+ */
+
+$item = $vars['item'];
+
+echo elgg_view('page/components/image_block', array(
+ 'image' => elgg_view('river/elements/image', $vars),
+ 'body' => elgg_view('river/elements/body', $vars),
+ 'class' => 'elgg-river-item',
+));
diff --git a/views/default/river/elements/responses.php b/views/default/river/elements/responses.php
new file mode 100644
index 000000000..f6c32e142
--- /dev/null
+++ b/views/default/river/elements/responses.php
@@ -0,0 +1,63 @@
+<?php
+/**
+ * River item footer
+ *
+ * @uses $vars['item'] ElggRiverItem
+ * @uses $vars['responses'] Alternate override for this item
+ */
+
+// allow river views to override the response content
+$responses = elgg_extract('responses', $vars, false);
+if ($responses) {
+ echo $responses;
+ return true;
+}
+
+$item = $vars['item'];
+$object = $item->getObjectEntity();
+
+// annotations do not have comments
+if ($item->annotation_id != 0 || !$object) {
+ return true;
+}
+
+$comment_count = $object->countComments();
+
+$options = array(
+ 'guid' => $object->getGUID(),
+ 'annotation_name' => 'generic_comment',
+ 'limit' => 3,
+ 'order_by' => 'n_table.time_created desc'
+);
+$comments = elgg_get_annotations($options);
+
+if ($comments) {
+ // why is this reversing it? because we're asking for the 3 latest
+ // comments by sorting desc and limiting by 3, but we want to display
+ // these comments with the latest at the bottom.
+ $comments = array_reverse($comments);
+
+?>
+ <span class="elgg-river-comments-tab"><?php echo elgg_echo('comments'); ?></span>
+
+<?php
+
+ echo elgg_view_annotation_list($comments, array('list_class' => 'elgg-river-comments'));
+
+ if ($comment_count > count($comments)) {
+ $num_more_comments = $comment_count - count($comments);
+ $url = $object->getURL();
+ $params = array(
+ 'href' => $url,
+ 'text' => elgg_echo('river:comments:more', array($num_more_comments)),
+ 'is_trusted' => true,
+ );
+ $link = elgg_view('output/url', $params);
+ echo "<div class=\"elgg-river-more\">$link</div>";
+ }
+}
+
+// inline comment form
+$form_vars = array('id' => "comments-add-{$object->getGUID()}", 'class' => 'hidden');
+$body_vars = array('entity' => $object, 'inline' => true);
+echo elgg_view_form('comments/add', $form_vars, $body_vars);
diff --git a/views/default/river/elements/summary.php b/views/default/river/elements/summary.php
new file mode 100644
index 000000000..416bc708b
--- /dev/null
+++ b/views/default/river/elements/summary.php
@@ -0,0 +1,53 @@
+<?php
+/**
+ * Short summary of the action that occurred
+ *
+ * @vars['item'] ElggRiverItem
+ */
+
+$item = $vars['item'];
+
+$subject = $item->getSubjectEntity();
+$object = $item->getObjectEntity();
+$target = $object->getContainerEntity();
+
+$subject_link = elgg_view('output/url', array(
+ 'href' => $subject->getURL(),
+ 'text' => $subject->name,
+ 'class' => 'elgg-river-subject',
+ 'is_trusted' => true,
+));
+
+$object_link = elgg_view('output/url', array(
+ 'href' => $object->getURL(),
+ 'text' => $object->title ? $object->title : $object->name,
+ 'class' => 'elgg-river-object',
+ 'is_trusted' => true,
+));
+
+$action = $item->action_type;
+$type = $item->type;
+$subtype = $item->subtype ? $item->subtype : 'default';
+
+$container = $object->getContainerEntity();
+if ($container instanceof ElggGroup) {
+ $params = array(
+ 'href' => $container->getURL(),
+ 'text' => $container->name,
+ 'is_trusted' => true,
+ );
+ $group_link = elgg_view('output/url', $params);
+ $group_string = elgg_echo('river:ingroup', array($group_link));
+}
+
+// check summary translation keys.
+// will use the $type:$subtype if that's defined, otherwise just uses $type:default
+$key = "river:$action:$type:$subtype";
+$summary = elgg_echo($key, array($subject_link, $object_link));
+
+if ($summary == $key) {
+ $key = "river:$action:$type:default";
+ $summary = elgg_echo($key, array($subject_link, $object_link));
+}
+
+echo $summary; \ No newline at end of file
diff --git a/views/default/river/item.php b/views/default/river/item.php
new file mode 100644
index 000000000..75767e08d
--- /dev/null
+++ b/views/default/river/item.php
@@ -0,0 +1,30 @@
+<?php
+/**
+ * Primary river item view
+ *
+ * Calls the individual view saved for that river item. Most of these
+ * individual river views then use the views in river/elements.
+ *
+ * @uses $vars['item'] ElggRiverItem
+ */
+
+// @todo remove this in Elgg 1.9
+global $_elgg_special_river_catch;
+if (!isset($_elgg_special_river_catch)) {
+ $_elgg_special_river_catch = false;
+}
+if ($_elgg_special_river_catch) {
+ // we changed the views a little in 1.8.1 so this catches the plugins that
+ // were updated in 1.8.0 and redirects to the layout view
+ echo elgg_view('river/elements/layout', $vars);
+ return true;
+}
+$_elgg_special_river_catch = true;
+
+
+$item = $vars['item'];
+
+echo elgg_view($item->getView(), $vars);
+
+
+$_elgg_special_river_catch = false;
diff --git a/views/default/river/relationship/friend/create.php b/views/default/river/relationship/friend/create.php
new file mode 100644
index 000000000..0408d79e1
--- /dev/null
+++ b/views/default/river/relationship/friend/create.php
@@ -0,0 +1,14 @@
+<?php
+/**
+ * Create friend river view
+ */
+$subject = $vars['item']->getSubjectEntity();
+$object = $vars['item']->getObjectEntity();
+
+$subject_icon = elgg_view_entity_icon($subject, 'tiny');
+$object_icon = elgg_view_entity_icon($object, 'tiny');
+
+echo elgg_view('river/elements/layout', array(
+ 'item' => $vars['item'],
+ 'attachments' => $subject_icon . elgg_view_icon('arrow-right') . $object_icon,
+));
diff --git a/views/default/river/user/default/profileiconupdate.php b/views/default/river/user/default/profileiconupdate.php
new file mode 100644
index 000000000..271064a06
--- /dev/null
+++ b/views/default/river/user/default/profileiconupdate.php
@@ -0,0 +1,24 @@
+<?php
+/**
+ * Update avatar river view
+ */
+
+$subject = $vars['item']->getSubjectEntity();
+
+$subject_link = elgg_view('output/url', array(
+ 'href' => $subject->getURL(),
+ 'text' => $subject->name,
+ 'class' => 'elgg-river-subject',
+ 'is_trusted' => true,
+));
+
+$string = elgg_echo('river:update:user:avatar', array($subject_link));
+
+echo elgg_view('river/elements/layout', array(
+ 'item' => $vars['item'],
+ 'summary' => $string,
+ 'attachments' => elgg_view_entity_icon($subject, 'tiny', array(
+ 'use_hover' => false,
+ 'use_link' => false,
+ )),
+));
diff --git a/views/default/river/user/default/profileupdate.php b/views/default/river/user/default/profileupdate.php
new file mode 100644
index 000000000..ce72970d6
--- /dev/null
+++ b/views/default/river/user/default/profileupdate.php
@@ -0,0 +1,20 @@
+<?php
+/**
+ * Update profile river view
+ */
+
+$subject = $vars['item']->getSubjectEntity();
+
+$subject_link = elgg_view('output/url', array(
+ 'href' => $subject->getURL(),
+ 'text' => $subject->name,
+ 'class' => 'elgg-river-subject',
+ 'is_trusted' => true,
+));
+
+$string = elgg_echo('river:update:user:profile', array($subject_link));
+
+echo elgg_view('river/elements/layout', array(
+ 'item' => $vars['item'],
+ 'summary' => $string,
+));