diff options
author | Brett Profitt <brett.profitt@gmail.com> | 2011-08-25 10:00:38 -0700 |
---|---|---|
committer | Brett Profitt <brett.profitt@gmail.com> | 2011-08-25 10:00:38 -0700 |
commit | dccc333c765bb28da55b4a55d9c916acdb88413a (patch) | |
tree | bdd26a0b4cd85241a19b7fcb2c0770f0ac3eb9f0 /views/default/river/elements | |
parent | ec7b94a64aef23b85866ecdac8e8acc712d29bb6 (diff) | |
parent | 003cb81c7888f4d2fd763e5814027c6f8d71186f (diff) | |
download | elgg-dccc333c765bb28da55b4a55d9c916acdb88413a.tar.gz elgg-dccc333c765bb28da55b4a55d9c916acdb88413a.tar.bz2 |
Merge branch 'master' of github.com:brettp/Elgg
Diffstat (limited to 'views/default/river/elements')
-rw-r--r-- | views/default/river/elements/body.php | 70 | ||||
-rw-r--r-- | views/default/river/elements/responses.php (renamed from views/default/river/elements/footer.php) | 10 | ||||
-rw-r--r-- | views/default/river/elements/summary.php | 41 |
3 files changed, 102 insertions, 19 deletions
diff --git a/views/default/river/elements/body.php b/views/default/river/elements/body.php index f9ecbc03c..c5a525733 100644 --- a/views/default/river/elements/body.php +++ b/views/default/river/elements/body.php @@ -2,32 +2,64 @@ /** * Body of river item * - * @uses $vars['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']; -$subject = $item->getSubjectEntity(); + +$menu = elgg_view_menu('river', array( + 'item' => $item, + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz', +)); // river item header -$params = array( - 'href' => $subject->getURL(), - 'text' => $subject->name, -); -$subject_link = elgg_view('output/url', $params); $timestamp = elgg_get_friendly_time($item->getPostedTime()); -$header = elgg_view_menu('river', array('item' => $item, 'sort_by' => 'priority')); -$header .= "$subject_link <span class=\"elgg-river-timestamp\">$timestamp</span>"; +$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', + )); +} + +$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>"; +} -// body -$body = elgg_view($item->getView(), array('item' => $item)); +$responses = elgg_view('river/elements/responses', $vars); +if ($responses) { + $responses = "<div class=\"elgg-river-responses\">$responses</div>"; +} -// footer -$footer = elgg_view('river/elements/footer', $vars); +$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, + )); + $group_string = elgg_echo('river:ingroup', array($group_link)); +} -echo elgg_view('page/components/module', array( - 'header' => $header, - 'body' => $body, - 'footer' => $footer, - 'class' => 'mbn', -));
\ No newline at end of file +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/footer.php b/views/default/river/elements/responses.php index f1e79f131..8c5be6316 100644 --- a/views/default/river/elements/footer.php +++ b/views/default/river/elements/responses.php @@ -1,8 +1,18 @@ <?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(); diff --git a/views/default/river/elements/summary.php b/views/default/river/elements/summary.php new file mode 100644 index 000000000..4d80c29a6 --- /dev/null +++ b/views/default/river/elements/summary.php @@ -0,0 +1,41 @@ +<?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', +)); + +$object_link = elgg_view('output/url', array( + 'href' => $object->getURL(), + 'text' => $object->title ? $object->title : $object->name, + 'class' => 'elgg-river-object', +)); + +$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, + ); + $group_link = elgg_view('output/url', $params); + $group_string = elgg_echo('river:ingroup', array($group_link)); +} + + +echo elgg_echo("river:$action:$type:$subtype", array($subject_link, $object_link));
\ No newline at end of file |