diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-13 12:32:43 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-13 12:32:43 +0000 |
commit | d611e9c962ce825eb7f4600f27f74c3dc477000f (patch) | |
tree | f5b600ce1ef7e27536548b514b3144ae138f1c7c /views/default/core/river | |
parent | f03c3bd5bfa8d8425121c769b27c4382147dec65 (diff) | |
download | elgg-d611e9c962ce825eb7f4600f27f74c3dc477000f.tar.gz elgg-d611e9c962ce825eb7f4600f27f74c3dc477000f.tar.bz2 |
Refs #2226 moving riverdashboard into core - need to clean up riverdashboard plugin and move to plugins repository and update plugins with new river views
git-svn-id: http://code.elgg.org/elgg/trunk@7610 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/core/river')
-rw-r--r-- | views/default/core/river/body.php | 32 | ||||
-rw-r--r-- | views/default/core/river/controls.php | 22 | ||||
-rw-r--r-- | views/default/core/river/filter.php | 48 | ||||
-rw-r--r-- | views/default/core/river/footer.php | 46 | ||||
-rw-r--r-- | views/default/core/river/image.php | 12 |
5 files changed, 160 insertions, 0 deletions
diff --git a/views/default/core/river/body.php b/views/default/core/river/body.php new file mode 100644 index 000000000..4129c3b15 --- /dev/null +++ b/views/default/core/river/body.php @@ -0,0 +1,32 @@ +<?php +/** + * Body of river item + * + * @uses $vars[item] + */ + +$item = $vars[item]; +$subject = $item->getSubjectEntity(); + +// 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 = "$subject_link <span class=\"elgg-river-timestamp\">$timestamp</span>"; + +// body +$body = elgg_view($item->getView(), array('item' => $item)); + +// footer +$footer = elgg_view('core/river/footer', $vars); + +$params = array( + 'header' => $header, + 'body' => $body, + 'footer' => $footer, + 'show_inner' => false, +); +echo elgg_view('layout/objects/module', $params); diff --git a/views/default/core/river/controls.php b/views/default/core/river/controls.php new file mode 100644 index 000000000..7d6feaadd --- /dev/null +++ b/views/default/core/river/controls.php @@ -0,0 +1,22 @@ +<?php +/** + * Controls on an river item + * + * + * @uses $vars['item'] + */ + +$object = $vars['item']->getObjectEntity(); + +if (isloggedin()) { + if ($vars['item']->annotation_id == 0) { + $params = array( + 'href' => '#', + 'text' => elgg_echo('generic_comments:text'), + 'class' => 'elgg-toggle', + 'internalid' => "elgg-toggler-{$object->getGUID()}", + ); + echo elgg_view('output/url', $params); + //echo elgg_view('likes/forms/link', array('entity' => $object)); + } +}
\ No newline at end of file diff --git a/views/default/core/river/filter.php b/views/default/core/river/filter.php new file mode 100644 index 000000000..08e211d44 --- /dev/null +++ b/views/default/core/river/filter.php @@ -0,0 +1,48 @@ +<?php +/** + * Content filter for river + * + * @uses $vars[] + */ + +// create selection array +$options = array(); +$options['type=all'] = elgg_echo('river:select', array(elgg_echo('all'))); +$registered_entities = elgg_get_config('registered_entities'); +if (!empty($registered_entities)) { + foreach ($registered_entities as $type => $subtypes) { + if (!is_array($subtypes)) { + $label = elgg_echo('river:select', array(elgg_echo("item:$type"))); + $options["type=$type"] = $label; + } else { + foreach ($subtypes as $subtype) { + $label = elgg_echo('river:select', array(elgg_echo("item:$type:$subtype"))); + $options["type=$type&subtype=$subtype"] = $label; + } + } + } +} + +$params = array( + 'internalid' => 'elgg-river-selector', + 'options_values' => $options, +); +$selector = $vars['selector']; +if ($selector) { + $params['value'] = $selector; +} +echo elgg_view('input/pulldown', $params); +?> + +<script type="text/javascript"> +$(document).ready(function() { + $('#elgg-river-selector').change(function() { + var url = window.location.href; + if (window.location.search.length) { + url = url.substring(0, url.indexOf('?')); + } + url += '?' + $(this).val(); + elgg.forward(url); + }); +}); +</script> diff --git a/views/default/core/river/footer.php b/views/default/core/river/footer.php new file mode 100644 index 000000000..de27f265f --- /dev/null +++ b/views/default/core/river/footer.php @@ -0,0 +1,46 @@ +<?php +/** + * River item footer + */ + +$item = $vars['item']; +$object = $item->getObjectEntity(); + +// annotations do not have comments +if ($item->annotation_id != 0 || !$object) { + return true; +} + +$comment_count = count_annotations($object->getGUID(), '', '', 'generic_comment'); + +$comments = get_annotations($object->getGUID(), "", "", 'generic_comment', "", "", 3, 0, "desc"); +if ($comments) { + $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)), + ); + $link = elgg_view('output/url', $params); + echo "<div class=\"elgg-river-more\">$link</div>"; + } +} + +// inline comment form +$body = elgg_view('forms/comments/inline', array('entity' => $object)); +$params = array( + 'body' => $body, + 'action' => 'action/comments/add', + 'internalid' => "elgg-togglee-{$object->getGUID()}", +); +echo elgg_view('input/form', $params); diff --git a/views/default/core/river/image.php b/views/default/core/river/image.php new file mode 100644 index 000000000..afb6b4019 --- /dev/null +++ b/views/default/core/river/image.php @@ -0,0 +1,12 @@ +<?php +/** + * Elgg river image + * + * Displayed next to the body of each river item + * + * @uses $vars['item'] + */ + +$subject = $vars['item']->getSubjectEntity(); + +echo elgg_view("profile/icon", array('entity' => $subject, 'size' => 'small')); |