%args>
$id => undef
$display_set => 'eng'
$image_id => undef
%args>
% foreach my $people_res (@people_res) {
% if ($people_res->{id} eq $movie_image->{id}){
% my $name=$people_res->{"name_$display_set"};
% my $person_id=$people_res->{pers_id};
<% $name %>
% }
% }
%if ( $movie_image->{"description_$display_set"}){
<% $movie_image->{"description_$display_set"} %>
%}
% if ($movie_image->{"upload_user"}){
(Image uploaded by <% $movie_image->{"upload_user"} %>)
% }
|
| |
<%init>
### Check for errors
# This'll be passed to /db/common/error.mhtml if
# required args are missing
my @missing_args;
# Required args
push(@missing_args, 'id') unless ($id);
push(@missing_args, 'display_set') unless ($display_set);
# Call error.mhtml if we're missing something
if (@missing_args)
{
$m->comp('/db/common/error.mhtml',
errors => [ { description => 'Missing arguments',
args => \@missing_args } ],
display_set => $display_set );
}
my $db = new HKMDB::Database;
# Get image info
my $movie_image = $db->select( table => 'images',
select => [ 'path',
"description_$display_set",
'height',
'upload_user',
'width' ],
keys => [ $image_id ] );
my $people_res_stmt = <<"EOSQL";
SELECT p.id as pers_id,p.name_$display_set
FROM images as i,movie_resources as mr,resources as r,people_resources as pr, people as p
WHERE mr.movie_id = ?
AND i.id = ?
AND r.id = mr.resource_id
AND r.table_name = 'images'
AND r.table_id = i.id
AND pr.resource_id = mr.resource_id
AND p.id=pr.people_id
ORDER BY pr.position
EOSQL
my @people_res = $db->select_rows( sql => $people_res_stmt, bind => [ $id,$image_id ],
hashref => 1 );
%init>