3 # represents an article from the database
6 @ISA = qw/Squirrel::Row/;
9 return qw/id parentid displayOrder title titleImage body
10 thumbImage thumbWidth thumbHeight imagePos
11 release expire keyword template link admin threshold
12 summaryLength generator level listed lastModified/;
18 Articles->getSpecial('stepParents', $self->{id});
21 sub visible_step_parents {
24 use BSE::Util::SQL qw/now_datetime/;
25 my $now = now_datetime();
26 grep $_->{release} le $now && $now le $_->{expire}, $self->step_parents;
32 if ($self->{generator} eq 'Generate::Catalog') {
33 require 'Products.pm';
34 return Products->getSpecial('stepProducts', $self->{id});
39 sub visible_stepkids {
42 if ($self->{generator} eq 'Generate::Catalog') {
43 use BSE::Util::SQL qw/now_sqldate/;
44 require 'Products.pm';
45 my $today = now_sqldate();
47 return Products->getSpecial('visibleStep', $self->{id}, $today);
53 # returns a list of all children in the correct sort order
58 require 'OtherParents.pm';
60 my @otherlinks = OtherParents->getBy(parentId=>$self->{id});
61 my @normalkids = Articles->children($self->{id});
63 (map { $_->{id}, $_->{displayOrder} } @normalkids ),
64 (map { $_->{childId}, $_->{parentDisplayOrder} } @otherlinks),
66 my @stepkids = $self->stepkids;
67 my %kids = map { $_->{id}, $_ } @stepkids, @normalkids;
69 return @kids{ sort { $order{$b} <=> $order{$a} } keys %kids };
72 # returns a list of all visible children in the correct sort order
74 sub all_visible_kids {
77 require 'OtherParents.pm';
79 my @otherlinks = OtherParents->getBy(parentId=>$self->{id});
80 my @normalkids = Articles->listedChildren($self->{id});
82 (map { $_->{id}, $_->{displayOrder} } @normalkids ),
83 (map { $_->{childId}, $_->{parentDisplayOrder} } @otherlinks),
85 my @stepkids = $self->visible_stepkids;
86 my %kids = map { $_->{id}, $_ } @stepkids, @normalkids;
88 return @kids{ sort { $order{$b} <=> $order{$a} } keys %kids };