diff options
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'; |