1
0

Copy 3.1 about_this_photo changes by undagiga over to 3.0 version

This commit is contained in:
Bharat Mediratta 2011-01-03 12:31:13 -08:00
parent 36375b226c
commit 668a453be4
3 changed files with 53 additions and 17 deletions

View File

@ -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;
}
}
}

View File

@ -1,3 +1,3 @@
name = "About this Photo"
description = "Show some simple, specific and useful info about a given photo"
version = 1
version = 2

View File

@ -1,17 +1,34 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<ul class="g-metadata">
<li>
<strong class="caption"><?= t("Date:") ?></strong>
<?= $date ?>
</li>
<li>
<strong class="caption"><?= t("Time:") ?></strong>
<?= $time ?>
</li>
<li>
<strong class=="caption"><?= t("Tags:") ?></strong>
<? date_default_timezone_set('Australia/ACT'); ?>
<div class="g-metadata">
<span class="g-about-this">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td><strong class="caption"><?= t("Date:&nbsp;") ?></strong></td>
<td><?= $date ?></td>
</tr>
<tr>
<td><strong class="caption"><?= t("Time:&nbsp;") ?></strong></td>
<td><?= $time ?></td>
</tr>
<tr>
<td><strong class="caption"><?= t("Views:&nbsp;") ?></strong></td>
<td><?= $vcount ?></td>
</tr>
<tr>
<td><strong class="caption"><?= t("Image ID:&nbsp;") ?></strong></td>
<td><?= $source ?></td>
</tr>
</table>
<span >
<strong class="caption"><?= t("Caption:&nbsp;") ?></strong>
<?= $caption ?>
</span ><br>
<span >
<strong class=="caption"><?= t("Tags: &nbsp;&nbsp;") ?></strong>
<? foreach ($tags as $tag): ?>
<a href="<?= $tag->url() ?>"><?= html::clean($tag->name) ?></a>
<a href="<?= $tag->url() ?>"><?= html::clean($tag->name) ?></a>,
<? endforeach?>
</li>
</ul>
</span ><br>
</span>
</div>