<%args> $id => undef $display_set => 'eng' % { % # ALIASES - If they exist % my @aliases = ( $m->comp( 'aliases.mhtml', % id => $id, % display_set => $display_set ) ); % if (@aliases) { % if ($display_set eq "eng") { % } else { % if ($person_info->{yod}) { - Died: <% $person_info->{yod} %> % } % } % } else { % if ($person_info->{yob}) { % } else { % if ($person_info->{yod}) { - Died: <% $person_info->{yod} %> % } % } % } else { % if ($person_info->{dod}) % { % } else { % if ($person_info->{yod}) { % } % } % } % } % } % if ($display_set eq "big5") { % if ($person_info->{dob}) % { % if ($person_info->{dom} eq 0){ % } else { % if ($person_info->{yod}) { - 逝世: <% $person_info->{yod} %>年 % } % } % } else { % if ($person_info->{yob}) { % } else { % if ($person_info->{dod}) % { % } else { % if ($person_info->{yod}) { % } % } % } % } % }
% } % if ($display_set eq "big5") { 別名: % } % my $ii=scalar @aliases; % foreach my $a (@aliases) { % $ii--; % if ($ii <= 0) { <% $a->{alias} %> % } else { <% $a->{alias} %>,  % } % } % } else { % } % if ($display_set eq "eng") { % if ($person_info->{dob}) % { % if ($person_info->{dom} eq 0){
Born: <% $person_info->{mob} %> %} else {
Born: <% $person_info->{dob} %> % } %if ($person_info->{birthplace}){ (<% $person_info->{birthplace} %>) %} % if ($person_info->{dod}) % { - Died: <% $person_info->{dod} %>
Born: <% $person_info->{yob} %> %if ($person_info->{birthplace}){ (<% $person_info->{birthplace} %>) %} % if ($person_info->{dod}) % { - Died: <% $person_info->{dod} %>
Died: <% $person_info->{dod} %>
Died: <% $person_info->{yod} %>
出生: <% $person_info->{yob} %>年 <% $person_info->{mmob} %>月 % } else {
出生: <% $person_info->{yob} %>年 <% $person_info->{mmob} %>月 <% $person_info->{ddob} %>日 % } %if ($person_info->{birthplace}){ (<% $person_info->{birthplace} %>) %} % if ($person_info->{dod}) % { - 逝世: <% $person_info->{yod} %>年<% $person_info->{mmod} %>月<% $person_info->{ddod} %>日
出生: <% $person_info->{yob} %>年 %if ($person_info->{birthplace}){ (<% $person_info->{birthplace} %>) %} % if ($person_info->{dod}) % { - 逝世: <% $person_info->{yod} %>年 <% $person_info->{mmod} %>月 <% $person_info->{ddod} %>日 % } else { % if ($person_info->{yod}) { 逝世: <% $person_info->{yod} %>年 % } % }
逝世: <% $person_info->{yod} %>年 <% $person_info->{mmod} %>月 <% $person_info->{ddod} %>日
逝世: <% $person_info->{yod} %>年
% foreach my $person_image (@person_images) % { % } else {
% } %}
%if ($person_image->{id_type} eq 'movie_id'){
% if ($person_info->{"bio_$display_set"}) % { % $person_info->{"bio_$display_set"} =~ s/\n\n/\/g; % }
%if (@filmography_rows){ % if($display_set eq "eng"){ % if ($year_min->{year_made} eq $year_max->{year_made}) { % my @sorted = sort { $jobs_order->{$a} <=> $jobs_order->{$b} } keys %$filmography; % #foreach my $job (sort keys %$filmography) % foreach my $job (@sorted) % { % my $job_title = $jobs->{$job}; % my $job_order = $jobs_order->{$job}; % next unless ($job_title); % my $num_films=@{$filmography->{$job}}; % if ($job_title eq 'Actor') { % if ($num_films > 1) { % if($display_set eq "eng") { % } elsif ($display_set eq "big5") { % } % } else { % if($display_set eq "eng") { % } elsif ($display_set eq "big5") { % } % } % } else { % if ($num_films > 1) { % if($display_set eq "eng") { % } elsif ($display_set eq "big5") { % } % } else { % if($display_set eq "eng"){ % } elsif ($display_set eq "big5") { % } % } % } % foreach my $appearance (@{$filmography->{$job}}) % { % my $movie_title = $appearance->{title}; % my $role = $appearance->{role}; % my $movie_id = $appearance->{movie_id}; % my $year = $appearance->{year}; % } % else % { % } % } % } % }
 
Filmography (<% $year_min->{year_made} %>) % } else {
Filmography (<% $year_min->{year_made} %>-<% $year_max->{year_made} %>) % } % } elsif ($display_set eq "big5") { % if ($year_min->{year_made} eq $year_max->{year_made}) {
影視作品 (<% $year_min->{year_made} %>) % } else {
影視作品 (<% $year_min->{year_made} %>-<% $year_max->{year_made} %>) % } % }
 
 <% $job_title %> (<% $num_films %> films) <% $job_title %> (<% $num_films %> 電影)<% $job_title %> (<% $num_films %> film) <% $job_title %> (<% $num_films %> 電影)<% $job_title %> (<% $num_films %> films) <% $job_title %> (<% $num_films %> 電影)<% $job_title %> (<% $num_films %> film) <% $job_title %> (<% $num_films %> 電影)
    <% $movie_title %> (<% $year %>) % if ($role) % { ... <% $role %>    
 
 
Biography
 
  <% $person_info->{"bio_$display_set"} %>
 
% } <%init> use Encode qw/encode decode/; use Encode::HanConvert; my $user = HKMDB::User->new; my $logged_in = $user->authenticate; ### Fetch the data my $db = new HKMDB::Database; my $portrait_image_stmt = <<"EOF"; SELECT i.id,i.description_$display_set,i.path,i.width,i.height,i.thumbnail_path,i.thumbnail_width,i.thumbnail_height FROM images as i, people as p WHERE p.id = ? AND p.portrait_image_id = i.id EOF my $portrait_image = $db->select_rows( sql => $portrait_image_stmt, bind => [ $id ], hashref => 1 ); # Get job titles my @job_rows = $db->select( table => 'jobs', select => [ 'id', 'job_' . $display_set, 'job_order' ] ); my $jobs; my $jobs_order; foreach my $job_row (@job_rows) { my $job_id = $job_row->{id}; my $job_title = $job_row->{"job_$display_set"}; my $job_order = $job_row->{"job_order"}; $jobs->{$job_id} = $job_title; $jobs_order->{$job_id} = $job_order; } ### Get filmography info my $filmography_stmt = <<"EOSQL"; SELECT m.id,m.title_$display_set,m.year_made,a.job_id,a.role_$display_set,date_start FROM appearances AS a,movies AS m WHERE a.people_id = ? AND m.id = a.movie_id ORDER BY year_made,date_start EOSQL my @filmography_rows = $db->select_rows( sql => $filmography_stmt, bind => [ $id ], hashref => 1 ); my $year_min_stmt = <<"EOSQL"; SELECT m.year_made FROM appearances AS a,movies AS m WHERE a.people_id = ? AND m.id = a.movie_id ORDER by year_made LIMIT 1 EOSQL my $year_min = $db->select_rows( sql => $year_min_stmt, bind => [ $id ], hashref => 1 ); my $year_max_stmt = <<"EOSQL"; SELECT m.year_made FROM appearances AS a,movies AS m WHERE a.people_id = ? AND m.id = a.movie_id ORDER by year_made DESC LIMIT 1 EOSQL my $year_max = $db->select_rows( sql => $year_max_stmt, bind => [ $id ], hashref => 1 ); #my $person_images_stmt = <<"EOSQL"; #SELECT i.id,i.thumbnail_path,i.thumbnail_height,i.thumbnail_width,i.description_$display_set #FROM images as i,people_resources as pr,resources as r #WHERE pr.people_id = ? # AND r.id = pr.resource_id # AND r.table_name = 'images' # AND r.table_id = i.id # AND (i.thumbnail_height+25)>i.thumbnail_width # AND i.is_portrait = 1 # ORDER BY RAND() LIMIT 5 #EOSQL my $person_images_stmt = <<"EOSQL"; select images.id as image_id,images.thumbnail_path,images.thumbnail_height,images.thumbnail_width,images.description_eng,people_resources.people_id as id,'people_id' as id_type FROM images,people_resources,resources where resources.id=people_resources.resource_id AND resources.table_name='images' AND resources.table_id=images.id AND people_resources.people_id=? AND is_portrait=1 AND images.id not in ( select images.id as image_id from movie_resources,people_resources,resources,images where resources.id=people_resources.resource_id and resources.table_name='images' and resources.table_id=images.id and people_resources.people_id=? AND is_portrait=1 and movie_resources.resource_id=people_resources.resource_id) union select * FROM ( select images.id as image_id,images.thumbnail_path,images.thumbnail_height,images.thumbnail_width,images.description_eng,movie_resources.movie_id as id,'movie_id' as id_type FROM images,people_resources,resources,movie_resources where resources.id=people_resources.resource_id AND resources.table_name='images' AND resources.table_id=images.id AND people_resources.people_id=? AND is_portrait=1 AND movie_resources.resource_id=people_resources.resource_id ORDER BY RAND()) tbl group by id order by rand() limit 5 EOSQL my @person_images = $db->select_rows( sql => $person_images_stmt, bind => [ $id,$id,$id ], hashref => 1 ); my $filmography; foreach my $row (@filmography_rows) { my $job_id = $row->{job_id}; my $movie_title = $row->{"title_$display_set"}; my $movie_id = $row->{id}; my $role = $row->{"role_$display_set"}; my $year = $row->{year_made}; unless ($filmography->{$job_id}) { $filmography->{$job_id} = []; } push(@{$filmography->{$job_id}}, { title => $movie_title, role => $role, movie_id => $movie_id, year => $year } ); } my $person_stmt .= <<"EOSQL"; SELECT name_$display_set,bio_$display_set,birthplace_id,DATE_FORMAT(dob, '%M %D, %Y') as dob,DATE_FORMAT(dob, '%Y') as yob,DATE_FORMAT(dod, '%M %D, %Y') as dod,DATE_FORMAT(dod, '%Y') as yod, DATE_FORMAT(dob, '%m') as mmob, DATE_FORMAT(dob, '%d') as ddob, DATE_FORMAT(dod, '%d') as ddod, DATE_FORMAT(dod, '%m') as mmod,DATE_FORMAT(dob, '%M, %Y') as mob,DAYOFMONTH(dob) as dom FROM people WHERE id = ? EOSQL my $person_info = $db->select_rows( sql => $person_stmt, bind => [ $id ], hashref => 1 ); my $location_id = $person_info->{birthplace_id}; if ( $location_id ) { while ($location_id) { my $location_row = $db->select( table => 'locations', select => [ 'location_' . $display_set, 'located_in' ], keys => [ $location_id ] ); $person_info->{birthplace} .= ', ' . $location_row->{'location_' . $display_set}; $location_id = $location_row->{located_in}; } $person_info->{birthplace} =~ s/^, //; }