From 668a453be4f858018de0c8a368d4251fabba08f6 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 3 Jan 2011 12:31:13 -0800 Subject: [PATCH] Copy 3.1 about_this_photo changes by undagiga over to 3.0 version --- .../helpers/about_this_photo_block.php | 23 +++++++++- 3.0/modules/about_this_photo/module.info | 2 +- .../views/about_this_photo.html.php | 45 +++++++++++++------ 3 files changed, 53 insertions(+), 17 deletions(-) diff --git a/3.0/modules/about_this_photo/helpers/about_this_photo_block.php b/3.0/modules/about_this_photo/helpers/about_this_photo_block.php index c1adb174..86869844 100644 --- a/3.0/modules/about_this_photo/helpers/about_this_photo_block.php +++ b/3.0/modules/about_this_photo/helpers/about_this_photo_block.php @@ -27,6 +27,10 @@ class about_this_photo_block_Core { $block = new Block(); switch ($block_id) { case "simple": + $item = $theme->item; + if ((!$item) or (!$item->is_photo())) { + return ""; + } $block->css_id = "g-about-this-photo"; $block->title = t("About this photo"); $block->content = new View("about_this_photo.html"); @@ -37,11 +41,25 @@ class about_this_photo_block_Core { if ($exif->loaded()) { $exif = unserialize($exif->data); $timestamp = strtotime($exif["DateTime"]); - $block->content->date = gallery::date($timestamp); + //$block->content->date = gallery::date($timestamp); + $block->content->date = date('D j M Y', $timestamp); $block->content->time = gallery::time($timestamp); } } + $block->content->vcount = $theme->item()->view_count; + + // IPTC - copied more or less from iptc.php + if (module::is_active("iptc")) { + $record = ORM::factory("iptc_record")->where("item_id", "=", $theme->item()->id)->find(); + if ($record->loaded()) { + $record = unserialize($record->data); + $block->content->source = $record["Source"]; + $block->content->caption = $record["Caption"]; + + } + } + if (module::is_active("tag")) { $block->content->tags = tag::item_tags($theme->item()); } @@ -49,4 +67,5 @@ class about_this_photo_block_Core { } return $block; } -} \ No newline at end of file +} + diff --git a/3.0/modules/about_this_photo/module.info b/3.0/modules/about_this_photo/module.info index 6943685e..632c0f05 100644 --- a/3.0/modules/about_this_photo/module.info +++ b/3.0/modules/about_this_photo/module.info @@ -1,3 +1,3 @@ name = "About this Photo" description = "Show some simple, specific and useful info about a given photo" -version = 1 +version = 2 diff --git a/3.0/modules/about_this_photo/views/about_this_photo.html.php b/3.0/modules/about_this_photo/views/about_this_photo.html.php index aa91c578..45db0274 100644 --- a/3.0/modules/about_this_photo/views/about_this_photo.html.php +++ b/3.0/modules/about_this_photo/views/about_this_photo.html.php @@ -1,17 +1,34 @@ - +
+ +