#!/usr/local/bin/perl # $Id: index.pl 8268 2008-01-30 12:10:17Z oinuma $ use strict; BEGIN { package FJ::C::Com::Support::Case::Index; use Tie::IxHash; use YAML::Syck (); use FJ::Controller; use FJ::M::CMSEntryFJ20; use base qw(FJ::Controller); # # TEMPLATES # __PACKAGE__->templates( default => { file => 'tmpl/com/support/case/index.tmpl' }, ); tie my %CATEGORIES, 'Tie::IxHash'; %CATEGORIES = ( creator => { name => 'クリエーター・デザイナー', sub_title_css => 'for_recstaff_exmcat_01', cms_category_id => 29 }, engineer => { name => 'エンジニア・プログラマ', sub_title_css => 'for_recstaff_exmcat_02', cms_category_id => 30 }, director => { name => 'ディレクター・プロデューサー', sub_title_css => 'for_recstaff_exmcat_03', cms_category_id => 31 }, marketing => { name => '営業・企画・マーケティング', sub_title_css => 'for_recstaff_exmcat_04', cms_category_id => 32 }, support => { name => '事務・サポート・インストラクター', sub_title_css => 'for_recstaff_exmcat_05', cms_category_id => 33 }, editor => { name => '編集・ライター', sub_title_css => 'for_recstaff_exmcat_06', cms_category_id => 34 }, ); # # METHODS # sub default { my ($self) = @_; my $category_name = $self->params->{category}; my $category = $CATEGORIES{$category_name}; if (!$category) { $self->output_http_header(status => 404); $self->exit; } my $sdbh = FJ::DBManager->load_slave_dbh(); my $entries_iterator = FJ::M::CMSEntryFJ20->load_iterator_by_sql( _sql => <<"SQL", SELECT e.*, c.category_name, c.directory FROM cms_entry_fj20 AS e INNER JOIN cms_category_fj20 AS c ON e.cms_category_id = c.cms_category_id WHERE e.status = 'publish' AND e.cms_category_id = ? ORDER BY e.cms_entry_id DESC SQL _bind_values => [ $category->{cms_category_id} ], ); my @entries = (); while (my $e = $entries_iterator->next) { my $params = YAML::Syck::Load($e->params); $e->{params_category} = $params->{category}; $e->{params_success} = $params->{success}; push @entries, $e; } my @other_categories = (); for my $category (keys %CATEGORIES) { push @other_categories, { category => $category, name => $CATEGORIES{$category}->{name}, count => FJ::M::CMSEntryFJ20->load_count( _where => "status = 'publish' AND cms_category_id = ?", _bind_values => [ $CATEGORIES{$category}->{cms_category_id} ], _dbh => $sdbh, ), }; } $self->template->param( name => $category->{name}, sub_title_css => $category->{sub_title_css}, entries => \@entries, other_categories => \@other_categories, ); $self->template->param( side_menu => $self->show_company_side_menu(type => 'support'), sc_tag => $self->show_sc_tag( channel => qq{"com/support"}, ), _no_escape => 1, ); } 1; } # End of package definition scope. FJ::C::Com::Support::Case::Index->new()->process();