// set up breadcrumbs
elgg_push_breadcrumb(elgg_echo('photos'), 'photos/all');
-elgg_push_breadcrumb($owner->name, "photos/owner/$owner->username");
+if (elgg_instanceof($owner, 'group')) {
+ elgg_push_breadcrumb($owner->name, "photos/group/$owner->guid/all");
+} else {
+ elgg_push_breadcrumb($owner->name, "photos/owner/$owner->username");
+}
elgg_push_breadcrumb($album->getTitle());
$content = elgg_view_entity($album, array('full_view' => true));
// Register for the entity menu
elgg_register_plugin_hook_handler('register', 'menu:entity', 'tidypics_entity_menu_setup');
-/*
- // Extend hover-over and profile menu
- elgg_extend_view('profile/menu/links','tidypics/hover_menu');
+ // Add group option
+ add_group_tool_option('photos', elgg_echo('tidypics:enablephotos'), true);
+ elgg_extend_view('groups/tool_latest', 'photos/group_module');
+/*
//group view ** psuedo widget view for group pages**
elgg_extend_view('groups/right_column','tidypics/groupprofile_albums');
// register for menus
//register_elgg_event_handler('pagesetup', 'system', 'tidypics_submenus');
- register_elgg_event_handler('pagesetup', 'system', 'tidypics_adminmenu');
// Add a new tidypics widget
add_widget_type('album_view', elgg_echo("tidypics:widget:albums"), elgg_echo("tidypics:widget:album_descr"), 'profile');
add_widget_type('latest_photos', elgg_echo("tidypics:widget:latest"), elgg_echo("tidypics:widget:latest_descr"), 'profile');
- // Register a URL handler for files
- register_entity_url_handler('tidypics_image_url', 'object', 'image');
- register_entity_url_handler('tidypics_album_url', 'object', 'album');
-
add_group_tool_option('photos', elgg_echo('tidypics:enablephotos'), true);
if (get_plugin_setting('grp_perm_override', 'tidypics') != "disabled") {
}
-/**
- * Sets up tidypics admin menu. Triggered on pagesetup.
- */
-function tidypics_adminmenu() {
- global $CONFIG;
-
- if (get_context() == 'admin' && isadminloggedin()) {
- add_submenu_item(elgg_echo('tidypics:administration'), $CONFIG->url . "pg/photos/admin/");
- }
-}
-
/**
* Sets up submenus for tidypics most viewed pages
*/
return null;
}
-/**
- * Populates the ->getUrl() method for file objects
- * Registered in the init function
- *
- * @param ElggEntity $entity album/image entity
- * @return string File URL
- */
-function tidypics_image_url($entity) {
- global $CONFIG;
- $title = $entity->title;
- $title = friendly_title($title);
- return $CONFIG->url . "pg/photos/view/" . $entity->getGUID() . "/" . $title;
-}
-
-function tidypics_album_url($entity) {
- global $CONFIG;
- $title = $entity->title;
- $title = friendly_title($title);
- return $CONFIG->url . "pg/photos/album/" . $entity->getGUID() . "/" . $title;
-}
-
-
/**
* Catch the plugin hook and add the default album slideshow
*
if ($full_view) {
echo elgg_view('object/album/full', $vars);
} else {
- echo elgg_view('object/album/summary', $vars);
+ if (elgg_in_context('widgets')) {
+ echo elgg_view('object/album/list', $vars);
+ } else {
+ echo elgg_view('object/album/gallery', $vars);
+ }
}
--- /dev/null
+<?php
+/**
+ * Display an album as an item in a list
+ *
+ * @uses $vars['entity'] TidypicsAlbum
+ *
+ * @author Cash Costello
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
+ */
+
+$album = elgg_extract('entity', $vars);
+$owner = $album->getOwnerEntity();
+
+$owner_link = elgg_view('output/url', array(
+ 'href' => "photos/owner/$owner->username",
+ 'text' => $owner->name,
+ 'is_trusted' => true,
+));
+$author_text = elgg_echo('byline', array($owner_link));
+$date = elgg_view_friendly_time($album->time_created);
+$categories = elgg_view('output/categories', $vars);
+
+$subtitle = "$author_text $date $categories";
+
+$title = elgg_view('output/url', array(
+ 'text' => $album->getTitle(),
+ 'href' => $album->getURL(),
+));
+
+$params = array(
+ 'entity' => $album,
+ 'title' => $title,
+ 'metadata' => null,
+ 'subtitle' => $subtitle,
+ 'tags' => elgg_view('output/tags', array('tags' => $album->tags)),
+);
+$params = $params + $vars;
+$summary = elgg_view('object/elements/summary', $params);
+
+$cover = elgg_view('output/img', array(
+ 'src' => $album->getCoverImageURL('thumb'),
+ 'alt' => $album->getTitle(),
+ 'class' => 'elgg-photo',
+));
+$icon = elgg_view('output/url', array(
+ 'text' => $cover,
+ 'href' => $album->getURL(),
+ 'encode_text' => false,
+ 'is_trusted' => true,
+));
+
+echo $header = elgg_view_image_block($icon, $summary);
--- /dev/null
+<?php
+/**
+ * Group blog module
+ */
+
+$group = elgg_get_page_owner_entity();
+
+if ($group->photos_enable == "no") {
+ return true;
+}
+
+$all_link = elgg_view('output/url', array(
+ 'href' => "photos/group/$group->guid/all",
+ 'text' => elgg_echo('link:view:all'),
+ 'is_trusted' => true,
+));
+
+elgg_push_context('widgets');
+$options = array(
+ 'type' => 'object',
+ 'subtype' => 'album',
+ 'container_guid' => elgg_get_page_owner_guid(),
+ 'limit' => 6,
+ 'full_view' => false,
+ 'pagination' => false,
+);
+$content = elgg_list_entities($options);
+elgg_pop_context();
+
+if (!$content) {
+ $content = '<p>' . elgg_echo('tidypics:none') . '</p>';
+}
+
+$new_link = elgg_view('output/url', array(
+ 'href' => "photos/add/$group->guid",
+ 'text' => elgg_echo('photos:add'),
+ 'is_trusted' => true,
+));
+
+echo elgg_view('groups/profile/module', array(
+ 'title' => elgg_echo('photos:group'),
+ 'content' => $content,
+ 'all_link' => $all_link,
+ 'add_link' => $new_link,
+));