diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-30 18:56:31 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-30 18:56:31 +0000 |
commit | 3b6143c0c5861685a8161e7816824a225290185f (patch) | |
tree | f21baca893b1d6fb9389770a284a8ff3cf04426d /views/default | |
parent | f23218799dcc49448603c95eabf1179c6f179533 (diff) | |
download | elgg-3b6143c0c5861685a8161e7816824a225290185f.tar.gz elgg-3b6143c0c5861685a8161e7816824a225290185f.tar.bz2 |
updated the default object entity view
git-svn-id: http://code.elgg.org/elgg/trunk@7773 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default')
-rw-r--r-- | views/default/layout/objects/list/metadata.php | 4 | ||||
-rw-r--r-- | views/default/object/default.php | 90 | ||||
-rw-r--r-- | views/default/object/object.php | 16 | ||||
-rw-r--r-- | views/default/output/access.php | 6 |
4 files changed, 45 insertions, 71 deletions
diff --git a/views/default/layout/objects/list/metadata.php b/views/default/layout/objects/list/metadata.php index 6b2fae7bf..43bfaf50b 100644 --- a/views/default/layout/objects/list/metadata.php +++ b/views/default/layout/objects/list/metadata.php @@ -7,7 +7,7 @@ */ $entity = $vars['entity']; -$handler = $vars['handler']; +$handler = elgg_get_array_value('handler', $vars, ''); ?> <ul class="elgg-list-metadata"> @@ -23,7 +23,7 @@ echo "<li>$likes</li>"; echo elgg_view("entity/metadata", array('entity' => $entity)); // links to delete or edit. -if ($entity->canEdit()) { +if ($entity->canEdit() && $handler) { $edit_url = "pg/$handler/edit/{$entity->getGUID()}"; $edit_link = elgg_view('output/url', array( diff --git a/views/default/object/default.php b/views/default/object/default.php index 6e03e9e78..be2be475e 100644 --- a/views/default/object/default.php +++ b/views/default/object/default.php @@ -1,61 +1,51 @@ <?php /** - * ElggEntity default view. + * ElggObject default view. + * + * @warning This view may be used for other ElggEntity objects * * @package Elgg * @subpackage Core */ -if ($vars['full']) { - echo elgg_view('export/entity', $vars); -} else { - - $icon = elgg_view( - 'graphics/icon', array( - 'entity' => $vars['entity'], - 'size' => 'small', - ) - ); - - - $title = $vars['entity']->title; - if (!$title) { - $title = $vars['entity']->name; - } - if (!$title) { - $title = get_class($vars['entity']); - } - - $controls = ""; - if ($vars['entity']->canEdit()) { - $delete = elgg_view('output/confirm_link', array( - 'href' => "action/entities/delete?guid={$vars['entity']->guid}", - 'text' => elgg_echo('delete') - )); - $controls .= " ($delete)"; - } - - $info = "<div><p><b><a href=\"" . $vars['entity']->getUrl() . "\">" . $title . "</a></b> $controls </p></div>"; - - if (get_input('listtype') == "gallery") { - $icon = ""; - } - - $owner = $vars['entity']->getOwnerEntity(); - $ownertxt = elgg_echo('unknown'); - if ($owner) { - $ownertxt = "<a href=\"" . $owner->getURL() . "\">" . $owner->name . "</a>"; - } - - $info .= "<div>" . elgg_echo("entity:default:strapline", array( - elgg_view_friendly_time($vars['entity']->time_created), - $ownertxt - )); +$icon = elgg_view('graphics/icon', array( + 'entity' => $vars['entity'], + 'size' => 'small', +)); - $info .= "</div>"; - $info = "<span title=\"" . elgg_echo('entity:default:missingsupport:popup') . "\">$info</span>"; - $icon = "<span title=\"" . elgg_echo('entity:default:missingsupport:popup') . "\">$icon</span>"; +$title = $vars['entity']->title; +if (!$title) { + $title = $vars['entity']->name; +} +if (!$title) { + $title = get_class($vars['entity']); +} - echo elgg_view_listing($icon, $info); +if (elgg_instanceof($vars['entity'], 'object')) { + $metadata = elgg_view('layout/objects/list/metadata', $vars); } + +$owner_link = ''; +$owner = $vars['entity']->getOwnerEntity(); +if ($owner) { + $owner_link = elgg_view('output/url', array( + 'href' => $owner->getURL(), + 'text' => $owner->name, + )); +} + +$date = elgg_view_friendly_time($vars['entity']->time_created); + +$subtitle = "$owner_link $date"; + +$params = array( + 'entity' => $vars['entity'], + 'title' => $title, + 'metadata' => $metadata, + 'subtitle' => $subtitle, + 'tags' => $vars['entity']->tags, +); +$body = elgg_view('layout/objects/list/body', $params); + +echo elgg_view_image_block($icon, $body); diff --git a/views/default/object/object.php b/views/default/object/object.php deleted file mode 100644 index 9e1441a9f..000000000 --- a/views/default/object/object.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php -/** - * Elgg default object view. - * This is a placeholder. - * - * @package Elgg - * @subpackage Core - */ - -$entity = $vars['entity']; - -?> -<div> - <p><?php echo $entity->title; ?></p> - <p><?php echo $entity->description; ?></p> -</div>
\ No newline at end of file diff --git a/views/default/output/access.php b/views/default/output/access.php index 5490d3203..cb1ffc94c 100644 --- a/views/default/output/access.php +++ b/views/default/output/access.php @@ -14,9 +14,9 @@ if (isset($vars['entity']) && elgg_instanceof($vars['entity'])) { // if within a group or shared access collection display group name and open/closed membership status // @todo have a better way to do this instead of checking against subtype / class. - $container = get_entity($vars['entity']->container_guid); + $container = $vars['entity']->getContainerEntity(); - if ($container instanceof ElggGroup) { + if ($container && $container instanceof ElggGroup) { // we decided to show that the item is in a group, rather than its actual access level // not required. Group ACLs are prepended with "Group: " when written. //$access_id_string = elgg_echo('groups:group') . $container->name; @@ -27,7 +27,7 @@ if (isset($vars['entity']) && elgg_instanceof($vars['entity'])) { } else { $access_class .= ' group_closed'; } - } elseif ($container->getSubtype() == 'shared_access') { + } elseif ($container && $container->getSubtype() == 'shared_access') { $access_level .= ' shared_collection'; } elseif ($access_id == ACCESS_PRIVATE) { $access_level .= ' private'; |