<%args> $id => undef $display_set => 'eng'

% unless (@movie_images) % { % } % else % { % my $cell_count = 1; % my $name = ""; % my $person_id = ""; % foreach my $movie_image (@movie_images) % { % if ($cell_count > 1) % { % if ($cell_count eq 5) % { % $cell_count = 1; % next; % } % } % else % { % } % $cell_count++; % } % unless ($cell_count eq 1) % { % }

No images
% { <% $movie_image->{">
% foreach my $people_res (@people_res) { % if ($people_res->{id} eq $movie_image->{id}){ % $name=$people_res->{"name_$display_set"}; % $person_id=$people_res->{pers_id}; <% $name %>
% } % } % }
 
<% $movie_image->{">
% foreach my $people_res (@people_res) { % if ($people_res->{id} eq $movie_image->{id}){ % $name=$people_res->{"name_$display_set"}; % $person_id=$people_res->{pers_id}; <% $name %>
% } % }
% } <%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 $user = HKMDB::User->new; my $logged_in = $user->authenticate; my $db = new HKMDB::Database; # Get image info my $movie_images_stmt = <<"EOSQL"; SELECT distinct i.id,i.thumbnail_path,i.thumbnail_height,i.thumbnail_width,i.description_$display_set FROM images as i,movie_resources as mr,resources as r WHERE mr.movie_id = ? AND r.id = mr.resource_id AND r.table_name = 'images' AND r.table_id = i.id AND i.is_credit = '0' EOSQL my @movie_images = $db->select_rows( sql => $movie_images_stmt, bind => [ $id ], hashref => 1 ); my $people_res_stmt = <<"EOSQL"; SELECT i.id,i.description_$display_set,i.is_portrait,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 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 ], hashref => 1 );