HEADER if ( $KeyValue{methode} > 0 ) { my $onChange = "onChange=\"this.form.submit();\""; if ( $KeyValue{range} eq "") {$KeyValue{range} = "6 months"} print "\n
"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n
" . dd::StaticListBox('Range','range',$KeyValue{range},$abv_langue,'','','','',$onChange) . "
"; print "\n
"; } # end if my $CompareDateFin = ""; # Date du systeme (my $sec, my $min, my $hour, my $date_day, my $date_month, my $date_year, my $wday, my $yday, my $isdst) = localtime(time); $date_month = $date_month + 1; if ( $date_month < 10 ) { $date_month = "0" . $date_month } if ( $date_day < 10 ) { $date_day = "0" . $date_day } $date_year += 1900; my $next_year = $date_year + 1; my $Date = $date_year . "-" . $date_month . "-" . $date_day; my $DateRange; if ( $KeyValue{range} eq "all" ) { ; } elsif ( $KeyValue{range} eq "1 year" ) { $DateRange = dd::SubstractFromDate($Date,'1','year'); } elsif ( $KeyValue{range} eq "6 months" ) { $DateRange = dd::SubstractFromDate($Date,'6','month'); } elsif ( $KeyValue{range} eq "3 months" ) { $DateRange = dd::SubstractFromDate($Date,'3','month'); } else { $DateRange = dd::SubstractFromDate($Date,'30','day'); } # end if if ( $DateRange ne "" ) { $CompareDateFin = " AND news_deb_parution >= '" . $DateRange . "'"; } # end if #my $SQLSelect = "select news_url,news_deb_parution,news_title,news_subtitle,news_heading,news_link_title,news_link_subtitle,news_link_heading,news_new_window from news_tb where news_section = '" . $KeyValue{methode} . "' AND news_language = '" . $KeyValue{langue} . "' AND news_enable = TRUE AND (news_always_present = TRUE OR (news_deb_parution <= '" . $Date . "'" . $CompareDateFin . ")) order by news_deb_parution desc, news_title asc;"; my $SQLSelect = "select news_url,news_deb_parution,news_title,news_subtitle,news_heading,news_link_title,news_link_subtitle,news_link_heading,news_new_window from news_tb where news_section = '" . dd::StripBlanks($KeyValue{methode}) . "' AND news_language = '" . $KeyValue{langue} . "' AND news_enable = TRUE AND (news_always_present = TRUE OR (news_deb_parution <= '" . $Date . "' AND news_fin_parution >= '" . $Date . "'))" . $CompareDateFin . " order by news_deb_parution desc, news_title asc;"; # Section Whats new if ( $KeyValue{methode} == 1 ) { ; } # Section News release elsif ( $KeyValue{methode} == 2 ) { ; } # Section Events elsif ( $KeyValue{methode} == 3 ) { ; } # Section Letters elsif ( $KeyValue{methode} == 4 ) { ; } # Section Home else { #$SQLSelect = "select news_url,news_deb_parution,news_title,news_subtitle,news_heading,news_link_title,news_link_subtitle,news_link_heading,news_new_window from news_tb where news_home_page = TRUE AND news_language = '" . $KeyValue{langue} . "' AND news_enable = TRUE AND (news_always_present = TRUE OR (news_deb_parution <= '" . $Date . "'" . $CompareDateFin . ")) order by news_deb_parution desc, news_title asc;"; $SQLSelect = "select news_url,news_deb_parution,news_title,news_subtitle,news_heading,news_link_title,news_link_subtitle,news_link_heading,news_new_window from news_tb where news_home_page = TRUE AND news_language = '" . $KeyValue{langue} . "' AND news_enable = TRUE AND (news_always_present = TRUE OR (news_deb_parution <= '" . $Date . "' AND news_fin_parution >= '" . $Date . "')) order by news_order asc, news_deb_parution desc, news_title asc;"; } # end if #print $SQLSelect; # Connection a la BDD my $dbh = dd::ConnectToDB(); ######################################### my $sth = $dbh->prepare($SQLSelect); my $rv = $sth->execute; my $nb_rec = $sth->rows; my $nb_c1; my $nb_c2; if ( $nb_rec % 2 ) { $nb_c1 = int($nb_rec / 2) + 1; $nb_c2 = int($nb_rec / 2); } else { $nb_c1 = $nb_c2 = int($nb_rec / 2); } # end if my $col = 1; print "\n"; print "\n
"; my $compteur = 0; my $nb_max = $nb_c1; while ( my @Info = $sth->fetchrow_array ) { if ( !$compteur ) { print "\n"; } # end if $compteur++; my $target = ""; if ( $Info[8] == 1 ) { $target = " target=_blank" } print ""; if ( ($compteur == $nb_max) and ($col == 1) ) { print "\n
"; if ( $KeyValue{methode} > 0 ) { print "

" . $Info[1] . "

"; } # end if # Liens sur le Sous-Titre et le Resume if ( ($Info[5] == 0) and ($Info[6] == 1) and ($Info[7] == 1) ) { print "

" . $Info[2] . "

" . $Info[3] . "

" . $Info[4] . "
"; } # Lien sur le Resume seulement elsif ( ($Info[5] == 0) and ($Info[6] == 0) and ($Info[7] == 1) ) { print "

" . $Info[2] . "

" . $Info[3] . "

" . $Info[4] . ""; } # Lien sur le Sous-Titre seulement elsif ( ($Info[5] == 0) and ($Info[6] == 1) and ($Info[7] == 0) ) { print "

" . $Info[2] . "

" . $Info[3] . "

" . $Info[4]; } # Liens sur le Titre et le Sous-Titre elsif ( ($Info[5] == 1) and ($Info[6] == 1) and ($Info[7] == 0) ) { print "

" . $Info[2] . "

" . $Info[3] . "

" . $Info[4]; } # Lien sur le Titre seulement elsif ( ($Info[5] == 1) and ($Info[6] == 0) and ($Info[7] == 0) ) { print "

" . $Info[2] . "

" . $Info[3] . "

" . $Info[4]; } # Liens sur tous elsif ( ($Info[5] == 1) and ($Info[6] == 1) and ($Info[7] == 1) ) { print "

" . $Info[2] . "

" . $Info[3] . "

" . $Info[4] . "
"; } # Pas de liens else { print "

" . $Info[2] . "

" . $Info[3] . "

" . $Info[4]; } # end if print "

"; print "
"; print "\n
"; $compteur = 0; $nb_max = $nb_c2; $col = 2; } elsif ( ($compteur == $nb_max) and ($col == 2) ) { print "\n
"; } # end if } # end loop print "\n"; print "\n"; # Fermeture de la BDD dd::CloseDB($dbh,$sth); # print <"; print "\n"; # FOOTER !>